zhaoxiaoqiang
2023-09-05 f867c1a87123e0dae74ec36591433082df094b75
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
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
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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<template>
    <div class="main_index">
      <div class="search_from">
        <el-form
          :model="formInline"
          inline
          label-width="100px"
          class="form-flex"
          size="small"
        >
          <div style="width: 90%">
            <el-form-item label="订单编号:">
              <el-input
                v-model.trim="formInline.orderId"
                style="width: 240px"
                @keyup.native="keyupEvent($event)"
                type="tel"
                clearable
                placeholder="请输入"
              ></el-input>
            </el-form-item>
            <el-form-item label="电话号码:">
              <el-input
                v-model.trim="formInline.mblNo"
                style="width: 240px"
                @keyup.native="keyupEvent($event)"
                type="tel"
                clearable
                placeholder="请输入"
              ></el-input>
            </el-form-item>
           
            <el-form-item label="签约时间:">
              <el-date-picker
                v-model="createdTime"
                style="width: 240px"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                type="daterange"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item label="推广位:">
                <el-select
                    v-model="formInline.promId"
                    style="width:240px"
                    clearable
                    placeholder="请选择"
                  >
                    <el-option label="全部" value="all"></el-option>
                    <el-option
                      v-for="item in relustObj.promoteList"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
            </el-form-item>
            <el-form-item label="订单状态:">
                  <el-select
                    v-model="formInline.orderStatus"
                    style="width:240px"
                    clearable
                    placeholder="请选择"
                  >
                    <el-option label="全部" value="all"></el-option>
                    <el-option
                      v-for="item in relustObj.orderStatusList"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
            </el-form-item>
            <el-form-item label="代理名称:">
                  <el-select
                    v-model="formInline.agencyName"
                    style="width:240px"
                    clearable
                    placeholder="请选择"
                  >
                    <el-option label="全部" value="all"></el-option>
                    <el-option
                      v-for="item in relustObj.agencyList"
                      :key="item.code"
                      :label="item.name"
                      :value="item.code"
                    ></el-option>
                  </el-select>
            </el-form-item>
          </div>
          <el-form-item style="text-align: right;">
 
            <el-button type="primary" style="margin-left: 10px;margin-bottom: 8px;" @click="onSearch">查 询</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="table_box">
        <div  style="margin-left: 10px;text-align: right;">
          <el-button type="primary" size="small" @click="addProduct">导出excel</el-button>
        </div>
        <Etable
          hasIndex
          hasSelection
          rowKey="orderId"
          httpUrl="orderList"
          :columns="columns"
          :searchData="searchData"
          @getDataList="getDataList"
          @handleSelectionChange="handleSelectionChange"
          :exportUrl="{
            url: '/qyp/order/orderExport',
            powerId: '',
            name: '订单列表',
          }"
        ></Etable>
      </div>
      <el-dialog top="2vh"  :title="title" :visible.sync="addProd" width="60%">
        <el-descriptions>
            <el-descriptions-item label="订单编号">{{ orderDetail.orderId }}</el-descriptions-item>
            <el-descriptions-item label="订单创建时间">{{ orderDetail.creTime }}</el-descriptions-item>
            <el-descriptions-item label="订单状态">{{ orderDetail.orderStatusStr }}</el-descriptions-item>
            <el-descriptions-item label="电话号码">{{ orderDetail.mblNo }}</el-descriptions-item>
            <el-descriptions-item label="代理名称">{{ orderDetail.agencyName }}</el-descriptions-item>
            <el-descriptions-item label="推广位名称">{{ orderDetail.promName }}</el-descriptions-item>
            <el-descriptions-item label="签约时间">{{ orderDetail.signTime }}</el-descriptions-item>
            <el-descriptions-item label="解约时间">{{ orderDetail.terminateTime }}</el-descriptions-item>
            <el-descriptions-item label="项目名称">{{ orderDetail.projName }}</el-descriptions-item>
        </el-descriptions>
      </el-dialog>
      <el-dialog top="2vh"  :title="subTitle" fullscreen :visible.sync="productShow" width="60%">
          <history v-if="isWhith==1"></history>
          <plan  v-else-if="isWhith==2"></plan>
          <draw  v-else-if="isWhith==3"></draw>
      </el-dialog>
    </div>
  </template>
  <script>
  import Etable from "@/components/table.vue";
  import history from './history.vue';
  import plan from './plan.vue';
  import draw from './draw.vue';
  import {orderInit,orderDtl,orderExport} from "@/api/order";
  import uploadImg from "@/components/upload.vue";
  import downloadUrl from "@/utils/excelDownLoadConfig";
  export default {
    name: "order",
    components: { Etable,uploadImg,history,plan,draw },
    data() {
      return {
          formInline: {promId:"all",orderStatus:"all",agencyName:'all'},
          searchData: {},
          columns: [
            {
              lable: "订单编号",
              prop: "orderId",
              align: "center",
              width: "300",
            },
            {
              lable: "签约时间",
              prop: "signTime",
              align: "center",
              width: "180",
            },
            {
              lable: "订单状态",
              prop: "orderStatusStr",
              align: "center"
            },
            {
              lable: "电话号码",
              prop: "mblNo",
              align: "center",
              width: "150",
            },
            {
              lable: "代理名称",
              prop: "agencyName",
              align: "center",
              width: "180",
            },
            {
              lable: "推广位名称",
              prop: "promName",
              align: "center",
              width: "180"
            },
            {
              lable: "支付金额",
              prop: "payAmt",
              align: "center",
              width: "180"
            },
            {
              lable: "支付方式",
              prop: "payType",
              align: "center",
              width: "180"
            },
            {
              lable: "是否使用优惠券",
              prop: "useCoup",
              align: "center",
              width: "180"
            },
            {
              lable: "",
            },
            {
              lable: "操作",
              align: "center",
              width: "300",
              fixed: "right",
              render: (h, scope) => {
                return h("div", [
                  h(
                    "el-button",
                    {
                      props:{
                        type:'text'
                      },
                      style: {
                        // display: this.filterBtnById(150101)
                        //   ? "inline-block"
                        //   : "none",
                      },
                      on: {
                        click: () => {
                          this.title = '订单详情'; 
                          let {orderId} = scope.row;
                          this.getProductDetail(orderId);
                        },
                      },
                    },
                    "查看详情"
                  ),
                  h(
                    "el-button",
                    {
                      props:{
                        type:'text'
                      },
                      style: {
                        // display: this.filterBtnById(150101)
                        //   ? "inline-block"
                        //   : "none",
                      },
                      on: {
                        click: () => {
 
                          this.isWhith = 1;
                          this.productShow  = true;
                          // this.title = '订单详情'; 
                          // let {orderId} = scope.row;
                          // this.getProductDetail(orderId);
                        },
                      },
                    },
                    "支付历史"
                  ),
                  h(
                    "el-button",
                    {
                      props:{
                        type:'text'
                      },
                      style: {
                        // display: this.filterBtnById(150101)
                        //   ? "inline-block"
                        //   : "none",
                      },
                      on: {
                        click: () => {
                          this.isWhith = 2;
                          this.productShow  = true;
                          // this.title = '订单详情'; 
                          // let {orderId} = scope.row;
                          // this.getProductDetail(orderId);
                        },
                      },
                    },
                    "扣款计划"
                  ),
                  h(
                    "el-button",
                    {
                      props:{
                        type:'text'
                      },
                      style: {
                        // display: this.filterBtnById(150101)
                        //   ? "inline-block"
                        //   : "none",
                      },
                      on: {
                        click: () => {
                          this.isWhith = 3;
                          this.productShow  = true;
                          // this.title = '订单详情'; 
                          // let {orderId} = scope.row;
                          // this.getProductDetail(orderId);
                        },
                      },
                    },
                    "权益领取"
                  )
                ]);
              },
            },
          ],
          relustObj: {},
          addProd:false,
          productShow:false,
          createdTime:[],
          title:"新增项目",
          orderDetail:{},
          exportExcelList:[],
          isWhith:''
      }
    },
    computed:{
      subTitle(){
        let text ='支付历史';
        if(this.isWhith==2){
          text = '扣款计划'
        }else if(this.isWhith==3){
          text = '权益领取'
        }
        return text;
      }
    },
    watch:{
      addProd:{
        handler: function(val) {
          if(!val){
          }
        },
        deep: true
      },
      productShow:{
        handler: function(val) {
          if(!val){
            this.isWhith ='';
          }
        },
        deep: true
      },
    },
    //生命周期 - 创建完成(可以访问当前this实例)
    created() {
      this.initSerch();
    },
    methods: {
      addProduct(){
        if(!this.exportExcelList.length){
          return this.$message.error("请选择订单后导出");
        }
        orderExport({orderIdList:this.exportExcelList.join(',')}).then((res) => {
          downloadUrl.configDate2(res, '管理员订单列表');
        });
      },
      keyupEvent(e) {
        //只能输入整数
        e.target.value = e.target.value.replace(/[^\d]/g, "");
      },
      onSearch() {
        if (this.createdTime && this.createdTime.length) {
          this.formInline.signStartTime = this.createdTime[0];
          this.formInline.signEndTime = this.createdTime[1];
        } else {
          this.formInline.signStartTime = null;
          this.formInline.signEndTime = null;
        }
        let objForm = JSON.parse(JSON.stringify(this.formInline));
        for (let key in objForm) {
          if (objForm[key] === "all") {
            delete objForm[key];
          }
        }
        this.searchData = { ...objForm };
      },
      initSerch() {
        orderInit().then(({ body }) => {
          this.relustObj = body;
        });
      },
      getDataList(e) {
      },
      handleSelectionChange(list){
        this.exportExcelList = list.map(d=>{
          return d.orderId
        });
      },
      getProductDetail(orderId){
        orderDtl({orderId:orderId}).then(({body})=>{
         this.orderDetail = body;
         this.addProd = true;
        })
      }
    }
  };
  </script>
  
  <style scoped lang="scss">
  .main_index {
    background-color: #f0f2f5;
    .table_box_num {
      margin-top: 5px;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      color: #666;
      font-size: 14px;
      font-weight: bold;
      padding-right: 16px;
      box-sizing: border-box;
      span {
        display: inline-block;
        &:nth-child(even) {
          margin-right: 20px;
          color: #333;
        }
      }
    }
    .el-form-div {
      width: 100%;
      display: flex;
    }
    .tips{
      color: #f56c6c;
    }
  }
  </style>