feat: 解决延迟发货展示问题
This commit is contained in:
@@ -79,6 +79,8 @@
|
||||
:disableDelayShipment="isPickUpOrder || !isAiStoreOrder"
|
||||
:showView="true"
|
||||
:hasDelayedItems="hasDelayedItems"
|
||||
:canDelayItems="canDelayItems"
|
||||
:canShipItems="canShipItems"
|
||||
:logisticsId="props.data.logisticsId"
|
||||
:logisticsNo="props.data.logisticsNo"
|
||||
:deliveryTime="props.data.deliveryTime"
|
||||
@@ -248,13 +250,46 @@
|
||||
const hasDelayedItems = computed(() => {
|
||||
if (!isAiStoreOrder.value) return false;
|
||||
if (isPickUpOrder.value) return false;
|
||||
const delayRecords = getCurrentDelayRecords();
|
||||
return delayRecords.some((record) => Number(record?.status) === 1);
|
||||
});
|
||||
|
||||
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(props.data?.productCount || props.data?.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(props.data?.productCount || props.data?.totalCount || 0) || 0;
|
||||
return totalCount > 0;
|
||||
}
|
||||
return delayRecords.some((record) => {
|
||||
const status = Number(record?.status);
|
||||
return status === 1 || status === 2;
|
||||
});
|
||||
});
|
||||
|
||||
const getCurrentDelayRecords = () => {
|
||||
if (Array.isArray(state.delayRecords) && state.delayRecords.length > 0) return state.delayRecords;
|
||||
const orderRecords = Array.isArray(props.data?.delayRecords)
|
||||
? props.data.delayRecords
|
||||
: Array.isArray(props.data?.delayRecordList)
|
||||
? props.data.delayRecordList
|
||||
: [];
|
||||
return orderRecords.some((record) => Number(record?.status) === 1);
|
||||
});
|
||||
return orderRecords.filter(Boolean);
|
||||
};
|
||||
|
||||
const hasLogistics = computed(() => {
|
||||
const data = props.data || {};
|
||||
@@ -356,8 +391,14 @@
|
||||
});
|
||||
if (code === 0) {
|
||||
close?.();
|
||||
currentStatus.value = 50;
|
||||
await loadDelayRecords(true);
|
||||
const records = getCurrentDelayRecords();
|
||||
const hasDelayed = records.some((r) => Number(r?.status) === 1);
|
||||
if (hasDelayed && ![15, 20, 30].includes(Number(currentStatus.value))) {
|
||||
currentStatus.value = 50;
|
||||
} else if (!hasDelayed && Number(currentStatus.value) === 50) {
|
||||
currentStatus.value = 10;
|
||||
}
|
||||
emit('downData');
|
||||
}
|
||||
};
|
||||
@@ -372,8 +413,14 @@
|
||||
});
|
||||
if (code === 0) {
|
||||
close?.();
|
||||
currentStatus.value = 10;
|
||||
await loadDelayRecords(true);
|
||||
const records = getCurrentDelayRecords();
|
||||
const hasDelayed = records.some((r) => Number(r?.status) === 1);
|
||||
if (hasDelayed && ![15, 20, 30].includes(Number(currentStatus.value))) {
|
||||
currentStatus.value = 50;
|
||||
} else if (Number(currentStatus.value) === 50) {
|
||||
currentStatus.value = 10;
|
||||
}
|
||||
emit('downData');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user