Selaa lähdekoodia

订单列表,优化时间筛选条件,增加支付状态筛选条件

sunxbiao 1 vuosi sitten
vanhempi
commit
f4febab76a
1 muutettua tiedostoa jossa 158 lisäystä ja 128 poistoa
  1. 158 128
      src/views/order/list/index.vue

+ 158 - 128
src/views/order/list/index.vue

@@ -6,78 +6,89 @@
6 6
           <el-form size="small" label-width="100px">
7 7
             <el-form-item label="订单状态:">
8 8
               <el-radio-group v-model="tableFrom.status" type="button" @change="getList(1)">
9
-                <el-radio-button label>全部 {{ '(' +orderChartType.all?orderChartType.all:0 + ')' }}</el-radio-button>
9
+                <el-radio-button label>全部 {{
10
+                    '(' + orderChartType.all ? orderChartType.all : 0 + ')'
11
+                  }}
12
+                </el-radio-button>
10 13
                 <el-radio-button
11
-                  label="1"
12
-                >待付款 {{ '(' +orderChartType.unpaid?orderChartType.unpaid:0+ ')' }}</el-radio-button>
14
+                    label="1"
15
+                >待付款 {{ '(' + orderChartType.unpaid ? orderChartType.unpaid : 0 + ')' }}
16
+                </el-radio-button>
13 17
                 <el-radio-button
14
-                  label="2"
15
-                >待发货 {{ '(' +orderChartType.unshipped?orderChartType.unshipped:0+ ')' }}</el-radio-button>
18
+                    label="2"
19
+                >待发货 {{ '(' + orderChartType.unshipped ? orderChartType.unshipped : 0 + ')' }}
20
+                </el-radio-button>
16 21
                 <el-radio-button
17
-                  label="3"
18
-                >待收货 {{ '(' +orderChartType.untake?orderChartType.untake:0+ ')' }}</el-radio-button>
22
+                    label="3"
23
+                >待收货 {{ '(' + orderChartType.untake ? orderChartType.untake : 0 + ')' }}
24
+                </el-radio-button>
19 25
                 <el-radio-button
20
-                  label="4"
21
-                >待评价 {{ '(' +orderChartType.unevaluate?orderChartType.unevaluate:0+ ')' }}</el-radio-button>
26
+                    label="4"
27
+                >待评价 {{ '(' + orderChartType.unevaluate ? orderChartType.unevaluate : 0 + ')' }}
28
+                </el-radio-button>
22 29
                 <el-radio-button
23
-                  label="5"
24
-                >交易完成 {{ '(' +orderChartType.complete?orderChartType.complete:0+ ')' }}</el-radio-button>
30
+                    label="5"
31
+                >交易完成 {{ '(' + orderChartType.complete ? orderChartType.complete : 0 + ')' }}
32
+                </el-radio-button>
25 33
                 <el-radio-button
26
-                  label="6"
27
-                >已退款 {{ '(' +orderChartType.refund?orderChartType.refund:0+ ')' }}</el-radio-button>
34
+                    label="6"
35
+                >已退款 {{ '(' + orderChartType.refund ? orderChartType.refund : 0 + ')' }}
36
+                </el-radio-button>
28 37
                 <el-radio-button
29
-                  label="7"
30
-                >已删除 {{ '(' +orderChartType.del?orderChartType.del:0+ ')' }}</el-radio-button>
38
+                    label="7"
39
+                >已删除 {{ '(' + orderChartType.del ? orderChartType.del : 0 + ')' }}
40
+                </el-radio-button>
31 41
               </el-radio-group>
32 42
             </el-form-item>
33 43
             <el-form-item label="时间选择:" class="width100">
34 44
               <el-radio-group
