fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
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
<template>
  <div>
    <list-condition-template ref="table" :form="listQuery" :formLabel="formLabel"
                             :tableData="tableData" :total="total"
                             @page-info-change="handlePageInfoChange" :dataKey="'key'">
      <template slot="otherElement">
        <el-col :span="24" :offset="0" class="buttonPosition">
          <el-button size="mini" type="primary" @click="queryData">查询</el-button>
          <el-button size="mini" @click="resetQuery">重置</el-button>
        </el-col>
      </template>
      <template slot="operationSection">
        <el-button size="mini" type="success" @click="distributionAdd">配货</el-button>
      </template>
      <template slot="columns">
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-table border :data="props.row.orderItemsAll.omsOrderItems">
              <el-table-column type="index" align="center" label="序号" width="80px">
              </el-table-column>
              <el-table-column label="商品图片" align="center">
                <template slot-scope="scope">
                  <product-img :imgUrl="scope.row.imgUrl"></product-img>
                </template>
              </el-table-column>
              <el-table-column label="商品" prop="spuName">
                <template slot-scope="scope">
                  <span class="giftStyle" v-if="scope.row.promotionType === '2'">赠</span>
                  <span class="giftStyle"
                        v-if="scope.row.refundStatus && scope.row.refundStatus!== '00'">
                    退
                  </span>
                  <span>{{scope.row.spuName}}</span>
                </template>
              </el-table-column>
              <el-table-column label="商品规格">
                <template slot-scope="scope">
                  {{ JSON.parse(scope.row.skuProps).length ? JSON.parse(scope.row.skuProps).map(item=>item.propValueName).join('/') : '-'}}
                </template>
              </el-table-column>
              <el-table-column label="数量">
                <template slot-scope="scope">
                  {{scope.row.buyQuantity}} * {{JSON.parse(scope.row.expInfo).skuReduceStorage}}
                  ({{scope.row.spuUnit}})
                </template>
              </el-table-column>
              <el-table-column label="售后状态">
                <template slot-scope="scope">
                  {{ getRefundStatus(scope.row.refundStatus) }}
                </template>
              </el-table-column>
            </el-table>
          </template>
        </el-table-column>
        <el-table-column label="订单编号" prop="orderId" width="170px" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-link class="urlLink" @click="lookOrderInfo(scope.row)">{{ scope.row.orderId }}</el-link>
          </template>
        </el-table-column>
        <el-table-column label="收货人姓名" prop="marketShopInfo.linkMan"></el-table-column>
        <el-table-column label="收货人电话" prop="marketShopInfo.linkPhone"></el-table-column>
        <el-table-column label="关联经销商" prop="marketShopInfo.ecMarketMerchant.merchantName">
        </el-table-column>
        <el-table-column label="订单状态" prop="orderStatus">
          <template slot-scope="scope">
            {{getDistributionOrder(scope.row.orderStatus,scope.row.deliveryStatus)}}
          </template>
        </el-table-column>
        <el-table-column label="下单时间" prop="orderTime"></el-table-column>
        <el-table-column label="门店名称" prop="marketShopInfo.shopName" show-overflow-tooltip>
        </el-table-column>
        <el-table-column label="操作" :width="`${$store.getters.colSize+1}px`">
          <template slot-scope="scope">
            <wly-btn @click="lookInfo(scope.row)">详情</wly-btn>
          </template>
        </el-table-column>
      </template>
    </list-condition-template>
    <el-dialog :visible.sync="dialogVisible" title="订单详情" :close-on-click-modal="false"
               :modal-append-to-body="false" width="40%">
      <details-info></details-info>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogVisible=false">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import orderMgtApi from '@/api/orderMgt'
