Merge pull request !262 from 疯狂的世界/dev
This commit is contained in:
芋道源码 2023-10-04 09:34:20 +00:00 committed by Gitee
commit 4c2eb3d8b2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 115 additions and 24 deletions

View File

@ -139,3 +139,8 @@ export const updateOrderPrice = async (data: any) => {
export const updateOrderAddress = async (data: any) => {
return await request.put({ url: `/trade/order/update-address`, data })
}
// 订单核销
export const pickUpOrder = async (id: number) => {
return await request.put({ url: `/trade/order/pick-up?id=${id}` })
}

View File

@ -389,3 +389,28 @@ export const DeliveryTypeEnum = {
name: '到店自提'
}
}
/**
* -
*/
export const TradeOrderStatusEnum = {
UNPAID: {
status: 0,
name: '待支付'
},
UNDELIVERED: {
status: 10,
name: '待发货'
},
DELIVERED: {
status: 20,
name: '已发货'
},
COMPLETED: {
status: 30,
name: '已完成'
},
CANCELED: {
status: 40,
name: '已取消'
}
}

View File

@ -27,24 +27,40 @@
<dict-tag :type="DICT_TYPE.TRADE_ORDER_STATUS" :value="formData.status!" />
</el-descriptions-item>
<el-descriptions-item label-class-name="no-colon">
<el-button v-if="formData.status! === 0" type="primary" @click="updatePrice">
<el-button
v-if="formData.status! === TradeOrderStatusEnum.UNPAID.status"
type="primary"
@click="updatePrice"
>
调整价格
</el-button>
<el-button type="primary" @click="remark">备注</el-button>
<el-button
v-if="formData.status! === 10 && formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
type="primary"
@click="delivery"
>
发货
</el-button>
<el-button
v-if="formData.status! === 10 && formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
type="primary"
@click="updateAddress"
>
修改地址
</el-button>
<!-- 待发货 -->
<template v-if="formData.status! === TradeOrderStatusEnum.UNDELIVERED.status">
<!-- 快递发货 -->
<el-button
v-if="formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
type="primary"
@click="delivery"
>
发货
</el-button>
<el-button
v-if="formData.deliveryType === DeliveryTypeEnum.EXPRESS.type"
type="primary"
@click="updateAddress"
>
修改地址
</el-button>
<!-- 到店自提 -->
<el-button
v-if="formData.deliveryType === DeliveryTypeEnum.PICK_UP.type"
type="primary"
@click="handlePickUp"
>
核销
</el-button>
</template>
</el-descriptions-item>
<el-descriptions-item>
<template #label><span style="color: red">提醒: </span></template>
@ -168,7 +184,7 @@
<!-- 自提门店 -->
<div v-if="formData.deliveryType === DeliveryTypeEnum.PICK_UP.type">
<el-descriptions-item label="自提门店: " v-if="formData.pickUpStoreId">
{{ pickUpStore.name }}
{{ pickUpStore?.name }}
</el-descriptions-item>
</div>
</el-descriptions>
@ -217,7 +233,7 @@ import OrderUpdateAddressForm from '@/views/mall/trade/order/form/OrderUpdateAdd
import OrderUpdatePriceForm from '@/views/mall/trade/order/form/OrderUpdatePriceForm.vue'
import * as DeliveryExpressApi from '@/api/mall/trade/delivery/express'
import { useTagsViewStore } from '@/store/modules/tagsView'
import { DeliveryTypeEnum } from '@/utils/constants'
import { DeliveryTypeEnum, TradeOrderStatusEnum } from '@/utils/constants'
import * as DeliveryPickUpStoreApi from '@/api/mall/trade/delivery/pickUpStore'
defineOptions({ name: 'TradeOrderDetail' })
@ -263,6 +279,19 @@ const updatePrice = () => {
updatePriceFormRef.value?.open(formData.value)
}
/** 核销 */
const handlePickUp = async () => {
try {
//
await message.confirm('确认核销订单吗?')
//
await TradeOrderApi.pickUpOrder(formData.value.id!)
message.success('核销成功')
//
await getDetail()
} catch {}
}
/** 获得详情 */
const { params } = useRoute() //
const getDetail = async () => {

View File

@ -74,7 +74,11 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="queryParams.deliveryType === 1" label="快递公司">
<el-form-item
v-if="queryParams.deliveryType === DeliveryTypeEnum.EXPRESS.type"
label="快递公司"
prop="logisticsId"
>
<el-select v-model="queryParams.logisticsId" class="!w-280px" clearable placeholder="全部">
<el-option
v-for="item in deliveryExpressList"
@ -84,7 +88,11 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="queryParams.deliveryType === 2" label="自提门店">
<el-form-item
v-if="queryParams.deliveryType === DeliveryTypeEnum.PICK_UP.type"
label="自提门店"
prop="pickUpStoreId"
>
<el-select
v-model="queryParams.pickUpStoreId"
class="!w-280px"
@ -100,6 +108,19 @@
/>
</el-select>
</el-form-item>
<el-form-item
v-if="queryParams.deliveryType === DeliveryTypeEnum.PICK_UP.type"
label="核销码"
prop="pickUpVerifyCode"
>
<el-input
v-model="queryParams.pickUpVerifyCode"
class="!w-280px"
clearable
placeholder="请输入自提核销码"
@keyup.enter="handleQuery"
/>
</el-form-item>
<!-- TODO puhui 聚合搜索等售后结束后实现-->
<!-- TODO puhui999尽量不要用 .k 这样的参数完整拼写有完整的业务含义 -->
<el-form-item label="聚合搜索">
@ -234,7 +255,10 @@
<el-table-column label="买家/收货人" min-width="160">
<template #default>
<!-- 快递发货 -->
<div v-if="scope.row.deliveryType === 1" class="flex flex-col">
<div
v-if="scope.row.deliveryType === DeliveryTypeEnum.EXPRESS.type"
class="flex flex-col"
>
<span>买家{{ scope.row.user.nickname }}</span>
<span>
收货人{{ scope.row.receiverName }} {{ scope.row.receiverMobile }}
@ -242,7 +266,10 @@
</span>
</div>
<!-- 自提 -->
<div v-if="scope.row.deliveryType === 2" class="flex flex-col">
<div
v-if="scope.row.deliveryType === DeliveryTypeEnum.PICK_UP.type"
class="flex flex-col"
>
<span>
门店名称
{{ pickUpStoreList.find((p) => p.id === scope.row.pickUpStoreId)?.name }}
@ -273,7 +300,7 @@
<el-table-column align="center" fixed="right" label="操作" width="160">
<template #default>
<!-- TODO 权限后续补齐 -->
<div class="flex justify-center items-center">
<div class="flex items-center justify-center">
<el-button link type="primary" @click="openDetail(scope.row.id)">
<Icon icon="ep:notification" />
详情
@ -287,7 +314,10 @@
<el-dropdown-menu>
<!-- 如果是快递并且未发货则展示发货按钮 -->
<el-dropdown-item
v-if="scope.row.deliveryType === 1 && scope.row.status === 10"
v-if="
scope.row.deliveryType === DeliveryTypeEnum.EXPRESS.type &&
scope.row.status === TradeOrderStatusEnum.UNDELIVERED.status
"
command="delivery"
>
<Icon icon="ep:takeaway-box" />
@ -332,6 +362,7 @@ import { formatDate } from '@/utils/formatTime'
import { floatToFixed2 } from '@/utils'
import { createImageViewer } from '@/components/ImageViewer'
import * as DeliveryExpressApi from '@/api/mall/trade/delivery/express'
import { DeliveryTypeEnum, TradeOrderStatusEnum } from '@/utils/constants'
defineOptions({ name: 'TradeOrder' })
@ -352,7 +383,8 @@ const queryParams = ref({
type: null, //
deliveryType: null, //
logisticsId: null, //
pickUpStoreId: null //
pickUpStoreId: null, //
pickUpVerifyCode: null //
})
const queryType = reactive({ k: '' }) // k