feat: ai店铺订单添加修改配送功能

This commit is contained in:
2026-09-24 11:20:36 +08:00
parent 8dee31e18c
commit 31c4aa36a5
11 changed files with 1037 additions and 23 deletions
+64 -5
View File
@@ -15,14 +15,17 @@
>
催一催
</view>
<view
v-if="showModifyDeliveryBtn"
class="btn size28 f500 modify-delivery-btn"
@click.stop="btnClick(13)"
>
修改配送
</view>
<view v-for="(item, index) in btns" :key="index">
<view
v-if="
item.id !== 3 &&
item.value.split(',').indexOf(String(props?.data?.status)) !== -1 &&
!(item.id === 3 && Number(props?.data?.type) === 5) &&
!(item.id === 3 && props?.data?.payChannelCode === 'cash_payment') &&
!(item.id === 3 && isAllRefunded)
shouldShowBtn(item)
"
class="btn size28 f500"
@click.stop="btnClick(item.id)"
@@ -105,6 +108,38 @@
isSorting.value
);
});
const isThirdPartyOrder = computed(() => {
const d = props.data || {};
if (d.thirdPartyOrder === true || d.thirdPartyOrder === 'true' || d.thirdPartyOrder === 1) {
return true;
}
const items = Array.isArray(d.items) ? d.items : [];
return items.some(
(it) => it.thirdPartyOrder === true || it.thirdPartyOrder === 'true' || it.thirdPartyOrder === 1,
);
});
const showModifyDeliveryBtn = computed(() => {
if (!isThirdPartyOrder.value) return false;
const d = props.data || {};
const canUpdate = d.canUpdateDeliveryType === true || d.canUpdateDeliveryType === 'true' || d.canUpdateDeliveryType === 1;
if (!canUpdate) return false;
return String(d?.status) === '10';
});
const shouldShowBtn = (item) => {
if (item.id !== 3 && item.value.split(',').indexOf(String(props?.data?.status)) === -1) {
return false;
}
if (item.id === 3 && Number(props?.data?.type) === 5) return false;
if (item.id === 3 && props?.data?.payChannelCode === 'cash_payment') return false;
if (item.id === 3 && isAllRefunded.value) return false;
if (Number(props.data?.deliveryType) === 2 && [4, 8, 11].includes(item.id)) {
return false;
}
return true;
};
let btns = ref([
{
id: 1,
@@ -197,6 +232,9 @@
case 8:
deleteOrder();
break;
case 13:
goModifyDelivery();
break;
}
};
// 取消订单
@@ -310,6 +348,22 @@
const upData = () => {
emit('downData');
};
const goModifyDelivery = () => {
const id = props.data?.orderId || props.data?.id;
if (!id) return;
const params = {
id,
orderTypeId: 1,
currentType: 0,
};
if (props.data?.type !== undefined && props.data?.type !== null) {
params.type = props.data.type;
}
if (props.data?.__source) {
params.source = props.data.__source;
}
sheep.$router.go('/pages/order/modifyDelivery', params);
};
</script>
<style scoped lang="scss">
.more {
@@ -335,4 +389,9 @@
background: rgba(37, 86, 236, 0.08);
border: 2rpx solid rgba(37, 86, 236, 0.28);
}
.modify-delivery-btn {
color: #1677FF;
background: rgba(22, 119, 255, 0.06);
border: 2rpx solid rgba(22, 119, 255, 0.28);
}
</style>
+34 -1
View File
@@ -7,6 +7,13 @@
>
催一催
</view>
<view
class="ai-button3 w_144 m-r-10 modify-delivery-btn"
v-if="showModifyDelivery"
@tap.stop="emit('modifyDelivery')"
>
修改配送
</view>
<view
class="ai-button3 w_144 m-r-10"
v-if="showDelay && !props.disableDelayShipment"
@@ -129,6 +136,27 @@
type: [Number, String],
default: '',
},
thirdPartyOrder: {
type: [Boolean, Number, String],
default: false,
},
canUpdateDeliveryType: {
type: [Boolean, Number, String],
default: false,
},
});
const isThirdPartyOrder = computed(() => {
const v = props.thirdPartyOrder;
if (v === true || v === 'true' || v === 1) return true;
return false;
});
const showModifyDelivery = computed(() => {
if (!isThirdPartyOrder.value) return false;
const v = props.canUpdateDeliveryType;
if (!(v === true || v === 'true' || v === 1)) return false;
const s = Number(props.status);
return s === 10;
});
// 延迟发货按钮:仅允许【待发货(10/伪50)、部分发货(15)】状态展示
@@ -197,7 +225,7 @@
);
});
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel', 'express', 'remind']);
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel', 'express', 'remind', 'modifyDelivery']);
</script>
<style scoped lang="scss">
@@ -206,4 +234,9 @@
background: rgba(37, 86, 236, 0.08);
border: 2rpx solid rgba(37, 86, 236, 0.28) !important;
}
.modify-delivery-btn {
color: #1677FF !important;
background: rgba(22, 119, 255, 0.06);
border: 2rpx solid rgba(22, 119, 255, 0.28) !important;
}
</style>
+41
View File
@@ -87,6 +87,8 @@
:logisticsNo="props.data.logisticsNo"
:deliveryTime="props.data.deliveryTime"
:hasLogistics="hasLogistics"
:thirdPartyOrder="resolveThirdPartyOrder()"
:canUpdateDeliveryType="props.data?.canUpdateDeliveryType"
@delay="onDelayShipment"
@now="onNowShipment"
@view="goAiOrderInfo"
@@ -94,6 +96,7 @@
@pay="goPay"
@cancel="cancelAiOrder"
@express="goExpressLog"
@modifyDelivery="goModifyDelivery"
/>
</view>
<view class="" style="margin-top: 32rpx" v-else-if="!props.isAfterSale">
@@ -231,6 +234,44 @@
Number(props.data?.type) === 4 ||
Number(props.data?.type) === 5;
const isAiStoreOrder = computed(() => String(props.data?.__source) === 'aishop');
const resolveThirdPartyOrder = () => {
const d = props.data || {};
if (d.thirdPartyOrder === true || d.thirdPartyOrder === 'true' || d.thirdPartyOrder === 1) {
return true;
}
const items = Array.isArray(d.items) ? d.items : [];
return items.some(
(it) => it.thirdPartyOrder === true || it.thirdPartyOrder === 'true' || it.thirdPartyOrder === 1,
);
};
const resolveOrderTypeForModify = () => {
const t = Number(props.data?.type ?? 0);
if (t === 4 || t === 5) return t;
// 只要能触发 AiOrderActionBar 的 modifyDelivery 按钮,就是 AI/店铺类订单
if (isAiActionOrder) return 4;
return 1;
};
const goModifyDelivery = () => {
const id = props.data?.id || props.data?.orderId;
if (!id) return;
const dataType = Number(props.data?.type ?? 0);
let finalType = dataType;
if (finalType !== 4 && finalType !== 5) {
finalType = isAiActionOrder ? 4 : 1;
}
const finalSource = props.data?.__source || (isAiActionOrder ? 'aishop' : '');
const currentType = isAiStoreOrder.value || isAiActionOrder ? 1 : 0;
const params = {
id,
orderTypeId: resolveOrderTypeForModify(),
type: finalType,
currentType,
};
if (finalSource) {
params.source = finalSource;
}
proxy.utils.go('/pages/order/modifyDelivery', params);
};
const isPickUpOrder = computed(() => {
if (Number(props.data?.deliveryType) === 2) return true;
return Boolean(