Quellcode durchsuchen

Merge branch 'feature/v2.4.9' of http://192.168.3.207:8080/group3/qmx_page_admin into feature/v2.4.9

tsz vor 2 Jahren
Ursprung
Commit
06c95a463d

+ 147 - 7
src/views/order/components/bigOrder.vue

@@ -14,6 +14,12 @@
                 <FormItem label="下单渠道" required>
                   <v-cascader ref="casRef1" :initVal="'d01'" placeholderType="请选择下单渠道" reqType="下单渠道" @levelChange="channelChange" v-if="bShow"></v-cascader>
                 </FormItem>
+                <FormItem label="购买主体" required>
+                    <RadioGroup v-model="member.buySubject" @on-change="radiosChange">
+                      <Radio label="1" style="marginRight:30px">个人</Radio>
+                      <Radio label="2">企业</Radio>
+                    </RadioGroup>
+                </FormItem>
                 <!-- <FormItem label="订单时间" required>
                     <date-sigle ref="sigleRef2" :dateType="'datetime'" :placeholderd="'请选择订单时间'" @startDate="orderDate" :overTime="0"></date-sigle>
                 </FormItem> -->
@@ -36,7 +42,10 @@
                 </FormItem>
                 <FormItem label="产品类型">
                     <Select v-model="member.products" placeholder="请选择产品类型(暂不支持数据导出)" @on-change="proChange" :disabled="proDis">
-                        <Option v-for="item in bigPro" :value="item.v" :key="item.v">{{ item.n }}</Option>
+                        <!-- <Option v-for="item in bigPro" :value="item.v" :key="item.v">{{ item.n }}</Option> -->
+                        <Option  value="1" >大会员</Option>
+                        <Option  value="2" :disabled="member.buySubject=='2'">大会员子账号</Option>
+                        <Option  value="3" :disabled="member.buySubject=='2'">大会员补充包</Option>
                     </Select>
                 </FormItem>
                 <FormItem label="计费模式" required>
@@ -50,6 +59,11 @@
               <FormItem label="业绩统计时间">
                   <date-sigle ref="sigleRef3" :dateType="'date'" :dataV="member.sale_time" :placeholderd="'请选择业绩统计时间'" @startDate="saleDate" :overTime="0"></date-sigle>
               </FormItem>
+
+                <FormItem label="购买数量" required v-if="member.buySubject == '2'">
+                    <Input v-model="member.buyCount" type="tel" maxlength="4" @on-keyup="buyHandler" placeholder="请填写购买数量"></Input>
+                </FormItem>
+
                 <FormItem label="会员套餐" v-if="creAuth == '1'" required>
                     <Select v-model="member.level" placeholder="请选择会员套餐" @on-change="leChange" @on-select="leSelect">
                         <Option :value="JSON.stringify(comVal)">自定义</Option>
@@ -251,7 +265,7 @@
                             :multipled="false"
                         ></b-upload>
                     </FormItem>
-                    <FormItem label="公司名称">
+                    <FormItem label="公司名称" :required="member.buySubject == '2'">
                         <Input v-model.trim="member.companyName" type="text" :maxlength="40" placeholder="请输入公司名称"></Input>
                     </FormItem>
                     <FormItem label="备注">
