feat: ai店铺订单按钮展示

This commit is contained in:
2026-06-08 10:29:25 +08:00
parent 2449d67e53
commit eba95941e2
6 changed files with 203 additions and 39 deletions
+27 -18
View File
@@ -5,8 +5,14 @@
}">
<view class="more size24" v-if="props.type != 2"></view>
<view class="flex-center ju-flex-end">
<view v-for="(item, index) in btns" :key="index">
<view v-if="item.value.split(',').indexOf(String(props?.data?.status)) !== -1" class="btn size28 f500"
<view
v-if="
item.value.split(',').indexOf(String(props?.data?.status)) !== -1 &&
!(item.id === 3 && Number(props?.data?.type) === 5)
"
class="btn size28 f500"
@click.stop="btnClick(item.id)"
:style="{ color: item.color, background: item.background, border: item.border }"
:class="{btn1: props.type == 2}">
@@ -56,11 +62,11 @@
background: 'rgba(238,10,36,0.2)',
border: 'none'
},
// { //在订单详情退货
// id: 3,
// name: '申请售后',
// value: '10,20',
// },
{ //在订单详情退货
id: 3,
name: '申请售后',
value: '10,20',
},
{
id: 4,
name: '确认收货',
@@ -69,12 +75,12 @@
background: 'rgba(238,10,36,0.2)',
border: 'none'
},
// {
// id: 5,
// name: '再次购买',
// value: '30,50,40',
// color: '#FA9C31',
// },
{
id: 5,
name: '再次购买',
value: '30,50,40',
color: '#FA9C31',
},
{
id: 6,
name: '取消售后',
@@ -91,6 +97,9 @@
});
return;
}
if (index === 3 && Number(props?.data?.type) === 5) {
return;
}
let id = props.data?.id;
switch (index) {
case 1:
@@ -197,17 +206,17 @@
.more {}
.btn {
line-height: 54rpx;
padding: 0 24rpx;
line-height: 24rpx;
padding: 10rpx 24rpx;
box-sizing: border-box;
border: 2rpx solid #999999;
border-radius: 94px 94px 94px 94px;
border-radius: 10rpx;
margin-left: 12rpx;
color: #999999;
}
.btn1 {
line-height: 74rpx;
padding: 0 30rpx;
// line-height: 74rpx;
// padding: 0 30rpx;
}
</style>
</style>
+135 -1
View File
@@ -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 {