35
-                v-model="tableFrom.date"
36
-                type="button"
37
-                class="mr20"
38
-                size="small"
39
-                @change="selectChange(tableFrom.date)"
45
+                  v-model="tableFrom.date"
46
+                  type="button"
47
+                  class="mr20"
48
+                  size="small"
49
+                  @change="selectChange(tableFrom.date)"
40 50
               >
41 51
                 <el-radio-button
42
-                  v-for="(item,i) in fromList.fromTxt"
43
-                  :key="i"
44
-                  :label="item.val"
45
-                >{{ item.text }}</el-radio-button>
52
+                    v-for="(item,i) in fromList.fromTxt"
53
+                    :key="i"
54
+                    :label="item.val"
55
+                >{{ item.text }}
56
+                </el-radio-button>
46 57
               </el-radio-group>
47 58
               <el-date-picker
48
-                v-model="timeVal"
49
-                value-format="yyyy/MM/dd"
50
-                format="yyyy/MM/dd"
51
-                size="small"
52
-                type="daterange"
53
-                placement="bottom-end"
54
-                placeholder="自定义时间"
55
-                style="width: 250px;"
56
-                @change="onchangeTime"
59
+                  v-model="timeVal"
60
+                  value-format="yyyy/MM/dd HH:mm:ss"
61
+                  format="yyyy/MM/dd HH:mm:ss"
62
+                  size="small"
63
+                  type="datetimerange"
64
+                  placement="bottom-end"
65
+                  placeholder="自定义时间"
66
+                  style="width: 250px;"
67
+                  @change="onchangeTime"
57 68
               />
58 69
             </el-form-item>
59 70
             <el-form-item label="商户名称:">
60 71
               <el-select
61
-                v-model="tableFrom.mer_id"
62
-                clearable
63
-                filterable
64
-                placeholder="请选择"
65
-                class="selWidth"
66
-                @change="getList(1)"
72
+                  v-model="tableFrom.mer_id"
73
+                  clearable
74
+                  filterable
75
+                  placeholder="请选择"
76
+                  class="selWidth"
77
+                  @change="getList(1)"
67 78
               >
68 79
                 <el-option
69
-                  v-for="item in merSelect"
70
-                  :key="item.mer_id"
71
-                  :label="item.mer_name"
72
-                  :value="item.mer_id"
80
+                    v-for="item in merSelect"
81
+                    :key="item.mer_id"
82
+                    :label="item.mer_name"
83
+                    :value="item.mer_id"
73 84
                 />
74 85
               </el-select>
75 86
             </el-form-item>
76
-            <el-form-item label="支付类型:" class="check-status" >
87
+            <el-form-item label="支付类型:" class="check-status">
77 88
               <el-select v-model="tableFrom.pay_type" placeholder="全部" class="filter-item" @change="getList(1)">
78
-                <el-option label="全部"  value="" />
79
-                <el-option label="微信" :value="1" />
80
-                <el-option label="支付宝" :value="4" />
89
+                <el-option label="全部" value=""/>
90
+                <el-option label="微信" :value="1"/>
91
+                <el-option label="支付宝" :value="4"/>
81 92
                 <!-- <el-option label="虚拟支付" :value="0" /> -->
82 93
 
83 94
                 <!-- <el-option label="红积分兑换" :value="6" /> -->
@@ -86,38 +97,48 @@
86 97
 
87 98
             <el-form-item label="关键字:" class="width100">
88 99
               <el-input
89
-                v-model="tableFrom.keywords"
90
-                placeholder="请输入订单号/收货人/联系方式"
91
-                class="selWidth"
92
-                size="small"
100
+                  v-model="tableFrom.keywords"
101
+                  placeholder="请输入订单号/收货人/联系方式"
102
+                  class="selWidth"
103
+                  size="small"
93 104
               >
94
-                <el-button slot="append" icon="el-icon-search" size="small" @click="getList(1)" />
105
+                <el-button slot="append" icon="el-icon-search" size="small" @click="getList(1)"/>
95 106
               </el-input>
96 107
             </el-form-item>
