feat(escort): 订单详情移除删除入口,取消按状态分流
只保留取消订单按钮;待确认未收款取消后直接返回列表,已确认或已收款刷新显示「待取消」。新增待取消状态展示。
This commit is contained in:
@@ -182,10 +182,8 @@ Page({
|
|||||||
const paymentInfo = PAYMENT_STATUS_MAP[paymentStatus] || PAYMENT_STATUS_MAP.unpaid
|
const paymentInfo = PAYMENT_STATUS_MAP[paymentStatus] || PAYMENT_STATUS_MAP.unpaid
|
||||||
|
|
||||||
// 底栏与「修改」入口的口径在这里算一次,WXML 只读结果,不再重复一串状态判断。
|
// 底栏与「修改」入口的口径在这里算一次,WXML 只读结果,不再重复一串状态判断。
|
||||||
// 删除收窄为「未支付 且 未进入服务阶段」:进行中的订单已产生服务成本,不允许直接删
|
// 用户只能取消:未确认且未收款的取消后订单即被删除;已确认/已收款的转为取消申请
|
||||||
const canCancel = status === 'pending' || status === 'confirmed'
|
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
|
const canRebook = (status === 'completed' || status === 'cancelled') && item.escort?.serviceId > 0
|
||||||
// 终态单据只读:医院预约与陪诊需求不允许回改(就诊人「档案」跳的是档案页,不在此列)
|
// 终态单据只读:医院预约与陪诊需求不允许回改(就诊人「档案」跳的是档案页,不在此列)
|
||||||
// 进行中服务已开始:排期与医院不允许用户单方变更,仅保留就诊人备注(与后端字段白名单一致)
|
// 进行中服务已开始:排期与医院不允许用户单方变更,仅保留就诊人备注(与后端字段白名单一致)
|
||||||
@@ -258,12 +256,11 @@ Page({
|
|||||||
statusBorder: statusInfo.border,
|
statusBorder: statusInfo.border,
|
||||||
statusDesc: statusInfo.desc,
|
statusDesc: statusInfo.desc,
|
||||||
canCancel,
|
canCancel,
|
||||||
canDelete,
|
|
||||||
canRebook,
|
canRebook,
|
||||||
canEditBooking,
|
canEditBooking,
|
||||||
canEditNote,
|
canEditNote,
|
||||||
// 底栏只在确实有按钮时出现,避免无动作状态空留一条白栏
|
// 底栏只在确实有按钮时出现,避免无动作状态空留一条白栏
|
||||||
showBottomBar: canCancel || canDelete || canRebook,
|
showBottomBar: canCancel || canRebook,
|
||||||
createTime: item.meta?.createtime ? formatDateTime(item.meta.createtime) : '',
|
createTime: item.meta?.createtime ? formatDateTime(item.meta.createtime) : '',
|
||||||
updateTime: item.meta?.updatetime ? formatDateTime(item.meta.updatetime) : ''
|
updateTime: item.meta?.updatetime ? formatDateTime(item.meta.updatetime) : ''
|
||||||
}
|
}
|
||||||
@@ -502,9 +499,14 @@ Page({
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
wx.showToast({ title: '订单已取消', icon: 'success' })
|
|
||||||
this.setData({ showCancelPopup: false })
|
this.setData({ showCancelPopup: false })
|
||||||
|
wx.showToast({ title: res.msg || '操作成功', icon: 'success' })
|
||||||
|
// 未确认且未收款的订单取消后已被删除,直接退回列表;其余刷新展示「待取消」
|
||||||
|
if (res.data?.deleted) {
|
||||||
|
setTimeout(() => wx.navigateBack(), 1200)
|
||||||
|
} else {
|
||||||
this.loadRecord(this.data.recordId)
|
this.loadRecord(this.data.recordId)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
wx.showToast({ title: res.msg || '操作失败', icon: 'none' })
|
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() {
|
onRebook() {
|
||||||
const serviceId = this.data.record.serviceId
|
const serviceId = this.data.record.serviceId
|
||||||
if (!serviceId) return
|
if (!serviceId) return
|
||||||
|
|||||||
@@ -253,11 +253,6 @@
|
|||||||
wx:if="{{record.canCancel}}"
|
wx:if="{{record.canCancel}}"
|
||||||
bindtap="onCancelOrder"
|
bindtap="onCancelOrder"
|
||||||
>取消订单</view>
|
>取消订单</view>
|
||||||
<view
|
|
||||||
class="action-btn action-ghost action-danger"
|
|
||||||
wx:if="{{record.canDelete}}"
|
|
||||||
bindtap="onDeleteOrder"
|
|
||||||
>删除订单</view>
|
|
||||||
<view
|
<view
|
||||||
class="action-btn {{record.status === 'cancelled' ? 'action-primary' : 'action-ghost'}}"
|
class="action-btn {{record.status === 'cancelled' ? 'action-primary' : 'action-ghost'}}"
|
||||||
wx:if="{{record.canRebook}}"
|
wx:if="{{record.canRebook}}"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
const STATUS_MAP = {
|
const STATUS_MAP = {
|
||||||
pending: { text: '待确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已提交,等待陪诊师确认' },
|
pending: { text: '待确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已提交,等待陪诊师确认' },
|
||||||
confirmed: { text: '已确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已确认,陪诊师将准时为您服务' },
|
confirmed: { text: '已确认', color: '#0F766E', bg: '#ECF7F4', border: '#C7E5DF', desc: '订单已确认,陪诊师将准时为您服务' },
|
||||||
|
cancel_requested: { text: '待取消', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', desc: '取消申请已提交,等待陪诊师确认' },
|
||||||
in_progress: { text: '进行中', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', desc: '陪诊服务正在进行中' },
|
in_progress: { text: '进行中', color: '#B8520A', bg: '#FFF4E8', border: '#FFE0C2', desc: '陪诊服务正在进行中' },
|
||||||
completed: { text: '已完成', color: '#1F7A4D', bg: '#EAF6EE', border: '#CDE9D7', desc: '陪诊服务已完成,感谢您的使用' },
|
completed: { text: '已完成', color: '#1F7A4D', bg: '#EAF6EE', border: '#CDE9D7', desc: '陪诊服务已完成,感谢您的使用' },
|
||||||
cancelled: { text: '已取消', color: '#B4231A', bg: '#FCF0EE', border: '#F2D6D1', desc: '该订单已取消' }
|
cancelled: { text: '已取消', color: '#B4231A', bg: '#FCF0EE', border: '#F2D6D1', desc: '该订单已取消' }
|
||||||
|
|||||||
Reference in New Issue
Block a user