feat: 解决延迟发货展示问题
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
<view class="flex-center ju-flex-end w100">
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10"
|
||||
v-if="(props.status === 10 || props.status === 15) && !props.disableDelayShipment"
|
||||
v-if="showDelay && !props.disableDelayShipment"
|
||||
@tap.stop="emit('delay')"
|
||||
>
|
||||
延迟发货
|
||||
</view>
|
||||
<view
|
||||
class="ai-button3 w_144 m-r-10"
|
||||
v-if="(props.status === 50 || props.hasDelayedItems) && !props.disableDelayShipment"
|
||||
v-if="showNow && !props.disableDelayShipment"
|
||||
@tap.stop="emit('now')"
|
||||
>
|
||||
立即发货
|
||||
@@ -66,6 +66,14 @@
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
canDelayItems: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
canShipItems: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
logisticsId: {
|
||||
type: [Number, String],
|
||||
default: 0,
|
||||
@@ -84,6 +92,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const showDelay = computed(() => {
|
||||
if (![10, 15, 50].includes(Number(props.status))) return false;
|
||||
if (Number(props.status) === 10 || Number(props.status) === 15) return true;
|
||||
return Boolean(props.canDelayItems);
|
||||
});
|
||||
|
||||
const showNow = computed(() => {
|
||||
if (![10, 15, 50].includes(Number(props.status))) return false;
|
||||
if (Number(props.status) === 50) return true;
|
||||
if (Boolean(props.hasDelayedItems)) return true;
|
||||
return Boolean(props.canShipItems);
|
||||
});
|
||||
|
||||
const hasExpress = computed(() => {
|
||||
if ([15, 20, 30].includes(props.status)) return true;
|
||||
if (props.hasLogistics) return true;
|
||||
|
||||
@@ -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