diff --git a/pages/order/detail.vue b/pages/order/detail.vue index a428fda..133ef82 100755 --- a/pages/order/detail.vue +++ b/pages/order/detail.vue @@ -511,11 +511,11 @@ 确认收货 - 绑定设备 + 绑定设备 我要退租 - 取消退租 - - + + 请输入更换的新电池编号 @@ -553,6 +553,19 @@ + + + + 请输入绑定电池编号 + + + + + 确定 + + + @@ -619,6 +632,7 @@ canReset: false, equipment: {}, showQRCodeBind: false, + showQRCodeChange: false, bindValue: '', equipmentGoods: {}, equipmentId: null, @@ -953,19 +967,15 @@ content: '是否退租', success: (result) => { if (result.confirm) { - const { - orderId, - equipmentId - } = order EquipmentApi.rentingOut({ - orderId, - equipmentId + orderId: order.orderId, + isRefund: 1 }).then(res => { this.$success(res.message) setTimeout(() => { // 刷新当前订单数据 app.getOrderDetail(true) - }, 1500) + }, 1000) }).catch(err => { this.$success(err.message) }) @@ -975,6 +985,30 @@ }, + handleRentingOutCancel(order) { + const app = this + uni.showModal({ + title: '提示', + content: "是否取消退租", + success: (result) => { + if (result.confirm) { + EquipmentApi.rentingOut({ + orderId: order.orderId, + isRefund: 2 + }).then(res => { + this.$success(res.message) + setTimeout(() => { + // 刷新当前订单数据 + app.onRefreshList() + }, 1000) + }).catch(err => { + this.$success(err.message) + }) + } + } + }) + }, + // 跳转到设备详情页 handleTargetEquipment(equipmentId) { this.$navTo('pages/user/equipment/index', { @@ -1034,7 +1068,37 @@ }, handleChangeEquipment() { const app = this + app.showQRCodeChange = true + }, + + // 绑定设备页面 + onBind(item) { + const app = this + const { + equipment + } = item app.showQRCodeBind = true + app.equipment = item + // app.bindValue = equipment.equipmentCode + }, + // 执行绑定 + doBind() { + const app = this + const { + orderId, + bindValue + } = this + EquipmentApi.bindEquipment({ + equipmentCode: bindValue, + orderId: equipment.orderId + }).then(result => { + app.$success(result.message) + app.showQRCodeBind = false + // 刷新订单列表 + app.onRefreshList() + }).catch(err => { + app.$error(err.message) + }) }, // 换电 doEquipment(canReset = false) { @@ -1050,7 +1114,7 @@ equipmentId }).then(result => { app.$success(result.message) - app.showQRCodeBind = false + app.showQRCodeChange = false // 相应全局事件订阅: 刷新上级页面数据 canReset && uni.$emit('syncRefreshOrder', true, true) }).catch(err => { diff --git a/pages/order/index.vue b/pages/order/index.vue index 9b5215f..e9b52ee 100755 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -103,7 +103,7 @@ 我要退租 - 取消退租 { app.$error(err.message) }) - console.log("this.bindValue: ", this.bindValue); }, // 获取核销二维码 @@ -571,16 +570,12 @@ const app = this uni.showModal({ title: '提示', - content: '是否退租', + content: "是否退租", success: (result) => { if (result.confirm) { - const { - orderId, - equipmentId - } = order EquipmentApi.rentingOut({ - orderId, - equipmentId + orderId: order.orderId, + isRefund: 1 }).then(res => { this.$success(res.message) setTimeout(() => { @@ -593,7 +588,30 @@ } } }) + }, + handleRentingOutCancel(order) { + const app = this + uni.showModal({ + title: '提示', + content: "是否取消退租", + success: (result) => { + if (result.confirm) { + EquipmentApi.rentingOut({ + orderId: order.orderId, + isRefund: 2 + }).then(res => { + this.$success(res.message) + setTimeout(() => { + // 刷新当前订单数据 + app.onRefreshList() + }, 1000) + }).catch(err => { + this.$success(err.message) + }) + } + } + }) }, // 点击去支付