feat: 核销码展示、备货进度静态

This commit is contained in:
2026-07-14 16:44:57 +08:00
parent 585fd6fb7e
commit 94f8297a01
6 changed files with 504 additions and 37 deletions
+11
View File
@@ -233,6 +233,17 @@
"title": "订单详情"
}
},
{
"path": "stockProgress",
"style": {
"navigationBarTitleText": "备货进度",
"navigationStyle": "custom"
},
"meta": {
"auth": true,
"title": "备货进度"
}
},
{
"path": "confirm",
"style": {
+37 -35
View File
@@ -38,23 +38,25 @@
<view class="list">
<view v-for="item in filteredList" :key="item.id" class="card bg24">
<view class="card-hd flex-center ju-between">
<view class="status" :class="{ statusWait: item.status === 'wait' }">
{{ item.statusText }}
<view class="status" :class="{ statusWait: Number(item.status) === 1 }">
{{ item.statusName }}
</view>
<view class="time c_999 size24">
下单时间:{{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM') }}
</view>
<view class="time c_999 size24">{{ item.time }}</view>
</view>
<view class="card-bd flex-center al-flex-start">
<image class="thumb" :src="item.pic" mode="aspectFill" />
<image class="thumb" :src="item.picUrl" mode="aspectFill" />
<view class="flex1">
<view class="name lineTwo">{{ item.name }}</view>
<view class="name lineTwo">{{ item.spuName }}</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">取货码:{{ item.pickUpCode }}</view>
</view>
<view class="actions">
<view v-if="item.status === 'sorting'" class="btn btnPrimary" @tap="markPicked(item)">
<view v-if="Number(item.status) === 0" class="btn btnPrimary" @tap="markPicked(item)">
标记已分拣
</view>
<view v-else-if="item.status === 'wait'" class="btn btnOutline" @tap="goScan">
<view v-else-if="Number(item.status) === 1" class="btn btnOutline" @tap="goScan">
去核销
</view>
</view>
@@ -68,7 +70,10 @@
<script setup>
import { computed, ref } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import modeSwitch from '@/components/mode_switch/mode_switch.vue';
import sheep from '@/sheep';
import OrderStoreApi from '@/sheep/api/trade/orderStore';
const tabs = [
{ label: '全部', value: 'all' },
@@ -79,50 +84,47 @@
const currentTab = ref('all');
const keyword = ref('');
const list = ref([
{
id: 1,
status: 'sorting',
statusText: '待分拣',
time: '下单时间:2026-06-25 10:15',
name: 'Apple iPhone 15 Pro 256G 原色钛金属',
orderNo: 'ORD202406251022',
pickupCode: '882910',
pic: '/static/empty/goods-empty.png',
},
{
id: 2,
status: 'wait',
statusText: '待取货',
time: '下单时间:2026-06-25 09:10',
name: '索尼 WH-1000XM5 无线降噪耳机',
orderNo: 'ORD202406250915',
pickupCode: '127736',
pic: '/static/empty/goods-empty.png',
},
]);
const list = ref([]);
const loading = ref(false);
const filteredList = computed(() => {
const k = String(keyword.value || '').trim();
return list.value.filter((item) => {
const hitTab = currentTab.value === 'all' || item.status === currentTab.value;
const s = Number(item.status);
const hitTab =
currentTab.value === 'all' ||
(currentTab.value === 'sorting' && s === 0) ||
(currentTab.value === 'wait' && s === 1);
if (!hitTab) return false;
if (!k) return true;
return (
String(item.orderNo).includes(k) ||
String(item.pickupCode).includes(k) ||
String(item.name).includes(k)
String(item.pickUpCode).includes(k) ||
String(item.spuName).includes(k)
);
});
});
const getList = async () => {
if (loading.value) return;
loading.value = true;
const { data, code } = await OrderStoreApi.getPendingList({});
loading.value = false;
if (code !== 0) return;
list.value = Array.isArray(data) ? data : [];
};
onShow(() => {
getList();
});
const goScan = () => {
uni.reLaunch({ url: '/pages/merchant/scanVerify' });
};
const markPicked = (item) => {
item.status = 'wait';
item.statusText = '待取货';
item.status = 1;
item.statusName = '待取货';
uni.showToast({ title: '已标记', icon: 'success' });
};
</script>
+8
View File
@@ -31,6 +31,13 @@
@getOrderDetail="getOrderDetail"
></card_order>
<PickUpVerify
v-if="Number(state.orderInfo.deliveryType) === 2"
ref="pickUpVerifyRef"
:orderInfo="state.orderInfo"
:systemStore="systemStore"
/>
<!-- 价格信息 -->
<view class="order-price-box bg24">
<view class="notice-item ss-flex ss-row-between" v-for="(v, i) in priceArr" :key="i">
@@ -120,6 +127,7 @@
import card_order from '@/components/orderItem/card_order.vue';
import AiOrderActionBar from '@/components/orderItem/AiOrderActionBar.vue';
import truckLine from '@/components/truckLine/truckLine.vue'
import PickUpVerify from '@/pages/order/pickUpVerify.vue';
const headerBg = sheep.$url.css('/static/img/shop/order/order_bg.png');
+34 -2
View File
@@ -2,7 +2,10 @@
<view class="order-details">
<!-- 自提商品核销 -->
<view v-if="orderInfo.deliveryType === 2 && orderInfo.payStatus" class="writeOff borRadius14">
<view class="title">核销信息</view>
<view class="title-row">
<view class="title">核销信息</view>
<view class="progress-btn" @tap.stop="goStockProgress">备货进度</view>
</view>
<view class="grayBg flex-center">
<view class="pictrue">
<image
@@ -73,6 +76,14 @@
qrcodeSize: 145,
});
const goStockProgress = () => {
const id = props.orderInfo?.id || props.orderInfo?.orderId;
if (!id) return;
uni.navigateTo({
url: `/pages/order/stockProgress?id=${id}`,
});
};
/**
* 打开地图
*/
@@ -155,13 +166,34 @@
padding-bottom: 50rpx;
}
.order-details .writeOff .title {
.order-details .writeOff .title-row {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 30rpx;
color: #282828;
height: 87rpx;
border-bottom: 1px solid #f0f0f0;
padding: 0 24rpx;
line-height: 87rpx;
box-sizing: border-box;
}
.order-details .writeOff .title {
font-size: 30rpx;
color: #282828;
height: 87rpx;
line-height: 87rpx;
}
.order-details .writeOff .progress-btn {
height: 52rpx;
line-height: 52rpx;
padding: 0 16rpx;
border-radius: 26rpx;
font-size: 24rpx;
color: #5b4eff;
background: rgba(91, 78, 255, 0.12);
}
.order-details .writeOff .grayBg {
+397
View File
@@ -0,0 +1,397 @@
<template>
<s-layout title="备货进度" navPreset="light">
<view class="page">
<view class="card bg24">
<view class="timeline">
<view v-for="(step, i) in steps" :key="step.key" class="step">
<view class="left">
<view class="dot" :class="dotClass(step)">
<uni-icons v-if="step.state === 'done'" type="checkmarkempty" size="16" color="#fff" />
<image
v-else-if="step.key === 'delivered'"
class="dot-icon"
:src="truckIconSrc(step)"
mode="aspectFit"
/>
<uni-icons
v-else-if="step.key === 'sorting'"
type="gift"
size="16"
:color="step.state === 'active' ? '#fff' : '#b9bec8'"
/>
<uni-icons
v-else-if="step.key === 'wait'"
type="cart"
size="16"
:color="step.state === 'active' ? '#fff' : '#b9bec8'"
/>
<uni-icons v-else type="location" size="16" :color="step.state === 'active' ? '#fff' : '#b9bec8'" />
</view>
<view v-if="i !== steps.length - 1" class="line" :class="lineClass(i)"></view>
</view>
<view class="right">
<view class="title" :class="{ titleActive: step.state !== 'todo' }">{{ step.title }}</view>
<view v-if="step.time" class="time">{{ step.time }}</view>
<view v-if="step.desc" class="desc">{{ step.desc }}</view>
<view v-if="step.key === 'sorting' && step.state === 'active'" class="bar-wrap">
<view class="bar">
<view class="bar-fill" :style="{ width: sortingPercent + '%' }"></view>
</view>
</view>
<view v-if="step.key === 'wait'" class="hint">{{ step.hint }}</view>
</view>
</view>
</view>
</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>
</view>
</view>
<su-fixed bottom placeholder bg="bg24">
<view class="footer">
<button class="btn" @tap="notifyStore">通知门店备货</button>
</view>
</su-fixed>
</s-layout>
</template>
<script setup>
import { computed, reactive, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import OrderApi from '@/sheep/api/trade/order';
const state = reactive({
orderId: 0,
orderInfo: {},
loading: false,
});
const sortingPercent = ref(72);
const items = computed(() => {
const list = state.orderInfo?.items;
return Array.isArray(list) ? list : [];
});
const formatTime = (t) => {
if (!t) return '';
return sheep.$helper.timeFormat(t, 'yyyy-mm-dd hh:MM:ss');
};
const hasVerifyCode = computed(() => {
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';
return 'sorting';
});
const steps = computed(() => {
const createTime = formatTime(state.orderInfo?.createTime);
const s = stage.value;
const sortingState = s === 'sorting' ? 'active' : 'done';
const deliveredState = s === 'delivered' ? 'active' : s === 'sorting' ? 'todo' : 'done';
const waitState = s === 'done' ? 'done' : 'todo';
return [
{
key: 'created',
title: '已下单',
time: createTime,
state: 'done',
},
{
key: 'sorting',
title: '商品分拣中',
desc: sortingState === 'active' ? '预计 15 分钟内完成分拣' : '',
state: sortingState,
},
{
key: 'delivered',
title: '已送达门店',
desc: deliveredState === 'todo' ? '等待物流更新' : '',
state: deliveredState,
},
{
key: 'wait',
title: '待取货',
hint: hasVerifyCode.value ? `取货码:${state.orderInfo?.pickUpVerifyCode || ''}` : '到达门店后将发送取货通知',
state: waitState,
},
];
});
const dotClass = (step) => {
if (step.state === 'done') return 'dotDone';
if (step.state === 'active' && step.key === 'delivered') return 'dotDeliveredActive';
if (step.state === 'active' && step.key === 'wait') return 'dotWaitActive';
if (step.state === 'active') return 'dotActive';
return 'dotTodo';
};
const lineClass = (index) => {
const cur = steps.value[index];
if (cur?.state === 'todo') return 'lineTodo';
return 'lineDone';
};
const truckIconSrc = (step) => {
const fill = step?.state === 'active' ? '#ffffff' : '#b9bec8';
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="${fill}" d="M382.507 768a149.333 149.333 0 0 1-295.68 0h-44.16V256a42.667 42.667 0 0 1 42.666-42.667h597.334A42.667 42.667 0 0 1 725.333 256v85.333h128l128 173.056V768h-86.826a149.376 149.376 0 0 1-295.68 0zM640 298.667H128v343.466a149.333 149.333 0 0 1 241.621 40.534h242.091A150.5 150.5 0 0 1 640 642.133zm85.333 256H896v-12.16l-85.675-115.84h-84.992zm21.334 256a64 64 0 1 0 0-128.043 64 64 0 0 0 0 128.043m-448-64a64 64 0 1 0-128 0 64 64 0 0 0 128 0"/></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 () => {
if (!state.orderId || state.loading) return;
state.loading = true;
const res = await OrderApi.getOrderDetail(state.orderId);
state.loading = false;
if (res?.code !== 0) return;
state.orderInfo = res.data || {};
};
const notifyStore = () => {
uni.showToast({
title: '已通知门店',
icon: 'none',
});
};
onLoad((options) => {
const id = Number(options?.id || 0);
if (id) state.orderId = id;
});
onShow(() => {
getDetail();
});
</script>
<style scoped lang="scss">
.page {
padding: 24rpx 24rpx 170rpx;
box-sizing: border-box;
}
.card {
border-radius: 24rpx;
padding: 26rpx 22rpx;
box-sizing: border-box;
margin-bottom: 18rpx;
}
.timeline {
display: flex;
flex-direction: column;
gap: 34rpx;
}
.step {
display: flex;
align-items: stretch;
}
.left {
position: relative;
width: 56rpx;
flex-shrink: 0;
display: flex;
justify-content: flex-start;
}
.dot {
width: 40rpx;
height: 40rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 2rpx auto 0;
position: relative;
z-index: 2;
}
.dotDone {
background: #21c28a;
}
.dotActive {
background: #5b4eff;
}
.dotTodo {
background: #fff;
border: 2rpx solid #e6e8ef;
box-sizing: border-box;
}
.dotDeliveredActive {
background: #fa7e31;
}
.dotWaitActive {
background: #21c28a;
}
.dot-icon {
width: 18rpx;
height: 18rpx;
}
.line {
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 46rpx;
bottom: -34rpx;
width: 4rpx;
border-radius: 2rpx;
}
.lineDone {
background: rgba(0, 0, 0, 0.08);
}
.lineTodo {
background: rgba(0, 0, 0, 0.05);
}
.right {
flex: 1;
padding-left: 10rpx;
}
.title {
font-size: 30rpx;
color: #c9c9c9;
font-weight: 600;
line-height: 1.2;
}
.titleActive {
color: #222;
}
.time {
margin-top: 8rpx;
font-size: 24rpx;
color: #9aa0a6;
}
.desc {
margin-top: 8rpx;
font-size: 24rpx;
color: #9aa0a6;
}
.bar-wrap {
margin-top: 14rpx;
}
.bar {
width: 100%;
height: 10rpx;
border-radius: 6rpx;
background: rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.bar-fill {
height: 100%;
border-radius: 6rpx;
background: #21c28a;
}
.hint {
margin-top: 10rpx;
font-size: 24rpx;
color: #9aa0a6;
}
.goods-card {
border-radius: 24rpx;
padding: 22rpx;
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;
color: #9aa0a6;
}
.goods-count {
margin-top: 6rpx;
font-size: 24rpx;
color: #222;
font-weight: 600;
}
.footer {
padding: 18rpx 24rpx 28rpx;
}
.btn {
width: 100%;
height: 96rpx;
line-height: 96rpx;
border-radius: 20rpx;
background: #5b4eff;
color: #fff;
font-size: 32rpx;
font-weight: 600;
}
</style>
+17
View File
@@ -0,0 +1,17 @@
import request from '@/sheep/request';
const OrderStoreApi = {
getPendingList: (params = {}) => {
return request({
url: '/trade/order-store/pending',
method: 'GET',
params,
custom: {
showLoading: false,
},
});
},
};
export default OrderStoreApi;