From 84ffbdee47fa2a51edd4eb23a9e919b1eb600046 Mon Sep 17 00:00:00 2001 From: 15233722133 <15233722133@163.com> Date: Mon, 8 Jun 2026 10:50:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ai=E5=BA=97=E9=93=BA=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=8C=89=E9=92=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/orderItem/AiOrderActionBar.vue | 38 ++++++++ components/orderItem/orderItem.vue | 47 ++++----- pages/order/detail.vue | 113 +++++++++++++++++++++- 3 files changed, 167 insertions(+), 31 deletions(-) create mode 100644 components/orderItem/AiOrderActionBar.vue diff --git a/components/orderItem/AiOrderActionBar.vue b/components/orderItem/AiOrderActionBar.vue new file mode 100644 index 0000000..adf96c9 --- /dev/null +++ b/components/orderItem/AiOrderActionBar.vue @@ -0,0 +1,38 @@ + + + diff --git a/components/orderItem/orderItem.vue b/components/orderItem/orderItem.vue index 0fc3d9d..c8c764f 100644 --- a/components/orderItem/orderItem.vue +++ b/components/orderItem/orderItem.vue @@ -60,35 +60,15 @@ - - 延迟发货 - - - 立即发货 - - 查看订单 - - 确认收货 - - - 去支付 - + @@ -109,6 +89,7 @@ } from '@/sheep/hooks/useGoods'; import card_order from './card_order.vue'; import card_orderBan from '@/components/card_orderBan/card_orderBan.vue'; + import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue'; import AfterSaleApi from '@/sheep/api/trade/afterSale'; import { aiDelayedShipment, @@ -164,6 +145,14 @@ return data?.id || data?.orderId; }; + const onDelayShipment = () => { + delayShipment(props.data); + }; + + const onNowShipment = () => { + nowShipment(props.data); + }; + function delayShipment(data) { const id = resolveAiOrderId(data); if (!id) { diff --git a/pages/order/detail.vue b/pages/order/detail.vue index 75b942e..132c466 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -85,7 +85,15 @@ - + + @@ -100,9 +108,17 @@ handleOrderButtons, } from '@/sheep/hooks/useGoods'; import OrderApi from '@/sheep/api/trade/order'; - import { getOrderDetail as getAiOrderDetail, getOpenOrderDetail } from '@/sheep/api/ai'; + import { + aiDelayedShipment, + aiPendingShipment, + confirmReceive as aiConfirmReceive, + giftConfirmReceive, + getOrderDetail as getAiOrderDetail, + getOpenOrderDetail, + } from '@/sheep/api/ai'; import DeliveryApi from '@/sheep/api/trade/delivery'; import card_order from '@/components/orderItem/card_order.vue'; + import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue'; import truckLine from '@/components/truckLine/truckLine.vue' const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png'); @@ -126,6 +142,99 @@ const pickUpVerifyRef = ref(); + const isAiActionOrder = computed(() => { + return ( + String(state.source) === 'aishop' || + String(state.orderType) === '5' || + String(state.orderInfo?.__source) === 'aishop' || + Number(state.orderInfo?.type) === 5 + ); + }); + + const resolveAiOrderId = (data) => { + return data?.id || data?.orderId; + }; + + function delayShipment() { + const id = resolveAiOrderId(state.orderInfo); + if (!id) { + uni.showToast({ + title: '订单信息异常', + icon: 'none', + }); + return; + } + uni.showModal({ + title: '延迟发货', + content: '请您确认是否暂时不需要发货,确认后该产品将为您安排延迟发货', + confirmColor: '#FA7E31', + success: async function (res) { + if (!res.confirm) return; + const { code } = await aiDelayedShipment({ + id, + status: 50, + }); + if (code === 0) { + getOrderDetail(); + } + }, + }); + } + + function nowShipment() { + const id = resolveAiOrderId(state.orderInfo); + if (!id) { + uni.showToast({ + title: '订单信息异常', + icon: 'none', + }); + return; + } + uni.showModal({ + title: '立即发货', + content: '请您确认是否需要立即发货,确认后将尽快为您安排发货', + confirmColor: '#FA7E31', + success: async function (res) { + if (!res.confirm) return; + const { code } = await aiPendingShipment({ + id, + status: 10, + }); + if (code === 0) { + getOrderDetail(); + } + }, + }); + } + + const confirmReceiveOrder = async () => { + const id = resolveAiOrderId(state.orderInfo); + if (!id) return; + const req = Number(state.orderInfo?.type) === 5 || String(state.orderType) === '5' + ? giftConfirmReceive + : aiConfirmReceive; + const { code } = await req({ id }); + if (code === 0) { + getOrderDetail(); + } + }; + + const goPay = () => { + const id = resolveAiOrderId(state.orderInfo); + const payOrderId = state.orderInfo?.payOrderId; + if (!id || !payOrderId) { + uni.showToast({ + title: '支付信息异常', + icon: 'none', + }); + return; + } + sheep.$router.go('/pages/AI/cashierDesk', { + id, + payOrderId, + }); + }; + async function getOrderDetail() { let id = state.orderInfo.id; // 对详情数据进行适配