From eb6aed3a862dc8958641bcb1f1d6a408ce1c7d8e Mon Sep 17 00:00:00 2001 From: 15233722133 <15233722133@163.com> Date: Wed, 15 Jul 2026 10:31:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=87=E8=AE=B0=E5=88=86=E6=8B=A3?= =?UTF-8?q?=E3=80=81=E5=8F=96=E8=B4=A7=E9=97=A8=E5=BA=97=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/merchant/pickupList.vue | 142 ++++++++++++++++++++++++++--- pages/order/detail.vue | 4 +- pages/order/pickUpVerify.vue | 166 +++++++++++++++++++++++++++------- sheep/api/trade/orderStore.js | 14 +++ sheep/api/trade/store.js | 12 +++ 5 files changed, 292 insertions(+), 46 deletions(-) diff --git a/pages/merchant/pickupList.vue b/pages/merchant/pickupList.vue index 0e45824..dd134de 100644 --- a/pages/merchant/pickupList.vue +++ b/pages/merchant/pickupList.vue @@ -46,11 +46,26 @@ - + + + + + + 暂无图片 + + + {{ getPicCount(item) }} + + - {{ item.spuName }} + {{ getOrderTitle(item) }} 订单号:{{ item.orderNo }} - 取货码:{{ item.pickUpCode }} + 取货码:{{ getPickUpCode(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' }); + } + }, + }); }; @@ -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 { diff --git a/pages/order/detail.vue b/pages/order/detail.vue index 962b9d7..559d560 100644 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -123,7 +123,7 @@ getOrderDetail as getAiOrderDetail, getOpenOrderDetail, } from '@/sheep/api/ai'; - import DeliveryApi from '@/sheep/api/trade/delivery'; + import StoreApi from '@/sheep/api/trade/store'; import card_order from '@/components/orderItem/card_order.vue'; import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue'; import truckLine from '@/components/truckLine/truckLine.vue' @@ -266,7 +266,7 @@ handleOrderButtons(state.orderInfo); // 配送方式:门店自提 if (res.data.pickUpStoreId) { - const { data } = await DeliveryApi.getDeliveryPickUpStore(res.data.pickUpStoreId); + const { data } = await StoreApi.getStoreById(res.data.pickUpStoreId); systemStore.value = data || {}; } if (state.orderInfo.deliveryType === 2 && state.orderInfo.payStatus) { diff --git a/pages/order/pickUpVerify.vue b/pages/order/pickUpVerify.vue index b802815..1cefd13 100644 --- a/pages/order/pickUpVerify.vue +++ b/pages/order/pickUpVerify.vue @@ -25,7 +25,7 @@ 核销时间 每日: - {{ systemStore.openingTime }} - {{ systemStore.closingTime }} + {{ openingTimeText }} - {{ closingTimeText }} @@ -39,12 +39,19 @@ - 自提地址信息 - - 查看位置 + + + {{ systemStore.name || '自提门店' }} + {{ distanceText }} + {{ pickupAddressText || '--' }} + + + 营业时间:{{ openingTimeText }} - {{ closingTimeText }} + + 查看位置导航 import sheep from '@/sheep'; - import { reactive, ref } from 'vue'; + import { computed, reactive, ref } from 'vue'; const props = defineProps({ orderInfo: { @@ -87,26 +94,70 @@ /** * 打开地图 */ + const formatHm = (hm) => { + if (!Array.isArray(hm) || hm.length < 2) return ''; + const h = String(hm[0]).padStart(2, '0'); + const m = String(hm[1]).padStart(2, '0'); + return `${h}:${m}`; + }; + + const openingTimeText = computed(() => { + return props.systemStore?.openingTime || formatHm(props.systemStore?.businessHoursStart) || '--'; + }); + + const closingTimeText = computed(() => { + return props.systemStore?.closingTime || formatHm(props.systemStore?.businessHoursEnd) || '--'; + }); + + const pickupAddressText = computed(() => { + const s = props.systemStore || {}; + const province = s.province || ''; + const city = s.city || ''; + const district = s.district || ''; + const address = s.address || ''; + const legacy = `${s.areaName || ''}${s.detailAddress || ''}`; + return `${province}${city}${district}${address}` || legacy || s.description || ''; + }); + + const distanceText = computed(() => { + const d = Number(props.systemStore?.distance); + if (!(d > 0)) return ''; + const t = d >= 1000 ? `${(d / 1000).toFixed(1)}km` : `${Math.round(d)}m`; + return `距离${t}`; + }); + + const sanitizeUrl = (value) => String(value || '').replace(/[`"'\s]/g, ''); + + const coverImageUrl = computed(() => { + const raw = sanitizeUrl(props.systemStore?.coverImage); + if (!raw) return ''; + if (/^https?:\/\//i.test(raw)) return raw; + return sheep.$url.cdn(raw); + }); + + const addressText = computed(() => { + const s = props.systemStore || {}; + const province = s.province || ''; + const city = s.city || ''; + const district = s.district || ''; + const description = s.description || ''; + const legacy = `${s.areaName || ''}${s.detailAddress || ''}`; + return `${province}${city}${district}${description}` || legacy || s.address || ''; + }); + const showMaoLocation = () => { - if (!props.systemStore.latitude || !props.systemStore.longitude) { + const latitude = Number(props.systemStore?.latitude); + const longitude = Number(props.systemStore?.longitude); + if (!(latitude && longitude)) { sheep.$helper.toast('缺少经纬度信息无法查看地图!'); return; } uni.openLocation({ - latitude: props.systemStore.latitude, - longitude: props.systemStore.longitude, + latitude, + longitude, scale: 8, - name: props.systemStore.name, - address: props.systemStore.areaName + props.systemStore.detailAddress, - }); - }; - - /** - * 拨打电话 - */ - const makePhone = () => { - uni.makePhoneCall({ - phoneNumber: props.systemStore.phone, + name: props.systemStore?.name, + address: addressText.value, }); }; @@ -270,23 +321,72 @@ margin-left: 20rpx; } - .order-details .map { - height: 86rpx; - font-size: 30rpx; - color: #282828; - line-height: 86rpx; - border-bottom: 1px solid #f0f0f0; + .order-details .pickup-card { margin-top: 15rpx; background-color: #fff; - padding: 0 24rpx; + padding: 22rpx 24rpx 24rpx; + box-sizing: border-box; } - .order-details .map .place { + .order-details .pickup-hd { + display: flex; + align-items: center; + justify-content: space-between; + } + + .order-details .pickup-title { + font-size: 30rpx; + color: #282828; + font-weight: 700; + } + + .order-details .pickup-distance { + padding: 4rpx 12rpx; + border-radius: 999rpx; + font-size: 22rpx; + color: #2556ec; + background: rgba(37, 86, 236, 0.12); + } + + .order-details .pickup-address { + margin-top: 10rpx; font-size: 26rpx; - width: 176rpx; - height: 50rpx; - border-radius: 25rpx; - line-height: 50rpx; - text-align: center; + color: #666; + line-height: 36rpx; + } + + .order-details .pickup-cover { + width: 100%; + height: 168rpx; + border-radius: 16rpx; + display: block; + margin-bottom: 14rpx; + background: #f2f4f7; + } + + .order-details .pickup-hours { + margin-top: 10rpx; + display: flex; + align-items: center; + gap: 10rpx; + } + + .order-details .pickup-hours__text { + font-size: 24rpx; + color: #8c8c8c; + } + + .order-details .pickup-btn { + margin-top: 16rpx; + height: 76rpx; + border-radius: 16rpx; + border: 2rpx solid rgba(37, 86, 236, 0.35); + background: #fff; + color: #2556ec; + font-size: 28rpx; + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; } diff --git a/sheep/api/trade/orderStore.js b/sheep/api/trade/orderStore.js index 84397ab..a65add2 100644 --- a/sheep/api/trade/orderStore.js +++ b/sheep/api/trade/orderStore.js @@ -21,6 +21,20 @@ const OrderStoreApi = { }, }); }, + markSorted: (ids) => { + const idText = Array.isArray(ids) ? ids.filter(Boolean).join(',') : String(ids || ''); + return request({ + url: '/trade/order-store/staff/mark-sorted', + method: 'PUT', + params: { + ids: idText, + }, + custom: { + showSuccess: true, + successMsg: '已标记分拣', + }, + }); + }, }; export default OrderStoreApi; diff --git a/sheep/api/trade/store.js b/sheep/api/trade/store.js index 4c62c88..0ce7c0b 100644 --- a/sheep/api/trade/store.js +++ b/sheep/api/trade/store.js @@ -29,6 +29,18 @@ const StoreApi = { } return res; }, + getStoreById: (storeId) => { + return request({ + url: '/trade/store/getStoreById', + method: 'GET', + params: { + storeId, + }, + custom: { + showLoading: false, + }, + }); + }, }; export default StoreApi;