From ffc608c5b779ce18202463c318926a3d538a2f31 Mon Sep 17 00:00:00 2001 From: e <2432808546@qq.com> Date: Tue, 3 Aug 2021 17:33:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=BB=AD=E8=B4=B9=E5=92=8C?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E5=8F=91=E8=B4=A7=E8=A7=A6=E5=8F=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/api.js | 8 ++- src/views/order/AddOrder.vue | 99 +++++++++++++++++++++++++----------- 2 files changed, 76 insertions(+), 31 deletions(-) diff --git a/src/utils/api.js b/src/utils/api.js index d3a64fb..a647030 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,9 +1,9 @@ -let host = 'http://39.108.250.202:9000' +// let host = 'http://39.108.250.202:9000' let host1 = 'http://192.168.31.216:9000'//榕 let host2 = 'http://192.168.31.125:9000'//林 let host3 = 'http://192.168.31.140:9000'//7 -// let host = 'http://192.168.31.137:9000'// 陈赓 +let host = 'http://192.168.31.137:9000'// 陈赓 export default { upload:`${host}/nakadai/nakadai/oss/fileUpload`,// 上传文件-订单 @@ -18,6 +18,10 @@ export default { orderList:`${host}/nakadai/nakadai/order/list`,// 订单列表 orderUpdate:`${host}/nakadai/nakadai/order/update`,// 订单更新 + renew:`${host}/nakadai/nakadai/orderOther/renew`,// 续费信息管理-post + ship:`${host}/nakadai/nakadai/orderOther/ship`,// 处理时的订单发货管理-post + + queryAccountIsExist: `${host}/liuwanr/userInfo/queryServerAccountIsExist`, //查询账号是否存在 diff --git a/src/views/order/AddOrder.vue b/src/views/order/AddOrder.vue index 0e4ad75..a10cef1 100644 --- a/src/views/order/AddOrder.vue +++ b/src/views/order/AddOrder.vue @@ -186,7 +186,7 @@ @@ -218,7 +218,7 @@ @@ -233,7 +233,7 @@ @@ -241,7 +241,7 @@ @@ -274,7 +274,7 @@ :inactive-value="false" active-text="发货" inactive-text="未发货" - @change="formSwitch($event,scope.row)"> + @change="deliverGoods($event,scope.row)"> @@ -393,7 +393,7 @@ - +
@@ -405,7 +405,7 @@
- + @@ -498,6 +498,8 @@ export default { editDisabled:false,// 编辑禁用 renewDisabled:false,// 续费禁用 + whetherSubmit:false,/* 提交否 */ + showSelectClient:false,// 切换展示选择客户页 form: {// 基本信息 // orderNumber: '',// 编号 @@ -737,6 +739,10 @@ export default { } }) if(!verify){ + this.whetherSubmit = true + setTimeout(() => { + this.whetherSubmit = false + }, 4000); return this.$message.error('请把产品参数输入完整!') } if(this.dataPlatform){ @@ -752,9 +758,14 @@ export default { }) this.$refs['form'].validate((valid) => { if (valid) { - if(this.renewDisabled){/* 续费状态下 */ - + let renew = this.dataPlatform.some(e=>e.renew) + if(this.renewDisabled||renew){/* 续费状态下 */ this.form.orderNature = 2 + if(renew){ + this.dataPlatform.forEach(e=>{ + if(e.renew) delete e.renew + }) + } } let param = { contractInformation:this.contract,//合同信息 @@ -829,13 +840,10 @@ export default { this.$forceUpdate() } }, - - // 课程权限 addClassJurisdiction(){ this.classVisible = !this.classVisible }, - // 数据平台权限 addDataJurisdiction(val){ if(val!=='search'){ @@ -859,7 +867,9 @@ export default { this.platformSelect = val }, // 数据平台弹框--确定 - addPlatform(){ + async addPlatform(){ + + if(!this.form.customerId) return this.$message.warning('请先选择客户!') if(this.platformSelect.length>0){ let that = this let fn = function(e){ @@ -880,8 +890,9 @@ export default { } that.dataPlatform.push(obj) } - + let idArr = [] this.platformSelect.map(e=>{// 取得选中的值,进行赋值 + idArr.push(e.id) if(this.dataPlatform.length>0){ // 比对是否存在该id,若存在,不操作,不存在,则进行push操作 let find = this.dataPlatform.some(i=>e.id === i.dataOrCourseId)// 判断已有的相同的id不进行处理 @@ -894,6 +905,29 @@ export default { }) this.showPlatform = !this.showPlatform this.platformSelect = [] + + /* 调接口,判断是否为客户已有的产品功能 */ + let params = { + authority:0, + customerId:this.form.customerId, + productId:idArr + } + await this.$post(this.api.renew,params).then(res=>{ + console.log(res,'调用查询接口'); + this.dataPlatform.map(e=>{ + res.orderOthers.map(el=>{ + if(el.dataOrCourseId === e.dataOrCourseId){ + let time = el.endTime.split(" ")[0] + let arr = time.split('-') + e.startTime = arr[0]+'-'+arr[1]+'-'+'0'+(+arr[2]+1) + e.endTime = "" + e.periodOfUse = '' + e.renew = true + } + }) + }) + }) + }else{ return this.$message('请选中数据后再确定!') } @@ -915,7 +949,6 @@ export default { row.accountNum = Math.floor(row.totalAmount/val) } }, - // 合同起止日期选择 contractTimeChange(val){ if(val.length>0){ @@ -932,7 +965,6 @@ export default { }) this.form.orderAmount = arr.reduce((a,b)=>a+b) }, - // 总金额触发--计算账号或市场价 allAmountChange(val,row){ if(row.totalAmount){ @@ -960,18 +992,18 @@ export default { }, // 权限switch切换--计算天数 formSwitch (e,row) { - - if("遇见西瓜") return '买一个包子' - else return '买一斤包子' - + console.log(e,row,'switch切换'); + }, + // 数据平台--发货 + deliverGoods (e,row) { if(this.editDisabled){ + // this.$post(this.api.ship+"?id="+`${row.dataOrCourseId}`).then(res=>{ + this.$post(this.api.ship,{id:4}).then(res=>{ + console.log(res); - return + }) } - // this.deadLine(row.periodOfUse,row) }, - // - // 使用期限转换以及计算剩余天数 deadLine(e,row){ function completeDate(value) { @@ -985,14 +1017,14 @@ export default { let year = nowDate.getFullYear(); console.log(nowDate,'nowdata'); - if(this.renewDisabled){/* 处于续费状态 */ + if(this.renewDisabled||row.renew){/* 处于续费状态 */ if(!e) return row.endTime = '' let arr = row.startTime.split('-') let renewY = arr.shift()/* 年 */ let renewM = arr.shift()/* 月 */ let renewD = arr.shift()/* 日 */ - console.log(renewY,renewM,day,'拆分时间'); - let endYear = +renewY + (parseInt((+renewM+(+e))/12)===0?0:parseInt((+renewM+(+e))/12))+ char + completeDate((+renewM+(+e))%12) + char + completeDate(renewD); + console.log(renewY,renewM,renewD,'拆分时间'); + let endYear = +renewY + (parseInt((+renewM+(+e))/12)===0?0:parseInt((+renewM+(+e))/12))+ char + completeDate((+renewM+(+e))%12) + char + renewD; row.endTime = endYear // 计算剩余天数 @@ -1001,8 +1033,6 @@ export default { let ms = Math.abs(date1 - date2) row.remainingPeriod = Math.floor(ms / (24 * 3600 * 1000)) ; - - }else{ if(e==='') { row.startTime = '' @@ -1262,6 +1292,17 @@ export default { goback(){ this.$router.go(-1) }, + /* 表格禁用 */ + selectable(row,index){ + let boolean = true + this.dataPlatform.length&&this.dataPlatform.some(e=>{ + if(e.dataOrCourseId === row.id){ + boolean = false + } + }) + console.log(boolean); + return boolean + } } };