|
|
@@ -108,7 +108,7 @@ export default {
|
|
|
selectedKeys: [],
|
|
|
showRefundActions: false,
|
|
|
refundVisible: false,
|
|
|
- refundTarget: null,
|
|
|
+ refundTargets: [],
|
|
|
refundSubmitting: false
|
|
|
}
|
|
|
},
|
|
|
@@ -171,32 +171,33 @@ export default {
|
|
|
},
|
|
|
handleRefund() {
|
|
|
const selected = this.items.filter((item, index) => this.isSelected(item, index))
|
|
|
- if (selected.length !== 1) {
|
|
|
- uni.showToast({ title: selected.length ? '一次只能选择一条套餐退款' : '请选择要退款的套餐', icon: 'none' })
|
|
|
+ if (!selected.length) {
|
|
|
+ uni.showToast({ title: '请选择要退款的套餐', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
- if (!selected[0].userOrderId) {
|
|
|
+ if (selected.some(item => !item.userOrderId)) {
|
|
|
uni.showToast({ title: '退款缺少用户子订单号', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
- this.refundTarget = selected[0]
|
|
|
+ this.refundTargets = selected
|
|
|
this.refundVisible = true
|
|
|
},
|
|
|
closeRefundModal() {
|
|
|
if (this.refundSubmitting) return
|
|
|
this.refundVisible = false
|
|
|
- this.refundTarget = null
|
|
|
+ this.refundTargets = []
|
|
|
},
|
|
|
confirmRefund() {
|
|
|
- if (!this.refundTarget || !this.refundTarget.userOrderId || this.refundSubmitting) return
|
|
|
+ if (!this.refundTargets.length || this.refundSubmitting) return
|
|
|
this.refundSubmitting = true
|
|
|
- merchantDishApi.packageOrderDirectRefund(this.refundTarget.userOrderId).then((res) => {
|
|
|
+ const userOrderIds = this.refundTargets.map(item => item.userOrderId)
|
|
|
+ merchantDishApi.packageOrderDirectRefund(userOrderIds).then((res) => {
|
|
|
if (res.data.code !== 200) {
|
|
|
uni.showToast({ title: res.data.message || '退款失败', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
this.refundVisible = false
|
|
|
- this.refundTarget = null
|
|
|
+ this.refundTargets = []
|
|
|
this.selectedKeys = []
|
|
|
uni.showToast({ title: res.data.message || '退款成功', icon: 'success' })
|
|
|
this.loadDetail()
|