|
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+<template>
|
|
|
2
|
+ <div class="app-container">
|
|
|
3
|
+ <!-- 检索区 -->
|
|
|
4
|
+ <el-card shadow="never" class="search-card">
|
|
|
5
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
|
|
|
6
|
+ <el-form-item label="订单编号" prop="orderNo">
|
|
|
7
|
+ <el-input v-model="queryParams.orderNo" placeholder="订单编号" clearable style="width: 150px" @keyup.enter.native="handleQuery" />
|
|
|
8
|
+ </el-form-item>
|
|
|
9
|
+ <el-form-item label="商品名称" prop="goodsName">
|
|
|
10
|
+ <el-input v-model="queryParams.goodsName" placeholder="商品名称" clearable style="width: 140px" @keyup.enter.native="handleQuery" />
|
|
|
11
|
+ </el-form-item>
|
|
|
12
|
+ <el-form-item label="发货状态" prop="shipStatus">
|
|
|
13
|
+ <el-select v-model="queryParams.shipStatus" placeholder="全部" clearable style="width: 120px">
|
|
|
14
|
+ <el-option label="待支付" value="0" />
|
|
|
15
|
+ <el-option label="待发货" value="1" />
|
|
|
16
|
+ <el-option label="已发货" value="2" />
|
|
|
17
|
+ </el-select>
|
|
|
18
|
+ </el-form-item>
|
|
|
19
|
+ <el-form-item label="收货人" prop="consigneeName">
|
|
|
20
|
+ <el-input v-model="queryParams.consigneeName" placeholder="收货人" clearable style="width: 110px" />
|
|
|
21
|
+ </el-form-item>
|
|
|
22
|
+ <el-form-item label="收货手机" prop="consigneeMobile">
|
|
|
23
|
+ <el-input v-model="queryParams.consigneeMobile" placeholder="手机号" clearable style="width: 130px" />
|
|
|
24
|
+ </el-form-item>
|
|
|
25
|
+ <el-form-item label="收货地址" prop="consigneeAddress">
|
|
|
26
|
+ <el-input v-model="queryParams.consigneeAddress" placeholder="地址关键词" clearable style="width: 140px" />
|
|
|
27
|
+ </el-form-item>
|
|
|
28
|
+ <el-form-item label="配送方式" prop="deliveryType">
|
|
|
29
|
+ <el-select v-model="queryParams.deliveryType" placeholder="全部" clearable style="width: 120px">
|
|
|
30
|
+ <el-option label="物流配送" value="1" />
|
|
|
31
|
+ <el-option label="商家配送" value="2" />
|
|
|
32
|
+ </el-select>
|
|
|
33
|
+ </el-form-item>
|
|
|
34
|
+ <el-form-item label="下单时间">
|
|
|
35
|
+ <el-date-picker
|
|
|
36
|
+ v-model="dateRange"
|
|
|
37
|
+ type="daterange"
|
|
|
38
|
+ value-format="yyyy-MM-dd"
|
|
|
39
|
+ range-separator="至"
|
|
|
40
|
+ start-placeholder="开始日期"
|
|
|
41
|
+ end-placeholder="结束日期"
|
|
|
42
|
+ style="width: 240px"
|
|
|
43
|
+ />
|
|
|
44
|
+ </el-form-item>
|
|
|
45
|
+ <el-form-item>
|
|
|
46
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
47
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
48
|
+ </el-form-item>
|
|
|
49
|
+ </el-form>
|
|
|
50
|
+ </el-card>
|
|
|
51
|
+
|
|
|
52
|
+ <br/>
|
|
|
53
|
+
|
|
|
54
|
+ <!-- 列表区 -->
|
|
|
55
|
+ <el-card shadow="never" class="table-card">
|
|
|
56
|
+ <el-tabs v-model="statusTab" @tab-click="handleTabClick">
|
|
|
57
|
+ <el-tab-pane label="全部" name="all" />
|
|
|
58
|
+ <el-tab-pane label="待发货" name="1" />
|
|
|
59
|
+ <el-tab-pane label="已发货" name="2" />
|
|
|
60
|
+ <el-tab-pane label="已关闭" name="4" />
|
|
|
61
|
+ <el-tab-pane label="已完成" name="3" />
|
|
|
62
|
+ <el-tab-pane label="已删除" name="5" />
|
|
|
63
|
+ </el-tabs>
|
|
|
64
|
+
|
|
|
65
|
+ <el-row :gutter="10" class="mb8">
|
|
|
66
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
67
|
+ </el-row>
|
|
|
68
|
+
|
|
|
69
|
+ <el-table border v-loading="loading" :data="orderList">
|
|
|
70
|
+ <el-table-column label="订单信息" align="left" min-width="280">
|
|
|
71
|
+ <template slot-scope="scope">
|
|
|
72
|
+ <div class="order-info">
|
|
|
73
|
+ <div class="order-no">订单号:{{ scope.row.orderNo || '—' }}</div>
|
|
|
74
|
+ <div class="order-time">下单:{{ parseTime(scope.row.createTime) || '—' }}</div>
|
|
|
75
|
+ <div v-if="scope.row.items && scope.row.items.length" class="goods-info">
|
|
|
76
|
+ <image-preview v-if="scope.row.items[0].goodsImage" :src="scope.row.items[0].goodsImage" :width="44" :height="44" />
|
|
|
77
|
+ <div class="goods-text">
|
|
|
78
|
+ <div>{{ scope.row.items[0].goodsName || '—' }}</div>
|
|
|
79
|
+ <div class="sub-text">
|
|
|
80
|
+ {{ scope.row.items[0].goodsSpec || '默认' }}
|
|
|
81
|
+ × {{ scope.row.items[0].quantity }}
|
|
|
82
|
+ · ¥{{ scope.row.items[0].unitPrice != null ? scope.row.items[0].unitPrice : '—' }}
|
|
|
83
|
+ </div>
|
|
|
84
|
+ <div v-if="scope.row.itemCount > 1" class="more-tip">共 {{ scope.row.itemCount }} 件商品</div>
|
|
|
85
|
+ </div>
|
|
|
86
|
+ </div>
|
|
|
87
|
+ </div>
|
|
|
88
|
+ </template>
|
|
|
89
|
+ </el-table-column>
|
|
|
90
|
+ <el-table-column label="订单金额" align="center" width="110">
|
|
|
91
|
+ <template slot-scope="scope">
|
|
|
92
|
+ <div>¥{{ scope.row.payAmount != null ? scope.row.payAmount : '—' }}</div>
|
|
|
93
|
+ <div v-if="Number(scope.row.freightAmount) > 0" class="sub-text">含运费 ¥{{ scope.row.freightAmount }}</div>
|
|
|
94
|
+ </template>
|
|
|
95
|
+ </el-table-column>
|
|
|
96
|
+ <el-table-column label="会员名称" align="center" prop="memberNickName" width="100" :show-overflow-tooltip="true">
|
|
|
97
|
+ <template slot-scope="scope">
|
|
|
98
|
+ <span>{{ scope.row.memberNickName || '—' }}</span>
|
|
|
99
|
+ </template>
|
|
|
100
|
+ </el-table-column>
|
|
|
101
|
+ <el-table-column label="收货人信息" align="left" min-width="160">
|
|
|
102
|
+ <template slot-scope="scope">
|
|
|
103
|
+ <div>{{ scope.row.consigneeName || '—' }}</div>
|
|
|
104
|
+ <div class="sub-text">{{ scope.row.consigneeMobile || '—' }}</div>
|
|
|
105
|
+ <div class="sub-text addr-text">{{ scope.row.consigneeAddress || '—' }}</div>
|
|
|
106
|
+ </template>
|
|
|
107
|
+ </el-table-column>
|
|
|
108
|
+ <el-table-column label="配送方式" align="center" width="100">
|
|
|
109
|
+ <template slot-scope="scope">
|
|
|
110
|
+ <span>{{ scope.row.deliveryTypeLabel || '—' }}</span>
|
|
|
111
|
+ </template>
|
|
|
112
|
+ </el-table-column>
|
|
|
113
|
+ <el-table-column label="订单状态" align="center" width="90">
|
|
|
114
|
+ <template slot-scope="scope">
|
|
|
115
|
+ <el-tag size="small" :type="orderStatusTag(scope.row.orderStatus)">
|
|
|
116
|
+ {{ scope.row.orderStatusLabel || orderStatusLabel(scope.row.orderStatus) }}
|
|
|
117
|
+ </el-tag>
|
|
|
118
|
+ </template>
|
|
|
119
|
+ </el-table-column>
|
|
|
120
|
+ <el-table-column label="操作" align="center" width="220" fixed="right">
|
|
|
121
|
+ <template slot-scope="scope">
|
|
|
122
|
+ <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)" v-hasPermi="['agri:seller:order:query']">详情</el-button>
|
|
|
123
|
+ <el-button
|
|
|
124
|
+ v-if="canShip(scope.row)"
|
|
|
125
|
+ size="mini"
|
|
|
126
|
+ type="text"
|
|
|
127
|
+ icon="el-icon-truck"
|
|
|
128
|
+ @click="handleShip(scope.row)"
|
|
|
129
|
+ v-hasPermi="['agri:seller:order:ship']"
|
|
|
130
|
+ >去发货</el-button>
|
|
|
131
|
+ <el-button
|
|
|
132
|
+ v-if="canLogistics(scope.row)"
|
|
|
133
|
+ size="mini"
|
|
|
134
|
+ type="text"
|
|
|
135
|
+ icon="el-icon-position"
|
|
|
136
|
+ @click="handleLogistics(scope.row)"
|
|
|
137
|
+ v-hasPermi="['agri:seller:order:ship']"
|
|
|
138
|
+ >更新物流</el-button>
|
|
|
139
|
+ <el-button
|
|
|
140
|
+ v-if="canDelivered(scope.row)"
|
|
|
141
|
+ size="mini"
|
|
|
142
|
+ type="text"
|
|
|
143
|
+ icon="el-icon-circle-check"
|
|
|
144
|
+ @click="handleDelivered(scope.row)"
|
|
|
145
|
+ v-hasPermi="['agri:seller:order:ship']"
|
|
|
146
|
+ >商品到货</el-button>
|
|
|
147
|
+ <el-button
|
|
|
148
|
+ v-if="canDelete(scope.row)"
|
|
|
149
|
+ size="mini"
|
|
|
150
|
+ type="text"
|
|
|
151
|
+ icon="el-icon-delete"
|
|
|
152
|
+ @click="handleDelete(scope.row)"
|
|
|
153
|
+ v-hasPermi="['agri:seller:order:remove']"
|
|
|
154
|
+ >删除</el-button>
|
|
|
155
|
+ </template>
|
|
|
156
|
+ </el-table-column>
|
|
|
157
|
+ </el-table>
|
|
|
158
|
+
|
|
|
159
|
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
|
160
|
+ </el-card>
|
|
|
161
|
+
|
|
|
162
|
+ <!-- 详情抽屉 -->
|
|
|
163
|
+ <seller-order-detail
|
|
|
164
|
+ ref="orderDetail"
|
|
|
165
|
+ :visible.sync="detailOpen"
|
|
|
166
|
+ :order-id="currentOrderId"
|
|
|
167
|
+ @ship="handleShipFromDetail"
|
|
|
168
|
+ @logistics="handleLogisticsFromDetail"
|
|
|
169
|
+ @delivered="handleDeliveredFromDetail"
|
|
|
170
|
+ @delete="handleDeleteFromDetail"
|
|
|
171
|
+ />
|
|
|
172
|
+
|
|
|
173
|
+ <!-- 发货弹窗 -->
|
|
|
174
|
+ <el-dialog title="去发货" :visible.sync="shipOpen" width="680px" append-to-body @close="cancelShip">
|
|
|
175
|
+ <el-form ref="shipFormRef" :model="shipForm" :rules="shipRules" label-width="110px">
|
|
|
176
|
+ <el-form-item label="发货时间" prop="shipTime">
|
|
|
177
|
+ <el-date-picker
|
|
|
178
|
+ v-model="shipForm.shipTime"
|
|
|
179
|
+ type="datetime"
|
|
|
180
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
181
|
+ placeholder="选择发货时间"
|
|
|
182
|
+ style="width: 100%"
|
|
|
183
|
+ />
|
|
|
184
|
+ </el-form-item>
|
|
|
185
|
+ <el-form-item label="配送方式" prop="deliveryType">
|
|
|
186
|
+ <el-radio-group v-model="shipForm.deliveryType">
|
|
|
187
|
+ <el-radio label="1">物流配送</el-radio>
|
|
|
188
|
+ <el-radio label="2">商家配送</el-radio>
|
|
|
189
|
+ </el-radio-group>
|
|
|
190
|
+ </el-form-item>
|
|
|
191
|
+ <template v-if="shipForm.deliveryType === '1'">
|
|
|
192
|
+ <el-form-item label="物流公司" prop="logisticsCompany">
|
|
|
193
|
+ <el-input v-model="shipForm.logisticsCompany" placeholder="请输入物流公司" maxlength="64" />
|
|
|
194
|
+ </el-form-item>
|
|
|
195
|
+ <el-form-item label="快递单号" prop="trackingNo">
|
|
|
196
|
+ <el-input v-model="shipForm.trackingNo" placeholder="请输入快递单号" maxlength="64" />
|
|
|
197
|
+ </el-form-item>
|
|
|
198
|
+ </template>
|
|
|
199
|
+ <template v-if="shipForm.deliveryType === '2'">
|
|
|
200
|
+ <el-form-item label="车辆号码" prop="vehicleNo">
|
|
|
201
|
+ <el-input v-model="shipForm.vehicleNo" placeholder="请输入车辆号码" maxlength="32" />
|
|
|
202
|
+ </el-form-item>
|
|
|
203
|
+ <el-form-item label="配送员" prop="courierName">
|
|
|
204
|
+ <el-input v-model="shipForm.courierName" placeholder="请输入配送员姓名" maxlength="32" />
|
|
|
205
|
+ </el-form-item>
|
|
|
206
|
+ <el-form-item label="配送员手机" prop="courierMobile">
|
|
|
207
|
+ <el-input v-model="shipForm.courierMobile" placeholder="请输入配送员手机号" maxlength="20" />
|
|
|
208
|
+ </el-form-item>
|
|
|
209
|
+ </template>
|
|
|
210
|
+ <el-form-item label="发货备注" prop="shipRemark">
|
|
|
211
|
+ <el-input v-model="shipForm.shipRemark" type="textarea" :rows="2" placeholder="选填" maxlength="200" show-word-limit />
|
|
|
212
|
+ </el-form-item>
|
|
|
213
|
+ <el-form-item label="发货商品">
|
|
|
214
|
+ <el-table border size="small" :data="shipItems">
|
|
|
215
|
+ <el-table-column label="商品" min-width="180">
|
|
|
216
|
+ <template slot-scope="scope">
|
|
|
217
|
+ <div class="goods-cell">
|
|
|
218
|
+ <image-preview v-if="scope.row.goodsImage" :src="scope.row.goodsImage" :width="40" :height="40" />
|
|
|
219
|
+ <span>{{ scope.row.goodsName || '—' }}</span>
|
|
|
220
|
+ </div>
|
|
|
221
|
+ </template>
|
|
|
222
|
+ </el-table-column>
|
|
|
223
|
+ <el-table-column label="规格" prop="goodsSpec" width="90">
|
|
|
224
|
+ <template slot-scope="scope">
|
|
|
225
|
+ <span>{{ scope.row.goodsSpec || '默认' }}</span>
|
|
|
226
|
+ </template>
|
|
|
227
|
+ </el-table-column>
|
|
|
228
|
+ <el-table-column label="数量" prop="quantity" width="70" align="center" />
|
|
|
229
|
+ </el-table>
|
|
|
230
|
+ <div class="form-tip">须整单一次发完,不可拆单</div>
|
|
|
231
|
+ </el-form-item>
|
|
|
232
|
+ </el-form>
|
|
|
233
|
+ <div slot="footer" class="dialog-footer">
|
|
|
234
|
+ <el-button type="primary" @click="submitShip">确 定</el-button>
|
|
|
235
|
+ <el-button @click="cancelShip">取 消</el-button>
|
|
|
236
|
+ </div>
|
|
|
237
|
+ </el-dialog>
|
|
|
238
|
+
|
|
|
239
|
+ <!-- 更新物流弹窗 -->
|
|
|
240
|
+ <el-dialog title="更新物流信息" :visible.sync="logisticsOpen" width="520px" append-to-body @close="cancelLogistics">
|
|
|
241
|
+ <el-form ref="logisticsFormRef" :model="logisticsForm" :rules="traceRules" label-width="110px">
|
|
|
242
|
+ <el-form-item label="运输更新时间" prop="traceTime">
|
|
|
243
|
+ <el-date-picker
|
|
|
244
|
+ v-model="logisticsForm.traceTime"
|
|
|
245
|
+ type="datetime"
|
|
|
246
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
247
|
+ placeholder="选择时间"
|
|
|
248
|
+ style="width: 100%"
|
|
|
249
|
+ />
|
|
|
250
|
+ </el-form-item>
|
|
|
251
|
+ <el-form-item label="运输状态描述" prop="content">
|
|
|
252
|
+ <el-input v-model="logisticsForm.content" type="textarea" :rows="3" placeholder="如:到达 XX 中转站" maxlength="500" show-word-limit />
|
|
|
253
|
+ </el-form-item>
|
|
|
254
|
+ </el-form>
|
|
|
255
|
+ <div slot="footer" class="dialog-footer">
|
|
|
256
|
+ <el-button type="primary" @click="submitLogistics">确 定</el-button>
|
|
|
257
|
+ <el-button @click="cancelLogistics">取 消</el-button>
|
|
|
258
|
+ </div>
|
|
|
259
|
+ </el-dialog>
|
|
|
260
|
+
|
|
|
261
|
+ <!-- 商品到货弹窗 -->
|
|
|
262
|
+ <el-dialog title="商品到货登记" :visible.sync="deliveredOpen" width="520px" append-to-body @close="cancelDelivered">
|
|
|
263
|
+ <el-form ref="deliveredFormRef" :model="deliveredForm" :rules="deliveredRules" label-width="100px">
|
|
|
264
|
+ <el-form-item label="送达时间" prop="traceTime">
|
|
|
265
|
+ <el-date-picker
|
|
|
266
|
+ v-model="deliveredForm.traceTime"
|
|
|
267
|
+ type="datetime"
|
|
|
268
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
269
|
+ placeholder="选择送达时间"
|
|
|
270
|
+ style="width: 100%"
|
|
|
271
|
+ />
|
|
|
272
|
+ </el-form-item>
|
|
|
273
|
+ <el-form-item label="送达说明" prop="content">
|
|
|
274
|
+ <el-input v-model="deliveredForm.content" type="textarea" :rows="3" placeholder="选填" maxlength="500" show-word-limit />
|
|
|
275
|
+ </el-form-item>
|
|
|
276
|
+ </el-form>
|
|
|
277
|
+ <div class="form-tip">登记送达不替代买家确认收货,订单仍为「已发货」直至买家确认</div>
|
|
|
278
|
+ <div slot="footer" class="dialog-footer">
|
|
|
279
|
+ <el-button type="primary" @click="submitDelivered">确 定</el-button>
|
|
|
280
|
+ <el-button @click="cancelDelivered">取 消</el-button>
|
|
|
281
|
+ </div>
|
|
|
282
|
+ </el-dialog>
|
|
|
283
|
+ </div>
|
|
|
284
|
+</template>
|
|
|
285
|
+
|
|
|
286
|
+<script>
|
|
|
287
|
+import {
|
|
|
288
|
+ listSellerOrder,
|
|
|
289
|
+ getSellerOrder,
|
|
|
290
|
+ shipSellerOrder,
|
|
|
291
|
+ logisticsSellerOrder,
|
|
|
292
|
+ deliveredSellerOrder,
|
|
|
293
|
+ delSellerOrder
|
|
|
294
|
+} from "@/api/agri/seller/order"
|
|
|
295
|
+import { getSellerContext } from "@/api/agri/seller/context"
|
|
|
296
|
+import { setSellerShopContext } from "@/utils/sellerShop"
|
|
|
297
|
+import SellerOrderDetail from "./detail"
|
|
|
298
|
+
|
|
|
299
|
+export default {
|
|
|
300
|
+ name: "AgriSellerOrder",
|
|
|
301
|
+ components: { SellerOrderDetail },
|
|
|
302
|
+ data() {
|
|
|
303
|
+ const validateLogisticsCompany = (rule, value, callback) => {
|
|
|
304
|
+ if (this.shipForm.deliveryType !== '1') {
|
|
|
305
|
+ callback()
|
|
|
306
|
+ return
|
|
|
307
|
+ }
|
|
|
308
|
+ if (!value || !String(value).trim()) {
|
|
|
309
|
+ callback(new Error("请输入物流公司"))
|
|
|
310
|
+ return
|
|
|
311
|
+ }
|
|
|
312
|
+ callback()
|
|
|
313
|
+ }
|
|
|
314
|
+ const validateTrackingNo = (rule, value, callback) => {
|
|
|
315
|
+ if (this.shipForm.deliveryType !== '1') {
|
|
|
316
|
+ callback()
|
|
|
317
|
+ return
|
|
|
318
|
+ }
|
|
|
319
|
+ if (!value || !String(value).trim()) {
|
|
|
320
|
+ callback(new Error("请输入快递单号"))
|
|
|
321
|
+ return
|
|
|
322
|
+ }
|
|
|
323
|
+ callback()
|
|
|
324
|
+ }
|
|
|
325
|
+ const validateVehicleNo = (rule, value, callback) => {
|
|
|
326
|
+ if (this.shipForm.deliveryType !== '2') {
|
|
|
327
|
+ callback()
|
|
|
328
|
+ return
|
|
|
329
|
+ }
|
|
|
330
|
+ if (!value || !String(value).trim()) {
|
|
|
331
|
+ callback(new Error("请输入车辆号码"))
|
|
|
332
|
+ return
|
|
|
333
|
+ }
|
|
|
334
|
+ callback()
|
|
|
335
|
+ }
|
|
|
336
|
+ const validateCourierName = (rule, value, callback) => {
|
|
|
337
|
+ if (this.shipForm.deliveryType !== '2') {
|
|
|
338
|
+ callback()
|
|
|
339
|
+ return
|
|
|
340
|
+ }
|
|
|
341
|
+ if (!value || !String(value).trim()) {
|
|
|
342
|
+ callback(new Error("请输入配送员姓名"))
|
|
|
343
|
+ return
|
|
|
344
|
+ }
|
|
|
345
|
+ callback()
|
|
|
346
|
+ }
|
|
|
347
|
+ const validateCourierMobile = (rule, value, callback) => {
|
|
|
348
|
+ if (this.shipForm.deliveryType !== '2') {
|
|
|
349
|
+ callback()
|
|
|
350
|
+ return
|
|
|
351
|
+ }
|
|
|
352
|
+ if (!value || !String(value).trim()) {
|
|
|
353
|
+ callback(new Error("请输入配送员手机号"))
|
|
|
354
|
+ return
|
|
|
355
|
+ }
|
|
|
356
|
+ if (!/^1[3-9]\d{9}$/.test(String(value).trim())) {
|
|
|
357
|
+ callback(new Error("请输入正确的手机号"))
|
|
|
358
|
+ return
|
|
|
359
|
+ }
|
|
|
360
|
+ callback()
|
|
|
361
|
+ }
|
|
|
362
|
+ return {
|
|
|
363
|
+ loading: false,
|
|
|
364
|
+ showSearch: true,
|
|
|
365
|
+ total: 0,
|
|
|
366
|
+ orderList: [],
|
|
|
367
|
+ statusTab: "all",
|
|
|
368
|
+ dateRange: [],
|
|
|
369
|
+ detailOpen: false,
|
|
|
370
|
+ currentOrderId: null,
|
|
|
371
|
+ shipOpen: false,
|
|
|
372
|
+ shipItems: [],
|
|
|
373
|
+ shipForm: {},
|
|
|
374
|
+ logisticsOpen: false,
|
|
|
375
|
+ logisticsForm: {},
|
|
|
376
|
+ deliveredOpen: false,
|
|
|
377
|
+ deliveredForm: {},
|
|
|
378
|
+ queryParams: {
|
|
|
379
|
+ pageNum: 1,
|
|
|
380
|
+ pageSize: 10,
|
|
|
381
|
+ orderStatus: undefined,
|
|
|
382
|
+ orderNo: undefined,
|
|
|
383
|
+ goodsName: undefined,
|
|
|
384
|
+ shipStatus: undefined,
|
|
|
385
|
+ consigneeName: undefined,
|
|
|
386
|
+ consigneeMobile: undefined,
|
|
|
387
|
+ consigneeAddress: undefined,
|
|
|
388
|
+ deliveryType: undefined
|
|
|
389
|
+ },
|
|
|
390
|
+ shipRules: {
|
|
|
391
|
+ shipTime: [{ required: true, message: "请选择发货时间", trigger: "change" }],
|
|
|
392
|
+ deliveryType: [{ required: true, message: "请选择配送方式", trigger: "change" }],
|
|
|
393
|
+ logisticsCompany: [{ validator: validateLogisticsCompany, trigger: "blur" }],
|
|
|
394
|
+ trackingNo: [{ validator: validateTrackingNo, trigger: "blur" }],
|
|
|
395
|
+ vehicleNo: [{ validator: validateVehicleNo, trigger: "blur" }],
|
|
|
396
|
+ courierName: [{ validator: validateCourierName, trigger: "blur" }],
|
|
|
397
|
+ courierMobile: [{ validator: validateCourierMobile, trigger: "blur" }]
|
|
|
398
|
+ },
|
|
|
399
|
+ traceRules: {
|
|
|
400
|
+ traceTime: [{ required: true, message: "请选择运输更新时间", trigger: "change" }],
|
|
|
401
|
+ content: [{ required: true, message: "请填写运输状态描述", trigger: "blur" }]
|
|
|
402
|
+ },
|
|
|
403
|
+ deliveredRules: {
|
|
|
404
|
+ traceTime: [{ required: true, message: "请选择送达时间", trigger: "change" }]
|
|
|
405
|
+ }
|
|
|
406
|
+ }
|
|
|
407
|
+ },
|
|
|
408
|
+ created() {
|
|
|
409
|
+ this.applyRouteTab()
|
|
|
410
|
+ this.initPage()
|
|
|
411
|
+ },
|
|
|
412
|
+ methods: {
|
|
|
413
|
+ applyRouteTab() {
|
|
|
414
|
+ const tab = this.$route.query.orderStatus
|
|
|
415
|
+ if (tab === undefined || tab === null || tab === '') {
|
|
|
416
|
+ return
|
|
|
417
|
+ }
|
|
|
418
|
+ const allowed = ['all', '1', '2', '3', '4', '5']
|
|
|
419
|
+ if (allowed.includes(String(tab))) {
|
|
|
420
|
+ this.statusTab = String(tab) === 'all' ? 'all' : String(tab)
|
|
|
421
|
+ this.syncTabToQuery()
|
|
|
422
|
+ }
|
|
|
423
|
+ },
|
|
|
424
|
+ syncTabToQuery() {
|
|
|
425
|
+ this.queryParams.orderStatus = this.statusTab === 'all' ? undefined : this.statusTab
|
|
|
426
|
+ },
|
|
|
427
|
+ initPage() {
|
|
|
428
|
+ this.syncTabToQuery()
|
|
|
429
|
+ this.loadShopContext().then(() => {
|
|
|
430
|
+ this.getList()
|
|
|
431
|
+ }).catch(() => {
|
|
|
432
|
+ this.getList()
|
|
|
433
|
+ })
|
|
|
434
|
+ },
|
|
|
435
|
+ loadShopContext() {
|
|
|
436
|
+ return getSellerContext().then(response => {
|
|
|
437
|
+ const data = response.data || {}
|
|
|
438
|
+ if (data.shopId != null) {
|
|
|
439
|
+ setSellerShopContext(data.shopId, data.shopName)
|
|
|
440
|
+ }
|
|
|
441
|
+ })
|
|
|
442
|
+ },
|
|
|
443
|
+ getList() {
|
|
|
444
|
+ this.loading = true
|
|
|
445
|
+ listSellerOrder(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
446
|
+ this.orderList = response.rows || []
|
|
|
447
|
+ this.total = response.total || 0
|
|
|
448
|
+ this.loading = false
|
|
|
449
|
+ }).catch(() => {
|
|
|
450
|
+ this.loading = false
|
|
|
451
|
+ })
|
|
|
452
|
+ },
|
|
|
453
|
+ handleTabClick() {
|
|
|
454
|
+ this.syncTabToQuery()
|
|
|
455
|
+ this.queryParams.pageNum = 1
|
|
|
456
|
+ this.getList()
|
|
|
457
|
+ },
|
|
|
458
|
+ handleQuery() {
|
|
|
459
|
+ this.queryParams.pageNum = 1
|
|
|
460
|
+ this.getList()
|
|
|
461
|
+ },
|
|
|
462
|
+ resetQuery() {
|
|
|
463
|
+ this.dateRange = []
|
|
|
464
|
+ this.resetForm("queryForm")
|
|
|
465
|
+ this.syncTabToQuery()
|
|
|
466
|
+ this.queryParams.pageNum = 1
|
|
|
467
|
+ this.getList()
|
|
|
468
|
+ },
|
|
|
469
|
+ handleDetail(row) {
|
|
|
470
|
+ this.currentOrderId = row.orderId
|
|
|
471
|
+ this.detailOpen = true
|
|
|
472
|
+ },
|
|
|
473
|
+ orderStatusLabel(status) {
|
|
|
474
|
+ const map = { "0": "待支付", "1": "待发货", "2": "已发货", "3": "已完成", "4": "已关闭", "5": "已删除" }
|
|
|
475
|
+ return map[status] || "—"
|
|
|
476
|
+ },
|
|
|
477
|
+ orderStatusTag(status) {
|
|
|
478
|
+ const map = { "0": "warning", "1": "primary", "2": "", "3": "success", "4": "info", "5": "info" }
|
|
|
479
|
+ return map[status] || "info"
|
|
|
480
|
+ },
|
|
|
481
|
+ canShip(row) {
|
|
|
482
|
+ return row.orderStatus === '1'
|
|
|
483
|
+ },
|
|
|
484
|
+ canLogistics(row) {
|
|
|
485
|
+ return row.orderStatus === '2'
|
|
|
486
|
+ },
|
|
|
487
|
+ canDelivered(row) {
|
|
|
488
|
+ return row.orderStatus === '2'
|
|
|
489
|
+ },
|
|
|
490
|
+ canDelete(row) {
|
|
|
491
|
+ return row.orderStatus === '4'
|
|
|
492
|
+ },
|
|
|
493
|
+ nowDateTime() {
|
|
|
494
|
+ return this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
|
|
495
|
+ },
|
|
|
496
|
+ prepareShipDialog(orderId) {
|
|
|
497
|
+ this.currentOrderId = orderId
|
|
|
498
|
+ return getSellerOrder(orderId).then(response => {
|
|
|
499
|
+ const data = response.data || {}
|
|
|
500
|
+ this.shipItems = data.items || []
|
|
|
501
|
+ this.resetShipForm()
|
|
|
502
|
+ this.shipOpen = true
|
|
|
503
|
+ })
|
|
|
504
|
+ },
|
|
|
505
|
+ handleShip(row) {
|
|
|
506
|
+ this.prepareShipDialog(row.orderId)
|
|
|
507
|
+ },
|
|
|
508
|
+ handleShipFromDetail(detail) {
|
|
|
509
|
+ this.prepareShipDialog(detail.orderId)
|
|
|
510
|
+ },
|
|
|
511
|
+ resetShipForm() {
|
|
|
512
|
+ this.shipForm = {
|
|
|
513
|
+ shipTime: this.nowDateTime(),
|
|
|
514
|
+ deliveryType: "1",
|
|
|
515
|
+ logisticsCompany: undefined,
|
|
|
516
|
+ trackingNo: undefined,
|
|
|
517
|
+ vehicleNo: undefined,
|
|
|
518
|
+ courierName: undefined,
|
|
|
519
|
+ courierMobile: undefined,
|
|
|
520
|
+ shipRemark: undefined
|
|
|
521
|
+ }
|
|
|
522
|
+ this.resetForm("shipFormRef")
|
|
|
523
|
+ },
|
|
|
524
|
+ cancelShip() {
|
|
|
525
|
+ this.shipOpen = false
|
|
|
526
|
+ this.resetShipForm()
|
|
|
527
|
+ },
|
|
|
528
|
+ submitShip() {
|
|
|
529
|
+ this.$refs["shipFormRef"].validate(valid => {
|
|
|
530
|
+ if (!valid) {
|
|
|
531
|
+ return
|
|
|
532
|
+ }
|
|
|
533
|
+ const payload = {
|
|
|
534
|
+ shipTime: this.shipForm.shipTime,
|
|
|
535
|
+ deliveryType: this.shipForm.deliveryType,
|
|
|
536
|
+ shipRemark: this.shipForm.shipRemark || undefined
|
|
|
537
|
+ }
|
|
|
538
|
+ if (this.shipForm.deliveryType === '1') {
|
|
|
539
|
+ payload.logisticsCompany = this.shipForm.logisticsCompany
|
|
|
540
|
+ payload.trackingNo = this.shipForm.trackingNo
|
|
|
541
|
+ } else {
|
|
|
542
|
+ payload.vehicleNo = this.shipForm.vehicleNo
|
|
|
543
|
+ payload.courierName = this.shipForm.courierName
|
|
|
544
|
+ payload.courierMobile = this.shipForm.courierMobile
|
|
|
545
|
+ }
|
|
|
546
|
+ shipSellerOrder(this.currentOrderId, payload).then(() => {
|
|
|
547
|
+ this.$modal.msgSuccess("发货成功")
|
|
|
548
|
+ this.shipOpen = false
|
|
|
549
|
+ this.getList()
|
|
|
550
|
+ if (this.detailOpen && this.$refs.orderDetail) {
|
|
|
551
|
+ this.$refs.orderDetail.reload()
|
|
|
552
|
+ }
|
|
|
553
|
+ })
|
|
|
554
|
+ })
|
|
|
555
|
+ },
|
|
|
556
|
+ openTraceDialog(type, orderId) {
|
|
|
557
|
+ this.currentOrderId = orderId
|
|
|
558
|
+ if (type === 'logistics') {
|
|
|
559
|
+ this.logisticsForm = {
|
|
|
560
|
+ traceTime: this.nowDateTime(),
|
|
|
561
|
+ content: undefined
|
|
|
562
|
+ }
|
|
|
563
|
+ this.resetForm("logisticsFormRef")
|
|
|
564
|
+ this.logisticsOpen = true
|
|
|
565
|
+ } else {
|
|
|
566
|
+ this.deliveredForm = {
|
|
|
567
|
+ traceTime: this.nowDateTime(),
|
|
|
568
|
+ content: undefined
|
|
|
569
|
+ }
|
|
|
570
|
+ this.resetForm("deliveredFormRef")
|
|
|
571
|
+ this.deliveredOpen = true
|
|
|
572
|
+ }
|
|
|
573
|
+ },
|
|
|
574
|
+ handleLogistics(row) {
|
|
|
575
|
+ this.openTraceDialog('logistics', row.orderId)
|
|
|
576
|
+ },
|
|
|
577
|
+ handleLogisticsFromDetail(detail) {
|
|
|
578
|
+ this.openTraceDialog('logistics', detail.orderId)
|
|
|
579
|
+ },
|
|
|
580
|
+ cancelLogistics() {
|
|
|
581
|
+ this.logisticsOpen = false
|
|
|
582
|
+ this.logisticsForm = {}
|
|
|
583
|
+ this.resetForm("logisticsFormRef")
|
|
|
584
|
+ },
|
|
|
585
|
+ submitLogistics() {
|
|
|
586
|
+ this.$refs["logisticsFormRef"].validate(valid => {
|
|
|
587
|
+ if (!valid) {
|
|
|
588
|
+ return
|
|
|
589
|
+ }
|
|
|
590
|
+ logisticsSellerOrder(this.currentOrderId, this.logisticsForm).then(() => {
|
|
|
591
|
+ this.$modal.msgSuccess("物流信息已更新")
|
|
|
592
|
+ this.logisticsOpen = false
|
|
|
593
|
+ this.getList()
|
|
|
594
|
+ if (this.detailOpen && this.$refs.orderDetail) {
|
|
|
595
|
+ this.$refs.orderDetail.reload()
|
|
|
596
|
+ }
|
|
|
597
|
+ })
|
|
|
598
|
+ })
|
|
|
599
|
+ },
|
|
|
600
|
+ handleDelivered(row) {
|
|
|
601
|
+ this.openTraceDialog('delivered', row.orderId)
|
|
|
602
|
+ },
|
|
|
603
|
+ handleDeliveredFromDetail(detail) {
|
|
|
604
|
+ this.openTraceDialog('delivered', detail.orderId)
|
|
|
605
|
+ },
|
|
|
606
|
+ cancelDelivered() {
|
|
|
607
|
+ this.deliveredOpen = false
|
|
|
608
|
+ this.deliveredForm = {}
|
|
|
609
|
+ this.resetForm("deliveredFormRef")
|
|
|
610
|
+ },
|
|
|
611
|
+ submitDelivered() {
|
|
|
612
|
+ this.$refs["deliveredFormRef"].validate(valid => {
|
|
|
613
|
+ if (!valid) {
|
|
|
614
|
+ return
|
|
|
615
|
+ }
|
|
|
616
|
+ deliveredSellerOrder(this.currentOrderId, this.deliveredForm).then(() => {
|
|
|
617
|
+ this.$modal.msgSuccess("送达登记成功")
|
|
|
618
|
+ this.deliveredOpen = false
|
|
|
619
|
+ this.getList()
|
|
|
620
|
+ if (this.detailOpen && this.$refs.orderDetail) {
|
|
|
621
|
+ this.$refs.orderDetail.reload()
|
|
|
622
|
+ }
|
|
|
623
|
+ })
|
|
|
624
|
+ })
|
|
|
625
|
+ },
|
|
|
626
|
+ handleDelete(row) {
|
|
|
627
|
+ this.confirmDelete(row.orderId)
|
|
|
628
|
+ },
|
|
|
629
|
+ handleDeleteFromDetail(detail) {
|
|
|
630
|
+ this.confirmDelete(detail.orderId)
|
|
|
631
|
+ },
|
|
|
632
|
+ confirmDelete(orderId) {
|
|
|
633
|
+ this.$modal.confirm('确认删除该已关闭订单?删除后将移至「已删除」页签,默认列表不再展示。').then(() => {
|
|
|
634
|
+ return delSellerOrder(orderId)
|
|
|
635
|
+ }).then(() => {
|
|
|
636
|
+ this.$modal.msgSuccess("删除成功")
|
|
|
637
|
+ this.getList()
|
|
|
638
|
+ if (this.detailOpen && this.currentOrderId === orderId) {
|
|
|
639
|
+ this.detailOpen = false
|
|
|
640
|
+ }
|
|
|
641
|
+ }).catch(() => {})
|
|
|
642
|
+ }
|
|
|
643
|
+ }
|
|
|
644
|
+}
|
|
|
645
|
+</script>
|
|
|
646
|
+
|
|
|
647
|
+<style scoped lang="scss">
|
|
|
648
|
+.order-info {
|
|
|
649
|
+ .order-no {
|
|
|
650
|
+ font-weight: 600;
|
|
|
651
|
+ margin-bottom: 4px;
|
|
|
652
|
+ }
|
|
|
653
|
+ .order-time {
|
|
|
654
|
+ color: #909399;
|
|
|
655
|
+ font-size: 12px;
|
|
|
656
|
+ margin-bottom: 8px;
|
|
|
657
|
+ }
|
|
|
658
|
+}
|
|
|
659
|
+.goods-info {
|
|
|
660
|
+ display: flex;
|
|
|
661
|
+ align-items: flex-start;
|
|
|
662
|
+ gap: 8px;
|
|
|
663
|
+}
|
|
|
664
|
+.goods-text {
|
|
|
665
|
+ flex: 1;
|
|
|
666
|
+ min-width: 0;
|
|
|
667
|
+}
|
|
|
668
|
+.goods-cell {
|
|
|
669
|
+ display: flex;
|
|
|
670
|
+ align-items: center;
|
|
|
671
|
+ gap: 8px;
|
|
|
672
|
+}
|
|
|
673
|
+.sub-text {
|
|
|
674
|
+ color: #909399;
|
|
|
675
|
+ font-size: 12px;
|
|
|
676
|
+ line-height: 1.4;
|
|
|
677
|
+}
|
|
|
678
|
+.more-tip {
|
|
|
679
|
+ color: #909399;
|
|
|
680
|
+ font-size: 12px;
|
|
|
681
|
+ margin-top: 2px;
|
|
|
682
|
+}
|
|
|
683
|
+.addr-text {
|
|
|
684
|
+ display: -webkit-box;
|
|
|
685
|
+ -webkit-line-clamp: 2;
|
|
|
686
|
+ -webkit-box-orient: vertical;
|
|
|
687
|
+ overflow: hidden;
|
|
|
688
|
+}
|
|
|
689
|
+.form-tip {
|
|
|
690
|
+ color: #909399;
|
|
|
691
|
+ font-size: 12px;
|
|
|
692
|
+ margin-top: 8px;
|
|
|
693
|
+ line-height: 1.5;
|
|
|
694
|
+}
|
|
|
695
|
+</style>
|