fix(admin): 锁定已收款支付信息并支持人工退款核销

- 已收款/退款中订单禁止编辑支付状态、金额与支付方式,避免覆盖退款状态
- 退款中订单新增「确认已退款」入口,线下退款可核销为已退款
- 线上退款仍保留查询退款结果兜底
This commit is contained in:
lik
2026-11-06 17:30:29 +08:00
parent 4cbf6e7906
commit bfe820aa31
5 changed files with 64 additions and 12 deletions
+41 -2
View File
@@ -89,7 +89,9 @@ Page({
paymentMethodText: '',
payChannelText: '',
showQueryRefundBtn: false,
showManualRefundBtn: false,
queryingRefund: false,
completingRefund: false,
attendantSexText: '',
sexRequirementText: '',
// 操作按钮配置
@@ -164,9 +166,13 @@ Page({
paymentStatusText: PAYMENT_STATUS_MAP[payment.status] || payment.status || '未支付',
paymentMethodText: PAYMENT_METHOD_MAP[payment.method] || '',
payChannelText: PAY_CHANNEL_MAP[payment.payChannel || 'offline'] || '',
// 退款回调丢失时由管理端主动查退款补写终态
showQueryRefundBtn: payment.status === 'refunding',
// 线上退款:回调丢失时由管理端主动查退款补写终态;
// 人工核销:线下退款、或历史手工标记「线上微信」但无退款单的订单;
// 后端在存在处理中的线上退款时会拒绝,避免误把微信退款标成已完成
showQueryRefundBtn: payment.status === 'refunding' && payment.method === 'online_wechat',
showManualRefundBtn: payment.status === 'refunding',
queryingRefund: false,
completingRefund: false,
attendantSexText: attendant.sex === 'male' ? '男' : attendant.sex === 'female' ? '女' : '',
sexRequirementText: escort.sexRequirement === 'male' ? '要求男陪诊' : escort.sexRequirement === 'female' ? '要求女陪诊' : '不限',
// 操作按钮(任何状态下均可编辑订单信息)
@@ -292,6 +298,39 @@ Page({
}
},
// 线下/人工退款:平台确认已退款后核销,避免订单永远停在「退款中」
onCompleteManualRefund() {
if (this.data.completingRefund) return
wx.showModal({
title: '确认退款完成',
content: '请确认已通过现金/转账等方式将款项退还给用户,操作后订单将显示「已退款」。',
success: (modal) => {
if (modal.confirm) this.doCompleteManualRefund()
}
})
},
async doCompleteManualRefund() {
this.setData({ completingRefund: true })
wx.showLoading({ title: '处理中...' })
try {
const res = await API.escort.completeManualRefund(this.data.orderId)
wx.hideLoading()
if (res.code !== 0) {
wx.showToast({ title: res.msg || '操作失败', icon: 'none' })
return
}
wx.showToast({ title: '已标记退款完成', icon: 'success' })
this.loadOrderDetail(this.data.orderId)
} catch (err) {
wx.hideLoading()
console.error('人工核销退款失败', err)
wx.showToast({ title: '网络错误', icon: 'none' })
} finally {
this.setData({ completingRefund: false })
}
},
async updateStatus(newStatus) {
wx.showLoading({ title: '处理中...' })
try {