diff --git a/pages/escort/recorddetail.js b/pages/escort/recorddetail.js
index 080da5d..d152648 100644
--- a/pages/escort/recorddetail.js
+++ b/pages/escort/recorddetail.js
@@ -182,10 +182,8 @@ Page({
const paymentInfo = PAYMENT_STATUS_MAP[paymentStatus] || PAYMENT_STATUS_MAP.unpaid
// 底栏与「修改」入口的口径在这里算一次,WXML 只读结果,不再重复一串状态判断。
- // 删除收窄为「未支付 且 未进入服务阶段」:进行中的订单已产生服务成本,不允许直接删
+ // 用户只能取消:未确认且未收款的取消后订单即被删除;已确认/已收款的转为取消申请
const canCancel = status === 'pending' || status === 'confirmed'
- const canDelete = paymentStatus === 'unpaid'
- && (status === 'pending' || status === 'confirmed' || status === 'cancelled')
const canRebook = (status === 'completed' || status === 'cancelled') && item.escort?.serviceId > 0
// 终态单据只读:医院预约与陪诊需求不允许回改(就诊人「档案」跳的是档案页,不在此列)
// 进行中服务已开始:排期与医院不允许用户单方变更,仅保留就诊人备注(与后端字段白名单一致)
@@ -258,12 +256,11 @@ Page({
statusBorder: statusInfo.border,
statusDesc: statusInfo.desc,
canCancel,
- canDelete,
canRebook,
canEditBooking,
canEditNote,
// 底栏只在确实有按钮时出现,避免无动作状态空留一条白栏
- showBottomBar: canCancel || canDelete || canRebook,
+ showBottomBar: canCancel || canRebook,
createTime: item.meta?.createtime ? formatDateTime(item.meta.createtime) : '',
updateTime: item.meta?.updatetime ? formatDateTime(item.meta.updatetime) : ''
}
@@ -502,9 +499,14 @@ Page({
.then((res) => {
wx.hideLoading()
if (res.code === 0) {
- wx.showToast({ title: '订单已取消', icon: 'success' })
this.setData({ showCancelPopup: false })
- this.loadRecord(this.data.recordId)
+ wx.showToast({ title: res.msg || '操作成功', icon: 'success' })
+ // 未确认且未收款的订单取消后已被删除,直接退回列表;其余刷新展示「待取消」
+ if (res.data?.deleted) {
+ setTimeout(() => wx.navigateBack(), 1200)
+ } else {
+ this.loadRecord(this.data.recordId)
+ }
} else {
wx.showToast({ title: res.msg || '操作失败', icon: 'none' })
}
@@ -515,35 +517,6 @@ Page({
})
},
- onDeleteOrder() {
- wx.showModal({
- title: '删除订单',
- content: '确定要删除该订单吗?删除后不可恢复。',
- confirmColor: '#B4231A',
- success: (res) => {
- if (res.confirm) {
- wx.showLoading({ title: '删除中...' })
- API.escort.deleteRecord(this.data.recordId)
- .then((res) => {
- wx.hideLoading()
- if (res.code === 0) {
- wx.showToast({ title: '删除成功', icon: 'success' })
- setTimeout(() => {
- wx.navigateBack()
- }, 1500)
- } else {
- wx.showToast({ title: res.msg || '删除失败', icon: 'none' })
- }
- })
- .catch(() => {
- wx.hideLoading()
- wx.showToast({ title: '网络请求失败', icon: 'none' })
- })
- }
- }
- })
- },
-
onRebook() {
const serviceId = this.data.record.serviceId
if (!serviceId) return
diff --git a/pages/escort/recorddetail.wxml b/pages/escort/recorddetail.wxml
index 1b2f5ac..838a2fc 100644
--- a/pages/escort/recorddetail.wxml
+++ b/pages/escort/recorddetail.wxml
@@ -253,11 +253,6 @@
wx:if="{{record.canCancel}}"
bindtap="onCancelOrder"
>取消订单
- 删除订单