diff --git a/jeepay-ui-manager/src/utils/infoBox.js b/jeepay-ui-manager/src/utils/infoBox.js
index ca59a8a195f07de37bfb4152ce291925f9cb42c6..863d81177c69421f48ed4e55245f2e53a61c376e 100644
--- a/jeepay-ui-manager/src/utils/infoBox.js
+++ b/jeepay-ui-manager/src/utils/infoBox.js
@@ -10,7 +10,7 @@ import { Modal } from 'ant-design-vue'
// 确认提示: 标题, 内容, 点击确定回调函数, 取消回调, 扩展参数
export const confirmResult = {
confirm: function (title, content, okFunc, cancelFunc = (() => {}), extConfig = {}) {
- Modal.confirm(
+ return Modal.confirm(
Object.assign({
okText: '确定',
cancelText: '取消',
@@ -22,11 +22,23 @@ export const confirmResult = {
}, extConfig))
},
confirmPrimary: function (title, content, okFunc, cancelFunc = (() => {}), extConfig = {}) {
- this.confirm(title, content, okFunc, cancelFunc, Object.assign({ okType: 'primary' }, extConfig))
+ return this.confirm(title, content, okFunc, cancelFunc, Object.assign({ okType: 'primary' }, extConfig))
},
confirmDanger: function (title, content, okFunc, cancelFunc = (() => {}), extConfig = {}) {
- this.confirm(title, content, okFunc, cancelFunc, Object.assign({ okType: 'danger' }, extConfig))
+ return this.confirm(title, content, okFunc, cancelFunc, Object.assign({ okType: 'danger' }, extConfig))
+ },
+
+ modalError: function (title, content, okFunc = (() => {})) {
+ return Modal.error({ title: title, content: content, onOk: okFunc })
+ },
+
+ modalSuccess: function (title, content, okFunc = (() => {})) {
+ return Modal.success({ title: title, content: content, onOk: okFunc })
+ },
+
+ modalWarning: function (title, content, okFunc = (() => {})) {
+ return Modal.warning({ title: title, content: content, onOk: okFunc })
}
}
diff --git a/jeepay-ui-manager/src/views/order/pay/PayOrderList.vue b/jeepay-ui-manager/src/views/order/pay/PayOrderList.vue
index ad47f6ffa7846fcaed301370642a8b654acfb9c6..9358a0892b0cf9253403a5e5ebd1805f97e48f64 100644
--- a/jeepay-ui-manager/src/views/order/pay/PayOrderList.vue
+++ b/jeepay-ui-manager/src/views/order/pay/PayOrderList.vue
@@ -88,13 +88,13 @@
详情
- 退款
+ 退款
-
+
() => ({}) }
+ },
+
data () {
return {
recordId: '',
@@ -111,19 +115,42 @@ export default {
payOrderRefund(that.recordId, that.refund.refundAmount, that.refund.refundReason).then(res => {
that.visible = false // 关闭弹窗
that.confirmLoading = false // 取消按钮转圈
+
+ if (res.state === 0 || res.state === 3) { // 订单生成 || 失败
+ const refundErrorModal = that.$infoBox.modalError('退款失败', (h) => that.buildModalText(res, h, () => { refundErrorModal.destroy() }))
+ } else if (res.state === 1) { // 退款中
+ const refundErrorModal = that.$infoBox.modalWarning('退款中', (h) => that.buildModalText(res, h, () => { refundErrorModal.destroy() }))
+ that.callbackFunc()
+ } else if (res.state === 2) { // 退款成功
that.$message.success('退款成功')
- console.log(that.refund.refundAmount)
- }).catch(err => {
- console.log(err)
+ that.callbackFunc()
+ } else {
+ const refundErrorModal = that.$infoBox.modalWarning('退款状态未知', (h) => that.buildModalText(res, h, () => { refundErrorModal.destroy() }))
+ }
+ }).catch(() => {
that.confirmLoading = false // 取消按钮转圈
- console.log(that.refund.refundAmount)
})
}
})
},
handleCancel (e) {
this.visible = false
+ },
+
+ buildModalText (res, h, callbackFunc) {
+ // 跳转退款列表Btn
+ const toRefundPageBtn = h('a', { on: { click: () => {
+ callbackFunc()
+ this.$router.push({ name: 'ENT_REFUND_ORDER' })
+ } } })
+ toRefundPageBtn.text = '退款列表'
+ return h('div', [
+ h('div', res.errCode ? `错误码:${res.errCode}` : ''),
+ h('div', res.errMsg ? `错误信息:${res.errMsg}` : ''),
+ h('div', [h('span', '请到'), toRefundPageBtn, h('span', '中查看详细信息')])
+ ])
}
+
}
}