Compare commits
1
Commits
4cbf6e7906
...
bfe820aa31
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfe820aa31 |
@@ -89,7 +89,9 @@ Page({
|
|||||||
paymentMethodText: '',
|
paymentMethodText: '',
|
||||||
payChannelText: '',
|
payChannelText: '',
|
||||||
showQueryRefundBtn: false,
|
showQueryRefundBtn: false,
|
||||||
|
showManualRefundBtn: false,
|
||||||
queryingRefund: false,
|
queryingRefund: false,
|
||||||
|
completingRefund: false,
|
||||||
attendantSexText: '',
|
attendantSexText: '',
|
||||||
sexRequirementText: '',
|
sexRequirementText: '',
|
||||||
// 操作按钮配置
|
// 操作按钮配置
|
||||||
@@ -164,9 +166,13 @@ Page({
|
|||||||
paymentStatusText: PAYMENT_STATUS_MAP[payment.status] || payment.status || '未支付',
|
paymentStatusText: PAYMENT_STATUS_MAP[payment.status] || payment.status || '未支付',
|
||||||
paymentMethodText: PAYMENT_METHOD_MAP[payment.method] || '',
|
paymentMethodText: PAYMENT_METHOD_MAP[payment.method] || '',
|
||||||
payChannelText: PAY_CHANNEL_MAP[payment.payChannel || 'offline'] || '',
|
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,
|
queryingRefund: false,
|
||||||
|
completingRefund: false,
|
||||||
attendantSexText: attendant.sex === 'male' ? '男' : attendant.sex === 'female' ? '女' : '',
|
attendantSexText: attendant.sex === 'male' ? '男' : attendant.sex === 'female' ? '女' : '',
|
||||||
sexRequirementText: escort.sexRequirement === 'male' ? '要求男陪诊' : escort.sexRequirement === '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) {
|
async updateStatus(newStatus) {
|
||||||
wx.showLoading({ title: '处理中...' })
|
wx.showLoading({ title: '处理中...' })
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -190,8 +190,9 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 底部操作 -->
|
<!-- 底部操作 -->
|
||||||
<view class="bottom-actions" wx:if="{{showEditBtn || showConfirmBtn || showCancelBtn || showStartBtn || showCompleteBtn || showQueryRefundBtn}}">
|
<view class="bottom-actions" wx:if="{{showEditBtn || showConfirmBtn || showCancelBtn || showStartBtn || showCompleteBtn || showQueryRefundBtn || showManualRefundBtn}}">
|
||||||
<view class="action-btn btn-ghost" wx:if="{{showQueryRefundBtn}}" bindtap="onQueryRefund">查询退款结果</view>
|
<view class="action-btn btn-ghost" wx:if="{{showQueryRefundBtn}}" bindtap="onQueryRefund">查询退款结果</view>
|
||||||
|
<view class="action-btn btn-ghost" wx:if="{{showManualRefundBtn}}" bindtap="onCompleteManualRefund">确认已退款</view>
|
||||||
<view class="action-btn btn-ghost" wx:if="{{showEditBtn}}" bindtap="onEdit">编辑订单</view>
|
<view class="action-btn btn-ghost" wx:if="{{showEditBtn}}" bindtap="onEdit">编辑订单</view>
|
||||||
<view class="action-btn btn-ghost" wx:if="{{showCancelBtn}}" bindtap="onCancel">{{cancelBtnText}}</view>
|
<view class="action-btn btn-ghost" wx:if="{{showCancelBtn}}" bindtap="onCancel">{{cancelBtnText}}</view>
|
||||||
<view class="action-btn btn-solid" wx:if="{{showConfirmBtn}}" bindtap="onConfirm">确认订单</view>
|
<view class="action-btn btn-solid" wx:if="{{showConfirmBtn}}" bindtap="onConfirm">确认订单</view>
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ Page({
|
|||||||
methodLabel: '',
|
methodLabel: '',
|
||||||
// 存在未支付流水时金额锁定:需先关单/取消后再改价
|
// 存在未支付流水时金额锁定:需先关单/取消后再改价
|
||||||
amountLocked: false,
|
amountLocked: false,
|
||||||
|
// 已收款/退款中的订单锁定支付信息,避免把退款状态改回未支付后被重复收款
|
||||||
|
paymentLocked: false,
|
||||||
today: '',
|
today: '',
|
||||||
submitting: false
|
submitting: false
|
||||||
},
|
},
|
||||||
@@ -181,10 +183,13 @@ Page({
|
|||||||
const sexLabel = p.sex === 'male' ? '男' : (p.sex === 'female' ? '女' : '')
|
const sexLabel = p.sex === 'male' ? '男' : (p.sex === 'female' ? '女' : '')
|
||||||
const age = calcAge(p.birth)
|
const age = calcAge(p.birth)
|
||||||
this.originalTotalFee = Number(order.payment && order.payment.totalFee) || 0
|
this.originalTotalFee = Number(order.payment && order.payment.totalFee) || 0
|
||||||
const amountLocked = (order.payment?.status || 'unpaid') === 'unpaid'
|
const payStatus = (order.payment && order.payment.status) || 'unpaid'
|
||||||
&& !!order.payment?.paymentRecordId
|
const paymentLocked = ['partial', 'paid', 'refunding', 'refunded'].includes(payStatus)
|
||||||
|
const amountLocked = paymentLocked
|
||||||
|
|| (payStatus === 'unpaid' && !!order.payment?.paymentRecordId)
|
||||||
this.setData({
|
this.setData({
|
||||||
amountLocked,
|
amountLocked,
|
||||||
|
paymentLocked,
|
||||||
// 有关联档案时交由 patient-info 按 ID 加载(不读缓存,以档案最新数据为准)
|
// 有关联档案时交由 patient-info 按 ID 加载(不读缓存,以档案最新数据为准)
|
||||||
profileId: order.healthProfileId || '',
|
profileId: order.healthProfileId || '',
|
||||||
// 无关联档案时用订单 patient 快照兜底展示姓名/性别/年龄/电话;
|
// 无关联档案时用订单 patient 快照兜底展示姓名/性别/年龄/电话;
|
||||||
@@ -494,15 +499,19 @@ Page({
|
|||||||
'schedule.startTime': form.schedule.startTime || '',
|
'schedule.startTime': form.schedule.startTime || '',
|
||||||
'escort.serviceId': form.escort.serviceId || -1,
|
'escort.serviceId': form.escort.serviceId || -1,
|
||||||
'escort.serviceName': form.escort.serviceName,
|
'escort.serviceName': form.escort.serviceName,
|
||||||
'payment.totalFee': form.payment.totalFee ? Number(form.payment.totalFee) : 0,
|
|
||||||
'payment.method': form.payment.method || '',
|
|
||||||
'payment.paidFee': form.payment.paid ? (form.payment.totalFee ? Number(form.payment.totalFee) : 0) : 0,
|
|
||||||
'payment.status': form.payment.paid ? 'paid' : 'unpaid',
|
|
||||||
'notes.patientNote': form.notes.patientNote,
|
'notes.patientNote': form.notes.patientNote,
|
||||||
'inquiry.medicalHistory': form.inquiry.medicalHistory,
|
'inquiry.medicalHistory': form.inquiry.medicalHistory,
|
||||||
'inquiry.demand': form.inquiry.demand
|
'inquiry.demand': form.inquiry.demand
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 已收款/退款中的订单不回传 payment:回传旧值会把退款状态覆盖成 unpaid/paid
|
||||||
|
if (!this.data.paymentLocked) {
|
||||||
|
payload['payment.totalFee'] = form.payment.totalFee ? Number(form.payment.totalFee) : 0
|
||||||
|
payload['payment.method'] = form.payment.method || ''
|
||||||
|
payload['payment.paidFee'] = form.payment.paid ? (form.payment.totalFee ? Number(form.payment.totalFee) : 0) : 0
|
||||||
|
payload['payment.status'] = form.payment.paid ? 'paid' : 'unpaid'
|
||||||
|
}
|
||||||
|
|
||||||
this.setData({ submitting: true })
|
this.setData({ submitting: true })
|
||||||
wx.showLoading({ title: '保存中...' })
|
wx.showLoading({ title: '保存中...' })
|
||||||
|
|
||||||
|
|||||||
@@ -104,20 +104,21 @@
|
|||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label">费用(元)</text>
|
<text class="field-label">费用(元)</text>
|
||||||
<input class="field-input" type="digit" placeholder="请输入服务费用" value="{{form.payment.totalFee}}" data-key="payment.totalFee" bindinput="onInput" disabled="{{amountLocked}}" />
|
<input class="field-input" type="digit" placeholder="请输入服务费用" value="{{form.payment.totalFee}}" data-key="payment.totalFee" bindinput="onInput" disabled="{{amountLocked}}" />
|
||||||
<text class="field-tip" wx:if="{{amountLocked}}">存在未支付流水,金额已锁定</text>
|
<text class="field-tip" wx:if="{{paymentLocked}}">已收款订单支付信息已锁定,退款请走取消流程</text>
|
||||||
|
<text class="field-tip" wx:elif="{{amountLocked}}">存在未支付流水,金额已锁定</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label">是否已支付</text>
|
<text class="field-label">是否已支付</text>
|
||||||
<view class="field-switch">
|
<view class="field-switch">
|
||||||
<text class="switch-label {{form.payment.paid ? 'paid' : 'unpaid'}}">{{form.payment.paid ? '已支付' : '未支付'}}</text>
|
<text class="switch-label {{form.payment.paid ? 'paid' : 'unpaid'}}">{{form.payment.paid ? '已支付' : '未支付'}}</text>
|
||||||
<switch checked="{{form.payment.paid}}" color="#17c3a5" bindchange="onPaidChange" />
|
<switch checked="{{form.payment.paid}}" color="#17c3a5" disabled="{{paymentLocked}}" bindchange="onPaidChange" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="field">
|
<view class="field">
|
||||||
<text class="field-label">支付方式</text>
|
<text class="field-label">支付方式</text>
|
||||||
<picker class="field-picker" mode="selector" range="{{methodOptions}}" range-key="label" bindchange="onMethodChange">
|
<picker class="field-picker" mode="selector" range="{{methodOptions}}" range-key="label" disabled="{{paymentLocked}}" bindchange="onMethodChange">
|
||||||
<view class="field-value">
|
<view class="field-value">
|
||||||
{{methodLabel || '未记录'}}
|
{{methodLabel || '未记录'}}
|
||||||
<text class="arrow">›</text>
|
<text class="arrow">›</text>
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ const API = {
|
|||||||
deleteRecord: (id) => request.delete(`/health/escort-record/${id}`),
|
deleteRecord: (id) => request.delete(`/health/escort-record/${id}`),
|
||||||
// 退款回调丢失时的人工兜底:主动查询微信退款结果并补写终态
|
// 退款回调丢失时的人工兜底:主动查询微信退款结果并补写终态
|
||||||
queryRefund: (id) => request.post(`/health/escort-record/${id}/refund/query`),
|
queryRefund: (id) => request.post(`/health/escort-record/${id}/refund/query`),
|
||||||
|
// 线下/人工退款完成后核销:确认已退款,把订单置为「已退款」
|
||||||
|
completeManualRefund: (id) => request.post(`/health/escort-record/${id}/refund/manual`),
|
||||||
},
|
},
|
||||||
|
|
||||||
healthProfile: {
|
healthProfile: {
|
||||||
|
|||||||
Reference in New Issue
Block a user