diff --git a/orderList/orderDetails/orderDetails.vue b/orderList/orderDetails/orderDetails.vue index dbc4ea3..221364f 100644 --- a/orderList/orderDetails/orderDetails.vue +++ b/orderList/orderDetails/orderDetails.vue @@ -113,10 +113,8 @@ {{details.createTime}} - - 退款 @@ -188,31 +186,31 @@ refundMap: new Map([ [ ['FUYOU'], { - interface: serve.fuyouRefund, + serveTarget: serve.fuyouRefund, type: 'post' } ], [ ['ZHIZHU', 'NEWHOPE', 'MUYUAN', 'G7CLUSTER-CAHNGJIU'], { - interface: serve.orderRefund, + serveTarget: serve.orderRefund, type: 'post' } ], [ ['SHUNFENG'], { - interface: serve.sfRefund, + serveTarget: serve.sfRefund, type: 'post' } ], [ ['ANNENG'], { - interface: serve.refund, + serveTarget: serve.refund, type: 'get' } ], [ ['YIGUANYOU', 'ANTU'], { - interface: serve.unifiedRefund, + serveTarget: serve.unifiedRefund, type: 'post' } ], @@ -226,26 +224,67 @@ this.id = JSON.parse(e.jsData).id this.getList(this.id) } - console.log('refundMap', this.refundMap) + // console.log('refundMap', this.refundMap) }, methods: { - refundff() { - let {createSource} = this.details - if(!createSource) { + refundNew() { + let { + createSource, + id + } = this.details + if (!createSource) { uni.showToast({ - title:"createSource 为空", - icon:"none" + title: "未查询到该订单创建来源", + icon: "none" }) - return + return } let keys = this.refundMap.keys() - console.log(keys) - // console.log(this.details) - // console.log('refundff') + let result = null + for (let key of keys) { + if (key.includes(createSource)) { + result = this.refundMap.get(key) + break + } + } + if (result) { + let { + type, + serveTarget + } = result + let params = type === 'post' ? { + id, + orderId: id + } : id + serveTarget(params).then(res => { + if (res.code === 20000) { + uni.showToast({ + title: '退款成功', + duration: 2000 + }); + setTimeout(() => { + that.getList(id) + }, 1000) + } + }) + } else { + orderList.refund({ + id + }).then(res => { + if (res.code == 20000) { + uni.showToast({ + title: '退款成功', + duration: 2000 + }); + setTimeout(() => { + that.getList(id) + }, 1000) + } + }) + } }, codeFn() { if (this.details.orderWfStatus == 0) { - orderList.getOrderQrCodeOms(this.details.orderSerialNumber).then(res => { if (res.code == 20000) { console.log(res) @@ -265,28 +304,29 @@ }, refund() { if (this.details.orderStatus !== 1) return; - let that = this + // let that = this uni.showModal({ title: '提示', content: '是否确认退款', - success: function(res) { + success: (res) => { if (res.confirm) { - orderList.refund({ - id: that.id - }).then(res => { - if (res.code == 20000) { - uni.showToast({ - title: '退款成功', - duration: 2000 - }); - setTimeout(() => { - that.getList(that.id) - }, 1000) - } - }) - console.log('用户点击确定'); + this.refundNew() + // orderList.refund({ + // id: that.id + // }).then(res => { + // if (res.code == 20000) { + // uni.showToast({ + // title: '退款成功', + // duration: 2000 + // }); + // setTimeout(() => { + // that.getList(that.id) + // }, 1000) + // } + // }) + // console.log('用户点击确定'); } else if (res.cancel) { - console.log('用户点击取消'); + // console.log('用户点击取消'); } } });