feat(mini): add withdraw on ETC vehicle recharge apply list
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
94e4ef6f8e
commit
4e9c539989
2 files changed
+34
No files matched your search
@@ -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 } }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@
|
||||
<button class="btn btn-sm btn-primary" @click="goForm(item.id)">编辑</button>
|
||||
<button class="btn btn-sm btn-danger" @click="handleCancel(item)">作废</button>
|
||||
</template>
|
||||
<template v-else-if="canWithdraw(item)">
|
||||
<button class="btn btn-sm btn-ghost" @click="handleWithdraw(item)">撤回</button>
|
||||
<button class="btn btn-sm btn-primary" @click="goForm(item.id)">查看</button>
|
||||
</template>
|
||||
<button v-else class="btn btn-sm btn-primary" @click="goForm(item.id)">查看</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user