feat: 备货进度商品展示
This commit is contained in:
@@ -45,15 +45,14 @@
|
||||
</view>
|
||||
|
||||
<view class="goods-card bg24">
|
||||
<view class="goods-title">商品清单 ({{ items.length }})</view>
|
||||
<view v-for="it in items" :key="it.id || it.skuId" class="goods-row">
|
||||
<image class="goods-pic" :src="it.picUrl" mode="aspectFill" />
|
||||
<view class="goods-main">
|
||||
<view class="goods-name lineTwo">{{ it.spuName }}</view>
|
||||
<view class="goods-spec">{{ getSpecText(it) }}</view>
|
||||
<view class="goods-count">x{{ it.count }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<card_order
|
||||
v-if="goodsCardData.items.length"
|
||||
class="order-goods"
|
||||
:data="goodsCardData"
|
||||
:type="goodsCardType"
|
||||
theme="2"
|
||||
/>
|
||||
<view v-else class="goods-empty">暂无商品信息</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -71,18 +70,23 @@
|
||||
import sheep from '@/sheep';
|
||||
import OrderApi from '@/sheep/api/trade/order';
|
||||
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({
|
||||
orderId: 0,
|
||||
pickUpStoreId: 0,
|
||||
preparationStatus: null,
|
||||
source: '',
|
||||
orderType: '',
|
||||
detailStyle: 'order',
|
||||
orderInfo: {},
|
||||
loading: false,
|
||||
});
|
||||
|
||||
const sortingPercent = ref(72);
|
||||
|
||||
const items = computed(() => {
|
||||
const goodsItems = computed(() => {
|
||||
const list =
|
||||
state.orderInfo?.items ||
|
||||
state.orderInfo?.orderItems ||
|
||||
@@ -91,6 +95,15 @@
|
||||
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) => {
|
||||
if (!t) return '';
|
||||
return sheep.$helper.timeFormat(t, 'yyyy-mm-dd hh:MM:ss');
|
||||
@@ -102,7 +115,15 @@
|
||||
|
||||
const resolvePickUpStoreId = (data = {}) => {
|
||||
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)}`;
|
||||
};
|
||||
|
||||
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 () => {
|
||||
if (!state.orderId || state.loading) return;
|
||||
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) {
|
||||
state.orderInfo = detailRes.data || {};
|
||||
state.pickUpStoreId = resolvePickUpStoreId(detailRes.data);
|
||||
const detailData = detailRes.data?.orderInfo || detailRes.data || {};
|
||||
state.orderInfo = detailData;
|
||||
state.pickUpStoreId = resolvePickUpStoreId(detailData);
|
||||
}
|
||||
}
|
||||
if (!(state.pickUpStoreId > 0)) {
|
||||
@@ -239,6 +258,9 @@
|
||||
if (id) state.orderId = id;
|
||||
const pickUpStoreId = Number(options?.pickUpStoreId || options?.storeId || 0);
|
||||
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(() => {
|
||||
@@ -393,52 +415,13 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.goods-title {
|
||||
font-size: 30rpx;
|
||||
color: #222;
|
||||
font-weight: 600;
|
||||
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;
|
||||
.goods-empty {
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #9aa0a6;
|
||||
}
|
||||
|
||||
.goods-count {
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #222;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 18rpx 24rpx 28rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user