Compare commits
1
Commits
c6a8da0683
...
85b66c1a0d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85b66c1a0d |
@@ -24,6 +24,9 @@ const PAYMENT_METHOD_MAP = {
|
||||
|
||||
const WEEKDAYS = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||
|
||||
// 取消后的未支付订单不再有待办,胶囊用中性灰,避免仍像在催付
|
||||
const INACTIVE_PAYMENT_STYLE = { color: '#6F655C', bg: 'transparent', border: '#E5DACC' }
|
||||
|
||||
Page({
|
||||
data: {
|
||||
recordId: '',
|
||||
@@ -183,8 +186,13 @@ Page({
|
||||
&& !Number.isNaN(windowEnd.getTime())
|
||||
&& Date.now() > windowEnd.getTime()
|
||||
let paymentStatusText = paymentInfo.text
|
||||
let paymentStyle = paymentInfo
|
||||
if (paymentStatus === 'unpaid') {
|
||||
if (payChannel === 'offline') paymentStatusText = '待收款'
|
||||
if (cancelStatus !== 'none') {
|
||||
// 已申请取消或已取消的订单不再催付:胶囊只说明当前没有待付款项
|
||||
paymentStatusText = cancelStatus === 'cancelled' ? '无需支付' : '未支付'
|
||||
paymentStyle = INACTIVE_PAYMENT_STYLE
|
||||
} else if (payChannel === 'offline') paymentStatusText = '待收款'
|
||||
else if (paymentExpired) paymentStatusText = '支付已超时'
|
||||
else paymentStatusText = '待支付'
|
||||
} else if (paymentStatus === 'paid' && item.payment?.method === 'online_wechat') {
|
||||
@@ -206,6 +214,40 @@ Page({
|
||||
&& canEditBooking
|
||||
const canSwitchPayChannel = paymentStatus === 'unpaid' && canEditBooking
|
||||
|
||||
// 取消规则以「是否已确认」为界:未确认订单取消直接生效;
|
||||
// 已确认订单先提交取消申请,待陪诊师/平台确认后才进入退款
|
||||
const paymentMethod = item.payment?.method || ''
|
||||
const hasPaid = ['partial', 'paid', 'refunding', 'refunded'].includes(paymentStatus)
|
||||
const isWechatPaid = hasPaid && paymentMethod === 'online_wechat'
|
||||
let cancelFlowTip
|
||||
if (status === 'pending') {
|
||||
if (isWechatPaid) cancelFlowTip = '订单尚未确认,取消后已付费用将直接原路退回微信。'
|
||||
else if (hasPaid) cancelFlowTip = '订单尚未确认,取消后退款由平台尽快处理。'
|
||||
else cancelFlowTip = '该订单尚未支付,取消后订单将直接关闭,不会产生费用。'
|
||||
} else if (isWechatPaid) {
|
||||
cancelFlowTip = '提交后需陪诊师确认;确认取消后,已付费用将原路退回微信。'
|
||||
} else if (hasPaid) {
|
||||
cancelFlowTip = '提交后需陪诊师确认;确认取消后,退款由平台人工处理。'
|
||||
} else {
|
||||
cancelFlowTip = '提交后需陪诊师确认,确认后订单关闭,不会产生费用。'
|
||||
}
|
||||
|
||||
// 取消/退款路径:支付胶囊给结论,这里补一句钱怎么走,用户不必去账单里猜
|
||||
let refundNote = ''
|
||||
if (hasPaid && displayStatus === 'cancel_requested') {
|
||||
refundNote = isWechatPaid ? '取消确认后,已付费用将原路退回微信。' : '取消确认后,退款由平台人工处理。'
|
||||
} else if (displayStatus === 'cancelled') {
|
||||
if (paymentStatus === 'refunding') {
|
||||
refundNote = isWechatPaid ? '退款处理中,款项将原路退回微信。' : '退款处理中,平台将尽快完成退款。'
|
||||
} else if (paymentStatus === 'refunded') {
|
||||
refundNote = isWechatPaid ? '退款已完成,款项已原路退回微信。' : '退款已完成,退款方式以平台与您确认的为准。'
|
||||
} else if (paymentStatus === 'unpaid') {
|
||||
refundNote = '订单未支付,无需退款。'
|
||||
} else if (hasPaid) {
|
||||
refundNote = '退款进度请联系客服确认。'
|
||||
}
|
||||
}
|
||||
|
||||
// 就诊人字段先落到局部变量:摘要姓名与展开区资料都从同一批值派生,
|
||||
// 口径不在 WXML 与 JS 两处各写一份
|
||||
const patient = {
|
||||
@@ -258,9 +300,11 @@ Page({
|
||||
showPaidFee: Number(item.payment?.paidFee) > 0,
|
||||
paymentStatus,
|
||||
paymentStatusText,
|
||||
paymentStatusColor: paymentInfo.color,
|
||||
paymentStatusBg: paymentInfo.bg,
|
||||
paymentStatusBorder: paymentInfo.border,
|
||||
paymentStatusColor: paymentStyle.color,
|
||||
paymentStatusBg: paymentStyle.bg,
|
||||
paymentStatusBorder: paymentStyle.border,
|
||||
cancelFlowTip,
|
||||
refundNote,
|
||||
paymentMethodText: PAYMENT_METHOD_MAP[item.payment?.method] || '',
|
||||
payChannel,
|
||||
payChannelText: payChannel === 'online_wechat' ? '微信支付' : '线下支付',
|
||||
@@ -659,7 +703,8 @@ Page({
|
||||
if (res.code === 0) {
|
||||
this.setData({ showCancelPopup: false })
|
||||
wx.showToast({ title: res.msg || '操作成功', icon: 'success' })
|
||||
// 未确认且未收款的订单取消后已被删除,直接退回列表;其余刷新展示「待取消」
|
||||
// 未确认且未收款的订单取消后已被删除,直接退回列表;
|
||||
// 其余刷新展示最新状态:未确认已收款→退款中,已确认→待取消
|
||||
if (res.data?.deleted) {
|
||||
setTimeout(() => wx.navigateBack(), 1200)
|
||||
} else {
|
||||
|
||||
@@ -271,6 +271,12 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 退款路径:支付胶囊只说结论,这里交代钱怎么走,
|
||||
避免取消后用户看不出「在等确认」还是「已在退」 -->
|
||||
<view class="refund-note" wx:if="{{record.refundNote}}">
|
||||
<text class="refund-note-text">{{record.refundNote}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 支付渠道:仅待支付期间可切换;线下支付由平台收款后补记实际方式 -->
|
||||
<view
|
||||
class="pay-switch"
|
||||
@@ -485,7 +491,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="popup-body">
|
||||
<text class="cancel-tip">确定要取消该陪诊订单吗?取消后陪诊师将收到通知。</text>
|
||||
<text class="cancel-tip">确定要取消该陪诊订单吗?</text>
|
||||
<text class="cancel-refund-tip">{{record.cancelFlowTip}}</text>
|
||||
<view class="cancel-reason-list">
|
||||
<view
|
||||
class="cancel-reason-item {{cancelReason === item.text ? 'active' : ''}}"
|
||||
|
||||
@@ -438,6 +438,21 @@ page {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 退款说明:与取消原因同款浅底描边块,只补一句路径,不抢金额与胶囊 */
|
||||
.refund-note {
|
||||
margin-top: 12rpx;
|
||||
padding: 12rpx 20rpx;
|
||||
border: 2rpx solid var(--line);
|
||||
border-radius: 16rpx;
|
||||
background: var(--paper);
|
||||
}
|
||||
|
||||
.refund-note-text {
|
||||
font-size: var(--fs-26);
|
||||
color: var(--ink-2);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 取消原因:--paper 底在白卡上只差 1.06:1,靠描边托形 */
|
||||
.cancel-summary {
|
||||
margin-top: 12rpx;
|
||||
@@ -937,6 +952,15 @@ page {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* 取消后果:紧跟提问,单独成行并降一档字号,不抢主问题 */
|
||||
.cancel-refund-tip {
|
||||
display: block;
|
||||
margin-top: 12rpx;
|
||||
font-size: var(--fs-26);
|
||||
color: var(--muted);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.cancel-reason-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -117,6 +117,10 @@ Page({
|
||||
// 未支付的展示按渠道与支付窗口区分:线上可去支付、超时仅可改线下或取消、线下等平台收款
|
||||
const paymentStatus = item.payment?.status || 'unpaid'
|
||||
const payChannel = item.payment?.payChannel || 'offline'
|
||||
// 兼容旧数据:取消曾存放在 status 中
|
||||
const cancelStatus = item.status === 'cancelled'
|
||||
? 'cancelled'
|
||||
: (item.cancelStatus || 'none')
|
||||
const windowEnd = item.paymentWindowEnd ? new Date(item.paymentWindowEnd) : null
|
||||
const paymentExpired = paymentStatus === 'unpaid'
|
||||
&& payChannel === 'online_wechat'
|
||||
@@ -124,14 +128,20 @@ Page({
|
||||
&& !Number.isNaN(windowEnd.getTime())
|
||||
&& Date.now() > windowEnd.getTime()
|
||||
let paymentStatusText = paymentStatusInfo.text
|
||||
let paymentStatusStyle = paymentStatusInfo
|
||||
if (paymentStatus === 'unpaid') {
|
||||
if (payChannel === 'offline') paymentStatusText = '线下支付'
|
||||
// 取消中/已取消的订单不再催付,与详情页保持同一口径
|
||||
if (cancelStatus !== 'none') {
|
||||
paymentStatusText = cancelStatus === 'cancelled' ? '无需支付' : '未支付'
|
||||
paymentStatusStyle = { color: '#6F655C', bg: 'transparent', border: '#E5DACC' }
|
||||
} else if (payChannel === 'offline') paymentStatusText = '线下支付'
|
||||
else if (paymentExpired) paymentStatusText = '支付已超时'
|
||||
else paymentStatusText = '待支付'
|
||||
}
|
||||
const canPay = paymentStatus === 'unpaid'
|
||||
&& payChannel === 'online_wechat'
|
||||
&& !paymentExpired
|
||||
&& cancelStatus === 'none'
|
||||
&& ['pending', 'confirmed'].includes(displayStatus)
|
||||
|
||||
return {
|
||||
@@ -151,9 +161,9 @@ Page({
|
||||
paymentExpired,
|
||||
canPay,
|
||||
paymentStatusText,
|
||||
paymentStatusColor: paymentStatusInfo.color,
|
||||
paymentStatusBg: paymentStatusInfo.bg,
|
||||
paymentStatusBorder: paymentStatusInfo.border
|
||||
paymentStatusColor: paymentStatusStyle.color,
|
||||
paymentStatusBg: paymentStatusStyle.bg,
|
||||
paymentStatusBorder: paymentStatusStyle.border
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user