feat: 查看物流展示

This commit is contained in:
2026-08-06 15:39:41 +08:00
parent 497babbc3d
commit b8bcd46f1d
5 changed files with 124 additions and 8 deletions
+37 -4
View File
@@ -2,18 +2,25 @@
<view class="flex-center ju-flex-end w100"> <view class="flex-center ju-flex-end w100">
<view <view
class="ai-button3 w_144 m-r-10" class="ai-button3 w_144 m-r-10"
v-if="props.status === 10 && !props.disableDelayShipment" v-if="(props.status === 10 || props.status === 15) && !props.disableDelayShipment"
@tap.stop="emit('delay')" @tap.stop="emit('delay')"
> >
延迟发货 延迟发货
</view> </view>
<view <view
class="ai-button3 w_144 m-r-10" class="ai-button3 w_144 m-r-10"
v-if="(props.status === 50 || props.hasDelayedItems) && !props.disableDelayShipment" v-if="(props.status === 50 || props.status === 15 || props.hasDelayedItems) && !props.disableDelayShipment"
@tap.stop="emit('now')" @tap.stop="emit('now')"
> >
立即发货 立即发货
</view> </view>
<view
class="ai-button3 w_144 m-r-10"
v-if="hasExpress"
@tap.stop="emit('express')"
>
查看物流
</view>
<view <view
class="ai-button3 w_144" class="ai-button3 w_144"
v-if="props.showView && props.status !== 70" v-if="props.showView && props.status !== 70"
@@ -21,7 +28,7 @@
> >
{{ props.viewText }} {{ props.viewText }}
</view> </view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 20" @tap.stop="emit('confirm')"> <view class="ai-button1 w_144 m-l-16" v-if="props.status === 20 || props.status === 15" @tap.stop="emit('confirm')">
确认收货 确认收货
</view> </view>
<view class="ai-button1 w_144 m-l-16" v-if="props.status === 0" @tap.stop="emit('pay')"> <view class="ai-button1 w_144 m-l-16" v-if="props.status === 0" @tap.stop="emit('pay')">
@@ -37,6 +44,7 @@
</template> </template>
<script setup> <script setup>
import { computed } from 'vue';
const props = defineProps({ const props = defineProps({
status: { status: {
type: Number, type: Number,
@@ -58,7 +66,32 @@
type: Boolean, type: Boolean,
default: false, default: false,
}, },
logisticsId: {
type: [Number, String],
default: 0,
},
logisticsNo: {
type: String,
default: '',
},
deliveryTime: {
type: [Number, String],
default: '',
},
hasLogistics: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel']); const hasExpress = computed(() => {
if ([15, 20, 30].includes(props.status)) return true;
if (props.hasLogistics) return true;
if (Number(props.logisticsId) > 0) return true;
if (props.logisticsNo && String(props.logisticsNo).trim()) return true;
if (props.deliveryTime) return true;
return false;
});
const emit = defineEmits(['delay', 'now', 'view', 'confirm', 'pay', 'cancel', 'express']);
</script> </script>
+4 -1
View File
@@ -483,7 +483,10 @@
return { delayed: false, count: 0, text: '' }; return { delayed: false, count: 0, text: '' };
} }
const { spuRecords } = buildSpuRecordAssignment(spuItem); const { spuRecords } = buildSpuRecordAssignment(spuItem);
const count = sumDelayCount(spuRecords); const delayingRecords = spuRecords.filter(
(record) => resolveDelayStatus(record) === 1,
);
const count = sumDelayCount(delayingRecords);
if (!count) { if (!count) {
return { delayed: false, count: 0, text: '' }; return { delayed: false, count: 0, text: '' };
} }
+37
View File
@@ -79,12 +79,17 @@
:disableDelayShipment="isPickUpOrder || !isAiStoreOrder" :disableDelayShipment="isPickUpOrder || !isAiStoreOrder"
:showView="true" :showView="true"
:hasDelayedItems="hasDelayedItems" :hasDelayedItems="hasDelayedItems"
:logisticsId="props.data.logisticsId"
:logisticsNo="props.data.logisticsNo"
:deliveryTime="props.data.deliveryTime"
:hasLogistics="hasLogistics"
@delay="onDelayShipment" @delay="onDelayShipment"
@now="onNowShipment" @now="onNowShipment"
@view="goAiOrderInfo" @view="goAiOrderInfo"
@confirm="confirmReceiveOrder" @confirm="confirmReceiveOrder"
@pay="goPay" @pay="goPay"
@cancel="cancelAiOrder" @cancel="cancelAiOrder"
@express="goExpressLog"
/> />
</view> </view>
<view class="" style="margin-top: 32rpx" v-else-if="!props.isAfterSale"> <view class="" style="margin-top: 32rpx" v-else-if="!props.isAfterSale">
@@ -231,6 +236,26 @@
return orderRecords.some((record) => Number(record?.status) === 1); return orderRecords.some((record) => Number(record?.status) === 1);
}); });
const hasLogistics = computed(() => {
const data = props.data || {};
if (Number(data.logisticsId) > 0) return true;
if (data.logisticsNo && String(data.logisticsNo).trim()) return true;
if (data.deliveryTime) return true;
const items = Array.isArray(data.items) ? data.items : [];
for (const item of items) {
if (Number(item?.logisticsId) > 0) return true;
if (item?.logisticsNo && String(item.logisticsNo).trim()) return true;
if (item?.deliveryTime) return true;
const subItems = Array.isArray(item?.items) ? item.items : [];
for (const sub of subItems) {
if (Number(sub?.logisticsId) > 0) return true;
if (sub?.logisticsNo && String(sub.logisticsNo).trim()) return true;
if (sub?.deliveryTime) return true;
}
}
return false;
});
const state = reactive({ const state = reactive({
delayRecords: [], delayRecords: [],
delayRecordsLoaded: false, delayRecordsLoaded: false,
@@ -385,6 +410,18 @@
proxy.utils.go('/pages/AI/orderInfo', { id }); proxy.utils.go('/pages/AI/orderInfo', { id });
}; };
const goExpressLog = () => {
const id = resolveAiOrderId(props.data);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
proxy.utils.go('/pages/order/express/log', { id });
};
const confirmReceiveOrder = async () => { const confirmReceiveOrder = async () => {
const id = resolveAiOrderId(props.data); const id = resolveAiOrderId(props.data);
if (!id) return; if (!id) return;
+39 -2
View File
@@ -106,11 +106,16 @@
:status="Number(state.orderInfo.status)" :status="Number(state.orderInfo.status)"
:disableDelayShipment="isPickUpOrder || !isAiStoreOrder" :disableDelayShipment="isPickUpOrder || !isAiStoreOrder"
:hasDelayedItems="hasDelayedItems" :hasDelayedItems="hasDelayedItems"
:logisticsId="state.orderInfo.logisticsId"
:logisticsNo="state.orderInfo.logisticsNo"
:deliveryTime="state.orderInfo.deliveryTime"
:hasLogistics="hasLogistics"
@delay="delayShipment" @delay="delayShipment"
@now="nowShipment" @now="nowShipment"
@confirm="confirmReceiveOrder" @confirm="confirmReceiveOrder"
@pay="goPay" @pay="goPay"
@cancel="cancelAiOrder" @cancel="cancelAiOrder"
@express="goExpressLog"
/> />
<card_orderBan <card_orderBan
v-else v-else
@@ -229,14 +234,34 @@
return records.some((record) => Number(record?.status) === 1); return records.some((record) => Number(record?.status) === 1);
}); });
const hasLogistics = computed(() => {
const info = state.orderInfo || {};
if (Number(info.logisticsId) > 0) return true;
if (info.logisticsNo && String(info.logisticsNo).trim()) return true;
if (info.deliveryTime) return true;
const items = Array.isArray(info.items) ? info.items : [];
for (const item of items) {
if (Number(item?.logisticsId) > 0) return true;
if (item?.logisticsNo && String(item.logisticsNo).trim()) return true;
if (item?.deliveryTime) return true;
const subItems = Array.isArray(item?.items) ? item.items : [];
for (const sub of subItems) {
if (Number(sub?.logisticsId) > 0) return true;
if (sub?.logisticsNo && String(sub.logisticsNo).trim()) return true;
if (sub?.deliveryTime) return true;
}
}
return false;
});
const showBottomBar = computed(() => { const showBottomBar = computed(() => {
if (!isAiActionOrder.value) return true; if (!isAiActionOrder.value) return true;
const status = Number(state.orderInfo?.status); const status = Number(state.orderInfo?.status);
if ([0, 20].includes(status)) return true; if ([0, 15, 20].includes(status)) return true;
if (!isAiStoreOrder.value) return false; if (!isAiStoreOrder.value) return false;
if (isPickUpOrder.value) return false; if (isPickUpOrder.value) return false;
if (hasDelayedItems.value) return true; if (hasDelayedItems.value) return true;
return [10, 50, 70].includes(status); return [10, 15, 50, 70].includes(status);
}); });
const resolvePickUpStoreId = (data = {}) => { const resolvePickUpStoreId = (data = {}) => {
@@ -444,6 +469,18 @@
}); });
}; };
const goExpressLog = () => {
const id = resolveAiOrderId(state.orderInfo);
if (!id) {
uni.showToast({
title: '订单信息异常',
icon: 'none',
});
return;
}
sheep.$router.go('/pages/order/express/log', { id });
};
const cancelAiOrder = () => { const cancelAiOrder = () => {
const id = resolveAiOrderId(state.orderInfo); const id = resolveAiOrderId(state.orderInfo);
if (!id) return; if (!id) return;
+7 -1
View File
@@ -103,7 +103,7 @@ export function formatOrderColor(order) {
if (order.status === 0) { if (order.status === 0) {
return 'info-color'; return 'info-color';
} }
if (order.status === 10 || order.status === 20 || (order.status === 30 && !order.commentStatus)) { if (order.status === 10 || order.status === 15 || order.status === 20 || (order.status === 30 && !order.commentStatus)) {
return 'warning-color'; return 'warning-color';
} }
if (order.status === 30 && order.commentStatus) { if (order.status === 30 && order.commentStatus) {
@@ -125,6 +125,9 @@ export function formatOrderStatus(order) {
if (order.status == 10) { if (order.status == 10) {
return '待发货'; return '待发货';
} }
if (order.status == 15) {
return '部分发货';
}
if (order.status == 20) { if (order.status == 20) {
return '待收货'; return '待收货';
} }
@@ -162,6 +165,9 @@ export function formatOrderStatusDescription(order) {
if (order.status === 10) { if (order.status === 10) {
return '商家未发货,请耐心等待'; return '商家未发货,请耐心等待';
} }
if (order.status === 15) {
return '商家部分发货,剩余商品请耐心等待';
}
if (order.status === 20) { if (order.status === 20) {
return '商家已发货,请耐心等待'; return '商家已发货,请耐心等待';
} }