97 108
             <el-form-item label="用户信息:" class="width100">
98 109
               <el-input
99
-                v-model="tableFrom.username"
100
-                placeholder="请输入用户昵称/手机号"
101
-                class="selWidth"
102
-                size="small"
110
+                  v-model="tableFrom.username"
111
+                  placeholder="请输入用户昵称/手机号"
112
+                  class="selWidth"
113
+                  size="small"
103 114
               >
104
-                <el-button slot="append" icon="el-icon-search" size="small" @click="getList(1)" />
115
+                <el-button slot="append" icon="el-icon-search" size="small" @click="getList(1)"/>
105 116
               </el-input>
106 117
             </el-form-item>
118
+            <el-form-item label="支付状态:" class="check-status">
119
+              <el-select v-model="tableFrom.paid" placeholder="全部" class="filter-item" @change="getList(1)">
120
+                <el-option label="全部" value=""/>
121
+                <el-option label="已支付" :value="1"/>
122
+                <el-option label="未支付" :value="0"/>
123
+                <!-- <el-option label="虚拟支付" :value="0" /> -->
124
+
125
+                <!-- <el-option label="红积分兑换" :value="6" /> -->
126
+              </el-select>
127
+            </el-form-item>
107 128
           </el-form>
108 129
         </div>
109 130
         <!-- <cards-data :card-lists="cardLists" /> -->
110
-        <redCards-data :card-lists="cardLists" class="orderCount-box" />
131
+        <redCards-data :card-lists="cardLists" class="orderCount-box"/>
111 132
         <!-- <otherCards-data :card-lists="cardLists" class="orderCount-box"/> -->
112 133
       </div>
113 134
       <el-table
114
-        v-loading="listLoading"
115
-        :data="tableData.data"
116
-        style="width: 100%"
117
-        size="mini"
118
-        class="table"
119
-        highlight-current-row
120
-        :cell-class-name="addTdClass"
135
+          v-loading="listLoading"
136
+          :data="tableData.data"
137
+          style="width: 100%"
138
+          size="mini"
139
+          class="table"
140
+          highlight-current-row
141
+          :cell-class-name="addTdClass"
121 142
       >
122 143
         <el-table-column type="expand">
123 144
           <template slot-scope="props">
@@ -139,7 +160,7 @@
139 160
         </el-table-column>
140 161
         <el-table-column label="订单编号" min-width="170">
141 162
           <template slot-scope="scope">
142
-            <span style="display: block;" v-text="scope.row.order_sn" />
163
+            <span style="display: block;" v-text="scope.row.order_sn"/>
143 164
             <span v-show="scope.row.is_del > 0" style="color: #ED4014;display: block;">用户已删除</span>
144 165
           </template>
145 166
         </el-table-column>
@@ -149,7 +170,7 @@
149 170
           </template>
150 171
         </el-table-column>
151 172
 
152
-        <el-table-column prop="user_info" label="用户信息" min-width="130" >
173
+        <el-table-column prop="user_info" label="用户信息" min-width="130">
153 174
           <template slot-scope="scope">
154 175
             <div class="tabBox acea-row row-middle">
155 176
               <span>{{ scope.row.user.nickname ? scope.row.user.nickname : '' }}</span>
@@ -160,39 +181,39 @@
160 181
           </template>
161 182
         </el-table-column>
162 183
 
163
-        <el-table-column prop="real_name" label="收货人" min-width="130" />
184
+        <el-table-column prop="real_name" label="收货人" min-width="130"/>
164 185
         <el-table-column label="商户名称" min-width="150">
165 186
           <template slot-scope="scope">
166
-            <span>{{ scope.row.merchant ? scope.row.merchant.mer_name :'' }}</span>
187
+            <span>{{ scope.row.merchant ? scope.row.merchant.mer_name : '' }}</span>
167 188
           </template>
168 189
         </el-table-column>
