From 4fddbccea17327c11f2a00be57b35a6495d219b6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 2 Oct 2023 10:34:37 +0800 Subject: [PATCH] =?UTF-8?q?trade=EF=BC=9A=E5=AE=8C=E5=96=84=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/trade/order/index.ts | 17 +- src/utils/constants.ts | 14 ++ src/views/mall/trade/order/detail/index.vue | 157 +++++++++++------- .../trade/order/form/OrderDeliveryForm.vue | 4 +- .../order/form/OrderUpdateAddressForm.vue | 2 +- .../trade/order/form/OrderUpdatePriceForm.vue | 2 +- .../order/form/OrderUpdateRemarkForm.vue | 2 +- 7 files changed, 126 insertions(+), 72 deletions(-) diff --git a/src/api/mall/trade/order/index.ts b/src/api/mall/trade/order/index.ts index 80669c57..c77e939b 100644 --- a/src/api/mall/trade/order/index.ts +++ b/src/api/mall/trade/order/index.ts @@ -41,15 +41,22 @@ export interface OrderVO { refundPrice?: number | null // 退款金额 couponId?: number | null // 优惠劵编号 couponPrice?: number | null // 优惠劵减免金额 + vipPrice?: number | null // VIP 减免金额 pointPrice?: number | null // 积分抵扣的金额 receiverAreaName?: string //收件人地区名字 items?: OrderItemRespVO[] // 订单项列表 - // 用户信息 + // 下单用户信息 user?: { id?: number | null nickname?: string avatar?: string } + // 推广用户信息 + brokerageUser?: { + id?: number | null + nickname?: string + avatar?: string + } // 订单操作日志 logs?: OrderLogRespVO[] } @@ -114,21 +121,21 @@ export interface DeliveryVO { } // 订单发货 -export const delivery = async (data: DeliveryVO) => { +export const deliveryOrder = async (data: DeliveryVO) => { return await request.put({ url: `/trade/order/delivery`, data }) } // 订单备注 -export const updateRemark = async (data: any) => { +export const updateOrderRemark = async (data: any) => { return await request.put({ url: `/trade/order/update-remark`, data }) } // 订单调价 -export const updatePrice = async (data: any) => { +export const updateOrderPrice = async (data: any) => { return await request.put({ url: `/trade/order/update-price`, data }) } // 修改订单地址 -export const updateAddress = async (data: any) => { +export const updateOrderAddress = async (data: any) => { return await request.put({ url: `/trade/order/update-address`, data }) } diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 8c57ecd3..a3dc4c2c 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -375,3 +375,17 @@ export const BrokerageWithdrawTypeEnum = { name: '支付宝' } } + +/** + * 配送方式枚举 + */ +export const DeliveryTypeEnum = { + EXPRESS: { + type: 1, + name: '快递发货' + }, + PICK_UP: { + type: 2, + name: '到店自提' + } +} diff --git a/src/views/mall/trade/order/detail/index.vue b/src/views/mall/trade/order/detail/index.vue index e61b482a..b52876d7 100644 --- a/src/views/mall/trade/order/detail/index.vue +++ b/src/views/mall/trade/order/detail/index.vue @@ -3,35 +3,21 @@ {{ formData.no }} - - - - - 秒杀活动 + {{ formData?.user?.nickname }} - {{ formData.receiverName }} - {{ formData.userRemark }} - {{ formData.receiverMobile }} + {{ formData.userRemark }} {{ formData.remark }} {{ formData.payOrderId }} - - - - {{ formData.receiverAreaName }} {{ formData.receiverDetailAddress }} - + + {{ formData.brokerageUser?.nickname }} @@ -45,10 +31,18 @@ 调整价格 备注 - + 发货 - + 修改地址 @@ -95,64 +89,91 @@ - + + - {{ fenToYuan(formData.totalPrice!) }}元 + {{ fenToYuan(formData.totalPrice!) }} 元 - {{ fenToYuan(formData.deliveryPrice!) }}元 + {{ fenToYuan(formData.deliveryPrice!) }} 元 - {{ fenToYuan(formData.adjustPrice!) }}元 + {{ fenToYuan(formData.adjustPrice!) }} 元 - + + - - {{ fenToYuan(formData.couponPrice!) }}元 + + {{ fenToYuan(formData.couponPrice!) }} 元 - - {{ fenToYuan(formData.discountPrice!) }}元 + + {{ fenToYuan(formData.vipPrice!) }} 元 + + + + {{ fenToYuan(formData.discountPrice!) }} 元 - {{ fenToYuan(formData.pointPrice!) }}元 + {{ fenToYuan(formData.pointPrice!) }} 元 - - - + + - {{ fenToYuan(formData.payPrice!) }}元 + {{ fenToYuan(formData.payPrice!) }} 元 - - - - {{ deliveryExpressList.find((item) => item.id === formData.logisticsId)?.name }} - - {{ formData.logisticsNo }} - - {{ formatDate(formData.deliveryTime!) }} - - - - - - - - - - - {{ express.content }} - - + + + + + {{ formData.receiverName }} + {{ formData.receiverMobile }} + +
+ + {{ formData.receiverAreaName }} {{ formData.receiverDetailAddress }} + + + + {{ deliveryExpressList.find((item) => item.id === formData.logisticsId)?.name }} + + + {{ formData.logisticsNo }} + + + {{ formatDate(formData.deliveryTime) }} + + + + + + {{ express.content }} + + + +
+ +
+ + {{ pickUpStore.name }} + +
+ + @@ -196,6 +217,8 @@ 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 * as DeliveryPickUpStoreApi from '@/api/mall/trade/delivery/pickUpStore' defineOptions({ name: 'TradeOrderDetail' }) @@ -271,10 +294,20 @@ const clipboardSuccess = () => { /** 初始化 **/ const deliveryExpressList = ref([]) // 物流公司 const expressTrackList = ref([]) // 物流详情 +const pickUpStore = ref({}) // 自提门店 onMounted(async () => { await getDetail() - deliveryExpressList.value = await DeliveryExpressApi.getSimpleDeliveryExpressList() - expressTrackList.value = await TradeOrderApi.getExpressTrackList(formData.value.id!) + // 如果配送方式为快递,则查询物流公司 + if (formData.value.deliveryType === DeliveryTypeEnum.EXPRESS.type) { + deliveryExpressList.value = await DeliveryExpressApi.getSimpleDeliveryExpressList() + if (form.value.logisticsId) { + expressTrackList.value = await TradeOrderApi.getExpressTrackList(formData.value.id!) + } + } else if (formData.value.deliveryType === DeliveryTypeEnum.PICK_UP.type) { + pickUpStore.value = await DeliveryPickUpStoreApi.getDeliveryPickUpStore( + formData.value.pickUpStoreId + ) + } })