feat: 标记分拣、取货门店展示
This commit is contained in:
+131
-11
@@ -46,11 +46,26 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-bd flex-center al-flex-start">
|
||||
<image class="thumb" :src="item.picUrl" mode="aspectFill" />
|
||||
<view class="thumb-stack">
|
||||
<view
|
||||
v-for="(pic, picIndex) in getStackPics(item)"
|
||||
:key="`${item.orderId || item.id}-${picIndex}`"
|
||||
class="thumb-card"
|
||||
:style="{ left: `${picIndex * 22}rpx`, zIndex: getStackPics(item).length - picIndex }"
|
||||
>
|
||||
<image class="thumb-img" :src="resolvePicUrl(pic)" mode="aspectFill" />
|
||||
</view>
|
||||
<view v-if="!getStackPics(item).length" class="thumb-empty">
|
||||
暂无图片
|
||||
</view>
|
||||
<view v-if="getPicCount(item) > 1" class="thumb-count">
|
||||
{{ getPicCount(item) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex1">
|
||||
<view class="name lineTwo">{{ item.spuName }}</view>
|
||||
<view class="name lineTwo">{{ getOrderTitle(item) }}</view>
|
||||
<view class="meta c_999 size24 m-t-10">订单号:{{ item.orderNo }}</view>
|
||||
<view class="meta c_999 size24 m-t-6">取货码:{{ item.pickUpCode }}</view>
|
||||
<view class="meta c_999 size24 m-t-6">取货码:{{ getPickUpCode(item) || '--' }}</view>
|
||||
</view>
|
||||
<view class="actions">
|
||||
<view v-if="Number(item.status) === 0" class="btn btnPrimary" @tap="markPicked(item)">
|
||||
@@ -90,6 +105,8 @@
|
||||
|
||||
const displayList = computed(() => list.value);
|
||||
|
||||
const sanitizeText = (value) => String(value || '').replace(/[`"'\s]/g, '');
|
||||
|
||||
const pickUpStoreId = computed(() => {
|
||||
const userInfo = userStore?.userInfo || {};
|
||||
return Number(userInfo.storeId || 0);
|
||||
@@ -114,7 +131,6 @@
|
||||
const getList = async () => {
|
||||
if (loading.value) return;
|
||||
const storeId = await ensureStoreId();
|
||||
console.log('getList', storeId, );
|
||||
if (!(storeId > 0)) {
|
||||
uni.showToast({ title: '缺少门店ID', icon: 'none' });
|
||||
return;
|
||||
@@ -146,10 +162,64 @@
|
||||
uni.reLaunch({ url: '/pages/merchant/scanVerify' });
|
||||
};
|
||||
|
||||
const markPicked = (item) => {
|
||||
item.status = 1;
|
||||
item.statusName = '待取货';
|
||||
uni.showToast({ title: '已标记', icon: 'success' });
|
||||
const getOrderItems = (item) => {
|
||||
return Array.isArray(item?.items) ? item.items.filter(Boolean) : [];
|
||||
};
|
||||
|
||||
const getPicList = (item) => {
|
||||
const pics = getOrderItems(item)
|
||||
.map((it) => sanitizeText(it?.picUrl))
|
||||
.filter(Boolean);
|
||||
const fallback = sanitizeText(item?.picUrl);
|
||||
return pics.length ? pics : [fallback].filter(Boolean);
|
||||
};
|
||||
|
||||
const getStackPics = (item) => {
|
||||
return getPicList(item).slice(0, 3);
|
||||
};
|
||||
|
||||
const getPicCount = (item) => {
|
||||
return getPicList(item).length;
|
||||
};
|
||||
|
||||
const resolvePicUrl = (url) => {
|
||||
const text = sanitizeText(url);
|
||||
if (!text) return '';
|
||||
if (/^https?:\/\//i.test(text)) return text;
|
||||
return sheep.$url.cdn(text);
|
||||
};
|
||||
|
||||
const getOrderTitle = (item) => {
|
||||
const firstName = getOrderItems(item)[0]?.spuName || item?.spuName || '';
|
||||
const totalCount = Number(item?.totalCount || getOrderItems(item).length || 0);
|
||||
if (!firstName) return '商品信息暂无';
|
||||
return totalCount > 1 ? `${firstName} 等${totalCount}件商品` : firstName;
|
||||
};
|
||||
|
||||
const getPickUpCode = (item) => {
|
||||
return item?.pickUpVerifyCode || item?.pickUpCode || '';
|
||||
};
|
||||
|
||||
const markPicked = async (item) => {
|
||||
const ids = Array.isArray(item?.ids) ? item.ids : [];
|
||||
if (!ids.length) {
|
||||
uni.showToast({ title: '缺少分拣ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认标记为已分拣吗?',
|
||||
success: async ({ confirm }) => {
|
||||
if (!confirm) return;
|
||||
try {
|
||||
const { code } = await OrderStoreApi.markSorted(ids);
|
||||
if (code !== 0) return;
|
||||
await getList();
|
||||
} catch (error) {
|
||||
uni.showToast({ title: '标记失败,请稍后重试', icon: 'none' });
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -231,13 +301,63 @@
|
||||
background: rgba(107, 78, 255, 0.12);
|
||||
}
|
||||
|
||||
.thumb {
|
||||
.thumb-stack {
|
||||
width: 184rpx;
|
||||
height: 140rpx;
|
||||
margin-right: 16rpx;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.thumb-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 18rpx;
|
||||
margin-right: 16rpx;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
background: #f2f4f7;
|
||||
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.08);
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.thumb-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.thumb-empty {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #f2f4f7;
|
||||
color: #bbb;
|
||||
font-size: 22rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2rpx dashed #e3e6ee;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.thumb-count {
|
||||
position: absolute;
|
||||
right: 45rpx;
|
||||
bottom: 0;
|
||||
min-width: 36rpx;
|
||||
height: 36rpx;
|
||||
padding: 0 10rpx;
|
||||
font-size: 22rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
border-radius: 18rpx;
|
||||
color: rgba(0, 0, 0, 0.75);
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.name {
|
||||
|
||||
Reference in New Issue
Block a user