@@ -375,6 +389,10 @@ export default {
         },
         keyHandler() {
             this.member.phone = this.member.phone.replace(/[^\d]/g,'')
+            if(this.member.level){
+              this.member.level=''
+              this.nums=''
+            }
         },
         noPchange(val) {
             if (val) {
@@ -394,6 +412,34 @@ export default {
         channelChange(val) {
             this.member.orderChannel = String(val)
         },
+        radiosChange(val) {
+            this.member.buySubject = String(val)
+            this.member.buyCount = ''
+            this.creAuth = this.member.products
+            
+            if(val==2){
+              this.member.products=''
+              this.repair='1'
+
+            }
+            this.datas2 = []
+            this.member.paySub = ''
+            this.member.freeSub = ''
+            this.member.orderMoney = 0
+            this.member.payMoney = ''
+            this.nums=''
+            this.member.level = ''
+            this.member.contractUrl = ''
+            this.isAll = false
+            setTimeout(() => {
+                let uploads = this.$refs.uploadRef
+                if (uploads) {
+                    this.$refs.uploadRef.uploadShow = false
+                    this.$refs.uploadRef.payHtml = ''
+                }
+            },200)
+            this.reged() 
+        },
         paybackChange(val) {
             this.member.paybackCompany = String(val)
         },
@@ -419,7 +465,8 @@ export default {
                 this.currentServer()
                 setTimeout(() => {
                     this.spinShow = false
-                    if (res.data.comingIntoEffective) {
+                    if(this.member.buySubject!='2'){
+                      if (res.data.comingIntoEffective) {
                         this.$Modal.warning({
                             title: '警告提示',
                             content: '该用户存在即将生效的大会员订单,无法创建新订单',
@@ -428,9 +475,13 @@ export default {
                                 this.bShow = false
                             }
                         })
-                    }
+                     }
+                    } 
                     if (this.member.products == 1) {
+                      if(this.member.buySubject!='2'){//主体为个体走原有逻辑
+
                         if (this.bigStas == 1) {
+
                             if (this.subStas == 1) {
                                 this.colr = ''
                                 this.downDis = false
@@ -457,6 +508,7 @@ export default {
                                     this.monthTime = this.stopTime
                                 }
                             }
+
                         } else {
                             this.colr = ''
                             if (this.nums == 0) {
@@ -474,6 +526,25 @@ export default {
                                 this.monthTime = 60
                             }
                         }
+
+                      }else{ //企业直接按新用户购买处理
+                        this.colr = ''
+                            if (this.nums == 0) {
+                                this.creAuth = '1'
+                            }
+                            this.downDis = false
+                            this.getServed('')
+                            if (this.nums == 0) {
+                                this.sumSel = []
+                                this.radioDis1 = false
+                                this.radioDis2 = true
+                                this.radioDis3 = true
+                                this.member.createType = '1'
+                                this.repair = 1
+                                this.monthTime = 60
+                            }
+                      }
+                         
                     } else if (this.member.products == 2) {
                         if (this.bigStas == 0) {
                             if (this.subStas == 0) {
@@ -574,7 +645,8 @@ export default {
                         s_name: "自定义",
                         s_servers: ""
                     }
-                    if (this.bigStas == 1) {
+                    if(this.member.buySubject!='2'){//主体为个体走原有逻辑
+                      if (this.bigStas == 1) {
                         if (this.subStas == 1) {
                             this.colr = ''
                         } else {
@@ -583,7 +655,13 @@ export default {
                     } else {
                         this.colr = ''
                         this.downDis = false
+                    } 
+
+                    }else{ //主体为企业直接走新购买逻辑
+                      this.colr = ''
+                      this.downDis = false
                     }
+                    
                 }).get()
             }
             if (val == 2 || val == 3) {
@@ -866,6 +944,7 @@ export default {
                 this.myNoTchange()
             }
             if (val.i_ispreinstall == 0) {
+              if(this.member.buySubject!='2'){//主体为个体走原有逻辑
                 if (this.bigStas == 1) {
                     if (this.subStas == 1) {
                         this.radioDis1 = false
@@ -896,6 +975,19 @@ export default {
                         this.myNoTchange()
                     }
                 }
+
+              }else{
+
+                this.radioDis1 = false
+                    this.radioDis2 = true
+                    this.radioDis3 = true
+                    this.member.createType = '1'
+                    this.repair = '1'
+                    this.monthTime = 60
+                    if (!this.showOrderStatus && !this.pReadon){
+                        this.myNoTchange()
+                    }
+              }
                 this.getServed('')
             } else {
                 this.member.createType = ''
@@ -1190,6 +1282,9 @@ export default {
         freeHandler() {
             this.member.freeSub=this.member.freeSub.replace(/[^\d]+/g,'')
         },
+        buyHandler() {
+            this.member.buyCount=this.member.buyCount.replace(/[^\d]+/g,'')
+        },
         contractFile(val) {
             this.member.contractUrl = val
         },
@@ -1475,11 +1570,45 @@ export default {
                 this.isDisable = false
             }).post()
         },
-        ordConfirm(params) {
+        ordConfirm(params) { //提交
             if (!this.member.salesChannel || this.member.salesChannel == undefined || this.member.salesChannel == 'undefined') {
                 this.$Notice.warning({title: '请选择销售渠道'})
                 return
             }
+            if (this.member.buySubject == '') {
+                this.$Notice.warning({title: '请选择购买主体'})
+                return
+            }
+            if (this.member.phone == '') {
+                this.$Notice.warning({title: '请输入手机号'})
+                return
+            }
+            if(this.member.products == ''){
+              this.$Notice.warning({title: '请选择产品类型'})
+              return
+
+            }
+
+            if(this.member.billingMode  !== 0 && this.member.billingMode  !== 1){
+              this.$Notice.warning({title: '请选择计费模式'})
+              return
+
+            }
+            if (this.member.buySubject == '2') {
+                if(this.member.buyCount == '')  {
+                    this.$Notice.warning({title: '请输入购买数量'})
+                    return
+                }
+                if(this.member.buyCount <= 0 ){
+                  this.$Notice.warning({title: '请输入大于0的数量'})
+                    return
+                }
+                // 公司名称在依赖后端校验的几个选项后 继续依赖后端校验
+                // if (this.member.companyName == ''){
+                //     this.$Notice.warning({title: '购买主体为企业,请输入公司名称'})
+                //     return
+                // }
+            } 
             let serveData = []
             this.datas2.forEach(v => {
                 serveData.push({
@@ -1512,6 +1641,8 @@ export default {
                     ...params,
                     createTime: this.member.createTime,
                     phone: this.member.phone,
+                    buySubject:this.member.buySubject,//主体
+                    buyCount:this.member.buyCount,//购买数量
                     products: '',// 产品类型不需要传(传空)
                     billingMode: this.member.billingMode === ''?999:this.member.billingMode,
                     level: this.nums == 1 ? JSON.parse(this.member.level).id : 5,
@@ -1564,6 +1695,8 @@ export default {
                     createTime: this.member.createTime,
                     phone: this.member.phone,
                     products: '',// 产品类型不需要传(传空)
+                    buySubject:this.member.buySubject,//主体
+                    buyCount:this.member.buyCount,//购买数量
                     billingMode: this.member.billingMode === ''?999:this.member.billingMode,
                     paySub: this.member.paySub,
                     freeSub: this.member.freeSub,
@@ -1603,6 +1736,8 @@ export default {
                     billingMode: this.member.billingMode === ''?999:this.member.billingMode,
                     serversArr: serveData,
                     orderMoney: this.fixedNum(this.member.orderMoney),
+                    buySubject:this.member.buySubject,//主体
+                    buyCount:this.member.buyCount,//购买数量
                     contractUrl: this.member.contractUrl,
                     isAll: this.isAll ? 1 : this.member.contractUrl ? 3 : 2,
                     payMoney: this.fixedNum(this.member.payMoney),
@@ -1630,7 +1765,7 @@ export default {
                     this.urlReq('/order/myCreateSupplyOrder', obj)
                 }
             }
-            this.$refs.casRef.values = []
+            // this.$refs.casRef.values = []   
         },
         ordCancel() {
             this.$refs.casRef.values = []
@@ -1648,6 +1783,8 @@ export default {
                     this.member.level = ''
                     this.member.createType = ''
                     this.member.order_status  = '1'
+                    this.member.buySubject = ''
+                    this.member.buyCount = ''
                     this.nums = ''
                     this.serData = []
                     this.spinShow = false
@@ -1682,6 +1819,7 @@ export default {
     },
     data() {
         return {
+           comingIntoEffective:false,
             max_length:2,
             serData: [],
             servedData: [],
@@ -1728,6 +1866,7 @@ export default {
                 createType: '1',
                 payCycle: '',
                 cycleType: '',
+                buyCount : '',
                 beginTime: '',
                 paySub: '',
                 freeSub: '',
@@ -1753,6 +1892,7 @@ export default {
                 remark: '',
                 sale_time: dateFormatter(new Date(), 'yyyy-MM-dd') + ' 00:00:00',
                 order_status: '1',
+                buySubject: '',
                 contract_archive_status: '0',
                 contract_archive_time: '',
                 contract_archive_num: ''

+ 227 - 17
src/views/order/components/bigOrderEdit.vue

@@ -23,6 +23,12 @@
             <v-cascader ref="casRef1" :initVal="'d01'" placeholderType="请选择下单渠道" reqType="下单渠道"
                         @levelChange="channelChange" v-if="bShow"></v-cascader>
           </FormItem>
+          <FormItem label="购买主体" required>
+                    <RadioGroup v-model="member.buySubject" @on-change="radiosChange" >
+                      <Radio label="1" style="marginRight:30px" :disabled="radio_dis || finish_dis ">个人</Radio>
+                      <Radio label="2" :disabled="radio_dis || finish_dis ">企业</Radio>
+                    </RadioGroup>
+          </FormItem>
           <!-- <FormItem label="订单时间" prop="createTime">
                       <date-sigle ref="sigleRef2" :dateType="'datetime'" :placeholderd="'请选择订单时间'" @startDate="orderDate" :overTime="0"></date-sigle>
                   </FormItem> -->
@@ -48,7 +54,10 @@
             <!-- 我的订单不支持编辑产品类型 -->
             <Select v-model="member.products" placeholder="请选择产品类型(暂不支持数据导出)" @on-change="proChange"
                     :disabled="proDis || interested || typeRestriction">
-              <Option v-for="item in bigPro" :value="item.v" :key="item.v">{{ item.n }}</Option>
+              <!-- <Option v-for="item in bigPro" :value="item.v" :key="item.v">{{ item.n }}</Option> -->
+              <Option  value="1" >大会员</Option>
+              <Option  value="2" :disabled="member.buySubject=='2'">大会员子账号</Option>
+              <Option  value="3" :disabled="member.buySubject=='2'">大会员补充包</Option>
             </Select>
           </FormItem>
           <FormItem label="计费模式" prop="billingMode">
@@ -63,6 +72,9 @@
             <date-sigle ref="sigleRef3" :dateType="'date'" :dataV="member.sale_time" :placeholderd="'请选择业绩统计时间'"
                         @startDate="saleDate" :overTime="0"></date-sigle>
           </FormItem>
+          <FormItem label="购买数量" required v-if="member.buySubject == '2'">
+                    <Input v-model="member.buyCount" type="tel" maxlength="4" @on-keyup="buyHandler" placeholder="请填写购买数量" :disabled="finish_dis"></Input>
+                </FormItem>
           <FormItem label="会员套餐" v-if="creAuth == '1'" prop="level">
             <Select v-model="member.level" placeholder="请选择会员套餐" @on-change="leChange" @on-select="leSelect"
                     :disabled="interested">
@@ -286,7 +298,7 @@
                   :multipled="false"
               ></b-upload>
             </FormItem>
-            <FormItem label="公司名称" prop="">
+            <FormItem label="公司名称" prop="" :required="member.buySubject == '2'">
               <Input v-model.trim="member.companyName" type="text" :maxlength="40" placeholder="请输入公司名称"></Input>
             </FormItem>
             <FormItem label="备注">
@@ -335,6 +347,7 @@ import bUpload from '@/components/uploadFile.vue'
 import saleSelect from './salesSelect.vue'
 import reviewRecord from './reviewRecord.vue'
 
+
 export default {
   components: {
     vCascader,
@@ -427,6 +440,31 @@ export default {
         },500)
       }).post()
     },
+    radiosChange(val) {
+            this.member.buySubject = String(val)
+            this.member.buyCount = ''
+            this.creAuth = this.member.products
+            
+            if(val==2){
+              // this.member.products=''
+              this.repair='1'
+              this.member.createType='1'
+              this.member.subPayMoney=0  
+            }
+            this.member.level=''
+            this.nums=''
+            this.datas2=[]
+            // 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,'')
+        },
     clearReview() {
       this.bShow = false
       this.orderReview.pass = '通过'
@@ -567,7 +605,7 @@ export default {
     paybackChange(val) {
       this.member.paybackCompany = String(val)
     },
-    reged() {
+    reged(val) {
       this.spinShow = true
       // this.initialized()
       this.$request('/order/isOpenBig').data({// 验证手机号权限
@@ -591,7 +629,8 @@ export default {
         setTimeout(() => {
           this.spinShow = false
           if (res.data.comingIntoEffective && !this.readonly) {
-            this.$Modal.warning({
+            if(this.member.buySubject!='2'){//主体为个体走原有逻辑
+              this.$Modal.warning({
               title: '警告提示',
               content: '该用户存在即将生效的大会员订单,无法编辑订单',
               okText: '我知道了',
@@ -599,9 +638,13 @@ export default {
                 this.bShow = false
               }
             })
+
+            }
           }
+          console.log(this.member.products,this.member.buySubject)
           if (this.member.products == 1) {
-            if (this.bigStas == 1) {
+            if(this.member.buySubject!='2'){//主体为个体走原有逻辑
+              if (this.bigStas == 1) {
               if (this.subStas == 1) {
                 this.colr = ''
                 this.downDis = false
@@ -667,6 +710,35 @@ export default {
                 this.monthTime = 60
               }
             }
+
+            }else{
+              console.log('企业',this.member.buySubject)
+              this.colr = ''
+              if (this.nums == 0) {
+                this.creAuth = '1'
+              }
+              this.downDis = false
+              this.getServed('')
+              if (this.nums == 0) {
+                this.sumSel = []
+                this.radioDis1 = false
+                this.radioDis2 = true
+                this.radioDis3 = true
+                //编辑订单时手机号修改建通自定义跳转
+                // if (this.member.oldPhone !== this.member.phone) {
+                //   this.member.createType = '1'
+                // } else {
+                //   this.member.createType = this.member.oldCreateType
+                // }
+                // this.repair = this.member.createType 
+                //企业自定义走新建
+                this.member.createType = '1'
+                this.repair = '1'
+                this.monthTime = 60
+              }
+
+            }
+            
             if (this.member.createType == '3') {
               this.monthTime = 60 - this.stopTime
             }
@@ -769,7 +841,8 @@ export default {
             s_name: "自定义",
             s_servers: ""
           }
-          if (this.bigStas == 1) {
+          if(this.member.buySubject!='2'){//主体为个体走原有逻辑
+            if (this.bigStas == 1) {
             if (this.subStas == 1) {
               this.colr = ''
             } else {
@@ -779,6 +852,13 @@ export default {
             this.colr = ''
             this.downDis = false
           }
+
+          }else{
+            this.colr = ''
+            this.downDis = false
+
+          }
+          
         }).get()
       }
       if (val == 2 || val == 3) {
@@ -805,9 +885,9 @@ export default {
       }
     },
     tipFunc(val) {
-      if (val) {
+     
         return val.toLocaleString('zh', {style: 'currency', currency: 'CNY'})
-      }
+      
     },
     currentServer() {// 获取用户当前已享有的服务
       this.currentId = this.curIds
@@ -880,12 +960,38 @@ export default {
             }
           }
           if (v.i_ispackage == 1) {
+            
             let countStr = this.supplys ? this.supplys.filter(s => {
               return Number(s.id) == v.id
             }).map(t => {
               return t.count
             }) : []
-            this.pacData.push({
+            console.log(this.member.level,this.member.buySubject)
+            if(this.member.buySubject!=this.show_buy_subject){
+              this.pacData.push({
+              id: v.id,
+              s_name: v.s_name,
+              i_pkprice: v.i_pkprice,
+              s_pkcount: v.s_pkcount,
+              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,
               s_name: v.s_name,
               i_pkprice: v.i_pkprice,
@@ -902,6 +1008,9 @@ export default {
                 count: Number(String(countStr)) / v.s_pkcount ? Number(String(countStr)) / v.s_pkcount : ''
               })
             }
+
+            }
+            
           }
         })
         let arr1 = {
@@ -964,6 +1073,7 @@ export default {
           s_pkcount: null,
           _checked: false
         }
+       
         if (this.repair == '1' || this.repair == '2') {
           if (!(this.currentId.indexOf(17) > -1) && !(this.currentId.indexOf(18) > -1)) {
             resList.splice(1, 0, arr1)
@@ -1002,14 +1112,19 @@ 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) {
+          //原有逻辑已开通不回显勾选
+          // if (!this.equity) {
+          //   if (this.currentId.indexOf(k.id) > -1) {
+          //     k._checked = true
+          //   }
+          // }
+          if (this.currentId.indexOf(k.id) > -1) {
               k._checked = true
-            }
           }
           if (k._checked) {
             this.sumSel.push(k)
@@ -1095,7 +1210,8 @@ export default {
         //   if (check && val !== undefined) {
         //   this.allCancel()
         // }
-        if (this.bigStas == 1) {
+        if(this.member.buySubject!='2'){//主体为个体走原有逻辑
+          if (this.bigStas == 1) {
           if (this.subStas == 1) {
             this.radioDis1 = false
             this.radioDis2 = true
@@ -1148,6 +1264,28 @@ export default {
             this.myNoTchange()
           }
         }
+        }else{
+          this.radioDis1 = false
+          this.radioDis2 = true
+          this.radioDis3 = true
+          //避免初始化权益修改自定义内容
+          // if (this.member.oldPhone !== this.member.phone) {
+          //   this.member.createType = '1'
+          //   this.repair = '1'
+          // } else {
+          //   this.member.createType = this.member.oldCreateType
+          // }
+
+          //企业固定为购买
+          this.repair = '1'
+          this.member.createType = '1'
+          this.monthTime = 60
+          if (!this.returnMyReceivable && !this.pReadon) {
+            this.myNoTchange()
+          }
+
+        }
+        
         if (this.member.createType == '3') {
           this.monthTime = 60 - this.stopTime
           this.repair = '3'
@@ -1699,11 +1837,46 @@ export default {
         this.isDisable = false
       }).post()
     },
-    ordConfirm() {
+    ordConfirm() { //编辑提交
       if (!this.member.salesChannel || this.member.salesChannel == undefined || this.member.salesChannel == 'undefined') {
         this.$Notice.warning({title: '请选择销售渠道'})
         return
       }
+      //编辑存在老数据为空 前端不校验 提交后端接口 再至为1
+      // if (this.member.buySubject == '') {
+      //           this.$Notice.warning({title: '请选择购买主体'})
+      //           return
+      //       }
+      if (this.member.phone == '') {
+                this.$Notice.warning({title: '请输入手机号'})
+                return
+            }
+      if(this.member.products == ''){
+              this.$Notice.warning({title: '请选择产品类型'})
+              return
+
+            }
+
+      if(this.member.billingMode  !== 0 && this.member.billingMode  !== 1){
+              this.$Notice.warning({title: '请选择计费模式'})
+              return
+
+            }
+      if (this.member.buySubject == '2') {
+        if(this.member.buyCount == '')  {
+              this.$Notice.warning({title: '请输入购买数量'})
+              return
+          }
+        if(this.member.buyCount <= 0 ){
+              this.$Notice.warning({title: '请输入大于0的数量'})
+              return
+          }
+                // 公司名称在依赖后端校验的几个选项后 继续依赖后端校验
+                // if (this.member.companyName == ''){
+                //     this.$Notice.warning({title: '购买主体为企业,请输入公司名称'})
+                //     return
+                // }
+            }
       let serveData = []
       this.datas2.forEach(v => {
         serveData.push({
@@ -1754,6 +1927,8 @@ export default {
           createTime: this.member.createTime,
           phone: this.member.phone,
           products: '',// 产品类型不需要传(传空)
+          buySubject:this.member.buySubject?this.member.buySubject:'1',//主体 老数据编辑回显为空 提交默认为个体
+          buyCount:this.member.buyCount,//购买数量
           billingMode: this.member.billingMode === '' ? 999 : this.member.billingMode,
           level: this.nums == 1 ? JSON.parse(this.member.level).id : 5,
           payCycle: this.member.payCycle,
@@ -1808,6 +1983,8 @@ export default {
           updateProductType: 1,
           phone: this.member.phone,
           products: '',// 产品类型不需要传(传空)
+          buySubject:this.member.buySubject?this.member.buySubject:'1',//主体 老数据编辑回显为空 提交默认为个体
+          buyCount:this.member.buyCount,//购买数量
           billingMode: this.member.billingMode === '' ? 999 : this.member.billingMode,
           paySub: this.member.paySub,
           freeSub: this.member.freeSub,
@@ -1847,6 +2024,8 @@ export default {
           updateProductType: 2,
           phone: this.member.phone,
           products: '',// 产品类型不需要传(传空)
+          buySubject:this.member.buySubject?this.member.buySubject:'1',//主体 老数据编辑回显为空 提交默认为个体
+          buyCount:this.member.buyCount,//购买数量
           billingMode: this.member.billingMode === '' ? 999 : this.member.billingMode,
           serversArr: serveData,
           orderMoney: this.fixedNum(this.member.orderMoney),
@@ -1882,7 +2061,9 @@ export default {
     ordCancel() {
       this.bShow = false
     },
+    //回显
     show(data) {
+      this.olddata=data
       this.typeRestriction = true,
           this.colr = ''
       setTimeout(() => {
@@ -1962,6 +2143,21 @@ export default {
         this.curIds = filterData.serversId ? filterData.serversId.split(',').map(Number) : []
 
         this.proNums = products
+        
+        if(!res.buy_subject){ //老数据购买主体无值 禁用购买主体选项
+          this.radio_dis=true
+        }else{
+          this.radio_dis=false
+
+        }
+        this.show_buy_subject=res.buy_subject
+        if(res.orderStatus == 1){//回显订单已完成禁用购买主体
+          this.finish_dis=true
+        }else{
+          this.finish_dis=false
+
+        }
+       
         // 补充包列表
         this.supplys = filterData.supplys
         this.member = {
@@ -1971,6 +2167,8 @@ export default {
           oldPhone: res.user_phone,
           oldCreateType: filterData.createType + '', //
           products: products, //
+          buySubject: res.buy_subject?res.buy_subject + "" : '',//购买主体 回显无值默认为个体
+          buyCount: res.buy_count?res.buy_count:'',//购买数量
           billingMode: res.billingMode, //
           salesPerson: JSON.stringify({
             id: res.salesperson_id,
@@ -2009,6 +2207,7 @@ export default {
           contract_archive_time: contractRes.contract_archive_time, //
           contract_archive_num: contractRes.contract_archive_num == 0 ? '' : contractRes.contract_archive_num //
         }
+        
         if (this.member.cycleType === 1) {
           this.max_length = 4
         }
@@ -2023,7 +2222,7 @@ export default {
           this.radioDis2 = true
           this.radioDis3 = true
         }
-
+        
         if (filterData.level !== '自定义') {
           this.creAuth = this.member.products
           this.proNums = Number(products)
@@ -2036,16 +2235,19 @@ export default {
             }
           }, 200)
           this.$request('/order/getCombo').data().success((res) => {
+            this.levelDown = []
             res.data.lists.forEach(v => {
               if (v.id == filterData.comboId) {
                 this.member.level = JSON.stringify(v)
                 this.leChange(JSON.stringify(v), false)
-                this.levelDown = []
+                
+              }
+              
                 if (v.id !== 4) {// 试用版
                   this.levelDown.push(v)
                 }
-              }
             })
+      
           }).get()
         } else {
           let obj = {
@@ -2060,13 +2262,17 @@ export default {
           // this.proChange(Number(products))
         }
         this.nums = 0
+        console.log(this.interested,res.buy_subject,this.member.buySubject,'21212121')
       })
       this.bShow = true
+      
 
     }
   },
   data() {
     return {
+      olddata:null,
+      show_buy_subject:'',
       max_length: 2,
       doReview: false,
       orderCode: '',
@@ -2074,6 +2280,8 @@ export default {
         pass: "通过",
         reason: ""
       },
+      radio_dis:false, 
+      finish_dis:false,
       overTime: 0,
       serData: [],
       servedData: [],
@@ -2124,6 +2332,8 @@ export default {
       member: {
         phone: '',
         products: '',
+        buySubject: '',//购买主体
+        buyCount: '',//购买数量
         billingMode: '',
         salesPerson: '',
         level: '',

+ 3 - 0
src/views/order/components/details.vue

@@ -28,6 +28,7 @@
                         <p>业绩统计时间:</p>
                         <i class="i-inpt">{{orDetails?orDetails.sale_time?orDetails.sale_time:'--':'--'}}</i>
                     </span>
+                    <span v-if="orDetails.buy_subject"><p>购买主体:</p>{{orDetails.buy_subject==1?'个人':'企业'}}</span>
                     <span><p>公司名称:</p>{{orDetails?orDetails.company_name?orDetails.company_name:'--':'--'}}</span>
                     <span><p>签约主体:</p>{{orDetails?orDetails.return_commpany?orDetails.return_commpany:'--':'--'}}</span>
                     <span><p>销售渠道:</p>{{orDetails?orDetails.sales_channel?orDetails.sales_channel:'--':'--'}}</span>
@@ -122,6 +123,7 @@
                 <div class="tit">产品信息</div>
                 <div class="classfity">
                     <span><p>手机号:</p>{{orDetails.user_phone?orDetails.user_phone:'--'}}</span>
+                    <span v-if="orDetails.buy_count&&orDetails.buy_subject==2"><p>购买数量:</p><i>{{orDetails.buy_count}}人</i></span>
                     <span v-if="orderType == 8"><p>购买省份:</p>{{buyProvince?buyProvince:'--'}}</span>
                     <span v-if="orderType == 16"><p>购买区域:</p><i v-if="book">{{orderObjectd(book.area)?String(Object.keys(book.area)):'全国'}}</i></span>
                     <span>
@@ -182,6 +184,7 @@
                         <i class="i-inpt">{{orDetails.user_phone?orDetails.user_phone:'--'}}</i>
                     </span>
                     <span v-else><p>手机号:</p>{{orDetails.user_phone?orDetails.user_phone:'--'}}</span>
+                    <span v-if="orDetails.buy_count&&orDetails.buy_subject==2"><p>购买数量:</p><i>{{orDetails.buy_count}}人</i></span>
                     <span><p>计费模式:</p><i v-if="orDetails">{{orDetails?orDetails.billingMode==0?'免费':'收费':'--'}}</i></span>
                     <span><p>会员套餐:</p><i v-if="book">{{book?orderType == 10?'自定义':book.level:'--'}}</i></span>
                     <span v-if="orderType == 7">

+ 74 - 6
src/views/order/components/otherOrder.vue

@@ -17,6 +17,12 @@
           <v-cascader ref="casRef1" :initVal="'d01'" placeholderType="请选择下单渠道" reqType="下单渠道"
                       @levelChange="channelChange" v-if="oShow"></v-cascader>
         </FormItem>
+        <FormItem label="购买主体" required>
+                <RadioGroup v-model="others.buySubject" @on-change="radiosChange">
+                  <Radio label="1" style="marginRight:30px">个人</Radio>
+                  <Radio label="2">企业</Radio>
+                </RadioGroup>
+        </FormItem>
         <!-- <FormItem label="订单时间" required>
             <date-sigle ref="sigleRef3" :dateType="'datetime'" :placeholderd="'请选择订单时间'" @startDate="orderDate" :overTime="0"></date-sigle>
         </FormItem> -->
@@ -48,6 +54,9 @@
             <Option value="2">升级</Option>
           </Select>
         </FormItem>
+        <FormItem label="购买数量" required  v-show="others.buySubject == '2'&&others.productType == '5'">
+            <Input v-model="others.buyCount" type="tel" maxlength="4" @on-keyup="buyHandler" placeholder="请填写购买数量"></Input>
+        </FormItem>
         <FormItem label="销售人员">
           <sale-select ref="saleRef" @salePerson="salePerson"
                        :setDefaultPerson="this.$store.getters.getAdminUser.username"></sale-select>
@@ -56,7 +65,7 @@
           <date-sigle ref="sigleRef4" :dateType="'date'" :dataV="others.sale_time" :placeholderd="'请选择业绩统计时间'"
                       @startDate="saleDate" :overTime="0"></date-sigle>
         </FormItem>
-        <FormItem label="公司名称">
+        <FormItem label="公司名称" :required="others.buySubject == '2'">
           <Input v-model.trim="others.companyName" type="text" :maxlength="40" placeholder="请输入公司名称"></Input>
         </FormItem>
         <FormItem label="客户名称">
@@ -246,6 +255,7 @@ import citySelect from "@/components/citySelect"
 import saleSelect from './salesSelect.vue'
 import {dateFormatter} from '@/assets/js/date'
 
+
 export default {
   components: {
     dateSigle,
@@ -320,6 +330,19 @@ export default {
         }
       })
     },
+    radiosChange(val) {
+            this.others.buySubject = String(val)
+            this.others.buyCount = ''
+            if (this.others.productType == '5') {
+                if (this.others.phone.length == 0) {
+                     this.payDis = true
+                     return
+               } else {
+                     this.payDis = false
+               }         
+           }
+           this.checkVip()
+        },
     timeReg(val) {
       return new Date(val + ' 00:00:00').getTime() / 1000
     },
@@ -329,6 +352,9 @@ export default {
     payHandler() {
       this.others.contract_archive_num = this.others.contract_archive_num.replace(/[^\d]+/g, '')
     },
+    buyHandler() { //过滤字母
+            this.others.buyCount=this.member.buyCount.replace(/[^\d]+/g,'')
+    },
     changeHandler() {
       if (this.others.productType == '5') {
         if (!(/^1[3456789]\d{9}$/.test(this.others.phone))) {
@@ -346,7 +372,8 @@ export default {
     },
     reged() {
       this.$request('/order/vipInfo').data({// 验证手机号权限
-        phone: this.others.phone
+        phone: this.others.phone,
+        buySubject:this.others.buySubject
       }).success((res) => {
         this.phoneReg = res.data
       }).post()
@@ -358,7 +385,8 @@ export default {
       if (this.others.phone) {
         if ((/^1[3456789]\d{9}$/.test(this.others.phone))) {
           this.$request('/order/vipInfo').data({// 验证手机号权限
-            phone: this.others.phone
+            phone: this.others.phone,
+            buySubject:this.others.buySubject
           }).success((res) => {
             if (res.data) {
               this.infoData = res.data
@@ -369,8 +397,10 @@ export default {
             if (res.data.userData) {
               this.areaNums = res.data.userData
             }
-            if (res.data.willEffect == true) { // 存在即将生效的超级订阅订单
-              this.$Modal.warning({
+            if(this.others.buySubject!='2'){// 个人或者不选走原逻辑
+              
+              if (res.data.willEffect == true) { // 存在即将生效的超级订阅订单
+                this.$Modal.warning({
                 title: '警告提示',
                 content: '该用户存在即将生效的超级订阅订单,无法创建新订单',
                 okText: '我知道了',
@@ -378,6 +408,7 @@ export default {
                   this.oShow = false
                 }
               })
+
             } else {// 不存在即将生效的超级订阅订单
               if (res.data.vipExist == true) { // 存在已经生效的超级订阅订单
                 if (res.data.nationwide) { // 购买区域是“全国”
@@ -400,6 +431,14 @@ export default {
                 this.payChange()
               }
             }
+
+            }else{//企业 固定为购买
+              this.others.vipType = '0'
+                this.payDis = true
+                this.payChange()
+
+            }
+            
           }).post()
         }
       }
@@ -571,6 +610,12 @@ export default {
         this.$Notice.warning({title: '手机号格式不正确'})
         return
       }
+      if(this.others.productType == '5'){
+       if(!this.others.vipType){
+        this.$Notice.warning({title: '请选择付费类型'})
+        return
+       }
+      }
       // if (!this.others.companyName) {
       //   this.$Notice.warning({title: '请输入公司名称'})
       //   return
@@ -579,13 +624,32 @@ export default {
         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.buyCount == '')  {
+                this.$Notice.warning({title: '请输入购买数量'})
+              return
+          }
+          if(this.others.buyCount <= 0 ){
+                this.$Notice.warning({title: '请输入大于0的数量'})
+              return
+           }
+       }
       if (this.others.productType == '1') {
         if (!this.others.adSource) {
           this.$Notice.warning({title: '请选择广告来源'})
           return
         }
       }
+      if(this.others.buySubject == '2'){
+        if (!this.others.companyName) {
+        this.$Notice.warning({title: '请输入公司名称'})
+        return
+      }
+      }
       if (!this.others.contractStatus) {
         this.$Notice.warning({title: '请选择协议状态'})
         return
@@ -673,6 +737,8 @@ export default {
         createTime: this.others.createTime,
         phone: this.others.phone,
         productType: this.others.productType,
+        buySubject:this.others.buySubject, //购买主体
+        buyCount:this.others.buyCount,//数量
         companyName: this.others.companyName,
         vipType: this.others.productType == '5' ? this.others.vipType : '',
         area: this.others.productType == '5' ? this.others.area : '',
@@ -784,6 +850,8 @@ export default {
         phone: '',
         productType: '2',
         adSource: '',
+        buySubject:'', // 购买主体
+        buyCount:'', //购买数量
         vipType: '',
         salesPerson: '',
         companyName: '',

+ 104 - 9
src/views/order/components/otherOrderEdit.vue

@@ -25,6 +25,12 @@
             <v-cascader ref="casRef1" :initVal="'d01'" placeholderType="请选择下单渠道" reqType="下单渠道"
                         @levelChange="channelChange" v-if="oShow"></v-cascader>
           </FormItem>
+          <FormItem label="购买主体" required>
+                <RadioGroup v-model="others.buySubject" @on-change="radiosChange">
+                  <Radio label="1" style="marginRight:30px" :disabled="radio_dis || finish_dis">个人</Radio>
+                  <Radio label="2" :disabled="radio_dis || finish_dis">企业</Radio>
+                </RadioGroup>
+        </FormItem>
           <!-- <FormItem label="订单时间" prop="createTime">
               <date-sigle ref="sigleRef3" :dateType="'datetime'" :placeholderd="'请选择订单时间'" @startDate="orderDate" :overTime="0"></date-sigle>
           </FormItem> -->
@@ -45,7 +51,7 @@
   -                  <Select v-model="others.productType" placeholder="请选择产品类型" @on-change="goodChange" :disabled="interested"> -->
             <!-- 我的订单不支持编辑产品类型 -->
             <Select v-model="others.productType" placeholder="请选择产品类型" @on-change="goodChange"
-                    :disabled="interested || typeRestriction">
+                    :disabled="interested || typeRestriction || isEnterprise">
               <Option v-for="item in otherPro" :value="item.v" :key="item.v">{{ item.n }}</Option>
             </Select>
           </FormItem>
@@ -55,12 +61,15 @@
             </Select>
           </FormItem>
           <FormItem label="付费类型" prop="vipType" v-show="others.productType == '5'">
-            <Select v-model="others.vipType" placeholder="请选择付费类型" @on-change="payChange" :disabled="payDis">
+            <Select v-model="others.vipType" placeholder="请选择付费类型" @on-change="payChange" :disabled="payDis || isEnterprise">
               <Option value="0" :disabled="gouDis">购买</Option>
               <Option value="1">续费</Option>
               <Option value="2">升级</Option>
             </Select>
           </FormItem>
+          <FormItem label="购买数量" required v-show="others.buySubject == '2' && others.productType == '5'">
+            <Input v-model="others.buyCount" type="tel" maxlength="4" @on-keyup="buyHandler" placeholder="请填写购买数量" :disabled="finish_dis"></Input>
+        </FormItem>
           <FormItem label="销售人员">
             <sale-select ref="saleRef" :saleType="'1'" @salePerson="salePerson" v-if="oShow"></sale-select>
           </FormItem>
@@ -68,7 +77,7 @@
             <date-sigle ref="sigleRef4" :dateType="'date'" :dataV="others.sale_time" :placeholderd="'请选择业绩统计时间'"
                         @startDate="saleDate" :overTime="0"></date-sigle>
           </FormItem>
-          <FormItem label="公司名称" prop="">
+          <FormItem label="公司名称" prop="" :required="others.buySubject == '2'">
             <Input v-model.trim="others.companyName" type="text" :maxlength="40" placeholder="请输入公司名称"></Input>
           </FormItem>
           <FormItem label="客户名称">
@@ -402,6 +411,22 @@ export default {
         }
       }
     },
+    radiosChange(val) {
+            this.others.buySubject = String(val)
+            this.others.buyCount = ''
+            if (this.others.productType == '5') {
+                if (this.others.phone.length == 0) {
+                     this.payDis = true
+                     return
+               } else {
+                     this.payDis = false
+               }          
+          }
+          this.checkVip(1)
+        },
+    buyHandler() { //过滤字母
+            this.others.buyCount=this.member.buyCount.replace(/[^\d]+/g,'')
+    },
     timeReg(val) {
       return new Date(val + ' 00:00:00').getTime() / 1000
     },
@@ -429,7 +454,8 @@ export default {
     },
     reged() {
       this.$request('/order/vipInfo').data({// 验证手机号权限
-        phone: this.others.phone
+        phone: this.others.phone,
+        buySubject:this.others.buySubject
       }).success((res) => {
         this.phoneReg = res.data
       }).post()
@@ -439,7 +465,8 @@ export default {
         if ((/^1[3456789]\d{9}$/.test(this.others.phone))) {
           this.$request('/order/vipInfo').data({// 验证手机号权限
             phone: this.others.phone,
-            orderCode: this.others.orderCode
+            orderCode: this.others.orderCode,
+            buySubject:this.others.buySubject
           }).success((res) => {
             if (res.data) {
               this.infoData = res.data
@@ -452,7 +479,9 @@ export default {
             }
             console.log(res.data.willEffect)
             if (res.data.willEffect == true && !this.readonly) { // 存在即将生效的超级订阅订单
-              this.$Modal.warning({
+              if(this.others.buySubject!='2'){ //个人走原逻辑
+                
+                this.$Modal.warning({
                 title: '警告提示',
                 content: '该用户存在即将生效的超级订阅订单,无法编辑订单',
                 okText: '我知道了',
@@ -460,8 +489,12 @@ export default {
                   this.oShow = false
                 }
               })
+
+              }
+        
             } else {// 不存在即将生效的超级订阅订单
-              if (res.data.vipExist == true) { // 存在已经生效的超级订阅订单
+              if(this.others.buySubject!='2'){ //个人走原逻辑
+                if (res.data.vipExist == true) { // 存在已经生效的超级订阅订单
                 if (res.data.nationwide) { // 购买区域是“全国”
                   if (res.data.new) { // 新版超级订订阅
                     if (!num1) {
@@ -487,6 +520,14 @@ export default {
                 this.payDis = true
                 this.payChange()
               }
+              console.log(this.others.vipType,this.payDis)
+              }else{//企业默认为购买
+                this.others.vipType = '0'
+                this.payDis = true
+                this.payChange()
+
+              }
+              
             }
           }).post()
         }
@@ -661,10 +702,30 @@ export default {
         this.$Notice.warning({title: '手机号格式不正确'})
         return
       }
+      if(this.others.productType == '5'){
+       if(this.others.vipType == ''){
+        this.$Notice.warning({title: '请选择付费类型'})
+        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.buyCount == '')  {
+                this.$Notice.warning({title: '请输入购买数量'})
+              return
+          }
+          if(this.others.buyCount <= 0 ){
+                this.$Notice.warning({title: '请输入大于0的数量'})
+              return
+           }
+       }
       if (this.others.productType == '1') {
         if (!this.others.adSource) {
           this.$Notice.warning({title: '请选择广告来源'})
@@ -764,6 +825,8 @@ export default {
         orderCode: this.others.orderCode,
         createTime: this.others.createTime,
         phone: this.others.phone,
+        buySubject:this.others.buySubject?this.others.buySubject:'1',//主体 老数据编辑回显为空 提交默认为个体
+        buyCount:this.others.buyCount,//购买数量
         productType: this.others.productType,
         companyName: this.others.companyName,
         vipType: this.others.productType == '5' ? this.others.vipType : '',
@@ -866,9 +929,15 @@ export default {
             }
           })
           if (area.join('')) {
-            this.$refs.cityArea.selectCitys = area
+            this.$nextTick(()=>{
+              this.$refs.cityArea.selectCitys = area
+            })
+            
           } else {
-            this.$refs.cityArea.selectCitys = [{name: '全国', id: '928'}]
+            this.$nextTick(()=>{
+               this.$refs.cityArea.selectCitys = [{name: '全国', id: '928'}]
+            })
+           
           }
         }
 
@@ -942,11 +1011,28 @@ export default {
         //签约主体
         this.$refs.casRef2.values = [res.signing_subject]
 
+
+        if(!res.buy_subject){ //老数据购买主体无值 禁用购买主体选项
+          this.radio_dis=true
+        }else{
+          this.radio_dis=false
+
+        }
+     
+        if(res.orderStatus == 1){//回显订单已完成禁用购买主体
+          this.finish_dis=true
+        }else{
+          this.finish_dis=false
+
+        }
+
         this.others = {
           orderCode: res.order_code,
           id: res.id,
           createTime: res.create_time, //
           phone: res.user_phone, //
+          buySubject: res.buy_subject?res.buy_subject + "" : '',//购买主体 回显无值默认为个体
+          buyCount: res.buy_count?res.buy_count:'',//购买数量
           productType: productType, //
           companyName: res.company_name, //
           vipType: res.vip_type ? res.vip_type + '' : '0', //
@@ -989,8 +1075,12 @@ export default {
         console.log(this.others)
         if (productType == "5") {
           this.checkVip(1)
+        } 
+        if(this.others.buySubject=='2'){ //购买主体为企业 禁用 产品类型和付费类型
+          this.isEnterprise=true
         }
       })
+     
       this.oShow = true
     },
     clearReview() {
@@ -1025,6 +1115,9 @@ export default {
   },
   data() {
     return {
+      isEnterprise:false,
+      radio_dis:false, 
+      finish_dis:false,
       cancel: false,
       oShow: false,
       isDisable: false,
@@ -1048,6 +1141,8 @@ export default {
       others: {
         phone: '',
         productType: '2',
+        buySubject:'', // 购买主体
+        buyCount:'', //购买数量
         adSource: '',
         vipType: '',
         salesPerson: '',