xuzhiheng 1 jaar geleden
bovenliggende
commit
581453df2e

+ 26 - 18
src/views/order/components/bigOrder.vue

@@ -285,7 +285,7 @@
                                 <strong>{{ row.name }}</strong>
                             </template>
                             <template slot-scope="{ row, index }" slot="money">
-                                <Input v-model="saleTableData[index].money" @on-change="saleTableFunc" type="number"></Input>
+                                <Input v-model="saleTableData[index].money" @on-keyup="saleTableChange(index)" type="number"></Input>
                             </template>
                         </Table>
                     </FormItem>
@@ -338,7 +338,7 @@ export default {
                 if (this.noPhone) {
                     return false
                 } else {
-                    if (!(/^1[3456789]\d{9}$/.test(this.member.phone))) {
+                    if (!(/^1[03456789]\d{9}$/.test(this.member.phone))) {
                         return true
                     } else {
                         return false
@@ -416,18 +416,16 @@ export default {
             }
           },200)
         },
-        saleTableFunc (val) {
-            let money = Number(this.member.payMoney)+Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
-            let moneys = Number(money/(this.saleTableData.length-1)).fixed(2)
-            if (this.saleTableData.length > 2) {
-                if (Number(val).fixed(2) > money - moneys*this.saleTableData.length-2) {
-                    this.$Notice.warning({title: '业绩金额大于应付金额'})
-                }
-            } else {
-                if (Number(val).fixed(2) > money) {
-                    this.$Notice.warning({title: '业绩金额大于应付金额'})
+        saleTableChange(index) {
+            let money = Number(this.saleTableData[index].money).fixed(2)
+            this.saleTableData[index].money = money
+            let moneys = 0
+            this.saleTableData.forEach(v => {
+                if (v.name !== '合计') {
+                    moneys += v.money
                 }
-            }
+            })
+            this.saleTableData[this.saleTableData.length-1].money = moneys
         },
         updateSaleMoney () {
             let money = Number(this.member.payMoney)+Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
@@ -1740,11 +1738,21 @@ export default {
                   this.$Notice.warning({title: '请输入大于0的数量'})
                     return
                 }
-                // 公司名称在依赖后端校验的几个选项后 继续依赖后端校验
-                // if (this.member.companyName == ''){
-                //     this.$Notice.warning({title: '购买主体为企业,请输入公司名称'})
-                //     return
-                // }
+            }
+            if (this.saleTableData) {
+                let isOk = true
+                this.saleTableData.forEach(v => {
+                    if (v.name === '合计') {
+                        let money = Number(this.member.payMoney)+Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
+                        if (Number(v.money) > money) {
+                            this.$Notice.warning({title: '业绩金额大于应付金额'})
+                            isOk = false
+                        }
+                    }
+                })
+                if (!isOk) {
+                    return
+                }
             }
             let serveData = []
             this.datas2.forEach(v => {

+ 33 - 46
src/views/order/components/bigOrderEdit.vue

@@ -319,7 +319,7 @@
                         <strong>{{ row.name }}</strong>
                     </template>
                     <template slot-scope="{ row, index }" slot="money">
-                        <Input v-model="saleTableData[index].money" type="number"></Input>
+                        <Input v-model="saleTableData[index].money" @on-keyup="saleTableChange(index)" type="number"></Input>
                     </template>
                 </Table>
             </FormItem>
@@ -448,6 +448,11 @@ export default {
           }
           //业绩统计时间
           this.$refs.sigleRef3.dataVals = new Date(res.sale_time)
+          setTimeout( ()=>{
+            if (res.salesperson) {
+              this.saleTableData = JSON.parse(res.saleMoney).data
+            }
+          },1000)
         })
       }
     },
@@ -511,8 +516,19 @@ export default {
         },500)
       }).post()
     },
