Blame view

merchant-web-master/src/views/comprehensive/pcdetails/index.vue 14.9 KB
3f535f30   杨鑫   '初始'
1
2
  <template>
    <!-- <div style="padding: 10px;background-color:#F2F3F5"> -->
8dca79c8   杨鑫   1
3
      <div style="background-color:#F2F3F5">
3f535f30   杨鑫   '初始'
4
5
      <div class="history">
        <div style="background-color:#Fff;padding:20px 20px 0 20px;display:flex;justify-content: space-between;">
9683c4af   杨鑫   '最新'
6
  
3f535f30   杨鑫   '初始'
7
8
            <!-- 顶部搜索 -->
            <div class="toolbar">
6f06533e   杨鑫   最新1
9
              <el-form ref="formInline" :inline="true" :model="formInline">
3f535f30   杨鑫   '初始'
10
11
                <el-form-item label="日期">
                  <el-date-picker
3d9acc2b   杨鑫   '最新'
12
  				popper-class="elDatePicker"
6f06533e   杨鑫   最新1
13
                    v-model="formInline.dates"
3d9acc2b   杨鑫   '最新'
14
15
                     type="monthrange"
                     style="width:250px"
3f535f30   杨鑫   '初始'
16
17
18
19
20
21
22
23
24
                    range-separator="至"
                    start-placeholder="开始时间"
                    end-placeholder="结束时间"
                    value-format="yyyy-MM-dd"
                  />
                </el-form-item>
  
                <el-form-item label-width="0">
                  <el-button   @click="search"  style="background-color: #3F9B6A;color: #fff;">查询</el-button>
6f06533e   杨鑫   最新1
25
                  <el-button  @click="clear" class="buttonHover"
3f535f30   杨鑫   '初始'
26
27
28
29
30
31
32
33
34
35
36
37
38
              style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">重置</el-button>
                </el-form-item>
              </el-form>
            </div>
        </div>
        <div style="background-color:#fff;padding: 20px 20px 0px;">
           <div style="background-color:#F2F3F5;padding: 5px;">
             <div style="background-color:#fff;display:flex;">
               <div style="padding:15px;width:49%;">
                 <div style="margin-bottom:10px">商品消费数量分布图</div>
                 <div style="height:250px" ref="myEchartsOne"></div>
               </div>
               <div style="padding:15px;width:49%;">
7ec3e5a7   杨鑫   最新
39
                 <div style="margin-bottom:10px">商品消费表(月销售额)</div>
3f535f30   杨鑫   '初始'
40
41
42
43
44
45
46
47
                 <div style="height:250px" ref="myEchartsTwo"></div>
               </div>
             </div>
           </div>
        </div>
        <div style="background-color:#fff;padding: 20px 20px 0px;">
           <div style="background-color:#F2F3F5;padding: 5px;">
             <div style="background-color:#fff;padding:15px">商品消费排行榜</div>
9683c4af   杨鑫   '最新'
48
49
             <div style="display:flex; ">
                 <div style="width:100%;height:250px;background-color:#fff;padding: 0 20px;" ref="myEchartsThree" ></div>
3f535f30   杨鑫   '初始'
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
                 <!-- <div style="width:100%;height:250px;background-color:#fff;"></div> -->
             </div>
           </div>
        </div>
          <!-- 表格 -->
          <div class="content_table" style="padding: 15px 10px 10px 20px;background-color:#fff">
               <div style="background-color: #F2F3F5;padding:5px;margin-bottom: 20px;">
            <div style="background-color:#fff;padding:15px;">
              <div class="table">
                <el-table
                  :data="tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
                   :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
                >
                  <el-table-column prop="orderFormid" label="订单号" />
                  <el-table-column  prop="customerName" label="下单用户">
                  </el-table-column>
                  <el-table-column prop="paymentMode" label="支付方式">
                    <template slot-scope="scope">
                      {{scope.row.paymentMode == 1?'微信':''}}
                      </template>
                  </el-table-column>
                  <el-table-column prop="state" label="订单状态">
                    <template slot-scope="scope">
                        {{scope.row.state == 1?'待付款':scope.row.state == 2?'待发货':scope.row.state == 3?'待收货':scope.row.state == 4?'已完成':scope.row.state ==5?'已取消':scope.row.state == 6?'待成团':'代售后'}}
                        </template>
                    </el-table-column>
                  <el-table-column prop="price" label="订单总金额" />
                  <!-- <el-table-column prop="yh" label="优惠金额" /> -->
                  <!-- <el-table-column prop="sf" label="订单实付金额" /> -->
                  <el-table-column prop="paymentTime" label="下单时间" />
                </el-table>
              </div>
              <div class="fenye">
