feat: ai店铺订单详情按钮展示
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
<template>
|
||||||
|
<view class="flex-center ju-flex-end w100">
|
||||||
|
<view class="ai-button3 w_144 m-r-10" v-if="props.status === 10" @tap.stop="emit('delay')">
|
||||||
|
延迟发货
|
||||||
|
</view>
|
||||||
|
<view class="ai-button3 w_144 m-r-10" v-if="props.status === 50" @tap.stop="emit('now')">
|
||||||
|
立即发货
|
||||||
|
</view>
|
||||||
|
<view class="ai-button3 w_144" v-if="props.showView" @tap.stop="emit('view')">
|
||||||
|
{{ props.viewText }}
|
||||||
|
</view>
|
||||||
|
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 20" @tap.stop="emit('confirm')">
|
||||||
|
确认收货
|
||||||
|
</view>
|
||||||
|
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 0" @tap.stop="emit('pay')">
|
||||||
|
去支付
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
status: {
|
||||||
|
type: Number,
|
||||||
|
default: -1,
|
||||||
|
},
|
||||||
|
showView: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
viewText: {
|
||||||
|
type: String,
|
||||||
|
default: '查看订单',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay']);
|
||||||
|
</script>
|
||||||
@@ -60,35 +60,15 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-center ju-flex-end m-t-12" v-if="props.index != 5 && isAiActionOrder">
|
<view class="flex-center ju-flex-end m-t-12" v-if="props.index != 5 && isAiActionOrder">
|
||||||
<view
|
<AiOrderActionBar
|
||||||
class="ai-button3 w_144 m-r-10"
|
:status="Number(props.data.status)"
|
||||||
@tap.stop="delayShipment(props.data)"
|
:showView="true"
|
||||||
v-if="Number(props.data.status) === 10"
|
@delay="onDelayShipment"
|
||||||
>
|
@now="onNowShipment"
|
||||||
延迟发货
|
@view="goAiOrderInfo"
|
||||||
</view>
|
@confirm="confirmReceiveOrder"
|
||||||
<view
|
@pay="goPay"
|
||||||
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>
|
||||||
<view class="" style="margin-top: 32rpx" v-else-if="props.index != 5">
|
<view class="" style="margin-top: 32rpx" v-else-if="props.index != 5">
|
||||||
<card_orderBan :data="props.data" @downData="downData"></card_orderBan>
|
<card_orderBan :data="props.data" @downData="downData"></card_orderBan>
|
||||||
@@ -109,6 +89,7 @@
|
|||||||
} from '@/sheep/hooks/useGoods';
|
} from '@/sheep/hooks/useGoods';
|
||||||
import card_order from './card_order.vue';
|
import card_order from './card_order.vue';
|
||||||
import card_orderBan from '@/components/card_orderBan/card_orderBan.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 AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||||
import {
|
import {
|
||||||
aiDelayedShipment,
|
aiDelayedShipment,
|
||||||
@@ -164,6 +145,14 @@
|
|||||||
return data?.id || data?.orderId;
|
return data?.id || data?.orderId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onDelayShipment = () => {
|
||||||
|
delayShipment(props.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onNowShipment = () => {
|
||||||
|
nowShipment(props.data);
|
||||||
|
};
|
||||||
|
|
||||||
function delayShipment(data) {
|
function delayShipment(data) {
|
||||||
const id = resolveAiOrderId(data);
|
const id = resolveAiOrderId(data);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
|
|||||||
+111
-2
@@ -85,7 +85,15 @@
|
|||||||
</view>
|
</view>
|
||||||
<su-fixed bottom placeholder bg="bg24">
|
<su-fixed bottom placeholder bg="bg24">
|
||||||
<view class="orderBan flex-column ju-center">
|
<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>
|
</view>
|
||||||
</su-fixed>
|
</su-fixed>
|
||||||
</s-pages>
|
</s-pages>
|
||||||
@@ -100,9 +108,17 @@
|
|||||||
handleOrderButtons,
|
handleOrderButtons,
|
||||||
} from '@/sheep/hooks/useGoods';
|
} from '@/sheep/hooks/useGoods';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
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 DeliveryApi from '@/sheep/api/trade/delivery';
|
||||||
import card_order from '@/components/orderItem/card_order.vue';
|
import card_order from '@/components/orderItem/card_order.vue';
|
||||||
|
import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue';
|
||||||
import truckLine from '@/components/truckLine/truckLine.vue'
|
import truckLine from '@/components/truckLine/truckLine.vue'
|
||||||
|
|
||||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||||
@@ -126,6 +142,99 @@
|
|||||||
|
|
||||||
const pickUpVerifyRef = ref();
|
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() {
|
async function getOrderDetail() {
|
||||||
let id = state.orderInfo.id;
|
let id = state.orderInfo.id;
|
||||||
// 对详情数据进行适配
|
// 对详情数据进行适配
|
||||||
|
|||||||
Reference in New Issue
Block a user