+    saleTableChange(index) {
+        let money = Number(this.saleTableData[index].money).fixed(2)
+        this.saleTableData[index].money = money
+        let moneys = 0
+        this.saleTableData.forEach(v => {
+            if (v.name !== '合计') {
+                moneys += v.money
+            }
+        })
+        this.saleTableData[this.saleTableData.length-1].money = moneys
+    },
     updateSaleMoney () {
-      let money = Number(this.member.payMoney)+Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
+      let money = Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
       let moneys = Number(money/(this.saleTableData.length-1)).fixed(2)
       this.saleTableData.forEach(v => {
         if (v.name === '合计') {
@@ -588,14 +604,10 @@ export default {
             this.combo_id = ''
             this.member.single = false
             this.member.areaCount = 0
-
-      // this.initialized()
             this.reged() 
             if(this.member.buySubject==this.show_buy_subject){
               this.show(this.olddata)
             }
-            
-            // console.log(this.repair,this.member.createType,'切换服务状态')
         },
     buyHandler() {
             this.member.buyCount=this.member.buyCount.replace(/[^\d]+/g,'')
@@ -700,11 +712,6 @@ export default {
           this.interested = true
         }
       }
-      //我的订单均为无权益
-      // if (!this.returnMyReceivable) {
-      //   this.interested = false
-      // }
-      // console.log('权益是否开通' + this.interested)
     },
     moneyReg(val) {
       return val.replace(/[^\d^\.]+/g, '').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')
@@ -776,7 +783,6 @@ export default {
 
             }
           }
-          // console.log(this.member.products,this.member.buySubject)
           if (this.member.products == 1) {
             if(this.member.buySubject!='2'){//主体为个体走原有逻辑
               if (this.bigStas == 1) {
@@ -847,7 +853,6 @@ export default {
             }
 
             }else{
-              // console.log('企业',this.member.buySubject)
               this.colr = ''
               if (this.nums == 0) {
                 this.creAuth = '1'
@@ -1031,7 +1036,6 @@ export default {
       }).success((res) => {
         this.oldCurrentId = res.data.list
       }).post()
-      // console.log("扩充订单新旧服务对比", this.currentId, this.oldCurrentId)
     },
     unique(arr) {// 去重
       const res = new Map()
@@ -1101,7 +1105,6 @@ export default {
             }).map(t => {
               return t.count
             }) : []
-            // console.log(this.member.level,this.member.buySubject)
             if(this.member.buySubject!=this.show_buy_subject){
               this.pacData.push({
               id: v.id,
@@ -1111,20 +1114,9 @@ export default {
               b_pkcount: '',
               count: Number(String(countStr))
             })
-            // console.log(this.member.supplyMoney)
             this.member.supplyMoney='0'
             this.member.sums='0'
             this.member.supplyPayMoney=0
-            // if (Number(String(countStr)) / v.s_pkcount) {
-            //   this.datas2.push({
-            //     id: v.id,
-            //     name: v.s_name,
-            //     price: v.i_pkprice,
-            //     s_pkcount: v.s_pkcount,
-            //     count: Number(String(countStr)) / v.s_pkcount ? Number(String(countStr)) / v.s_pkcount : ''
-            //   })
-            // }
-
             }else{
               this.pacData.push({
               id: v.id,
@@ -1247,17 +1239,10 @@ export default {
       this.sumSel = []
       this.serData.forEach(k => {
         if (this.repair == '1') {
-          // console.log(this.currentId,this.equity,'新服务选中ID,和权益是否开通')
           if (k.id == 1) {
             k._checked = true
             k._disabled = true
           }
-          //原有逻辑已开通不回显勾选
-          // if (!this.equity) {
-          //   if (this.currentId.indexOf(k.id) > -1) {
-          //     k._checked = true
-          //   }
-          // }
           if (this.currentId.indexOf(k.id) > -1) {
               k._checked = true
           }
@@ -1331,8 +1316,6 @@ export default {
       })
     },
     leChange(val, check = true) {// 会员套餐
-      // console.log("会员套餐", val, check)
-
       val = val ? JSON.parse(val) : ''
       this.sArr = []
       this.combo_id = val
@@ -1340,11 +1323,7 @@ export default {
       if (this.pReadon) {
         this.myNoTchange()
       }
-      // console.log("phone 权益", val.i_ispreinstall, this.bigStas, this.subStas)
       if (val.i_ispreinstall == 0) { //自定义套餐
-        //   if (check && val !== undefined) {
-        //   this.allCancel()
-        // }
         if(this.member.buySubject!='2'){//主体为个体走原有逻辑
           if (this.bigStas == 1) {
           if (this.subStas == 1) {
@@ -2027,6 +2006,21 @@ export default {
             return
         }
       }
+      if (this.saleTableData) {
+          let isOk = true
+          this.saleTableData.forEach(v => {
+              if (v.name === '合计') {
+                  let money = Number(this.member.payMoney)+Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
+                  if (Number(v.money) > money) {
+                      this.$Notice.warning({title: '业绩金额大于应付金额'})
+                      isOk = false
+                  }
+              }
+          })
+          if (!isOk) {
+              return
+          }
+      }
       let serveData = []
       this.datas2.forEach(v => {
         serveData.push({
@@ -2132,7 +2126,6 @@ export default {
           saleDep: this.saleCode,
           saleMoney: JSON.stringify({data: this.saleTableData}),
         }
-        // console.log(obj)
         if (this.returnMyReceivable) {
           this.urlReq('/order/updateBigOrder', obj)
         } else {
@@ -2177,7 +2170,6 @@ export default {
           saleDep: this.saleCode,
           saleMoney: JSON.stringify({data: this.saleTableData}),
         }
-        // console.log(obj)
         if (this.returnMyReceivable) {
           this.urlReq('/order/updateSubOrder', obj)
         } else {
@@ -2333,9 +2325,6 @@ export default {
         }else{
           this.finish_dis=false
         }
-        if (res.salesperson) {
-            this.saleTableData = JSON.parse(res.saleMoney).data
-        }
         // 补充包列表
         this.supplys = filterData.supplys
         this.member = {
@@ -2441,10 +2430,8 @@ export default {
             s_servers: ""
           }
           this.member.level = JSON.stringify(obj)
-          // this.proChange(Number(products))
         }
         this.nums = 0
-        // console.log(this.interested,res.buy_subject,this.member.buySubject,'21212121')
       })
       this.bShow = true
       

+ 27 - 7
src/views/order/components/otherOrder.vue

@@ -243,7 +243,7 @@
                     <strong>{{ row.name }}</strong>
                 </template>
                 <template slot-scope="{ row, index }" slot="money">
-                    <Input v-model="saleTableData[index].money" type="number"></Input>
+                    <Input v-model="saleTableData[index].money" @on-keyup="saleTableChange(index)" type="number"></Input>
                 </template>
             </Table>
         </FormItem>
@@ -353,6 +353,17 @@ export default {
         }
       })
     },
+    saleTableChange(index) {
+        let money = Number(this.saleTableData[index].money).fixed(2)
+        this.saleTableData[index].money = money
+        let moneys = 0
+        this.saleTableData.forEach(v => {
+            if (v.name !== '合计') {
+                moneys += v.money
+            }
+        })
+        this.saleTableData[this.saleTableData.length-1].money = moneys
+    },
     updateSaleMoney () {
         let money = Number(this.others.contractMoney)-Number(this.others.commission)-Number(this.others.proceduresMoney)
         let moneys = Number(money/(this.saleTableData.length-1)).fixed(2)
@@ -595,9 +606,7 @@ export default {
       }
     },
     provinceSel(data) {
-      console.log(String(data))
       this.others.area = String(data)
-      // this.$refs.others.validateField('area')
     },
     startDate1(val) {
       if (val) {
@@ -606,10 +615,6 @@ export default {
         this.others.vipStartTime = ''
       }
     },
-    // myStartDate1() {
-    //   this.$refs.sigleRef1.dataVals = '2099-01-01'
-    //   this.others.vipStartTime = '2099-01-01'
-    // },
     noTchange(val) {
       this.dateReadon = val
       if (val) {
@@ -792,6 +797,21 @@ export default {
           }
         }
       }
+      if (this.saleTableData) {
+          let isOk = true
+          this.saleTableData.forEach(v => {
+              if (v.name === '合计') {
+                  let money = Number(this.member.payMoney)+Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
+                  if (Number(v.money) > money) {
+                      this.$Notice.warning({title: '业绩金额大于应付金额'})
+                      isOk = false
+                  }
+              }
+          })
+          if (!isOk) {
+              return
+          }
+      }
       if (this.others.productType == '5') {
         if (this.others.phone) {
           if ((/^1[03456789]\d{9}$/.test(this.others.phone))) {

+ 36 - 21
src/views/order/components/otherOrderEdit.vue

@@ -260,7 +260,7 @@
                     <strong>{{ row.name }}</strong>
                 </template>
                 <template slot-scope="{ row, index }" slot="money">
-                    <Input v-model="saleTableData[index].money" type="number"></Input>
+                    <Input v-model="saleTableData[index].money" @on-keyup="saleTableChange(index)" type="number"></Input>
                 </template>
             </Table>
         </FormItem>
@@ -421,6 +421,17 @@ export default {
         }
       })
     },
+    saleTableChange(index) {
+        let money = Number(this.saleTableData[index].money).fixed(2)
+        this.saleTableData[index].money = money
+        let moneys = 0
+        this.saleTableData.forEach(v => {
+            if (v.name !== '合计') {
+                moneys += v.money
+            }
+        })
+        this.saleTableData[this.saleTableData.length-1].money = moneys
+    },
     updateSaleMoney () {
       let money = Number(this.others.contractMoney)-Number(this.others.commission)-Number(this.others.proceduresMoney)
         let moneys = Number(money/(this.saleTableData.length-1)).fixed(2)
@@ -482,7 +493,6 @@ export default {
         return result.reverse()
     },
     intered(time, phone, money) {// 判断权益是否开通
-      console.log(time, phone.substr(0, 1), money)
       if (money > 0) {// 已回款金额
         this.others.order_status = 1
         this.noFinishDis = true
@@ -576,7 +586,6 @@ export default {
             if (res.data.userData) {
               this.areaNums = res.data.userData
             }
-            console.log(res.data.willEffect)
             if (res.data.willEffect == true && !this.readonly) { // 存在即将生效的超级订阅订单
               if(this.others.buySubject!='2'){ //个人走原逻辑
 
@@ -619,7 +628,6 @@ export default {
                 this.payDis = true
                 this.payChange()
               }
-              console.log(this.others.vipType,this.payDis)
               }else{//企业默认为购买
                 this.others.vipType = '0'
                 this.payDis = true
@@ -822,15 +830,7 @@ export default {
         return
        }
       }
-      // if (!this.others.companyName) {
-      //   this.$Notice.warning({title: '请输入公司名称'})
-      //   return
-      // }
-      // if (this.others.buySubject == '') {
-      //   this.$Notice.warning({title: '请选择购买主体'})
-      //   return
-      //  }
-       if(this.others.productType == '5' && this.others.buySubject == '2'){
+      if(this.others.productType == '5' && this.others.buySubject == '2'){
           if(this.others.buyCount == '')  {
                 this.$Notice.warning({title: '请输入购买数量'})
               return
@@ -838,8 +838,8 @@ export default {
           if(this.others.buyCount <= 0 ){
                 this.$Notice.warning({title: '请输入大于0的数量'})
               return
-           }
-       }
+          }
+      }
       if (this.others.productType == '1') {
         if (!this.others.adSource) {
           this.$Notice.warning({title: '请选择广告来源'})
@@ -878,7 +878,7 @@ export default {
       }
       if (this.others.productType == '5') {
         if (this.others.phone) {
-          if ((/^1[3456789]\d{9}$/.test(this.others.phone))) {
+          if ((/^1[03456789]\d{9}$/.test(this.others.phone))) {
             let selects = this.$refs.cityArea.selectCitys.length, originalArea = this.areaNums.areaCount
             if (this.others.productType == '5') {
               if (this.others.vipType == '2') {
@@ -912,7 +912,21 @@ export default {
           }
         }
       }
-
+      if (this.saleTableData) {
+          let isOk = true
+          this.saleTableData.forEach(v => {
+              if (v.name === '合计') {
+                  let money = Number(this.member.payMoney)+Number(this.member.bigPayMoney)+Number(this.member.subPayMoney)+Number(this.member.supplyPayMoney)-Number(this.member.commission)-Number(this.member.proceduresMoney)
+                  if (Number(v.money) > money) {
+                      this.$Notice.warning({title: '业绩金额大于应付金额'})
+                      isOk = false
+                  }
+              }
+          })
+          if (!isOk) {
+              return
+          }
+      }
       if (this.others.vipType == '1') {
         if (this.areaNums.areaCount == 0) {
           this.others.area = '全国'
@@ -1133,10 +1147,6 @@ export default {
         }
 
         //销售人员
-        this.$refs.saleRef.salePerson = JSON.stringify({
-          id: res.salesperson_id,
-          username: res.salesperson
-        })
         if (res.salesperson.indexOf(',') > -1) {
           let sarr = []
           let sidarr = res.salesperson_id.split(',')
@@ -1154,6 +1164,11 @@ export default {
             username: res.salesperson
           })]
         }
+        setTimeout( ()=>{
+          if (res.salesperson) {
+            this.saleTableData = JSON.parse(res.saleMoney).data
+          }
+        },1000)
 
         //签约主体
         this.$refs.casRef2.values = [res.signing_subject]