feat: 区分普通订单和ai订单的查看物流
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
:data="state.orderInfo"
|
||||
type="4"
|
||||
@getOrderDetail="getOrderDetail"
|
||||
@openExpress="handleOpenExpress"
|
||||
></card_order>
|
||||
|
||||
<!-- 价格信息 -->
|
||||
@@ -77,6 +78,7 @@
|
||||
:data="state.orderInfo"
|
||||
:code="3"
|
||||
v-if="state.orderInfo.deliveryTime"
|
||||
@openExpress="handleOpenExpress"
|
||||
></truckLine>
|
||||
</view>
|
||||
<view class="notice-item flex-row ju-between">
|
||||
@@ -99,8 +101,14 @@
|
||||
</view>
|
||||
<view
|
||||
class="flex btns bg16"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2"
|
||||
>
|
||||
<view
|
||||
v-if="hasExpress"
|
||||
class="ai-button3 h_70 line70 size28"
|
||||
:class="{ 'm-r-28': statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2 }"
|
||||
@click="handleOpenExpress"
|
||||
>查看物流</view
|
||||
>
|
||||
<view
|
||||
class="ai-button1 h_70 line70 size28"
|
||||
:class="{
|
||||
@@ -119,13 +127,21 @@
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<ExpressListPopup
|
||||
ref="expressListPopupRef"
|
||||
popup-type="center"
|
||||
:order-no="state.orderInfo.no || ''"
|
||||
:order-data="state.orderInfo"
|
||||
:delay-records="[]"
|
||||
:order-id="orderId || state.orderInfo.id || 0"
|
||||
/>
|
||||
</s-pages>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { reactive, ref, getCurrentInstance, computed } from 'vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import {
|
||||
fen2yuan,
|
||||
@@ -137,6 +153,7 @@
|
||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
||||
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
|
||||
import card_order from '@/components/orderItem/card_order.vue';
|
||||
import ExpressListPopup from '@/components/orderItem/ExpressListPopup.vue';
|
||||
|
||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
|
||||
@@ -288,6 +305,33 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const expressListPopupRef = ref();
|
||||
const isPickUpOrder = () => Number(state.orderInfo?.deliveryType ?? 0) === 2;
|
||||
const hasExpress = computed(() => {
|
||||
const s = Number(state.orderInfo?.status ?? -1);
|
||||
if ([15, 20, 30].includes(s)) return true;
|
||||
if (Number(state.orderInfo?.logisticsId ?? 0) > 0) return true;
|
||||
if (state.orderInfo?.logisticsNo && String(state.orderInfo.logisticsNo).trim()) return true;
|
||||
if (state.orderInfo?.deliveryTime) return true;
|
||||
return false;
|
||||
});
|
||||
const handleOpenExpress = () => {
|
||||
const id = orderId.value || state.orderInfo?.id || 0;
|
||||
if (!id) {
|
||||
uni.showToast({
|
||||
title: '订单信息异常',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 赠送店铺订单详情页:赠送订单(无论type多少)一律弹窗查看物流;自提兜底走原生
|
||||
if (!isPickUpOrder()) {
|
||||
expressListPopupRef.value?.open?.();
|
||||
return;
|
||||
}
|
||||
sheep.$router.go('/pages/order/express/log', { id });
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
+23
-3
@@ -108,8 +108,14 @@
|
||||
</view>
|
||||
<view
|
||||
class="flex btns bg16"
|
||||
v-if="statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2"
|
||||
>
|
||||
<view
|
||||
v-if="hasExpress"
|
||||
class="ai-button3 h_70 line70 size28"
|
||||
:class="{ 'm-r-28': statusObj[state.orderInfo.status]?.btn1 || statusObj[state.orderInfo.status]?.btn2 }"
|
||||
@click="handleOpenExpress"
|
||||
>查看物流</view
|
||||
>
|
||||
<view
|
||||
class="ai-button1 h_70 line70 size28"
|
||||
:class="{
|
||||
@@ -142,7 +148,7 @@
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, getCurrentInstance } from 'vue';
|
||||
import { reactive, ref, getCurrentInstance, computed } from 'vue';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import {
|
||||
fen2yuan,
|
||||
@@ -334,6 +340,15 @@
|
||||
|
||||
const expressListPopupRef = ref();
|
||||
const closeExpressListPopup = () => {};
|
||||
const isPickUpOrder = () => Number(state.orderInfo?.deliveryType ?? 0) === 2;
|
||||
const hasExpress = computed(() => {
|
||||
const s = Number(state.orderInfo?.status ?? -1);
|
||||
if ([15, 20, 30].includes(s)) return true;
|
||||
if (Number(state.orderInfo?.logisticsId ?? 0) > 0) return true;
|
||||
if (state.orderInfo?.logisticsNo && String(state.orderInfo.logisticsNo).trim()) return true;
|
||||
if (state.orderInfo?.deliveryTime) return true;
|
||||
return false;
|
||||
});
|
||||
const handleOpenExpress = () => {
|
||||
const id = orderId.value || state.orderInfo?.id || 0;
|
||||
if (!id) {
|
||||
@@ -343,7 +358,12 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
expressListPopupRef.value?.open?.();
|
||||
// AI 店铺订单详情页:店铺订单(无论type多少)一律弹窗查看物流;自提兜底走原生
|
||||
if (!isPickUpOrder()) {
|
||||
expressListPopupRef.value?.open?.();
|
||||
return;
|
||||
}
|
||||
sheep.$router.go('/pages/order/express/log', { id });
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
+23
-6
@@ -230,11 +230,12 @@
|
||||
const pickUpVerifyRef = ref();
|
||||
|
||||
const isAiActionOrder = computed(() => {
|
||||
const orderType = Number(state.orderInfo?.type ?? state.orderType ?? 0);
|
||||
return (
|
||||
String(state.source) === 'aishop' ||
|
||||
String(state.orderType) === '5' ||
|
||||
String(state.orderInfo?.__source) === 'aishop' ||
|
||||
Number(state.orderInfo?.type) === 5
|
||||
orderType === 4 ||
|
||||
orderType === 5
|
||||
);
|
||||
});
|
||||
|
||||
@@ -321,8 +322,10 @@
|
||||
const showBottomBar = computed(() => {
|
||||
if (!isAiActionOrder.value) return true;
|
||||
const status = Number(state.orderInfo?.status);
|
||||
if ([0, 15, 20].includes(status)) return true;
|
||||
if (!isAiStoreOrder.value) return false;
|
||||
// 有物流信息(需要展示"查看物流")时,强制显示底部按钮栏
|
||||
if (hasLogistics.value) return true;
|
||||
if ([0, 15, 20, 30].includes(status)) return true;
|
||||
if (!isAiStoreOrder.value) return hasLogistics.value;
|
||||
if (isPickUpOrder.value) return false;
|
||||
if (hasDelayedItems.value) return true;
|
||||
return [10, 15, 50, 70].includes(status);
|
||||
@@ -565,8 +568,15 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 店铺订单(source=aishop)、入店订单(type=4)、赠送店铺订单(type=5) 一律弹窗查看物流;只有普通商城订单走原生跳转
|
||||
const orderType = Number(state.orderInfo?.type ?? state.orderType ?? 0);
|
||||
if (orderType !== 0 && isAiStoreOrder.value && !isPickUpOrder.value) {
|
||||
const isStoreOrGiftOrInStore =
|
||||
isAiStoreOrder.value || orderType === 4 || orderType === 5;
|
||||
if (!isStoreOrGiftOrInStore) {
|
||||
sheep.$router.go('/pages/order/express/log', { id });
|
||||
return;
|
||||
}
|
||||
if (!isPickUpOrder.value) {
|
||||
expressListPopupRef.value?.open?.();
|
||||
return;
|
||||
}
|
||||
@@ -582,8 +592,15 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 店铺订单(source=aishop)、入店订单(type=4)、赠送店铺订单(type=5) 一律弹窗查看物流;只有普通商城订单走原生跳转
|
||||
const orderType = Number(state.orderInfo?.type ?? state.orderType ?? 0);
|
||||
if (orderType !== 0 && !isPickUpOrder.value) {
|
||||
const isStoreOrGiftOrInStore =
|
||||
isAiStoreOrder.value || orderType === 4 || orderType === 5;
|
||||
if (!isStoreOrGiftOrInStore) {
|
||||
sheep.$router.go('/pages/order/express/log', { id });
|
||||
return;
|
||||
}
|
||||
if (!isPickUpOrder.value) {
|
||||
expressListPopupRef.value?.open?.();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user