diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index 8eecf09..8e6996b 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -806,75 +806,88 @@ export default { this.$get(this.api.orderDetail, { orderId: +id }).then(res => { let form = res.orderDetails.order;// 基本信息 let contract = res.orderDetails.contractInformation ? res.orderDetails.contractInformation : {}; // 合同 - let list = res.orderDetails.orderOther.map(e => { - // 处于续费 - if (this.renewDisabled) { - let end = Date.parse(e.endTime); - let now = +new Date(); - if (now < end) { - let time = e.endTime.split(" ")[0]; - let arr = time.split("-"); - e.startTime = arr[0] + "-" + arr[1] + "-" + (+arr[2] + 1); - } else { - // 过期 - e.startTime = ""; + const { orderOther } = res.orderDetails + const productId = orderOther.map(e => e.dataOrCourseId) + this.$post(this.api.renew, { + authority: orderOther[0].authority, + customerId: form.customerId, + productId + }).then(res => { + const renewList = res.orderOthers + let list = orderOther.map(e => { + const item = renewList.find(n => n.dataOrCourseId === e.dataOrCourseId) + if (item) { + // 处于续费 + if (this.renewDisabled) { + let end = Date.parse(item.endTime); + let now = +new Date(); + if (now < end) { + let time = new Date(item.endTime.split(" ")[0]) + time = new Date(time.setDate(time.getDate() + 1)) + e.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}` + } else { + // 过期 + e.startTime = ""; + } + e.endTime = ""; + e.periodOfUse = ""; + } else { + e.startTime = item.startTime.split(" ")[0]; + e.endTime = item.endTime.split(" ")[0]; + } } - e.endTime = ""; - e.periodOfUse = ""; + return e; + });// 俩列表 + if (this.renewDisabled) { // 续费状态下,清空上个订单合同信息 + this.contract = { + contractName: "", + contractFile: "", + contractMoney: "", + contractNumber: "", + startTime: "", + endTime: "" + }; } else { - e.startTime = e.startTime.split(" ")[0]; - e.endTime = e.endTime.split(" ")[0]; + this.contract = { + contractName: contract.contractName, + contractMoney: contract.contractMoney, + contractNumber: contract.contractNumber, + startTime: contract.startTime ? contract.startTime : "", + endTime: contract.endTime ? contract.endTime : "", + contractId: contract.contractId, + uploadList: { + name: contract.contractFile ? contract.contractFile.split("/").pop() : "", + url: contract.contractFile + } + }; + if (contract.startTime && contract.endTime) { + this.contractTime = [contract.startTime, contract.endTime]; + } } - return e; - });// 俩列表 - if (this.renewDisabled) { // 续费状态下,清空上个订单合同信息 - this.contract = { - contractName: "", - contractFile: "", - contractMoney: "", - contractNumber: "", - startTime: "", - endTime: "" + this.form = { + orderNumber: form.orderNumber, + createTime: form.createTime, + provinceId: form.provinceId, + orderContact: form.orderContact, + email: form.email, + customerId: form.customerId, + customerName: form.customerName, + orderType: form.orderType, + cityId: form.cityId, + phone: form.phone, + orderAmount: form.orderAmount, + orderId: form.orderId, + options: form.options, }; - } else { - this.contract = { - contractName: contract.contractName, - contractMoney: contract.contractMoney, - contractNumber: contract.contractNumber, - startTime: contract.startTime ? contract.startTime : "", - endTime: contract.endTime ? contract.endTime : "", - contractId: contract.contractId, - uploadList: { - name: contract.contractFile ? contract.contractFile.split("/").pop() : "", - url: contract.contractFile + this.coursePermissions = list.filter(i => i.authority === 1); + this.dataPlatformPermissions = list.filter(i => i.authority === 0); + this.$nextTick(() => { + if(this.form.provinceId){ + this.getCityData() } - }; - if (contract.startTime && contract.endTime) { - this.contractTime = [contract.startTime, contract.endTime]; - } - } - this.form = { - orderNumber: form.orderNumber, - createTime: form.createTime, - provinceId: form.provinceId, - orderContact: form.orderContact, - email: form.email, - customerId: form.customerId, - customerName: form.customerName, - orderType: form.orderType, - cityId: form.cityId, - phone: form.phone, - orderAmount: form.orderAmount, - orderId: form.orderId, - options: form.options, - }; - this.coursePermissions = list.filter(i => i.authority === 1); - this.dataPlatformPermissions = list.filter(i => i.authority === 0); - this.$nextTick(() => { - if(this.form.provinceId){ - this.getCityData() - } - }); + }); + }).catch(err => {}) + }); }, // 新增订单 @@ -886,7 +899,7 @@ export default { if (this.coursePermissions.length) { let courseVerify = this.coursePermissions.some(e => { - if (!e.periodOfUse || !e.finalPrice) { + if (!e.periodOfUse || e.finalPrice === '') { return false; } else { return true;