feat: 添加催一催按钮、应用宝跳转配置

This commit is contained in:
2026-08-12 13:15:50 +08:00
parent 6a1f4f66ac
commit 9a30b0efde
10 changed files with 744 additions and 54 deletions
+178 -32
View File
@@ -3,34 +3,54 @@
<!-- 自提商品核销 -->
<view v-if="orderInfo.deliveryType === 2 && orderInfo.payStatus" class="writeOff borRadius14">
<view class="title-row">
<view class="title">核销信息</view>
<view class="title-left flex-center">
<view class="title">核销信息</view>
<view class="status-tag" :class="statusTagClass">{{ statusTagText }}</view>
</view>
<view class="progress-btn" @tap.stop="goStockProgress">备货进度</view>
</view>
<view class="grayBg flex-center">
<view class="pictrue">
<image
v-if="!!painterImageUrl"
:src="painterImageUrl"
:style="{ width: `${state.qrcodeSize}px`, height: `${state.qrcodeSize}px` }"
:show-menu-by-longpress="true"
/>
<view v-if="isVerifyCompleted" class="verify-mask">
<view class="verify-mask__icon">
<uni-icons type="checkmarkempty" size="40" color="#ffffff" />
</view>
<view class="verify-mask__text">已核销</view>
<template v-if="isSorting">
<view class="preparation-placeholder">
<view class="preparation-placeholder__emoji">📦</view>
<view class="preparation-placeholder__title">门店正快马加鞭备货中</view>
<view class="preparation-placeholder__desc">
分拣完成后将生成取货码并发送通知,请耐心等待~
</view>
</view>
</view>
<view class="gear">
<image :src="sheep.$url.static('/static/img/shop/writeOff.png')"></image>
</view>
<view v-if="isVerifyCompleted" class="num-wrap">
<view class="num num--done">该商品券已完成核销</view>
</view>
<view v-else class="num-wrap" @tap="copyVerifyCode">
<view class="num">{{ orderInfo.pickUpVerifyCode }}</view>
</view>
<view v-if="isVerifyCompleted" class="num-wrap">
<view class="num num--done">该商品券已完成核销</view>
</view>
<view v-else class="num-wrap">
<view class="num num--pending">— 待备货完成后解锁 —</view>
</view>
</template>
<template v-else>
<view class="grayBg flex-center">
<view class="pictrue">
<image
v-if="!!painterImageUrl"
:src="painterImageUrl"
:style="{ width: `${state.qrcodeSize}px`, height: `${state.qrcodeSize}px` }"
:show-menu-by-longpress="true"
/>
<view v-if="isVerifyCompleted" class="verify-mask">
<view class="verify-mask__icon">
<uni-icons type="checkmarkempty" size="40" color="#ffffff" />
</view>
<view class="verify-mask__text">已核销</view>
</view>
</view>
</view>
<view class="gear">
<image :src="sheep.$url.static('/static/img/shop/writeOff.png')"></image>
</view>
<view v-if="isVerifyCompleted" class="num-wrap">
<view class="num num--done">该商品券已完成核销</view>
</view>
<view v-else class="num-wrap" @tap="copyVerifyCode">
<view class="num">{{ orderInfo.pickUpVerifyCode }}</view>
</view>
</template>
<view class="rules">
<view class="item">
<view class="rulesTitle flex flex-wrap align-center"> 核销时间 </view>
@@ -44,12 +64,12 @@
<text class="iconfont icon-shuoming1"></text>
使用说明
</view>
<view class="info">可将二维码出示给店员扫描或提供数字核销码</view>
<view class="info">{{ isSorting ? '分拣完成后将生成核销码,出示给店员扫描即可' : '可将二维码出示给店员扫描或提供数字核销码' }}</view>
</view>
</view>
</view>
<view
v-if="orderInfo.deliveryType === 2"
v-if="orderInfo.deliveryType === 2 && !isSorting"
class="pickup-card borRadius14"
>
<image v-if="coverImageUrl" class="pickup-cover" :src="coverImageUrl" mode="aspectFill" />
@@ -102,9 +122,6 @@
default: 'order',
},
});
const state = reactive({
qrcodeSize: 145,
});
const resolvePickUpStoreId = () => {
return Number(
@@ -208,6 +225,46 @@
);
});
const resolveStage = () => {
const data = props.orderInfo || {};
const external = Number(data?.preparationStatus);
const rawStatus = Number.isFinite(external) ? external : Number(data?.preparationStatus ?? data?.status ?? 0);
if (isVerifyCompleted.value) return 'done';
if (rawStatus === 1 || rawStatus === 2) return 'wait';
if (
data?.deliveryTime ||
data?.arriveStoreTime ||
data?.deliveredTime ||
rawStatus === 20
) {
return 'delivered';
}
return 'sorting';
};
const isSorting = computed(() => resolveStage() === 'sorting');
const state = reactive({
qrcodeSize: 145,
});
const statusTagText = computed(() => {
const s = resolveStage();
if (s === 'sorting') return '分拣中';
if (s === 'delivered') return '已送达门店';
if (s === 'wait') return '待取货';
if (s === 'done') return isVerifyCompleted.value ? '已核销' : '已完成';
return '';
});
const statusTagClass = computed(() => {
const s = resolveStage();
if (s === 'sorting') return 'status-tag--sorting';
if (s === 'delivered') return 'status-tag--delivered';
if (s === 'wait') return 'status-tag--wait';
return 'status-tag--done';
});
const addressText = computed(() => {
const s = props.systemStore || {};
const province = s.province || '';
@@ -237,19 +294,30 @@
const painterRef = ref(); // 海报画板
const painterImageUrl = ref(); // 海报 url
const showPainter = ref(true);
const lastMarkCodeText = ref('');
// 渲染海报
const renderPoster = async (poster) => {
if (!painterRef.value) return;
await painterRef.value.render(poster);
};
// 获得生成的图片
const setPainterImageUrl = (path) => {
painterImageUrl.value = path;
showPainter.value = false;
};
/**
* 生成核销二维码
*/
const markCode = (text) => {
const markCode = async (text) => {
const code = String(text || '').trim();
if (!code) return;
// 相同取货码无需重复生成,避免重复触发海报组件销毁/重建的空指针
if (lastMarkCodeText.value === code && painterImageUrl.value) return;
lastMarkCodeText.value = code;
// 如果 painterRef 已被销毁(showPainter=false 时 v-if 销毁了组件),先重建组件,等下一个 tick 再渲染
if (!painterRef.value) {
showPainter.value = true;
await new Promise((resolve) => setTimeout(resolve, 0));
}
renderPoster({
css: {
width: `${state.qrcodeSize}px`,
@@ -258,7 +326,7 @@
views: [
{
type: 'qrcode',
text: text,
text: code,
css: {
width: `${state.qrcodeSize}px`,
height: `${state.qrcodeSize}px`,
@@ -284,6 +352,7 @@
border-radius: 10rpx;
margin: 0 20rpx 20rpx 20rpx;
}
.order-details .writeOff {
background-color: #fff;
margin-top: 15rpx;
@@ -303,6 +372,11 @@
box-sizing: border-box;
}
.order-details .writeOff .title-left {
gap: 16rpx;
min-width: 0;
}
.order-details .writeOff .title {
font-size: 30rpx;
color: #282828;
@@ -310,6 +384,36 @@
line-height: 87rpx;
}
.order-details .writeOff .status-tag {
flex-shrink: 0;
height: 44rpx;
line-height: 44rpx;
padding: 0 16rpx;
border-radius: 22rpx;
font-size: 22rpx;
font-weight: 500;
}
.order-details .writeOff .status-tag--sorting {
color: #e8852f;
background: rgba(232, 133, 47, 0.12);
}
.order-details .writeOff .status-tag--delivered {
color: #2556ec;
background: rgba(37, 86, 236, 0.1);
}
.order-details .writeOff .status-tag--wait {
color: #12a06a;
background: rgba(18, 160, 106, 0.1);
}
.order-details .writeOff .status-tag--done {
color: #86909c;
background: rgba(134, 144, 156, 0.12);
}
.order-details .writeOff .progress-btn {
height: 52rpx;
line-height: 52rpx;
@@ -320,6 +424,48 @@
background: rgba(91, 78, 255, 0.12);
}
.preparation-placeholder {
width: 590rpx;
min-height: 384rpx;
margin: 50rpx auto 0 auto;
border-radius: 20rpx 20rpx 0 0;
background: linear-gradient(180deg, #fff7ea 0%, #ffe9c8 100%);
padding: 72rpx 48rpx 56rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
&__emoji {
font-size: 84rpx;
line-height: 1;
margin-bottom: 28rpx;
}
&__title {
font-size: 32rpx;
font-weight: 600;
color: #7a4a00;
line-height: 1.5;
margin-bottom: 14rpx;
}
&__desc {
font-size: 24rpx;
color: #a36d1a;
line-height: 1.7;
text-align: center;
}
}
.order-details .writeOff .num .num--pending {
background: #f7f8fa;
color: #98a2b3;
font-size: 26rpx;
letter-spacing: 2rpx;
}
.order-details .writeOff .grayBg {
background-color: #f2f5f7;
width: 590rpx;