feat: ai店铺订单详情按钮展示
This commit is contained in:
+111
-2
@@ -85,7 +85,15 @@
|
||||
</view>
|
||||
<su-fixed bottom placeholder bg="bg24">
|
||||
<view class="orderBan flex-column ju-center">
|
||||
<card_orderBan :data="state.orderInfo" @downData="getOrderDetail" type="2"></card_orderBan>
|
||||
<AiOrderActionBar
|
||||
v-if="isAiActionOrder"
|
||||
:status="Number(state.orderInfo.status)"
|
||||
@delay="delayShipment"
|
||||
@now="nowShipment"
|
||||
@confirm="confirmReceiveOrder"
|
||||
@pay="goPay"
|
||||
/>
|
||||
<card_orderBan v-else :data="state.orderInfo" @downData="getOrderDetail" type="2"></card_orderBan>
|
||||
</view>
|
||||
</su-fixed>
|
||||
</s-pages>
|
||||
@@ -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;
|
||||
// 对详情数据进行适配
|
||||
|
||||
Reference in New Issue
Block a user