import detailsInfo from '@/views/orderMgt/info.vue'
import productImg from '@/views/product/components/productImg.vue'
export default {
  components: { detailsInfo, productImg },
  data () {
    return {
      listQuery: {
        orderId: null,
        status: null,
        contactName: null,
        contactPhone: null,
        deliveryStatus: null
      },
      formLabel: [
        {
          model: 'orderId',
          label: '订单编号',
          type: 'input'
          // rule: /[^\w]/g // 可输入数字字母
        },
        {
          model: 'status',
          label: '订单状态',
          type: 'select',
          opts: [
            {
              id: '0',
              name: '仓库待出库'
            },
            {
              id: '03',
              name: '仓库已出库'
            },
            {
              id: '04',
              name: '门店待入库'
            },
            {
              id: '05',
              name: '门店已入库'
            }
          ]
        },
        {
          model: 'contactName',
          label: '收货人姓名',
          type: 'input',
          labelWidth: '90px'
        },
        {
          model: 'contactPhone',
          label: '收货人电话',
          type: 'input',
          labelWidth: '90px'
        }
      ],
      tableData: [],
      show: false,
      title: null,
      row: {},
      dialogVisible: false,
      form: {},
      total: 0,
      rows: []
    }
  },
  /**
   * 数据变化后刷新列表
   */
  activated () {
    this.queryList(this.$refs.table.getPageInfo())
  },
  methods: {
    /**
     * 获取售后状态
     */
    getRefundStatus (status) {
      switch (status) {
        case '10':
          return '售后中'
        case '20':
          return '退款失败'
        case '30':
          return '退款成功'
        default:
          return '-'
      }
    },
    /**
       * '分页信息改变时查询列表
       */
    handlePageInfoChange (pageInfo) {
      this.queryList(pageInfo)
    },
    /**
     * 重置
     */
    resetQuery () {
      this.$refs.table.reloadCurrent()
    },
    /**
     * 点击查询按钮
     */
    queryData () {
      this.$refs.table.changeCondition()
    },
    /**
     * 跳转到配货订单
     */
    distributionAdd () {
      this.$router.push({
        name: 'distributionAdd'
      })
    },
    /**
         * 查看详情
         */
    lookInfo (row) {
      this.$router.push({
        name: 'distributionInfo',
        query: {
          orderId: row.orderId
        }
      })
    },
    /**
    * 查看订单详情
    */
    lookOrderInfo (row) {
      this.$router.push({
        name: 'orderMgtInfo',
        query: {
          orderId: row.orderId,
          promotionStatus: row.promotionStatus
        }
      })
    },
    /**
     *获取订单的状态,在列表中的展示
     */
    getDistributionOrder (orderStatus, deliveryStatus) {
      let str = null
      switch (orderStatus) {
        case '03':
          str = deliveryStatus === '0' || !deliveryStatus ? '仓库待出库' : '仓库已出库'
          break
        case '04':
          str = deliveryStatus === '1' ? '门店待入库' : null
          break
        case '05':
          str = '门店已入库'
          break
        default:
          break
      }
      return str
    },
    /**
     * 设置查询时的订单状态
     */
    setDistributionOrder () {
      switch (this.listQuery.status) {
        case '0':
          this.listQuery.deliveryStatus = '0'
          break
        case '03':
          this.listQuery.deliveryStatus = '1'
          break
        case '04':
          this.listQuery.deliveryStatus = '1'
          break
        case '05':
          this.listQuery.deliveryStatus = null
          break
        default:
          this.listQuery.deliveryStatus = null
          break
      }
      this.listQuery.orderStatus = this.listQuery.status === '0' ? '03' : this.listQuery.status
    },
    /**
         * 查询列表
         */
    queryList (pageInfo = { pageNum: 1, pageSize: 10 }) {
      this.listQuery.bizId = 'B02'
      this.listQuery.isMarketOrder = '1'
      this.setDistributionOrder()
      orderMgtApi.getList({ ...this.listQuery, ...pageInfo }).then((res) => {
        if (res.data) {
          this.setKey(res.data.list, pageInfo)
          this.tableData = res.data.list
          this.total = res.data.total
        }
      })
    },
    /**
     * 设置表格行唯一key
     */
    setKey (data, pageInfo) {
      if (data && data.length) {
        data.forEach((item, index) => {
          const curIndex = index + 1
          item.key = (pageInfo.pageNum - 1) * pageInfo.pageSize + curIndex
        })
      }
    }
  }
}
</script>
<style>
.hideSelectAll .cell .el-checkbox {
  display: none !important;
}
</style>