169 190
         <el-table-column label="商品信息" min-width="330">
170 191
           <template slot-scope="scope">
171 192
             <div
172
-              v-for="(val, i ) in scope.row.orderProduct"
173
-              :key="i"
174
-              class="tabBox acea-row row-middle"
193
+                v-for="(val, i ) in scope.row.orderProduct"
194
+                :key="i"
195
+                class="tabBox acea-row row-middle"
175 196
             >
176 197
               <div class="demo-image__preview">
177
-                <el-image referrerpolicy='no-referrer' 
178
-                  :src="val.cart_info.product.image"
179
-                  :preview-src-list="[val.cart_info.product.image]"
198
+                <el-image referrerpolicy='no-referrer'
199
+                          :src="val.cart_info.product.image"
200
+                          :preview-src-list="[val.cart_info.product.image]"
180 201
                 />
181 202
               </div>
182 203
               <span
183
-                class="tabBox_tit"
204
+                  class="tabBox_tit"
184 205
               >{{ val.cart_info.product.store_name + ' | ' }}{{ val.cart_info.productAttr.sku }}</span>
185 206
               <span class="tabBox_pice">
186
-                {{ '¥'+ val.cart_info.productAttr.price + ' x '+ val.product_num }}
207
+                {{ '¥' + val.cart_info.productAttr.price + ' x ' + val.product_num }}
187 208
                 <em
188
-                  v-if="val.refund_num < val.product_num && val.refund_num  > 0"
189
-                  style="color: red;font-style: normal;"
209
+                    v-if="val.refund_num < val.product_num && val.refund_num  > 0"
210
+                    style="color: red;font-style: normal;"
190 211
                 >(-{{ val.product_num - val.refund_num }})</em>
191 212
               </span>
192 213
             </div>
193 214
           </template>
194 215
         </el-table-column>
195
-        <el-table-column prop="pay_price" label="订单金额" min-width="100" />
216
+        <el-table-column prop="pay_price" label="订单金额" min-width="100"/>
196 217
         <!-- <el-table-column label="支付类型" min-width="80">
197 218
           <template slot-scope="scope">
198 219
              <span v-if="scope.row.paid == 1">{{scope.row.pay_type == 0 ? "虚拟支付" :scope.row.pay_type == 1 ? "微信支付" : scope.row.pay_type == 2 ? '小程序支付' :scope.row.pay_type == 4 ? '支付宝支付' :scope.row.pay_type == 5 ? '积分' : '' }}</span>
@@ -203,10 +224,11 @@
203 224
           <template slot-scope="scope">
204 225
              <span v-if="scope.row.paid == 1">
205 226
               <div class="tabBox acea-row row-middle">
206
-                {{checkPayString(scope.row.fzone_paytype, scope.row.pay_type)}}
227
+                {{ checkPayString(scope.row.fzone_paytype, scope.row.pay_type) }}
207 228
               </div>
208 229
               <div class="tabBox acea-row row-middle">
209
-                {{scope.row.fzone_paytype.price}}  <span v-if="scope.row.fzone_paytype.other">+{{scope.row.fzone_paytype.other}}</span>
230
+                {{ scope.row.fzone_paytype.price }}  <span
231
+                  v-if="scope.row.fzone_paytype.other">+{{ scope.row.fzone_paytype.other }}</span>
210 232
               </div>
211 233
              </span>
212 234
             <span v-else>--</span>
@@ -220,7 +242,9 @@
220 242
         <el-table-column label="订单状态" min-width="100">
221 243
           <template slot-scope="scope">
222 244
             <span v-if="scope.row.is_del == 0">
