From 4e9c53998905ac9291eb9abdf44a14f87e6b6121 Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Tue, 29 Sep 2026 12:16:36 +0800 Subject: [PATCH] feat(mini): add withdraw on ETC vehicle recharge apply list Co-authored-by: Cursor --- miniprogram/api/pl.js | 6 ++++ .../pages/pl/vehicle-recharge-apply/list.vue | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/miniprogram/api/pl.js b/miniprogram/api/pl.js index 45de718b3..990e2c7b9 100644 --- a/miniprogram/api/pl.js +++ b/miniprogram/api/pl.js @@ -124,6 +124,12 @@ export const vehicleRechargeApplyApi = { `/transport/vehicle-recharge-apply/${id}/cancel`, {}, { params: { mineVehicles: true } } + ), + withdraw: (id) => + db.post( + `/transport/vehicle-recharge-apply/${id}/withdraw`, + {}, + { params: { mineVehicles: true } } ) } diff --git a/miniprogram/pages/pl/vehicle-recharge-apply/list.vue b/miniprogram/pages/pl/vehicle-recharge-apply/list.vue index b50ab15ec..83d502214 100644 --- a/miniprogram/pages/pl/vehicle-recharge-apply/list.vue +++ b/miniprogram/pages/pl/vehicle-recharge-apply/list.vue @@ -103,6 +103,10 @@ + @@ -157,6 +161,12 @@ function canWrite(item) { return String(item.applicantId || '') === currentUserId() } +function canWithdraw(item) { + if (!item) return false + if (item.status !== 'in_approval') return false + return String(item.applicantId || '') === currentUserId() +} + function typeLabel(v) { if (v === 'etc') return 'ETC' if (v === 'fuel') return '加油' @@ -300,6 +310,24 @@ function handleCancel(item) { }) } +function handleWithdraw(item) { + uni.showModal({ + title: '撤回确认', + content: '确定撤回该充值申请?撤回后变为草稿,可修改后再提交。', + confirmText: '确定撤回', + success: async (res) => { + if (!res.confirm) return + try { + await vehicleRechargeApplyApi.withdraw(item.id) + uni.showToast({ title: '已撤回', icon: 'success' }) + onRefresh() + } catch (e) { + // toasted by request layer + } + } + }) +} + onShow(() => { computeListHeight() onRefresh()