feat: 提货清单隐藏取货码
This commit is contained in:
@@ -19,7 +19,9 @@
|
||||
<view class="gear">
|
||||
<image :src="sheep.$url.static('/static/img/shop/writeOff.png')"></image>
|
||||
</view>
|
||||
<view class="num">{{ orderInfo.pickUpVerifyCode }}</view>
|
||||
<view class="num-wrap" @tap="copyVerifyCode">
|
||||
<view class="num">{{ orderInfo.pickUpVerifyCode }}</view>
|
||||
</view>
|
||||
<view class="rules">
|
||||
<view class="item">
|
||||
<view class="rulesTitle flex flex-wrap align-center"> 核销时间 </view>
|
||||
@@ -85,9 +87,34 @@
|
||||
|
||||
const goStockProgress = () => {
|
||||
const id = props.orderInfo?.id || props.orderInfo?.orderId;
|
||||
const pickUpStoreId = Number(
|
||||
props.orderInfo?.pickUpStoreId ||
|
||||
props.orderInfo?.pickUpStore?.id ||
|
||||
props.orderInfo?.pickUpStore?.storeId ||
|
||||
props.systemStore?.id ||
|
||||
props.systemStore?.storeId ||
|
||||
props.orderInfo?.storeId ||
|
||||
0,
|
||||
);
|
||||
if (!id) return;
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/stockProgress?id=${id}`,
|
||||
url: `/pages/order/stockProgress?id=${id}${
|
||||
pickUpStoreId > 0 ? `&pickUpStoreId=${pickUpStoreId}` : ''
|
||||
}`,
|
||||
});
|
||||
};
|
||||
|
||||
const copyVerifyCode = () => {
|
||||
const code = String(props.orderInfo?.pickUpVerifyCode || '').trim();
|
||||
if (!code) {
|
||||
sheep.$helper.toast('暂无核销码');
|
||||
return;
|
||||
}
|
||||
uni.setClipboardData({
|
||||
data: code,
|
||||
success: () => {
|
||||
sheep.$helper.toast('核销码已复制');
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -277,13 +304,17 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.order-details .writeOff .num-wrap {
|
||||
width: 590rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.order-details .writeOff .num {
|
||||
background-color: #f0c34c;
|
||||
width: 590rpx;
|
||||
width: 100%;
|
||||
height: 84rpx;
|
||||
color: #282828;
|
||||
font-size: 48rpx;
|
||||
margin: 0 auto;
|
||||
border-radius: 0 0 20rpx 20rpx;
|
||||
text-align: center;
|
||||
padding-top: 4rpx;
|
||||
|
||||
@@ -70,9 +70,11 @@
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import sheep from '@/sheep';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
import OrderStoreApi from '@/sheep/api/trade/orderStore';
|
||||
|
||||
const state = reactive({
|
||||
orderId: 0,
|
||||
pickUpStoreId: 0,
|
||||
orderInfo: {},
|
||||
loading: false,
|
||||
});
|
||||
@@ -80,7 +82,11 @@
|
||||
const sortingPercent = ref(72);
|
||||
|
||||
const items = computed(() => {
|
||||
const list = state.orderInfo?.items;
|
||||
const list =
|
||||
state.orderInfo?.items ||
|
||||
state.orderInfo?.orderItems ||
|
||||
state.orderInfo?.itemList ||
|
||||
state.orderInfo?.productList;
|
||||
return Array.isArray(list) ? list : [];
|
||||
});
|
||||
|
||||
@@ -93,10 +99,31 @@
|
||||
return Boolean(state.orderInfo?.pickUpVerifyCode) && Boolean(state.orderInfo?.payStatus);
|
||||
});
|
||||
|
||||
const stage = computed(() => {
|
||||
if (state.orderInfo?.pickUpVerifyTime || Number(state.orderInfo?.status) === 30) return 'done';
|
||||
if (state.orderInfo?.deliveryTime) return 'delivered';
|
||||
const resolvePickUpStoreId = (data = {}) => {
|
||||
return Number(
|
||||
data?.pickUpStoreId || data?.pickUpStore?.id || data?.pickUpStore?.storeId || data?.storeId || 0,
|
||||
);
|
||||
};
|
||||
|
||||
const resolveStage = (data = {}) => {
|
||||
const rawStatus = Number(data?.preparationStatus ?? data?.status ?? 0);
|
||||
if (data?.pickUpVerifyTime || data?.verifyTime || data?.completedTime || rawStatus === 30 || rawStatus === 3) {
|
||||
return 'done';
|
||||
}
|
||||
if (
|
||||
data?.deliveryTime ||
|
||||
data?.arriveStoreTime ||
|
||||
data?.deliveredTime ||
|
||||
rawStatus === 20 ||
|
||||
rawStatus === 2
|
||||
) {
|
||||
return 'delivered';
|
||||
}
|
||||
return 'sorting';
|
||||
};
|
||||
|
||||
const stage = computed(() => {
|
||||
return resolveStage(state.orderInfo);
|
||||
});
|
||||
|
||||
const steps = computed(() => {
|
||||
@@ -163,11 +190,28 @@
|
||||
|
||||
const getDetail = async () => {
|
||||
if (!state.orderId || state.loading) return;
|
||||
if (!(state.pickUpStoreId > 0)) {
|
||||
const detailRes = await OrderApi.getOrderDetail(state.orderId);
|
||||
if (detailRes?.code === 0) {
|
||||
state.pickUpStoreId = resolvePickUpStoreId(detailRes.data);
|
||||
}
|
||||
}
|
||||
if (!(state.pickUpStoreId > 0)) {
|
||||
uni.showToast({
|
||||
title: '缺少门店信息',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
state.loading = true;
|
||||
const res = await OrderApi.getOrderDetail(state.orderId);
|
||||
const res = await OrderStoreApi.getPreparationStatus(state.pickUpStoreId, state.orderId);
|
||||
state.loading = false;
|
||||
if (res?.code !== 0) return;
|
||||
state.orderInfo = res.data || {};
|
||||
const data = res.data || {};
|
||||
state.orderInfo = data?.orderInfo || data;
|
||||
if (!(state.pickUpStoreId > 0)) {
|
||||
state.pickUpStoreId = resolvePickUpStoreId(state.orderInfo);
|
||||
}
|
||||
};
|
||||
|
||||
const notifyStore = () => {
|
||||
@@ -180,6 +224,8 @@
|
||||
onLoad((options) => {
|
||||
const id = Number(options?.id || 0);
|
||||
if (id) state.orderId = id;
|
||||
const pickUpStoreId = Number(options?.pickUpStoreId || options?.storeId || 0);
|
||||
if (pickUpStoreId > 0) state.pickUpStoreId = pickUpStoreId;
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
|
||||
Reference in New Issue
Block a user