diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index f7957f2..09b5629 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -122,10 +122,10 @@ class="time-input" :class="!scope.row.periodOfUse&&whetherSubmit?'red':''" :disabled="viewDisabled||editDisabled" maxlength="4" - @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options)" + @change="deadLine(scope.row.periodOfUse,scope.row,scope.row.options, 1)" @input="scope.row.periodOfUse = scope.row.periodOfUse.replace(/[^0-9.]/g,'')" v-model="scope.row.periodOfUse" placeholder="输入时间"> - + @@ -1337,27 +1337,6 @@ export default { }, // 使用期限转换以及计算剩余天数 deadLine(e,row,options, isDate) { - // 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 - if (isDate) { - const cId = row.dataOrCourseId - const date = row.startTime - const orderRepeat = this.orderRepeat - this.$post(this.api.getOrderOtherTime, { - customerId: this.form.customerId, - id: row.dataOrCourseId, - startTime: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() - }).then(res => { - orderRepeat.includes(cId) && orderRepeat.splice(orderRepeat.findIndex(e => e === cId), 1) - if (res.endTime) { - let time = new Date(res.endTime) - time = new Date(time.setDate(time.getDate() + 1)) - row.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}` - } - }).catch(res => { - this.repeatMsg = res.message - orderRepeat.includes(cId) || orderRepeat.push(cId) - }) - } let optionsData = '' if(e > 0){ if (options == 1){ @@ -1379,6 +1358,28 @@ export default { let endYear = timestamp - time let endYears = endYear/1000/60/60/24 row.remainingPeriod = endYears + // 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 + if (isDate) { + const cId = row.dataOrCourseId + const date = new Date(row.startTime) + const orderRepeat = this.orderRepeat + this.$post(this.api.getOrderOtherTime, { + customerId: this.form.customerId, + id: row.dataOrCourseId, + startTime: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(), + endTime: row.endTime + }).then(res => { + orderRepeat.includes(cId) && orderRepeat.splice(orderRepeat.findIndex(e => e === cId), 1) + if (res.endTime) { + let time = new Date(res.endTime) + time = new Date(time.setDate(time.getDate() + 1)) + row.startTime = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}` + } + }).catch(res => { + this.repeatMsg = res.message + orderRepeat.includes(cId) || orderRepeat.push(cId) + }) + } }, // 清除省份 clearprovince() {