8dca79c8   杨鑫   1
83
84
85
  			<div style="line-height: 200%;">共{{total}}条</div>
                <el-pagination class="pagination" :hide-on-single-page="flag" background  :current-page="currentPage"
                  layout="prev, pager,next" :total="total"
9683c4af   杨鑫   '最新'
86
                  @current-change="handleCurrentChange" />
3f535f30   杨鑫   '初始'
87
88
89
90
91
92
93
94
95
96
97
98
99
              </div>
            </div>
            <!-- 分页 -->
  
         </div>
          </div>
        </div>
  
    </div>
  </template>
  
  <script>
  import echarts from 'echarts'
8dca79c8   杨鑫   1
100
    import {orderGetAll,getAllNotPage,
3f535f30   杨鑫   '初始'
101
102
103
104
105
106
    salesRanking,commodityConsumption} from '@/api/psRanking'
    import { dashIndex, userVisitExport, orderConvertExport, hotProductsExport } from '@/api/dashboard'
  export default {
    data() {
      return {
        list: [],
9683c4af   杨鑫   '最新'
107
        total: 0,
3f535f30   杨鑫   '初始'
108
109
        pageSize: 10,
        currentPage: 1,
6f06533e   杨鑫   最新1
110
  	  flag:false,
3f535f30   杨鑫   '初始'
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
        tipsList: [{
          id: 1,
          name: '系统消息'
        },
        {
          id: 2,
          name: '公告'
        },
        {
          id: 3,
          name: '站内信'
        }],
         tableData: [],
         formInline: {
           searchType: '1',
           search: '', // 搜索字段
           state: '',
           // afterState: '', // 售后状态 0-无售后 1-售后中 2-售后成功 3-售后关闭
           dates: [], // 下单时间数组
           page: 1,
           shopName: '',
6f06533e   杨鑫   最新1
132
           pageSize: 100
3f535f30   杨鑫   '初始'
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
         },
         bing:[
  
        ],
        yuantu:{
          names: [
          ],
          rates: [
          ]
        },
        form: {
          condition: 4
        },
        rules: {
          noticeType: [
            { required: true, message: '请选择消息类型', trigger: 'change' }
          ]
        },
8dca79c8   杨鑫   1
151
  	flag:false,
3f535f30   杨鑫   '初始'
152
153
154
155
156
157
158
159
160
161
      }
    },
    mounted() {
      // this.draws()
  
  
      this.getTu()
    },
    methods: {
     async getTu(){
8dca79c8   杨鑫   1
162
163
    const res =  await getAllNotPage(this.formInline)
   this.tableData =  res.data
3f535f30   杨鑫   '初始'
164
   this.total = this.tableData.length
60d9bf40   杨鑫   '1'
165
  
8dca79c8   杨鑫   1
166
167
    const Orderlist = await salesRanking(res.data)
     const zhutu  =  await commodityConsumption(res.data)
3f535f30   杨鑫   '初始'
168
169
170
171
172
173
174
175
     const remai = await dashIndex(this.form)
  
  this.drawsTwo(zhutu.data)
   for(let i =0;i<remai.data.hotSellProducts.length;i++){
        this.yuantu.names.push(remai.data.hotSellProducts[i].productName)
          this.yuantu.rates.push(remai.data.hotSellProducts[i].number)
   }
  
9683c4af   杨鑫   '最新'
176
  
3f535f30   杨鑫   '初始'
177
178
179
180
181
182
183
184
185
   for(let i =0;i<Orderlist.data.length;i++){
  
     let item = {}
     item.name = Orderlist.data[i].product.productName
     item.value = Orderlist.data[i].bigDecimal
      this.bing.push(item)
        // this.bing[i].value = Orderlist.data[i].bigDecimal
        // this.bing[i].name = Orderlist.data[i].product.productName
   }
9683c4af   杨鑫   '最新'
186
   this.draws(this.bing)
3f535f30   杨鑫   '初始'
187
188
189
190
   this.draw(this.bing)
  
      },
   async search(){
8dca79c8   杨鑫   1
191
192
    const res =  await getAllNotPage(this.formInline)
   this.tableData =  res.data
9683c4af   杨鑫   '最新'
193
   this.total = this.tableData.length
8dca79c8   杨鑫   1
194
195
196
  this.currentPage = 1
    const Orderlist = await salesRanking(res.data)
     const zhutu  =  await commodityConsumption(res.data)
3f535f30   杨鑫   '初始'
197
198
199
200
201
202
203
204
     const remai = await dashIndex(this.form)
  
  this.drawsTwo(zhutu.data)
   for(let i =0;i<remai.data.hotSellProducts.length;i++){
        this.yuantu.names.push(remai.data.hotSellProducts[i].productName)
          this.yuantu.rates.push(remai.data.hotSellProducts[i].number)
   }
  
9683c4af   杨鑫   '最新'
205
  
3f535f30   杨鑫   '初始'
206
207
208
209
   for(let i =0;i<Orderlist.data.length;i++){
        this.bing[i].value = Orderlist.data[i].bigDecimal
        this.bing[i].name = Orderlist.data[i].product.productName
   }
9683c4af   杨鑫   '最新'
210
   this.draws(this.bing)
3f535f30   杨鑫   '初始'
211
212
   this.draw(this.bing)
   },
6f06533e   杨鑫   最新1
213
214
215
216
217
218
219
220
221
   clear(){
  	 this.formInline= {
  	   searchType: '1',
  	   search: '', // 搜索字段
  	   state: '',
  	   // afterState: '', // 售后状态 0-无售后 1-售后中 2-售后成功 3-售后关闭
  	   dates: [], // 下单时间数组
  	   page: 1,
  	   shopName: '',
8dca79c8   杨鑫   1
222
  	   pageSize: 10
6f06533e   杨鑫   最新1
223
  	 }
8dca79c8   杨鑫   1
224
  	 this.currentPage = 1
6f06533e   杨鑫   最新1
225
226
  	 this.getTu()
   },
3f535f30   杨鑫   '初始'
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
      handleCurrentChange(val) {
        this.currentPage = val
      },
      handleSizeChange(val) {
        this.pageSize = val
      },
      draw(arr) {
        const myEchart = echarts.init(this.$refs.myEchartsOne, 'light')
  
       let option = {
          tooltip: {
            trigger: 'item'
          },
          series: [
            {
              name: '消费数量',
              type: 'pie',
              radius: ['40%', '70%'],
              avoidLabelOverlap: false,
              itemStyle: {
                borderRadius: 10,
                borderColor: '#fff',
                borderWidth: 2
              },
              label: {
                show: false,
                position: 'center'
              },
              emphasis: {
                label: {
                  show: true,
                  fontSize: 12,
                  fontWeight: 'bold'
                }
              },
              labelLine: {
                show: false
              },
  
              data: arr
            }
          ]
        };
        myEchart.setOption(option)
      },
      drawsTwo(zhutu){
        const keys = Object.keys(zhutu);
        const values = Object.values(zhutu);
        console.log(keys,values)
        const myEchart = echarts.init(this.$refs.myEchartsTwo, 'light')
       let  option = {
7ec3e5a7   杨鑫   最新
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
  		  tooltip: {
  		                 trigger: 'axis',
  		                 formatter: function (params) {
  		                     return `销售额: ${params[0].value}`;
  		                 }
  		             },
           xAxis: {
                  type: 'category',
                  data: keys
              },
              yAxis: {
                  type: 'value',
                  // 添加 Y 轴提示信息
                  name: '销售额',
                  // 设置提示信息的文本样式
                  nameTextStyle: {
                      fontSize: 12
                  }
              },
              series: [
6f06533e   杨鑫   最新1
298
299
300
301
302
303
304
305
                  {
                      data: values,
                      type: 'bar',
                      itemStyle: {
                          color: '#3F9B6A' 
                      }
                  }
              ]
3f535f30   杨鑫   '初始'
306
307
308
309
        }
        myEchart.setOption(option)
      },
      draws(arr) {
9683c4af   杨鑫   '最新'
310
        console.log(arr)
3f535f30   杨鑫   '初始'
311
312
313
        const myEchart = echarts.init(this.$refs.myEchartsThree, 'light')
        // const o = this.chartData
        const option = {
6f06533e   杨鑫   最新1
314
          color: ["#3F9B6A"],
3f535f30   杨鑫   '初始'
315
316
          // 设置图表的位置
          grid: {
9683c4af   杨鑫   '最新'
317
            x: 200, // 左间距
3f535f30   杨鑫   '初始'
318
            y: 0, // 上间距
6f06533e   杨鑫   最新1
319
            x2: 0, // 右间距
3f535f30   杨鑫   '初始'
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
            y2: 40 // 下间距
          },
          // 提示框组件
          tooltip: {
            trigger: 'axis', // 触发类型, axis: 坐标轴触发
            axisPointer: {
              // 指示器类型  'line' 直线指示器 'shadow' 阴影指示器 'none' 无指示器
              // 'cross' 十字准星指示器 其实是种简写,表示启用两个正交的轴的 axisPointer
              type: 'none'
            },
            textStyle: {
              color: '#cdd3ee' // 文字颜色
            },
            // 提示框浮层内容格式器,支持字符串模板和回调函数两种形式 折线(区域)图、柱状(条形)图、K线图
            // {a}(系列名称),{b}(类目值),{c}(数值), {d}(无)
6f06533e   杨鑫   最新1
335
            formatter: '{b}<br />已售出: {c0}个'
3f535f30   杨鑫   '初始'
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
          },
          // // 图例组件
          // legend: {
          //   textStyle: {
          //     // 文本样式
          //     fontSize: 16,
          //     color: "#cdd3ee"
          //   },
          //   top: 13, // 定位
          //   data: ["已完成", "进行中", "未完成"] // 图例的数据数组
          // },
          // X轴
          xAxis: {
            type: 'value', // 坐标轴类型,   'value' 数值轴,适用于连续数据
            // 坐标轴刻度
            axisTick: {
              show: false // 是否显示坐标轴刻度 默认显示
            },
            // 坐标轴轴线
            axisLine: {
              // 是否显示坐标轴轴线 默认显示
              show: false // 是否显示坐标轴轴线 默认显示
            },
            // 坐标轴在图表区域中的分隔线
            splitLine: {
              show: false // 是否显示分隔线。默认数值轴显示
            },
            // 坐标轴刻度标签
            axisLabel: {
              show: false // 是否显示刻度标签 默认显示
            }
          },
          yAxis: [
            // 左侧Y轴
            {
              // 坐标轴类型,  'category' 类目轴,适用于离散的类目数据
              // 为该类型时必须通过 data 设置类目数据
              type: 'category',
              // 坐标轴刻度
              axisTick: {
                show: false // 是否显示坐标轴刻度 默认显示
              },
              // 坐标轴轴线
              axisLine: {
                // 是否显示坐标轴轴线 默认显示
                show: false, // 是否显示坐标轴轴线 默认显示
                lineStyle: {
                  // 坐标轴线线的颜色
                  color: '#cdd3ee'
                }
              },
              // 坐标轴在图表区域中的分隔线
              splitLine: {
                show: false // 是否显示分隔线。默认数值轴显示
              },
              // 坐标轴刻度标签
              axisLabel: {
                show: true, // 是否显示刻度标签 默认显示
9683c4af   杨鑫   '最新'
394
                fontSize: 16, // 文字的字体大小
6f06533e   杨鑫   最新1
395
                color: '#000', // 刻度标签文字的颜色
3f535f30   杨鑫   '初始'
396
397
398
399
                // 使用字符串模板,模板变量为刻度默认标签 {value}
                formatter: '{value}'
              },
              // 类目数据,在类目轴(type: 'category')中有效
9683c4af   杨鑫   '最新'
400
              data: arr.map(item => item.name)
3f535f30   杨鑫   '初始'
401
402
403
            }
          ],
          // 系列列表
9683c4af   杨鑫   '最新'
404
405
406
407
408
409
410
411
412
413
          series: [
            {
              type: 'bar', // 系列类型
              name: '已完成',
              barMaxWidth: 20, // 柱条的最大宽度,不设时自适应
              // label: {
              //   show: true,
              //   position: "inside"
              // },
              itemStyle: {
6f06533e   杨鑫   最新1
414
                barBorderRadius: [10, 10, 10, 10] // 圆角半径, 单位px, 支持传入数组分别指定 4 个圆角半径
9683c4af   杨鑫   '最新'
415
416
417
418
              },
              data:arr.map(item => item.value)// 系列中的数据内容数组
            }
          ]
3f535f30   杨鑫   '初始'
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
        }
  
        myEchart.setOption(option)
      },
  
    }
   }
  </script>
  
  <style lang='scss' scoped>
  .history{
    padding: 0px;
    min-height: calc(100vh - 50px - 20px);
  }
   ::v-deep .el-form-item__label{
          font-weight: normal;
8dca79c8   杨鑫   1
435
           font-size: 14px;
3f535f30   杨鑫   '初始'
436
437
438
439
440
441
442
443
444
445
446
447
  
         }
         ::v-deep .btn .el-button:focus,
          .el-button:hover {
            border: 1px solid #3F9B6A;
          }
          ::v-deep .el-button {
             border: 1px solid #3F9B6A;
           }
            ::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
             background-color: #3F9B6A;
           }
3d9acc2b   杨鑫   '最新'
448
449
450
  		 
  	
  		 
3f535f30   杨鑫   '初始'
451
452
453
454
  </style>
  <style scoped>
  .history /deep/ .el-table .cell.el-tooltip img {
    max-height: 100px;
8dca79c8   杨鑫   1
455
456
457
458
459
  
  }
  .history{
  	margin-left:10px;
  	background-color: #fff;
3f535f30   杨鑫   '初始'
460
461
462
463
  }
    .fenye {
      margin-top: 20px;
      display: flex;
8dca79c8   杨鑫   1
464
      justify-content: space-between;
3f535f30   杨鑫   '初始'
465
466
467
468
469
470
471
      position: relative;
    }
    .pagination {
      text-align: right;
      line-height: 20px;
    }
  
8dca79c8   杨鑫   1
472
   
3f535f30   杨鑫   '初始'
473
474
475
476
477
   .toolbar{
     .el-form-item{
       margin-bottom:0px;
     }
   }
3d9acc2b   杨鑫   '最新'
478
479
480
481
  
  
  
  
3f535f30   杨鑫   '初始'
482
483
484
485
486
487
  </style>
  <style>
  .el-tooltip__popper {
    max-width: 50%;
  }
  </style>