223
-              <span >{{ scope.row.status == 5? '待付款' : scope.row.status ==0? '待发货':scope.row.status==1? '待收货' : scope.row.status == 2 ? '待评价' : scope.row.status ==3 ? '已完成' : scope.row.status == 4 ? '已申请退款' : scope.row.status== -1 ? '已退款' : scope.row.status == 6 ? '已取消' :''  }}</span>
245
+              <span>{{
246
+                  scope.row.status == 5 ? '待付款' : scope.row.status == 0 ? '待发货' : scope.row.status == 1 ? '待收货' : scope.row.status == 2 ? '待评价' : scope.row.status == 3 ? '已完成' : scope.row.status == 4 ? '已申请退款' : scope.row.status == -1 ? '已退款' : scope.row.status == 6 ? '已取消' : ''
247
+                }}</span>
224 248
 
225 249
             </span>
226 250
             <span v-else>已删除</span>
@@ -235,10 +259,10 @@
235 259
           <template slot-scope="scope">
236 260
             <span v-for="(val, i ) in scope.row.orderProduct" :key="i">
237 261
               <el-button
238
-                v-if="orderFilter(scope.row)"
239
-                type="text"
240
-                size="small"
241
-                @click="onRefundDetail(scope.row.order_sn)"
262
+                  v-if="orderFilter(scope.row)"
263
+                  type="text"
264
+                  size="small"
265
+                  @click="onRefundDetail(scope.row.order_sn)"
242 266
               >查看退款单</el-button>
243 267
             </span>
244 268
             <el-button type="text" size="small" @click="onOrderDetails(scope.row.order_id)">详情</el-button>
@@ -247,29 +271,30 @@
247 271
       </el-table>
248 272
       <div class="block">
249 273
         <el-pagination
250
-          :page-sizes="[20, 40, 60, 80]"
251
-          :page-size="tableFrom.limit"
252
-          :current-page="tableFrom.page"
253
-          layout="total, sizes, prev, pager, next, jumper"
254
-          :total="tableData.total"
255
-          @size-change="handleSizeChange"
256
-          @current-change="pageChange"
274
+            :page-sizes="[20, 40, 60, 80]"
275
+            :page-size="tableFrom.limit"
276
+            :current-page="tableFrom.page"
277
+            layout="total, sizes, prev, pager, next, jumper"
278
+            :total="tableData.total"
279
+            @size-change="handleSizeChange"
280
+            @current-change="pageChange"
257 281
         />
258 282
       </div>
259 283
     </el-card>
260 284
     <!--详情-->
261
-    <details-from ref="orderDetail" />
285
+    <details-from ref="orderDetail"/>
262 286
   </div>
263 287
 </template>
264 288
 
265 289
 <script>
266
-import { orderListApi, chartApi } from "@/api/order";
267
-import { merSelectApi } from "@/api/product";
290
+import {orderListApi, chartApi} from "@/api/order";
291
+import {merSelectApi} from "@/api/product";
268 292
 import detailsFrom from "./orderDetail";
269 293
 // import cardsData from "@/components/cards/index";
270 294
 // import otherCardsData from "@/components/cards/other";
271 295
 import redCardsData from "@/components/cards/redPoint";
