Compare commits

..
1 Commits
Author SHA1 Message Date
lik a6e308f034 feat(admin): 支持确认用户取消申请
订单详情对 cancel_requested 展示「同意取消」;列表新增待取消筛选与计数,便于陪诊师/管理员及时处理。
2026-11-05 12:43:08 +08:00
3 changed files with 16 additions and 2 deletions
+10
View File
@@ -6,6 +6,7 @@ const { calcAge } = require('../../utils/format.js')
const STATUS_MAP = { const STATUS_MAP = {
pending: { label: '待确认', text: '待确认', color: '#f59f00' }, pending: { label: '待确认', text: '待确认', color: '#f59f00' },
confirmed: { label: '已确认', text: '已确认', color: '#1abc9c' }, confirmed: { label: '已确认', text: '已确认', color: '#1abc9c' },
cancel_requested: { label: '待取消', text: '待取消', color: '#f59f00' },
in_progress: { label: '进行中', text: '进行中', color: '#20c997' }, in_progress: { label: '进行中', text: '进行中', color: '#20c997' },
completed: { label: '已完成', text: '已完成', color: '#51cf66' }, completed: { label: '已完成', text: '已完成', color: '#51cf66' },
cancelled: { label: '已取消', text: '已取消', color: '#ff6b6b' } cancelled: { label: '已取消', text: '已取消', color: '#ff6b6b' }
@@ -15,6 +16,7 @@ const STATUS_MAP = {
const STATUS_FILTERS = [ const STATUS_FILTERS = [
{ label: '全部', value: '', count: 0 }, { label: '全部', value: '', count: 0 },
{ label: '待确认', value: 'pending', count: 0 }, { label: '待确认', value: 'pending', count: 0 },
{ label: '待取消', value: 'cancel_requested', count: 0 },
{ label: '已确认', value: 'confirmed', count: 0 }, { label: '已确认', value: 'confirmed', count: 0 },
{ label: '进行中', value: 'in_progress', count: 0 }, { label: '进行中', value: 'in_progress', count: 0 },
{ label: '已完成', value: 'completed', count: 0 }, { label: '已完成', value: 'completed', count: 0 },
@@ -31,6 +33,7 @@ Page({
stats: { stats: {
total: 0, total: 0,
pending: 0, pending: 0,
cancelRequested: 0,
confirmed: 0, confirmed: 0,
inProgress: 0, inProgress: 0,
completed: 0, completed: 0,
@@ -74,6 +77,7 @@ Page({
const stats = { const stats = {
total: orders.length, total: orders.length,
pending: 0, pending: 0,
cancelRequested: 0,
confirmed: 0, confirmed: 0,
inProgress: 0, inProgress: 0,
completed: 0, completed: 0,
@@ -85,6 +89,9 @@ Page({
case 'pending': case 'pending':
stats.pending++; stats.pending++;
break; break;
case 'cancel_requested':
stats.cancelRequested++;
break;
case 'confirmed': case 'confirmed':
stats.confirmed++; stats.confirmed++;
break; break;
@@ -116,6 +123,9 @@ Page({
case 'pending': case 'pending':
count = stats.pending; count = stats.pending;
break; break;
case 'cancel_requested':
count = stats.cancelRequested;
break;
case 'confirmed': case 'confirmed':
count = stats.confirmed; count = stats.confirmed;
break; break;
+5 -1
View File
@@ -4,6 +4,7 @@ const API = require('../../utils/api.js')
const STATUS_MAP = { const STATUS_MAP = {
pending: '待确认', pending: '待确认',
confirmed: '已确认', confirmed: '已确认',
cancel_requested: '待取消',
in_progress: '进行中', in_progress: '进行中',
completed: '已完成', completed: '已完成',
cancelled: '已取消' cancelled: '已取消'
@@ -12,6 +13,7 @@ const STATUS_MAP = {
const STATUS_DESC_MAP = { const STATUS_DESC_MAP = {
pending: '订单已创建,等待确认', pending: '订单已创建,等待确认',
confirmed: '订单已确认,等待服务', confirmed: '订单已确认,等待服务',
cancel_requested: '用户已申请取消,待确认',
in_progress: '陪诊服务正在进行', in_progress: '陪诊服务正在进行',
completed: '陪诊服务已完成', completed: '陪诊服务已完成',
cancelled: '订单已取消' cancelled: '订单已取消'
@@ -75,6 +77,7 @@ Page({
// 操作按钮配置 // 操作按钮配置
showConfirmBtn: false, showConfirmBtn: false,
showCancelBtn: false, showCancelBtn: false,
cancelBtnText: '取消订单',
showStartBtn: false, showStartBtn: false,
showCompleteBtn: false showCompleteBtn: false
}, },
@@ -145,7 +148,8 @@ Page({
// 操作按钮(任何状态下均可编辑订单信息) // 操作按钮(任何状态下均可编辑订单信息)
showEditBtn: true, showEditBtn: true,
showConfirmBtn: status === 'pending', showConfirmBtn: status === 'pending',
showCancelBtn: status === 'pending', showCancelBtn: status === 'pending' || status === 'confirmed' || status === 'cancel_requested',
cancelBtnText: status === 'cancel_requested' ? '同意取消' : '取消订单',
showStartBtn: status === 'confirmed', showStartBtn: status === 'confirmed',
showCompleteBtn: status === 'in_progress' showCompleteBtn: status === 'in_progress'
}) })
+1 -1
View File
@@ -173,7 +173,7 @@
<!-- 底部操作 --> <!-- 底部操作 -->
<view class="bottom-actions" wx:if="{{showEditBtn || showConfirmBtn || showCancelBtn || showStartBtn || showCompleteBtn}}"> <view class="bottom-actions" wx:if="{{showEditBtn || showConfirmBtn || showCancelBtn || showStartBtn || showCompleteBtn}}">
<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">取消订单</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>
<view class="action-btn btn-solid" wx:if="{{showStartBtn}}" bindtap="onStart">开始服务</view> <view class="action-btn btn-solid" wx:if="{{showStartBtn}}" bindtap="onStart">开始服务</view>
<view class="action-btn btn-solid" wx:if="{{showCompleteBtn}}" bindtap="onComplete">完成服务</view> <view class="action-btn btn-solid" wx:if="{{showCompleteBtn}}" bindtap="onComplete">完成服务</view>