Skip to content

Commit 4c2eb3d

Browse files
YunaiVgitee-org
authored andcommitted
!262 核销
Merge pull request !262 from 疯狂的世界/dev
2 parents 7c491ff + 58b6b1b commit 4c2eb3d

File tree

4 files changed

+114
-23
lines changed

4 files changed

+114
-23
lines changed

src/api/mall/trade/order/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,8 @@ export const updateOrderPrice = async (data: any) => {
139139
export const updateOrderAddress = async (data: any) => {
140140
return await request.put({ url: `/trade/order/update-address`, data })
141141
}
142+
143+
// 订单核销
144+
export const pickUpOrder = async (id: number) => {
145+
return await request.put({ url: `/trade/order/pick-up?id=${id}` })
146+
}

src/utils/constants.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,3 +389,28 @@ export const DeliveryTypeEnum = {
389389
name: '到店自提'
390390
}
391391
}
392+
/**
393+
* 交易订单 - 状态
394+
*/
395+
export const TradeOrderStatusEnum = {
396+
UNPAID: {
397+
status: 0,
398+
name: '待支付'
399+
},
400+
UNDELIVERED: {
401+
status: 10,
402+
name: '待发货'
403+
},
404+
DELIVERED: {
405+
status: 20,
406+
name: '已发货'
407+
},
408+
COMPLETED: {
409+
status: 30,
410+
name: '已完成'
411+
},
412+
CANCELED: {
413+
status: 40,
414+
name: '已取消'
415+
}
416+
}