272
-import { fromList } from "@/libs/constants.js";
296
+import {fromList} from "@/libs/constants.js";
297
+
273 298
 export default {
274 299
   components: {
275 300
     redCardsData,
@@ -293,6 +318,7 @@ export default {
293 318
         date: "",
294 319
         mer_id: "",
295 320
         pay_type: "",
321
+        paid: "",
296 322
         order_ids: "",
297 323
         page: 1,
298 324
         limit: 20,
@@ -320,13 +346,13 @@ export default {
320 346
   mounted() {
321 347
     if (this.$route.query.hasOwnProperty("order_sn")) {
322 348
       // this.tableFrom.order_sn = this.$route.query.order_sn;
323
-      this.tableFrom.keywords=this.$route.query.order_sn;
349
+      this.tableFrom.keywords = this.$route.query.order_sn;
324 350
     } else {
325 351
       this.tableFrom.order_sn = "";
326 352
     }
327 353
     this.headerList();
328 354
     this.getMerSelect();
329
-    if(this.$route.query.hasOwnProperty("order_ids")){
355
+    if (this.$route.query.hasOwnProperty("order_ids")) {
330 356
       this.tableFrom.order_ids = this.$route.query.order_ids;
331 357
     } else {
332 358
       this.tableFrom.order_ids = "";
@@ -359,11 +385,11 @@ export default {
359 385
       const characterToCheck = '现金'; // 你想检查的字符
360 386
       if (fzone_paytype && fzone_paytype.note.includes(characterToCheck)) {
361 387
         return pay_type_name + "  " + fzone_paytype.note;
362
-      }else{
363
-        if (fzone_paytype && fzone_paytype.note){
364
-           return fzone_paytype.note
365
-        }else{
366
-           return ''
388
+      } else {
389
+        if (fzone_paytype && fzone_paytype.note) {
390
+          return fzone_paytype.note
391
+        } else {
392
+          return ''
367 393
         }
368 394
       }
369 395
     },
@@ -402,12 +428,12 @@ export default {
402 428
     // 商户列表;
403 429
     getMerSelect() {
404 430
       merSelectApi()
405
-        .then((res) => {
406
-          this.merSelect = res.data;
407
-        })
408
-        .catch((res) => {
409
-          this.$message.error(res.message);
410
-        });
431
+          .then((res) => {
432
+            this.merSelect = res.data;
433
+          })
434
+          .catch((res) => {
435
+            this.$message.error(res.message);
436
+          });
411 437
     },
412 438
     // 详情
413 439
     onOrderDetails(id) {
@@ -442,16 +468,16 @@ export default {
442 468
       this.listLoading = true;
443 469
       this.tableFrom.page = num ? num : this.tableFrom.page;
444 470
       orderListApi(this.tableFrom)
445
-        .then((res) => {
446
-          this.tableData.data = res.data.list;
447
-          this.tableData.total = res.data.count;
448
-          this.cardLists = res.data.stat;
449
-          this.listLoading = false;
450
-        })
451
-        .catch((res) => {
452
-          this.$message.error(res.message);
453
-          this.listLoading = false;
454
-        });
471
+          .then((res) => {
472
+            this.tableData.data = res.data.list;
473
+            this.tableData.total = res.data.count;
474
+            this.cardLists = res.data.stat;
475
+            this.listLoading = false;
476
+          })
477
+          .catch((res) => {
478
+            this.$message.error(res.message);
479
+            this.listLoading = false;
480
+          });
455 481
       this.headerList();
456 482
     },
457 483
     pageChange(page) {
@@ -464,12 +490,12 @@ export default {
464 490
     },
465 491
     headerList() {
466 492
       chartApi(this.tableFrom)
467
-        .then((res) => {
468
-          this.orderChartType = res.data;
469
-        })
470
-        .catch((res) => {
471
-          this.$message.error(res.message);
472
-        });
493
+          .then((res) => {
494
+            this.orderChartType = res.data;
495
+          })
496
+          .catch((res) => {
497
+            this.$message.error(res.message);
498
+          });
473 499
     },
474 500
   },
475 501
 };
@@ -477,21 +503,25 @@ export default {
477 503
 
478 504
 <style lang="scss" scoped>
479 505
 .demo-table-expand {
480
-  ::v-deep  label {
506
+  ::v-deep label {
481 507
     width: 83px !important;
482 508
   }
483 509
 }
510
+
484 511
 .selWidth {
485 512
   width: 300px;
486 513
 }
514
+
487 515
 .el-dropdown-link {
488 516
   cursor: pointer;
489 517
   color: #409eff;
490 518
   font-size: 12px;
491 519
 }
520
+
492 521
 .el-icon-arrow-down {
493 522
   font-size: 12px;
494 523
 }
524
+
495 525
 .tabBox_tit {
496 526
   width: 60%;
497 527
   font-size: 12px !important;