Blame view

merchant-web-master/src/views/salesSta/dataSta.vue 14.7 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
  <!--  -->
  <template>
    <div class="pending">
      <div class="tab_show">
        <div style="display: flex;margin: 15px 0;">
89bb9f2b   wesley88   1
6
7
8
9
10
11
12
13
14
15
16
17
          <el-form ref="formParams" :inline="true" :model="formParams">
            <el-form-item label="日期">
              <el-date-picker v-model="formParams.tongjiTime" type="daterange" range-separator="至"
                start-placeholder="开始时间" end-placeholder="结束时间" />
            </el-form-item>
  
            <el-form-item label-width="0">
              <el-button plain @click="search(1)" style="background-color: #3F9B6A;color: #fff;">查询</el-button>
              <el-button plain @click="clear(1)" class="buttonHover"
                style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">重置</el-button>
            </el-form-item>
          </el-form>
3f535f30   杨鑫   '初始'
18
19
        </div>
        <div style="padding:10px 40px 20px 20px;border:1px solid #EBEEF5;margin-bottom: 20px;">
89bb9f2b   wesley88   1
20
21
22
          <div class="titleTj">
            销售额统计
          </div>
3f535f30   杨鑫   '初始'
23
  
89bb9f2b   wesley88   1
24
25
26
27
28
          <div class="">
            <el-descriptions class="margin-top" title="" :column="1" border :labelStyle="labelStyle"
              :contentStyle="contentStyle">
              <el-descriptions-item>
                <template slot="label">
3f535f30   杨鑫   '初始'
29
  
89bb9f2b   wesley88   1
30
31
                  销售总额
                </template>
3a1f257b   杨鑫   最新
32
                ¥{{(tongji.transactionsCompleted + tongji.invalidOrderAmount).toFixed(2)}}
89bb9f2b   wesley88   1
33
34
35
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
3f535f30   杨鑫   '初始'
36
  
89bb9f2b   wesley88   1
37
38
39
40
                  有效订单数
                </template>
                {{tongji.validOrders}}
              </el-descriptions-item>
3f535f30   杨鑫   '初始'
41
  