src/views/mall/trade/order/detail/index.vue

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,40 @@
2727
<dict-tag :type="DICT_TYPE.TRADE_ORDER_STATUS" :value="formData.status!" />
2828
</el-descriptions-item>
2929
<el-descriptions-item label-class-name="no-colon">
30-
<el-button v-if="formData.status! === 0" type="primary" @click="updatePrice">
31-
调整价格
32-
</el-button>
33-
<el-button type="primary" @click="remark">备注</el-button>
3430
<el-button
35-
v-if="formData.status! === 10 && formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
31+
v-if="formData.status! === TradeOrderStatusEnum.UNPAID.status"
3632
type="primary"
37-
@click="delivery"
33+
@click="updatePrice"
3834
>
39-
发货
40-
</el-button>
41-
<el-button
42-
v-if="formData.status! === 10 && formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
43-
type="primary"
44-
@click="updateAddress"
45-
>
46-
修改地址
35+
调整价格
4736
</el-button>
37+
<el-button type="primary" @click="remark">备注</el-button>
38+
<!-- 待发货 -->
39+
<template v-if="formData.status! === TradeOrderStatusEnum.UNDELIVERED.status">
40+
<!-- 快递发货 -->
41+
<el-button
42+
v-if="formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
43+
type="primary"
44+
@click="delivery"
45+
>
46+
发货
47+
</el-button>
48+
<el-button
49+
v-if="formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
50+
type="primary"
51+
@click="updateAddress"
52+
>
53+
修改地址
54+
</el-button>
55+
<!-- 到店自提 -->
56+
<el-button
57+
v-if="formData.deliveryType === DeliveryTypeEnum.PICK_UP.type"
58+
type="primary"
59+
@click="handlePickUp"
60+
>
61+
核销
62+
</el-button>
63+
</template>
4864
</el-descriptions-item>
4965
<el-descriptions-item>
5066
<template #label><span style="color: red">提醒: </span></template>
@@ -168,7 +184,7 @@
168184
<!-- 自提门店 -->
169185
<div v-if="formData.deliveryType === DeliveryTypeEnum.PICK_UP.type">
170186
<el-descriptions-item label="自提门店: " v-if="formData.pickUpStoreId">
171-
{{ pickUpStore.name }}
187+
{{ pickUpStore?.name }}
172188
</el-descriptions-item>
173189
</div>
174190
</el-descriptions>
@@ -217,7 +233,7 @@ import OrderUpdateAddressForm from '@/views/mall/trade/order/form/OrderUpdateAdd
217233
import OrderUpdatePriceForm from '@/views/mall/trade/order/form/OrderUpdatePriceForm.vue'
218234
import * as DeliveryExpressApi from '@/api/mall/trade/delivery/express'
219235
import { useTagsViewStore } from '@/store/modules/tagsView'
220-
import { DeliveryTypeEnum } from '@/utils/constants'
236+
import { DeliveryTypeEnum, TradeOrderStatusEnum } from '@/utils/constants'
221237
import * as DeliveryPickUpStoreApi from '@/api/mall/trade/delivery/pickUpStore'
222238
223239
defineOptions({ name: 'TradeOrderDetail' })
@@ -263,6 +279,19 @@ const updatePrice = () => {
263279
updatePriceFormRef.value?.open(formData.value)
264280
}
265281
282+
/** 核销 */
283+
const handlePickUp = async () => {
284+
try {
285+
// 二次确认
286+
await message.confirm('确认核销订单吗?')
287+
// 提交
288+
await TradeOrderApi.pickUpOrder(formData.value.id!)
289+
message.success('核销成功')
290+
// 刷新列表
291+
await getDetail()
292+
} catch {}
293+
}
294+
266295
/** 获得详情 */
267296
const { params } = useRoute() // 查询参数
268297
const getDetail = async () => {

src/views/mall/trade/order/index.vue

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@
7474
/>
7575
</el-select>
7676
</el-form-item>
77-
<el-form-item v-if="queryParams.deliveryType === 1" label="快递公司">
77+
<el-form-item
78+
v-if="queryParams.deliveryType === DeliveryTypeEnum.EXPRESS.type"
79+
label="快递公司"
80+
prop="logisticsId"
81+
>
7882
<el-select v-model="queryParams.logisticsId" class="!w-280px" clearable placeholder="全部">
7983
<el-option
8084
v-for="item in deliveryExpressList"
@@ -84,7 +88,11 @@
8488
/>
8589
</el-select>
8690
</el-form-item>
87-
<el-form-item v-if="queryParams.deliveryType === 2" label="自提门店">
91+
<el-form-item
92+
v-if="queryParams.deliveryType === DeliveryTypeEnum.PICK_UP.type"
93+
label="自提门店"
94+
prop="pickUpStoreId"
95+
>
8896
<el-select
8997
v-model="queryParams.pickUpStoreId"
9098
class="!w-280px"
@@ -100,6 +108,19 @@
100108
/>
101109
</el-select>
102110
</el-form-item>
111+
<el-form-item
112+
v-if="queryParams.deliveryType === DeliveryTypeEnum.PICK_UP.type"
113+
label="核销码"
114+
prop="pickUpVerifyCode"
115+
>
116+
<el-input
117+
v-model="queryParams.pickUpVerifyCode"
118+
class="!w-280px"
119+
clearable
120+
placeholder="请输入自提核销码"
121+
@keyup.enter="handleQuery"
122+
/>
123+
</el-form-item>
103124
<!-- TODO puhui 聚合搜索等售后结束后实现-->
104125
<!-- TODO puhui999:尽量不要用 .k 这样的参数,完整拼写,有完整的业务含义 -->
105126
<el-form-item label="聚合搜索">
@@ -234,15 +255,21 @@
234255
<el-table-column label="买家/收货人" min-width="160">
235256
<template #default>
236257
<!-- 快递发货 -->
237-
<div v-if="scope.row.deliveryType === 1" class="flex flex-col">
258+
<div
259+
v-if="scope.row.deliveryType === DeliveryTypeEnum.EXPRESS.type"
260+
class="flex flex-col"
261+
>
238262
<span>买家:{{ scope.row.user.nickname }}</span>
239263
<span>
240264
收货人:{{ scope.row.receiverName }} {{ scope.row.receiverMobile }}
241265
{{ scope.row.receiverAreaName }} {{ scope.row.receiverDetailAddress }}
242266
</span>
243267
</div>
244268
<!-- 自提 -->
245-
<div v-if="scope.row.deliveryType === 2" class="flex flex-col">
269+
<div
270+
v-if="scope.row.deliveryType === DeliveryTypeEnum.PICK_UP.type"
271+
class="flex flex-col"
272+
>
246273
<span>
247274
门店名称:
248275
{{ pickUpStoreList.find((p) => p.id === scope.row.pickUpStoreId)?.name }}
@@ -273,7 +300,7 @@
273300
<el-table-column align="center" fixed="right" label="操作" width="160">
274301
<template #default>
275302
<!-- TODO 权限后续补齐 -->
276-
<div class="flex justify-center items-center">
303+
<div class="flex items-center justify-center">
277304
<el-button link type="primary" @click="openDetail(scope.row.id)">
278305
<Icon icon="ep:notification" />
279306
详情
@@ -287,7 +314,10 @@
287314
<el-dropdown-menu>
288315
<!-- 如果是【快递】,并且【未发货】,则展示【发货】按钮 -->
289316
<el-dropdown-item
290-
v-if="scope.row.deliveryType === 1 && scope.row.status === 10"
317+
v-if="
318+
scope.row.deliveryType === DeliveryTypeEnum.EXPRESS.type &&
319+
scope.row.status === TradeOrderStatusEnum.UNDELIVERED.status
320+
"
291321
command="delivery"
292322
>
293323
<Icon icon="ep:takeaway-box" />
@@ -332,6 +362,7 @@ import { formatDate } from '@/utils/formatTime'
332362
import { floatToFixed2 } from '@/utils'
333363
import { createImageViewer } from '@/components/ImageViewer'
334364
import * as DeliveryExpressApi from '@/api/mall/trade/delivery/express'
365+
import { DeliveryTypeEnum, TradeOrderStatusEnum } from '@/utils/constants'
335366
336367
defineOptions({ name: 'TradeOrder' })
337368
@@ -352,7 +383,8 @@ const queryParams = ref({
352383
type: null, // 订单类型
353384
deliveryType: null, // 配送方式
354385
logisticsId: null, // 快递公司
355-
pickUpStoreId: null // 自提门店
386+
pickUpStoreId: null, // 自提门店
387+
pickUpVerifyCode: null // 自提核销码
356388
})
357389
const queryType = reactive({ k: '' }) // 订单搜索类型 k
358390

0 commit comments

Comments
 (0)