feat: 备货进度商品展示
This commit is contained in:
+19
-2
@@ -50,6 +50,8 @@
|
|||||||
ref="pickUpVerifyRef"
|
ref="pickUpVerifyRef"
|
||||||
:orderInfo="state.orderInfo"
|
:orderInfo="state.orderInfo"
|
||||||
:systemStore="systemStore"
|
:systemStore="systemStore"
|
||||||
|
source="aishop"
|
||||||
|
detailStyle="ai"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 价格信息 -->
|
<!-- 价格信息 -->
|
||||||
@@ -189,6 +191,20 @@
|
|||||||
const pickUpVerifyRef = ref();
|
const pickUpVerifyRef = ref();
|
||||||
let orderId = ref();
|
let orderId = ref();
|
||||||
|
|
||||||
|
const resolvePickUpStoreId = (data = {}) => {
|
||||||
|
return Number(
|
||||||
|
data?.pickUpStoreId ||
|
||||||
|
data?.pickUpStore?.id ||
|
||||||
|
data?.pickUpStore?.storeId ||
|
||||||
|
data?.pickUpStoreVO?.id ||
|
||||||
|
data?.pickUpStoreVO?.storeId ||
|
||||||
|
data?.store?.id ||
|
||||||
|
data?.store?.storeId ||
|
||||||
|
data?.storeId ||
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
async function getOrderDetail() {
|
async function getOrderDetail() {
|
||||||
let id = orderId.value;
|
let id = orderId.value;
|
||||||
// 对详情数据进行适配
|
// 对详情数据进行适配
|
||||||
@@ -197,8 +213,9 @@
|
|||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
state.orderInfo = res.data;
|
state.orderInfo = res.data;
|
||||||
handleOrderButtons(state.orderInfo);
|
handleOrderButtons(state.orderInfo);
|
||||||
if (res.data.pickUpStoreId) {
|
const pickUpStoreId = resolvePickUpStoreId(res.data);
|
||||||
const { data } = await StoreApi.getStoreById(res.data.pickUpStoreId);
|
if (pickUpStoreId > 0) {
|
||||||
|
const { data } = await StoreApi.getStoreById(pickUpStoreId);
|
||||||
systemStore.value = data || {};
|
systemStore.value = data || {};
|
||||||
} else {
|
} else {
|
||||||
systemStore.value = {};
|
systemStore.value = {};
|
||||||
|
|||||||
+18
-6
@@ -36,6 +36,9 @@
|
|||||||
ref="pickUpVerifyRef"
|
ref="pickUpVerifyRef"
|
||||||
:orderInfo="state.orderInfo"
|
:orderInfo="state.orderInfo"
|
||||||
:systemStore="systemStore"
|
:systemStore="systemStore"
|
||||||
|
:source="state.source"
|
||||||
|
:orderType="state.orderType"
|
||||||
|
detailStyle="order"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 价格信息 -->
|
<!-- 价格信息 -->
|
||||||
@@ -159,6 +162,20 @@
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const resolvePickUpStoreId = (data = {}) => {
|
||||||
|
return Number(
|
||||||
|
data?.pickUpStoreId ||
|
||||||
|
data?.pickUpStore?.id ||
|
||||||
|
data?.pickUpStore?.storeId ||
|
||||||
|
data?.pickUpStoreVO?.id ||
|
||||||
|
data?.pickUpStoreVO?.storeId ||
|
||||||
|
data?.store?.id ||
|
||||||
|
data?.store?.storeId ||
|
||||||
|
data?.storeId ||
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const resolveAiOrderId = (data) => {
|
const resolveAiOrderId = (data) => {
|
||||||
return data?.id || data?.orderId;
|
return data?.id || data?.orderId;
|
||||||
};
|
};
|
||||||
@@ -266,12 +283,7 @@
|
|||||||
handleOrderButtons(state.orderInfo);
|
handleOrderButtons(state.orderInfo);
|
||||||
// 配送方式:门店自提
|
// 配送方式:门店自提
|
||||||
const isPickUp = Number(res.data?.deliveryType) === 2;
|
const isPickUp = Number(res.data?.deliveryType) === 2;
|
||||||
const pickUpStoreId = Number(
|
const pickUpStoreId = resolvePickUpStoreId(res.data);
|
||||||
res.data?.pickUpStoreId ||
|
|
||||||
res.data?.pickUpStore?.id ||
|
|
||||||
res.data?.pickUpStore?.storeId ||
|
|
||||||
res.data?.storeId,
|
|
||||||
);
|
|
||||||
if (isPickUp && pickUpStoreId > 0) {
|
if (isPickUp && pickUpStoreId > 0) {
|
||||||
const { data } = await StoreApi.getStoreById(pickUpStoreId);
|
const { data } = await StoreApi.getStoreById(pickUpStoreId);
|
||||||
systemStore.value = data || {};
|
systemStore.value = data || {};
|
||||||
|
|||||||
@@ -80,27 +80,52 @@
|
|||||||
type: Object,
|
type: Object,
|
||||||
default() {},
|
default() {},
|
||||||
},
|
},
|
||||||
|
source: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
orderType: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
detailStyle: {
|
||||||
|
type: String,
|
||||||
|
default: 'order',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
qrcodeSize: 145,
|
qrcodeSize: 145,
|
||||||
});
|
});
|
||||||
|
|
||||||
const goStockProgress = () => {
|
const resolvePickUpStoreId = () => {
|
||||||
const id = props.orderInfo?.id || props.orderInfo?.orderId;
|
return Number(
|
||||||
const pickUpStoreId = Number(
|
|
||||||
props.orderInfo?.pickUpStoreId ||
|
props.orderInfo?.pickUpStoreId ||
|
||||||
props.orderInfo?.pickUpStore?.id ||
|
props.orderInfo?.pickUpStore?.id ||
|
||||||
props.orderInfo?.pickUpStore?.storeId ||
|
props.orderInfo?.pickUpStore?.storeId ||
|
||||||
|
props.orderInfo?.pickUpStoreVO?.id ||
|
||||||
|
props.orderInfo?.pickUpStoreVO?.storeId ||
|
||||||
|
props.orderInfo?.store?.id ||
|
||||||
|
props.orderInfo?.store?.storeId ||
|
||||||
props.systemStore?.id ||
|
props.systemStore?.id ||
|
||||||
props.systemStore?.storeId ||
|
props.systemStore?.storeId ||
|
||||||
props.orderInfo?.storeId ||
|
props.orderInfo?.storeId ||
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const goStockProgress = () => {
|
||||||
|
const id = props.orderInfo?.id || props.orderInfo?.orderId;
|
||||||
|
const pickUpStoreId = resolvePickUpStoreId();
|
||||||
|
const source = String(props.source || props.orderInfo?.__source || props.orderInfo?.source || '').trim();
|
||||||
|
const orderType = String(props.orderType || props.orderInfo?.type || '').trim();
|
||||||
|
const detailStyle = String(props.detailStyle || '').trim();
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/order/stockProgress?id=${id}${
|
url: `/pages/order/stockProgress?id=${id}${
|
||||||
pickUpStoreId > 0 ? `&pickUpStoreId=${pickUpStoreId}` : ''
|
pickUpStoreId > 0 ? `&pickUpStoreId=${pickUpStoreId}` : ''
|
||||||
}`,
|
}${source ? `&source=${encodeURIComponent(source)}` : ''}${
|
||||||
|
orderType ? `&type=${encodeURIComponent(orderType)}` : ''
|
||||||
|
}${detailStyle ? `&detailStyle=${encodeURIComponent(detailStyle)}` : ''}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -45,15 +45,14 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="goods-card bg24">
|
<view class="goods-card bg24">
|
||||||
<view class="goods-title">商品清单 ({{ items.length }})</view>
|
<card_order
|
||||||
<view v-for="it in items" :key="it.id || it.skuId" class="goods-row">
|
v-if="goodsCardData.items.length"
|
||||||
<image class="goods-pic" :src="it.picUrl" mode="aspectFill" />
|
class="order-goods"
|
||||||
<view class="goods-main">
|
:data="goodsCardData"
|
||||||
<view class="goods-name lineTwo">{{ it.spuName }}</view>
|
:type="goodsCardType"
|
||||||
<view class="goods-spec">{{ getSpecText(it) }}</view>
|
theme="2"
|
||||||
<view class="goods-count">x{{ it.count }}</view>
|
/>
|
||||||
</view>
|
<view v-else class="goods-empty">暂无商品信息</view>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -71,18 +70,23 @@
|
|||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import OrderApi from '@/sheep/api/trade/order';
|
import OrderApi from '@/sheep/api/trade/order';
|
||||||
import OrderStoreApi from '@/sheep/api/trade/orderStore';
|
import OrderStoreApi from '@/sheep/api/trade/orderStore';
|
||||||
|
import { getOrderDetail as getAiOrderDetail, getOpenOrderDetail } from '@/sheep/api/ai';
|
||||||
|
import card_order from '@/components/orderItem/card_order.vue';
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
orderId: 0,
|
orderId: 0,
|
||||||
pickUpStoreId: 0,
|
pickUpStoreId: 0,
|
||||||
preparationStatus: null,
|
preparationStatus: null,
|
||||||
|
source: '',
|
||||||
|
orderType: '',
|
||||||
|
detailStyle: 'order',
|
||||||
orderInfo: {},
|
orderInfo: {},
|
||||||
loading: false,
|
loading: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const sortingPercent = ref(72);
|
const sortingPercent = ref(72);
|
||||||
|
|
||||||
const items = computed(() => {
|
const goodsItems = computed(() => {
|
||||||
const list =
|
const list =
|
||||||
state.orderInfo?.items ||
|
state.orderInfo?.items ||
|
||||||
state.orderInfo?.orderItems ||
|
state.orderInfo?.orderItems ||
|
||||||
@@ -91,6 +95,15 @@
|
|||||||
return Array.isArray(list) ? list : [];
|
return Array.isArray(list) ? list : [];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const goodsCardType = computed(() => (String(state.detailStyle) === 'ai' ? '4' : '2'));
|
||||||
|
|
||||||
|
const goodsCardData = computed(() => {
|
||||||
|
return {
|
||||||
|
...(state.orderInfo || {}),
|
||||||
|
items: goodsItems.value,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const formatTime = (t) => {
|
const formatTime = (t) => {
|
||||||
if (!t) return '';
|
if (!t) return '';
|
||||||
return sheep.$helper.timeFormat(t, 'yyyy-mm-dd hh:MM:ss');
|
return sheep.$helper.timeFormat(t, 'yyyy-mm-dd hh:MM:ss');
|
||||||
@@ -102,7 +115,15 @@
|
|||||||
|
|
||||||
const resolvePickUpStoreId = (data = {}) => {
|
const resolvePickUpStoreId = (data = {}) => {
|
||||||
return Number(
|
return Number(
|
||||||
data?.pickUpStoreId || data?.pickUpStore?.id || data?.pickUpStore?.storeId || data?.storeId || 0,
|
data?.pickUpStoreId ||
|
||||||
|
data?.pickUpStore?.id ||
|
||||||
|
data?.pickUpStore?.storeId ||
|
||||||
|
data?.pickUpStoreVO?.id ||
|
||||||
|
data?.pickUpStoreVO?.storeId ||
|
||||||
|
data?.store?.id ||
|
||||||
|
data?.store?.storeId ||
|
||||||
|
data?.storeId ||
|
||||||
|
0,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -183,21 +204,19 @@
|
|||||||
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSpecText = (it) => {
|
|
||||||
const props = it?.properties;
|
|
||||||
if (Array.isArray(props) && props.length) {
|
|
||||||
return props.map((p) => p?.valueName).filter(Boolean).join(' / ');
|
|
||||||
}
|
|
||||||
return it?.spec || '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const getDetail = async () => {
|
const getDetail = async () => {
|
||||||
if (!state.orderId || state.loading) return;
|
if (!state.orderId || state.loading) return;
|
||||||
if (!state.orderInfo || !Object.keys(state.orderInfo).length || !(state.pickUpStoreId > 0)) {
|
if (!state.orderInfo || !Object.keys(state.orderInfo).length || !(state.pickUpStoreId > 0)) {
|
||||||
const detailRes = await OrderApi.getOrderDetail(state.orderId);
|
const detailRes =
|
||||||
|
String(state.orderType) === '5'
|
||||||
|
? await getOpenOrderDetail({ id: state.orderId })
|
||||||
|
: String(state.source) === 'aishop'
|
||||||
|
? await getAiOrderDetail({ id: state.orderId })
|
||||||
|
: await OrderApi.getOrderDetail(state.orderId);
|
||||||
if (detailRes?.code === 0) {
|
if (detailRes?.code === 0) {
|
||||||
state.orderInfo = detailRes.data || {};
|
const detailData = detailRes.data?.orderInfo || detailRes.data || {};
|
||||||
state.pickUpStoreId = resolvePickUpStoreId(detailRes.data);
|
state.orderInfo = detailData;
|
||||||
|
state.pickUpStoreId = resolvePickUpStoreId(detailData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(state.pickUpStoreId > 0)) {
|
if (!(state.pickUpStoreId > 0)) {
|
||||||
@@ -239,6 +258,9 @@
|
|||||||
if (id) state.orderId = id;
|
if (id) state.orderId = id;
|
||||||
const pickUpStoreId = Number(options?.pickUpStoreId || options?.storeId || 0);
|
const pickUpStoreId = Number(options?.pickUpStoreId || options?.storeId || 0);
|
||||||
if (pickUpStoreId > 0) state.pickUpStoreId = pickUpStoreId;
|
if (pickUpStoreId > 0) state.pickUpStoreId = pickUpStoreId;
|
||||||
|
state.source = String(options?.source || '').trim();
|
||||||
|
state.orderType = String(options?.type || '').trim();
|
||||||
|
state.detailStyle = String(options?.detailStyle || 'order').trim() || 'order';
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
@@ -393,52 +415,13 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-title {
|
.goods-empty {
|
||||||
font-size: 30rpx;
|
padding: 24rpx 0;
|
||||||
color: #222;
|
text-align: center;
|
||||||
font-weight: 600;
|
font-size: 26rpx;
|
||||||
margin-bottom: 18rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-row {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
padding: 16rpx 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-pic {
|
|
||||||
width: 96rpx;
|
|
||||||
height: 96rpx;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
background: #f2f4f7;
|
|
||||||
flex-shrink: 0;
|
|
||||||
margin-right: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-main {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-name {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #222;
|
|
||||||
font-weight: 600;
|
|
||||||
line-height: 1.3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.goods-spec {
|
|
||||||
margin-top: 8rpx;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #9aa0a6;
|
color: #9aa0a6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-count {
|
|
||||||
margin-top: 6rpx;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #222;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
padding: 18rpx 24rpx 28rpx;
|
padding: 18rpx 24rpx 28rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user