89bb9f2b   wesley88   1
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
              <el-descriptions-item>
                <template slot="label">
                  有效订单总额
                </template>
                ¥{{tongji.transactionsCompleted}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  无效订单总数(关闭或取消)
                </template>
                {{tongji.invalidOrder}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  无效订单总额
                </template>
                ¥{{tongji.invalidOrderAmount}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  已成交订单总数
                </template>
                {{tongji.alreadyTransacted}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  已成交订单总额
                </template>
                ¥{{tongji.transactionsCompleted}}
              </el-descriptions-item>
            </el-descriptions>
          </div>
3f535f30   杨鑫   '初始'
74
75
        </div>
        <div style="padding:10px 40px 20px 20px;border:1px solid #EBEEF5;margin-bottom: 20px;">
89bb9f2b   wesley88   1
76
77
78
79
          <div class="titleTj">
            销售毛利润/率统计
          </div>
          <!-- <div style="display: flex;margin: 15px 0;">
3f535f30   杨鑫   '初始'
80
81
82
83
84
85
86
87
88
89
90
91
92
93
             <el-form ref="formParams" :inline="true" :model="formParams">
               <el-form-item label="日期">
                 <el-date-picker v-model="formParams.maoliTime" type="daterange"  range-separator="至"
                   start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd" />
               </el-form-item>
  
               <el-form-item label-width="0">
                 <el-button plain @click="search(2)"
                   style="background-color: #3F9B6A;color: #fff;">查询</el-button>
                 <el-button plain @click="clear(2)"
                   style="background-color: #fff;color: #000;">重置</el-button>
               </el-form-item>
             </el-form>
            </div> -->
89bb9f2b   wesley88   1
94
95
96
97
98
          <div class="">
            <el-descriptions class="margin-top" title="" :column="1" border :labelStyle="labelStyle"
              :contentStyle="contentStyle">
              <el-descriptions-item>
                <template slot="label">
3f535f30   杨鑫   '初始'
99
  
89bb9f2b   wesley88   1
100
101
102
103
104
105
                  销售总额
                </template>
                ¥{{tongji.transactionsCompleted + tongji.invalidOrderAmount}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
3f535f30   杨鑫   '初始'
106
  
89bb9f2b   wesley88   1
107
108
109
110
                  订单毛利润(总)
                </template>
                ¥{{maoli.subtract}}
              </el-descriptions-item>
3f535f30   杨鑫   '初始'
111
  
89bb9f2b   wesley88   1
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
              <el-descriptions-item>
                <template slot="label">
                  订单毛利率(总)
                </template>
                毛利率:{{maoli.divide}}%
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  有效订单总数
                </template>
                {{tongji.validOrders}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  有效订单总额
                </template>
                ¥{{tongji.transactionsCompleted}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  无效订单总数(关闭或取消)
                </template>
                {{tongji.invalidOrder}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  无效订单总额
                </template>
                ¥{{tongji.invalidOrderAmount}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  已成交订单总数
                </template>
                {{tongji.alreadyTransacted}}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  已成交订单总额
                </template>
                ¥{{tongji.transactionsCompleted}}
              </el-descriptions-item>
3d9acc2b   杨鑫   '最新'
154
              <!-- <el-descriptions-item>
89bb9f2b   wesley88   1
155
156
157
                <template slot="label">
                  毛利率排行
                </template>
3f535f30   杨鑫   '初始'
158
  
3d9acc2b   杨鑫   '最新'
159
160
              </el-descriptions-item> -->
              <!-- <el-descriptions-item v-for="item in maoli.salesRanking" :key="item.id">
89bb9f2b   wesley88   1
161
162
163
164
                <template slot="label">
                  <span v-for="(value, key) in item" :key="key">{{ key }}</span>
                </template>
                <span v-for="(value, key) in item" :key="key">毛利率:{{ value }}%</span>
3d9acc2b   杨鑫   '最新'
165
              </el-descriptions-item> -->
89bb9f2b   wesley88   1
166
              <!-- <el-descriptions-item>
3f535f30   杨鑫   '初始'
167
168
169
170
171
                    <template slot="label">
                       商品2
                    </template>
                    毛利率:21.01%
                  </el-descriptions-item> -->
89bb9f2b   wesley88   1
172
173
            </el-descriptions>
          </div>
3f535f30   杨鑫   '初始'
174
175
        </div>
        <!-- 搜索 -->
89bb9f2b   wesley88   1
176
        <!--       <div class="filter-container">
3f535f30   杨鑫   '初始'
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
           <div style="display:flex;justify-content: space-between;background-color: #f5f5f5;padding:10px">
            <div style="line-height:200%">筛选查询</div>
            <div>
              <button @click="toggleFilter">收起筛选</button>
              <el-button  plain @click="search"  style="background-color: #3F9B6A;color: #fff;">查询</el-button>
              <el-button plain @click="resetting"  style="color: #000;border-color:#d5d5d5;">重置</el-button>
            </div>
           </div>
           <div :class="fut?'formSearch':'collapsed'" ref="formSearch">
              <el-form :inline="true" :model="formInline" label-width="auto">
                <el-form-item label="订单状态">
                  <el-input v-model="formInline.searchType" placeholder="请输入方案编号"  style="width: 178px;margin-right: 5px;"/>
                </el-form-item>
                <el-form-item label="下单用户">
                  <el-input v-model="formInline.searchType" placeholder="请输入方案编号"  style="width: 178px;margin-right: 5px;"/>
                </el-form-item>
                <el-form-item label="下单时间">
                  <el-input v-model="formInline.searchType" placeholder="请输入方案编号"  style="width: 178px;margin-right: 5px;"/>
                </el-form-item>
                </el-form>
                </div>
          </div> -->
        <!-- 表格 -->
137c0ee8   杨鑫   'yanshou'
200
        <div class="tableBox">
89bb9f2b   wesley88   1
201
          <el-table :data="tableData"
3d9acc2b   杨鑫   '最新'
202
203
            :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
  		   >
89bb9f2b   wesley88   1
204
205
206
207
208
            <el-table-column prop="id" label="排名">
              <template slot-scope="scope">
                {{scope.$index + 1 }}
              </template>
            </el-table-column>
3d9acc2b   杨鑫   '最新'
209
            <!-- <el-table-column prop="shopnum" label="商品编号">
89bb9f2b   wesley88   1
210
211
212
              <template slot-scope="scope">
                {{scope.row.products[0].productId}}
              </template>
3d9acc2b   杨鑫   '最新'
213
214
            </el-table-column> -->
            <el-table-column prop="shopname" label="商品名称" width="300" show-overflow-tooltip>
89bb9f2b   wesley88   1
215
216
217
218
219
220
221
222
223
224
              <template slot-scope="scope">
                {{scope.row.products[0].productName}}
              </template>
            </el-table-column>
            <el-table-column prop="fl" label="商品分类">
              <template slot-scope="scope">
                {{scope.row.product.shopGroupName}}
              </template>
            </el-table-column>
  
3d9acc2b   杨鑫   '最新'
225
            <el-table-column prop="createTime" label="商品创建时间" show-overflow-tooltip>
89bb9f2b   wesley88   1
226
227
228
229
230
              <template slot-scope="scope">
                {{scope.row.product.createTime}}
              </template>
            </el-table-column>
            <el-table-column prop="bigDecimal" label="销售数量" />
3d9acc2b   杨鑫   '最新'
231
232
233
234
235
236
            <el-table-column prop="multiply" label="销售金额" />
  		  <el-table-column prop="grossProfitRate" label="毛利率" >
  			  <template slot-scope="scope">
  			      {{scope.row.grossProfitRate}}%
  			    </template>
  			  </el-table-column>
89bb9f2b   wesley88   1
237
          </el-table>
3f535f30   杨鑫   '初始'
238
          <div class="fenye">
1991126c   杨鑫   '最新'
239
            <div>共{{ total }}条</div>
89bb9f2b   wesley88   1
240
241
            <el-pagination :current-page="currentPage" :page-size="10" layout="prev, pager, next" :total="total"
              @current-change="handleCurrentChange" />
3f535f30   杨鑫   '初始'
242
          </div>
137c0ee8   杨鑫   'yanshou'
243
        </div>
3f535f30   杨鑫   '初始'
244
245
246
247
248
249
      </div>
  
    </div>
  </template>
  
  <script>
137c0ee8   杨鑫   'yanshou'
250
    import {
89bb9f2b   wesley88   1
251
      salesStatistics,
3d9acc2b   杨鑫   '最新'
252
      getAllNotPage,
89bb9f2b   wesley88   1
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
      calculateGrossProfit
    } from '@/api/dataSta'
    import {
      salesRanking,
    } from '@/api/psRanking'
    import {
      async
    } from 'q';
    export default {
      data() {
        // 这里存放数据
        return {
          formParams: {
            maoliTime: '',
            tongjiTime: ''
          },
          currentPage: 1,
          formInline: {
            searchType: '1',
            search: '', // 搜索字段
3d9acc2b   杨鑫   '最新'
273
            // state: '4',
89bb9f2b   wesley88   1
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
            // afterState: '', // 售后状态 0-无售后 1-售后中 2-售后成功 3-售后关闭
            dates: [], // 下单时间数组
            page: 1,
            shopName: '',
            pageSize: 10
          },
          fut: true,
          total: 1,
          tableData: [],
          tableLoading: false,
          dialogVisible: false,
          tongji: {},
          maoli: {},
          pageindex: {
            pageNumber: 1,
            pageSize: 10,
          },
          labelStyle: {
            width: '35%',
            textAlign: 'center',
            color: '#000',
            backgroundColor: '#F9FAFC',
          },
          contentStyle: {
            textAlign: 'center',
          }
3f535f30   杨鑫   '初始'
300
  
3f535f30   杨鑫   '初始'
301
        }
89bb9f2b   wesley88   1
302
  
3f535f30   杨鑫   '初始'
303
      },
89bb9f2b   wesley88   1
304
305
      // 生命周期 - 挂载完成(可以访问DOM元素)
      mounted() {
3f535f30   杨鑫   '初始'
306
        this.getAll()
89bb9f2b   wesley88   1
307
308
309
      },
      // 方法集合
      methods: {
3d9acc2b   杨鑫   '最新'
310
     
89bb9f2b   wesley88   1
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
        toggleFilter() {
          this.fut = !this.fut
        },
        handleSizeChange(val) {
          this.formInline.pageSize = val
          // this.getAll(this.formInline)
        },
        handleCurrentChange(val) {
          this.formInline.page = val
          // this.getAll(this.formInline)
        },
        //重置
        clear(val) {
          this.formInline = {
            searchType: '1',
            search: '', // 搜索字段
            state: '',
            // afterState: '', // 售后状态 0-无售后 1-售后中 2-售后成功 3-售后关闭
            dates: [], // 下单时间数组
            page: 1,
            shopName: '',
            pageSize: 10
          }
          this.formParams.tongjiTime = ''
          this.getAll()
          // if(val == 1){
          //  this.formParams.tongjiTime = ''
          //   this.getAll()
          // }else{
          //   this.formParams.maoliTime = ''
          //   this.getAll()
          // }
        },
        //  查询
        search(val) {
          this.formInline.dates = this.formParams.tongjiTime || []
          this.getAll()
3d9acc2b   杨鑫   '最新'
348
  		
89bb9f2b   wesley88   1
349
350
351
352
353
354
355
          // if(val ==1){
          //   this.formInline.dates = this.formParams.tongjiTime
          //   this.getAll()
          // }else{
          //   this.formInline.dates = this.formParams.maoliTime
          //   this.getAll()
          // }
3f535f30   杨鑫   '初始'
356
357
          // console.log(this.formParams.tongjiTime)
          // console.log(this.formParams.maoliTime)
89bb9f2b   wesley88   1
358
359
360
        },
        // 初始化查询所有数据
        async getAll() {
3d9acc2b   杨鑫   '最新'
361
362
363
          const res = await getAllNotPage(this.formInline)
          const Orderlist = await calculateGrossProfit(res.data)
          const tablelist = await salesStatistics(res.data)
89bb9f2b   wesley88   1
364
365
366
          this.maoli = Orderlist.data
          this.tongji = tablelist.data
          // this.loading = false;
137c0ee8   杨鑫   'yanshou'
367
368
  
  
3d9acc2b   杨鑫   '最新'
369
370
371
          const list = await salesRanking(res.data)
          // this.tableData = list.data
  		 this.tableData =  list.data.sort((a, b) => b.multiply - a.multiply);
89bb9f2b   wesley88   1
372
373
          // console.log(list.data)
          this.total = list.data.length
60d9bf40   杨鑫   '1'
374
  
89bb9f2b   wesley88   1
375
        },
3f535f30   杨鑫   '初始'
376
377
  
  
89bb9f2b   wesley88   1
378
      }
3f535f30   杨鑫   '初始'
379
    }
3f535f30   杨鑫   '初始'
380
381
  </script>
  <style lang='scss' scoped>
89bb9f2b   wesley88   1
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
    .pending {
      padding-left: 15px;
    }
  
    .tab_show {
      padding-top: 10px;
      padding-left: 15px;
      padding-right: 15px;
      background-color: #fff;
    }
  
    .filter-container {
      font-size: 12px;
      border: 1px solid #EBEEF5;
      margin-bottom: 20px;
  
    }
  
    .formSearch {
      padding: 0 20px;
      height: 60px;
      /* 或者你想要的任何高度 */
3f535f30   杨鑫   '初始'
404
      /* 过渡效果 */
89bb9f2b   wesley88   1
405
406
407
408
409
      transition: height 0.3s ease-in-out;
      /* 动画的持续时间、类型 */
      overflow: hidden;
      /* 隐藏溢出的内容,这样高度变化时内容不会显示出来 */
  
3f535f30   杨鑫   '初始'
410
    }
89bb9f2b   wesley88   1
411
412
413
414
415
416
417
418
419
  
    .collapsed {
      padding: 0 10px;
      margin-top: 0px;
      height: 0;
      transition: height 0.3s ease-in-out;
      /* 动画的持续时间、类型 */
      overflow: hidden;
      /* 隐藏溢出的内容,这样高度变化时内容不会显示出来 */
3f535f30   杨鑫   '初始'
420
    }
89bb9f2b   wesley88   1
421
422
423
  
    ::v-deep .collapsed {
      .el-form--inline .el-form-item {
3f535f30   杨鑫   '初始'
424
        margin-top: 10px;
89bb9f2b   wesley88   1
425
426
427
428
429
430
431
        margin-right: 20px;
        margin-bottom: 0px;
      }
  
      .el-form-item__label {
        font-size: 12px;
      }
3f535f30   杨鑫   '初始'
432
    }
89bb9f2b   wesley88   1
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
  
    ::v-deep .formSearch {
      .el-form--inline .el-form-item {
        margin-top: 10px;
        margin-right: 20px;
        margin-bottom: 0px;
      }
  
      .el-form-item__label {
        font-size: 12px;
      }
    }
  
    .fenye {
      margin-top: 20px;
      display: flex;
      justify-content: space-between;
    }
  
    .titleTj {
      width: 100%;
      color: #9C9C9C;
      position: relative;
      margin-bottom: 15px;
    }
  
    .titleTj::before {
      content: "";
      position: absolute;
      top: 0;
      left: -10px;
      width: 4px;
      height: 100%;
      background-color: #14BA99;
3f535f30   杨鑫   '初始'
467
    }
3f535f30   杨鑫   '初始'
468
  </style>