You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

/**
* 申请退单:弹窗收集必填理由
* @returns {Promise<string|null>}
*/
export function promptRefundReason() {
return new Promise((resolve) => {
uni.showModal({
title: '申请退单',
content: '',
editable: true,
placeholderText: '请填写退单理由(必填)',
confirmText: '下一步',
cancelText: '取消',
success: (r) => {
if (!r.confirm) {
resolve(null)
return
}
const reason = String(r.content || '').trim()
if (!reason) {
uni.showToast({ title: '请填写退单理由', icon: 'none' })
resolve(null)
return
}
resolve(reason)
},
fail: () => resolve(null)
})
})
}
export function hasPendingRefund(item) {
if (!item) return false
if (item.has_pending_refund === true || item.has_pending_refund === 1 || item.has_pending_refund === '1') {
return true
}
if (item.refund_display_status === 'pending') return true
const pending = item.pending_accompany_order_refund || item.pendingAccompanyOrderRefund
if (pending && pending.id) return true
return false
}
export function refundOrderStatusText(refundStatus) {
const n = Number(refundStatus)
if (n === 0) return '退款审核中'
if (n === 1) return '已退款'
if (n === 2) return '已驳回'
return '—'
}