feat: 立即发货、延迟发货、查看订单按钮展示调整
This commit is contained in:
@@ -92,21 +92,21 @@
|
||||
},
|
||||
});
|
||||
|
||||
// 延迟发货按钮:仅允许【待发货(10/伪50)、部分发货(15)】状态展示
|
||||
// 伪状态 50 = 原生 status=10 + 有 status===1(延迟中)的商品,属于待发货分支
|
||||
const showDelay = computed(() => {
|
||||
// 待收货(status=50)不展示延迟发货按钮——货已经发出,不需要延迟/立即发货操作
|
||||
const s = Number(props.status);
|
||||
if (s === 50) return false;
|
||||
if (![10, 15].includes(s)) return false;
|
||||
if (s === 10 || s === 15) return true;
|
||||
if (s === 20) return false; // 待收货:不展示
|
||||
if (![10, 15, 50].includes(s)) return false;
|
||||
return Boolean(props.canDelayItems);
|
||||
});
|
||||
|
||||
// 立即发货按钮:仅允许【待发货(10/伪50)、部分发货(15)】状态,
|
||||
// 且必须 delayRecords 里存在 status===1(延迟中)的商品(hasDelayedItems===true)
|
||||
const showNow = computed(() => {
|
||||
// 待收货(status=50)不展示立即发货按钮
|
||||
const s = Number(props.status);
|
||||
if (s === 50) return false;
|
||||
if (![10, 15].includes(s)) return false;
|
||||
// 只有存在延迟中(status===1)的商品时才展示立即发货按钮
|
||||
if (s === 20) return false; // 待收货:不展示
|
||||
if (![10, 15, 50].includes(s)) return false;
|
||||
if (!Boolean(props.hasDelayedItems)) return false;
|
||||
return Boolean(props.canShipItems);
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<AiOrderActionBar
|
||||
:status="currentStatus"
|
||||
:disableDelayShipment="isPickUpOrder || !isAiStoreOrder"
|
||||
:showView="true"
|
||||
:showView="false"
|
||||
:hasDelayedItems="hasDelayedItems"
|
||||
:canDelayItems="canDelayItems"
|
||||
:canShipItems="canShipItems"
|
||||
|
||||
@@ -108,6 +108,8 @@
|
||||
:status="Number(state.orderInfo.status)"
|
||||
:disableDelayShipment="isPickUpOrder || !isAiStoreOrder"
|
||||
:hasDelayedItems="hasDelayedItems"
|
||||
:canDelayItems="canDelayItems"
|
||||
:canShipItems="canShipItems"
|
||||
:logisticsId="state.orderInfo.logisticsId"
|
||||
:logisticsNo="state.orderInfo.logisticsNo"
|
||||
:deliveryTime="state.orderInfo.deliveryTime"
|
||||
@@ -257,6 +259,43 @@
|
||||
return records.some((record) => Number(record?.status) === 1);
|
||||
});
|
||||
|
||||
const getCurrentDelayRecords = () => {
|
||||
if (Array.isArray(state.delayRecords) && state.delayRecords.length > 0) return state.delayRecords;
|
||||
const orderRecords = Array.isArray(state.orderInfo?.delayRecords)
|
||||
? state.orderInfo.delayRecords
|
||||
: Array.isArray(state.orderInfo?.delayRecordList)
|
||||
? state.orderInfo.delayRecordList
|
||||
: [];
|
||||
return orderRecords;
|
||||
};
|
||||
|
||||
const canDelayItems = computed(() => {
|
||||
if (!isAiStoreOrder.value) return false;
|
||||
if (isPickUpOrder.value) return false;
|
||||
const delayRecords = getCurrentDelayRecords();
|
||||
const hasActivated = delayRecords.some((record) => Number(record?.status) === 2);
|
||||
if (hasActivated) return true;
|
||||
if (delayRecords.length === 0) {
|
||||
const totalCount = Number(state.orderInfo?.productCount || state.orderInfo?.totalCount || 0) || 0;
|
||||
if (totalCount > 0) return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
const canShipItems = computed(() => {
|
||||
if (!isAiStoreOrder.value) return false;
|
||||
if (isPickUpOrder.value) return false;
|
||||
const delayRecords = getCurrentDelayRecords();
|
||||
if (delayRecords.length === 0) {
|
||||
const totalCount = Number(state.orderInfo?.productCount || state.orderInfo?.totalCount || 0) || 0;
|
||||
return totalCount > 0;
|
||||
}
|
||||
return delayRecords.some((record) => {
|
||||
const status = Number(record?.status);
|
||||
return status === 1 || status === 2;
|
||||
});
|
||||
});
|
||||
|
||||
const hasLogistics = computed(() => {
|
||||
const info = state.orderInfo || {};
|
||||
if (Number(info.logisticsId) > 0) return true;
|
||||
|
||||
Reference in New Issue
Block a user