feat: ai店铺订单按钮展示
This commit is contained in:
@@ -59,7 +59,38 @@
|
||||
style="font-weight: 600;">{{ fen2yuan(props.data.payPrice) }}</span></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="margin-top: 32rpx" v-if="props.index != 5">
|
||||
<view class="flex-center ju-flex-end m-t-12" v-if="props.index != 5 && isAiActionOrder">
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10"
|
||||
@tap.stop="delayShipment(props.data)"
|
||||
v-if="Number(props.data.status) === 10"
|
||||
>
|
||||
延迟发货
|
||||
</view>
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10"
|
||||
@tap.stop="nowShipment(props.data)"
|
||||
v-if="Number(props.data.status) === 50"
|
||||
>
|
||||
立即发货
|
||||
</view>
|
||||
<view class="ai-button3 w_144" @tap.stop="goAiOrderInfo">查看订单</view>
|
||||
<view
|
||||
class="ai-button1 w_144 m-l-16"
|
||||
v-if="Number(props.data.status) === 20"
|
||||
@tap.stop="confirmReceiveOrder"
|
||||
>
|
||||
确认收货
|
||||
</view>
|
||||
<view
|
||||
class="ai-button1 w_144 m-l-16"
|
||||
v-if="Number(props.data.status) === 0"
|
||||
@tap.stop="goPay"
|
||||
>
|
||||
去支付
|
||||
</view>
|
||||
</view>
|
||||
<view class="" style="margin-top: 32rpx" v-else-if="props.index != 5">
|
||||
<card_orderBan :data="props.data" @downData="downData"></card_orderBan>
|
||||
</view>
|
||||
</view>
|
||||
@@ -79,6 +110,12 @@
|
||||
import card_order from './card_order.vue';
|
||||
import card_orderBan from '@/components/card_orderBan/card_orderBan.vue';
|
||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||
import {
|
||||
aiDelayedShipment,
|
||||
aiPendingShipment,
|
||||
confirmReceive as aiConfirmReceive,
|
||||
giftConfirmReceive,
|
||||
} from '@/sheep/api/ai';
|
||||
let emit = defineEmits(['downData']);
|
||||
let { proxy } = getCurrentInstance();
|
||||
let props = defineProps({
|
||||
@@ -119,6 +156,103 @@
|
||||
const statusChange = (arr, status) => {
|
||||
return arr.indexOf(status) != -1;
|
||||
};
|
||||
|
||||
const isAiActionOrder =
|
||||
String(props.data?.__source) === 'aishop' || Number(props.data?.type) === 5;
|
||||
|
||||
const resolveAiOrderId = (data) => {
|
||||
return data?.id || data?.orderId;
|
||||
};
|
||||
|
||||
function delayShipment(data) {
|
||||
const id = resolveAiOrderId(data);
|
||||
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) {
|
||||
emit('downData');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function nowShipment(data) {
|
||||
const id = resolveAiOrderId(data);
|
||||
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) {
|
||||
emit('downData');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const goAiOrderInfo = () => {
|
||||
if (Number(props.data?.type) === 5) {
|
||||
const id = props.data?.id;
|
||||
if (!id) return;
|
||||
proxy.utils.go('/pages/order/detail', { id, type: props.data?.type });
|
||||
return;
|
||||
}
|
||||
const id = resolveAiOrderId(props.data);
|
||||
if (!id) return;
|
||||
proxy.utils.go('/pages/AI/orderInfo', { id });
|
||||
};
|
||||
|
||||
const confirmReceiveOrder = async () => {
|
||||
const id = resolveAiOrderId(props.data);
|
||||
if (!id) return;
|
||||
const req = Number(props.data?.type) === 5 ? giftConfirmReceive : aiConfirmReceive;
|
||||
const { code } = await req({ id });
|
||||
if (code === 0) {
|
||||
emit('downData');
|
||||
}
|
||||
};
|
||||
|
||||
const goPay = () => {
|
||||
const id = resolveAiOrderId(props.data);
|
||||
const payOrderId = props.data?.payOrderId;
|
||||
if (!id || !payOrderId) {
|
||||
uni.showToast({
|
||||
title: '支付信息异常',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
proxy.utils.go('/pages/AI/cashierDesk', {
|
||||
id,
|
||||
payOrderId,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.card_order {
|
||||
|
||||
Reference in New Issue
Block a user