Browse Source

客资任务已出货增加出货总金额输入框

zhujindu 1 year ago
parent
commit
5d0b3a651c
1 changed files with 284 additions and 263 deletions
  1. 284 263
      src/views/clew/clewent.vue

+ 284 - 263
src/views/clew/clewent.vue

@@ -94,9 +94,7 @@
       style="width: 94%; margin: 0px auto; border-radius: 6px">
       <van-form ref="form">
         <div v-for="(item, index) in collectionItemList" :key="index">
-          <div
-            v-if="item.answerType == 'sz' && activTadioLabel == '已出货'"
-            class="formLabel z-cell">
+          <div v-if="item.answerType == 'sz' && totalMoneyFlag" class="formLabel z-cell">
             <van-cell>
               <template #title>
                 <span class="van-f-red">*</span>{{ item.customerClueName }}
@@ -104,10 +102,10 @@
               </template>
             </van-cell>
             <van-field
+              class="fieldNumber"
               v-model="item.answerValue"
               :placeholder="item.remark"
               type="number"
-              :border="true"
               @input="numberFn(item, index)"></van-field>
           </div>
           <div v-if="item.answerType == 'rq'" class="formLabel z-cell">
@@ -467,20 +465,20 @@
 </template>
 
 <script>
-import timeico from '@/assets/Icon/datatims.png';
-import zRadio from '@/components/zRadiokz';
-import zCheckbox from '@/components/zCheckbox1';
-import uploadImg from '@/components/uploadKTask';
-import deleteUploadImg from '@/components/deleteUploadImg2';
-import deleteUploadImgv from '@/components/deleteUploadImg';
+import timeico from '@/assets/Icon/datatims.png'
+import zRadio from '@/components/zRadiokz'
+import zCheckbox from '@/components/zCheckbox1'
+import uploadImg from '@/components/uploadKTask'
+import deleteUploadImg from '@/components/deleteUploadImg2'
+import deleteUploadImgv from '@/components/deleteUploadImg'
 import {
   getCustomerClueInfoById,
   insertCustomerClueAnswer,
   getDeptInfo,
   updateCustomerClueDept,
   getCustomerClueAnswerById,
-} from '@/api/clew';
-import { ImagePreview } from 'vant';
+} from '@/api/clew'
+import { ImagePreview } from 'vant'
 
 export default {
   name: 'MyHistoricalWeekly',
@@ -553,59 +551,59 @@ export default {
       tipSHow: false,
       namesss: '',
       tipText: '',
-      activTadioLabel: '', //当前选中跟进结果
-    };
+      totalMoneyFlag: '', //是否显示出货总金额
+    }
   },
   created() {
-    this.formData.startTime = this.getThreeDaysAgo();
-    this.strtcurrentDate = new Date(this.getThreeDaysAgo());
-    this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + '';
-    this.endminDate = new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'), 2));
-    this.powerGrade = localStorage.getItem('powerGrade');
-    this.id = this.$route.query.id;
-    this.getDeptInfo();
-    this.getCustomerClueInfoById();
+    this.formData.startTime = this.getThreeDaysAgo()
+    this.strtcurrentDate = new Date(this.getThreeDaysAgo())
+    this.formData.endTime = this.parseTime(new Date(), '{y}-{m}-{d}') + ''
+    this.endminDate = new Date(this.GetPreMonthDay(this.parseTime(new Date(), '{y}-{m}-{d}'), 2))
+    this.powerGrade = localStorage.getItem('powerGrade')
+    this.id = this.$route.query.id
+    this.getDeptInfo()
+    this.getCustomerClueInfoById()
   },
   watch: {
     $route(to, from) {
       if (to.path == '/clewent') {
-        this.isClose = '';
-        this.showv = false;
-        this.SBshow = false;
-        this.tipSHow = false;
-        this.followUpResult = '';
-        this.getCustomerClueInfoById();
+        this.isClose = ''
+        this.showv = false
+        this.SBshow = false
+        this.tipSHow = false
+        this.followUpResult = ''
+        this.getCustomerClueInfoById()
       }
     },
   },
 
   methods: {
     pviewFn(val, imgVal) {
-      var imgList = [];
-      var photos = this.reportTarget.photos[val].photos;
+      var imgList = []
+      var photos = this.reportTarget.photos[val].photos
       for (let i = 0; i < photos.length; i++) {
-        imgList.push(photos[i].fileUrl);
+        imgList.push(photos[i].fileUrl)
       }
-      ImagePreview({ images: imgList, startPosition: imgVal });
+      ImagePreview({ images: imgList, startPosition: imgVal })
     },
     viewFn(val) {
-      this.viewTextShow = false;
-      this.showView = true;
-      this.getDetailById(val);
+      this.viewTextShow = false
+      this.showView = true
+      this.getDetailById(val)
     },
     getDetailById(val) {
       let loading1 = this.$toast.loading({
         duration: 0,
         message: '加载中...',
         forbidClick: true,
-      });
+      })
       getCustomerClueAnswerById({ userCustomerClueId: val }).then((res) => {
-        loading1.clear();
-        this.reportTargetAll = res.data.reportTargetAll;
-        this.info = res.data;
+        loading1.clear()
+        this.reportTargetAll = res.data.reportTargetAll
+        this.info = res.data
 
-        this.customItemList = res.data.customerClue.customerClueItemList;
-        this.type = res.data.userType;
+        this.customItemList = res.data.customerClue.customerClueItemList
+        this.type = res.data.userType
         // if(res.data.status==3){
         //   this.successContent=res.data.successContent
         // }else{
@@ -618,62 +616,62 @@ export default {
             ) != -1
           ) {
             if (this.customItemList[1].customerClueOptionList[pl].value == 'Y') {
-              this.viewTextShow = true;
+              this.viewTextShow = true
               if (
                 this.customItemList[1].customerClueOptionList[pl].customerClueOption.indexOf(
                   '跟进'
                 ) != -1
               ) {
                 this.customItemList[2].customerClueName =
-                  '具体合作意向反馈(拜访时间、合同方向、预估合作时间)';
+                  '具体合作意向反馈(拜访时间、合同方向、预估合作时间)'
               }
             }
           } else {
             if (this.customItemList[1].customerClueOptionList[pl].value == 'Y') {
-              this.viewTextShow = true;
+              this.viewTextShow = true
               if (
                 this.customItemList[1].customerClueOptionList[pl].customerClueOption.indexOf(
                   '意向'
                 ) != -1
               ) {
-                this.customItemList[2].customerClueName = '没有意向原因';
-                this.customItemList[2].remark = '请输入';
+                this.customItemList[2].customerClueName = '没有意向原因'
+                this.customItemList[2].remark = '请输入'
               }
               if (
                 this.customItemList[1].customerClueOptionList[pl].customerClueOption.indexOf(
                   '开户'
                 ) != -1
               ) {
-                this.customItemList[2].customerClueName = '开户经销商代码(例:0110067321)';
-                this.customItemList[2].remark = '请输入';
+                this.customItemList[2].customerClueName = '开户经销商代码(例:0110067321)'
+                this.customItemList[2].remark = '请输入'
               }
               if (
                 this.customItemList[1].customerClueOptionList[pl].customerClueOption.indexOf(
                   '开店'
                 ) != -1
               ) {
-                this.customItemList[2].customerClueName = '开户门店代码(例:0190129032)';
-                this.customItemList[2].remark = '请输入';
+                this.customItemList[2].customerClueName = '开户门店代码(例:0190129032)'
+                this.customItemList[2].remark = '请输入'
               }
               if (
                 this.customItemList[1].customerClueOptionList[pl].customerClueOption.indexOf(
                   '出货'
                 ) != -1
               ) {
-                this.customItemList[2].customerClueName = '填写具体的产品和数量';
+                this.customItemList[2].customerClueName = '填写具体的产品和数量'
               }
             }
           }
         }
-        this.reportContents = res.data.reportContents;
-        var imgList = [];
+        this.reportContents = res.data.reportContents
+        var imgList = []
         if (res.data.photos != null) {
           for (var k = 0; k < res.data.photos.length; k++) {
-            imgList.push(res.data.photos[k].fileUrl + '');
+            imgList.push(res.data.photos[k].fileUrl + '')
           }
         }
-        this.imgList = imgList;
-      });
+        this.imgList = imgList
+      })
     },
     confirm(action, done) {
       if (action === 'confirm') {
@@ -683,81 +681,81 @@ export default {
             deptId: this.deptCode,
           }).then((require) => {
             if (require.code == 200) {
-              this.$toast.success('转发成功');
-              this.show = false;
+              this.$toast.success('转发成功')
+              this.show = false
               if (this.$route.query.token != undefined) {
-                window.location.replace(window.location.origin + '/mobile/clew');
+                window.location.replace(window.location.origin + '/mobile/clew')
               } else {
-                this.$router.go(-1);
+                this.$router.go(-1)
               }
-              return done(true);
+              return done(true)
             } else {
-              this.$toast(res.msg);
+              this.$toast(res.msg)
             }
-          });
+          })
         } else {
-          this.$toast('请选择要转发销售部');
-          return done(false);
+          this.$toast('请选择要转发销售部')
+          return done(false)
         }
       } else {
-        return done(true);
-        this.show = false;
+        return done(true)
+        this.show = false
       }
     },
     onstopVisit() {
-      this.deptCode = '';
-      this.regionList = [];
-      this.deptList = [];
-      this.companyName = '请选择公司';
-      this.companyCode = '';
-      this.regionName = '请选择大区';
-      this.regionCode = '';
-      this.deptName = '请选择销售部';
-      this.deptCode = '';
-      this.show = true;
+      this.deptCode = ''
+      this.regionList = []
+      this.deptList = []
+      this.companyName = '请选择公司'
+      this.companyCode = ''
+      this.regionName = '请选择大区'
+      this.regionCode = ''
+      this.deptName = '请选择销售部'
+      this.deptCode = ''
+      this.show = true
     },
     getCustomerClueInfoById() {
-      this.id = this.$route.query.id;
-      this.collectionAnswerlisd = [];
-      this.collectionItemList = [];
+      this.id = this.$route.query.id
+      this.collectionAnswerlisd = []
+      this.collectionItemList = []
       getCustomerClueInfoById({ customerClueInfoId: this.id }).then((response) => {
         if (response.code == 200) {
-          this.infoData = response.data;
-          this.title = response.data.name;
+          this.infoData = response.data
+          this.title = response.data.name
           if (response.data.customerClue != null) {
-            this.collectionItemList = response.data.customerClue.customerClueItemList;
+            this.collectionItemList = response.data.customerClue.customerClueItemList
           } else {
-            this.collectionItemList = [];
+            this.collectionItemList = []
           }
         } else {
-          this.$toast(res.msg);
+          this.$toast(res.msg)
         }
-      });
+      })
     },
     showCalendarClick(val) {
-      this.dateIndex = val;
-      this.showCalendar = true;
+      this.dateIndex = val
+      this.showCalendar = true
     },
     formatDate(date) {
-      var Month = date.getMonth() + 1;
-      var Day = date.getDate();
+      var Month = date.getMonth() + 1
+      var Day = date.getDate()
       if (Month < 10) {
-        Month = '0' + Month;
+        Month = '0' + Month
       }
       if (Day < 10) {
-        Day = '0' + Day;
+        Day = '0' + Day
       }
-      return `${date.getFullYear()}-${Month}-${Day}`;
+      return `${date.getFullYear()}-${Month}-${Day}`
     },
     onConfirm(date) {
-      this.showCalendar = false;
-      this.collectionItemList[this.dateIndex].answerValue = this.formatDate(date);
+      this.showCalendar = false
+      this.collectionItemList[this.dateIndex].answerValue = this.formatDate(date)
     },
     formatter(value) {
       return value.replace(
         /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi,
         ''
-      );
+      )
     },
     numberFn(val, index) {
       if (!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(this.collectionItemList[index].answerValue)) {
@@ -769,154 +767,163 @@ export default {
             this.collectionItemList[index].answerValue.indexOf('.'),
             3
           )
-        );
+        )
       }
     },
     zSelectVal(value) {
-      this.tipText = '';
+      this.tipText = ''
       if (value.Tindex == 1) {
-        this.activTadioLabel = value.customerClueOption;
-        this.tipSHow = false;
-        this.collectionItemList[2].answerValue = '';
+        this.totalMoneyFlag = false
+        if (value.customerClueOption == '已出货') {
+          // 判断是否显示出货总金额
+          let isFlag = this.collectionItemList.find(
+            (item) => item.customerClueName == '出货总金额' && item.answerType == 'sz'
+          )
+          if (isFlag) {
+            this.totalMoneyFlag = true
+          }
+        }
+        this.tipSHow = false
+        this.collectionItemList[2].answerValue = ''
         for (var iv = 0; iv < value.value.length; iv++) {
           if (value.value[iv].customerClueOption.indexOf('跟进中') != -1) {
             if (value.value[iv].value == 'Y') {
-              this.showv = true;
-              this.requ = false;
-              this.showvnum = false;
+              this.showv = true
+              this.requ = false
+              this.showvnum = false
               if (value.value[iv].customerClueOption.indexOf('跟进中') != -1) {
                 this.collectionItemList[2].customerClueName =
-                  '具体合作意向反馈(拜访时间、合同方向、预估合作时间)';
-                this.collectionItemList[2].remark = '请输入';
+                  '具体合作意向反馈(拜访时间、合同方向、预估合作时间)'
+                this.collectionItemList[2].remark = '请输入'
               }
             } else {
-              this.requ = true;
-              this.showv = true;
+              this.requ = true
+              this.showv = true
             }
           } else {
             if (value.value[iv].value == 'Y') {
               if (value.value[iv].customerClueOption.indexOf('意向') != -1) {
-                this.collectionItemList[2].customerClueName = '没有意向原因';
-                this.collectionItemList[2].remark = '请输入意想原因';
-                this.showvnum = false;
+                this.collectionItemList[2].customerClueName = '没有意向原因'
+                this.collectionItemList[2].remark = '请输入意想原因'
+                this.showvnum = false
               }
               if (value.value[iv].customerClueOption.indexOf('开户') != -1) {
-                this.collectionItemList[2].customerClueName = '开户经销商代码(例:0110067321)';
-                this.collectionItemList[2].remark = '例:0110067321';
+                this.collectionItemList[2].customerClueName = '开户经销商代码(例:0110067321)'
+                this.collectionItemList[2].remark = '例:0110067321'
                 this.tipText =
-                  '若该客户正在开户流程中,请勾选为“跟进中”,待流程走完,再将客资状态更新为“已开户”,并填写开户经销商代码。';
-                this.showvnum = true;
-                this.tipSHow = true;
-                this.showv = false;
+                  '若该客户正在开户流程中,请勾选为“跟进中”,待流程走完,再将客资状态更新为“已开户”,并填写开户经销商代码。'
+                this.showvnum = true
+                this.tipSHow = true
+                this.showv = false
               }
               if (value.value[iv].customerClueOption.indexOf('开店') != -1) {
-                this.collectionItemList[2].customerClueName = '开户门店代码(例:0190129032)';
+                this.collectionItemList[2].customerClueName = '开户门店代码(例:0190129032)'
                 this.tipText =
-                  '若该客户正在开店流程中,请勾选为“跟进中”,待流程走完,再将客资状态更新为“已开店”,并填写开店编码。';
-                this.collectionItemList[2].remark = '例:0190129032';
-                this.showvnum = true;
-                this.tipSHow = true;
-                this.showv = false;
+                  '若该客户正在开店流程中,请勾选为“跟进中”,待流程走完,再将客资状态更新为“已开店”,并填写开店编码。'
+                this.collectionItemList[2].remark = '例:0190129032'
+                this.showvnum = true
+                this.tipSHow = true
+                this.showv = false
               }
               if (value.value[iv].customerClueOption.indexOf('出货') != -1) {
-                this.showvnum = false;
-                this.collectionItemList[2].customerClueName = '填写具体的产品和数量';
-                this.collectionItemList[2].remark = '例:100桶时时丽,50包超好贴';
+                this.showvnum = false
+                this.collectionItemList[2].customerClueName = '填写具体的产品和数量'
+                this.collectionItemList[2].remark = '例:100桶时时丽,50包超好贴'
               }
             }
           }
         }
       } else {
         if (value.value[1].value == 'Y') {
-          this.SBshow = false;
+          this.SBshow = false
         } else {
-          this.SBshow = true;
+          this.SBshow = true
         }
       }
-      var collectionAnswerlisd = this.collectionAnswerlisd;
+      var collectionAnswerlisd = this.collectionAnswerlisd
       if (collectionAnswerlisd.length > 0) {
-        var num = 0;
+        var num = 0
         for (var a = 0; a < collectionAnswerlisd.length; a++) {
           if (collectionAnswerlisd[a].id == value.id) {
-            collectionAnswerlisd[a] = value;
-            num = 0;
+            collectionAnswerlisd[a] = value
+            num = 0
           } else {
-            num = 1;
+            num = 1
           }
         }
         if (num > 0) {
-          collectionAnswerlisd.push(value);
+          collectionAnswerlisd.push(value)
         }
       } else {
-        collectionAnswerlisd.push(value);
+        collectionAnswerlisd.push(value)
       }
-      this.collectionAnswerlisd = collectionAnswerlisd;
+      this.collectionAnswerlisd = collectionAnswerlisd
     },
     imgClick(val, index) {
-      this.collectionId = val.collectionId + '';
-      this.indeximg = index;
-      this.show = true;
+      this.collectionId = val.collectionId + ''
+      this.indeximg = index
+      this.show = true
     },
     newimgarr1(val) {
       if (
         this.collectionItemList[val.index].fileInfoList == null ||
         this.collectionItemList[val.index].fileInfoList == undefined
       ) {
-        this.collectionItemList[val.index].fileInfoList = [];
-        this.collectionItemList[val.index].fileIdList = [];
+        this.collectionItemList[val.index].fileInfoList = []
+        this.collectionItemList[val.index].fileIdList = []
       }
-      this.collectionItemList[val.index].fileInfoList.push(val);
-      this.collectionItemList[val.index].fileIdList.push(val.id);
+      this.collectionItemList[val.index].fileInfoList.push(val)
+      this.collectionItemList[val.index].fileIdList.push(val.id)
     },
     dateFn(val) {
-      return val.slice(0, 4) + '-' + val.slice(4, 6) + '-' + val.slice(6, 8);
+      return val.slice(0, 4) + '-' + val.slice(4, 6) + '-' + val.slice(6, 8)
     },
     onLoad() {},
     onSubmit() {
       for (var c = 0; c < this.collectionAnswerlisd.length; c++) {
         for (var b = 0; b < this.collectionItemList.length; b++) {
           if (this.collectionAnswerlisd[c].id == this.collectionItemList[b].customId) {
-            this.collectionItemList[b].customOptionList = this.collectionAnswerlisd[c].value;
+            this.collectionItemList[b].customOptionList = this.collectionAnswerlisd[c].value
           }
         }
       }
       for (var i = 0; i < this.collectionItemList.length; i++) {
-        this.collectionItemList[i].customerClueInfoId = this.infoData.customerClueInfoId;
+        this.collectionItemList[i].customerClueInfoId = this.infoData.customerClueInfoId
       }
       if (
         this.collectionItemList[0].customerClueOptionList[1].value == 'N' &&
         this.collectionItemList[0].customerClueOptionList[0].value == 'N'
       ) {
-        this.$toast('请选择回访电话是否接通');
-        return;
+        this.$toast('请选择回访电话是否接通')
+        return
       }
-      var show = false;
-      var textshow = false;
+      var show = false
+      var textshow = false
       for (var i1 = 0; i1 < this.collectionItemList[1].customerClueOptionList.length; i1++) {
         if (this.collectionItemList[1].customerClueOptionList[i1].value == 'Y') {
-          show = true;
+          show = true
           if (
             this.collectionItemList[1].customerClueOptionList[i1].customerClueOption.indexOf(
               '跟进中'
             ) == -1
           ) {
             if (this.collectionItemList[2].answerValue.trim() == '') {
-              textshow = true;
+              textshow = true
             }
           }
         }
       }
       if (!show) {
-        this.$toast('请选择跟进结果');
-        return;
+        this.$toast('请选择跟进结果')
+        return
       }
       if (
         this.collectionItemList[0].customerClueOptionList[1].value == 'Y' &&
         this.collectionItemList[1].customerClueOptionList[1].value == 'N' &&
         this.collectionItemList[1].customerClueOptionList[0].value == 'N'
       ) {
-        this.$toast('当您的回访电话未接通,跟进结果请选择  “跟进中”或者“没有意向”');
-        return;
+        this.$toast('当您的回访电话未接通,跟进结果请选择  “跟进中”或者“没有意向”')
+        return
       }
 
       if (textshow) {
@@ -924,212 +931,222 @@ export default {
           this.collectionItemList[1].customerClueOptionList[2].value == 'Y' ||
           this.collectionItemList[1].customerClueOptionList[3].value == 'Y'
         ) {
-          this.$toast('请输入10位' + this.collectionItemList[2].customerClueName);
+          this.$toast('请输入10位' + this.collectionItemList[2].customerClueName)
         } else {
-          this.$toast('请输入' + this.collectionItemList[2].customerClueName);
+          this.$toast('请输入' + this.collectionItemList[2].customerClueName)
         }
-        return;
+        return
       }
       if (this.showvnum) {
         if (this.collectionItemList[2].answerValue.trim().length < 10) {
-          this.$toast('请输入10位' + this.collectionItemList[2].customerClueName);
-          return;
+          this.$toast('请输入10位' + this.collectionItemList[2].customerClueName)
+          return
+        }
+      }
+      // 出货总金额必填校验
+      if (this.totalMoneyFlag) {
+        let obj = this.collectionItemList.find(
+          (item) => item.customerClueName == '出货总金额' && item.answerType == 'sz'
+        )
+        if (!obj.answerValue) {
+          this.$toast('请输入' + obj.customerClueName)
+          return
         }
       }
       var form = {
         isClose: this.isClose,
         followUpResult: this.followUpResult,
         customerClueItemList: this.collectionItemList,
-      };
+      }
       if (this.flagclick) {
-        this.flagclick = false;
-        this.timer = null;
+        this.flagclick = false
+        this.timer = null
         this.timer = setTimeout(() => {
-          this.flagclick = true;
-        }, 2000);
+          this.flagclick = true
+        }, 2000)
         insertCustomerClueAnswer(form).then((res) => {
           if (res.code == 200) {
             if (this.$route.query.token != undefined) {
-              window.location.replace(window.location.origin + '/mobile/clew');
+              window.location.replace(window.location.origin + '/mobile/clew')
             } else {
-              this.$router.go(-1);
+              this.$router.go(-1)
             }
           } else {
-            this.$toast(res.msg);
+            this.$toast(res.msg)
           }
-        });
+        })
       }
     },
     getThreeDaysAgo() {
-      let myDate = new Date();
-      let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 14); //最后一个数字30可改,30天的意思
-      let lastY = lw.getFullYear();
-      let lastM = lw.getMonth() + 1;
-      let lastD = lw.getDate();
+      let myDate = new Date()
+      let lw = new Date(myDate - 1000 * 60 * 60 * 24 * 14) //最后一个数字30可改,30天的意思
+      let lastY = lw.getFullYear()
+      let lastM = lw.getMonth() + 1
+      let lastD = lw.getDate()
       let startData =
-        lastY + '-' + (lastM < 10 ? '0' + lastM : lastM) + '-' + (lastD < 10 ? '0' + lastD : lastD); //三十天之前日期
-      return startData;
+        lastY + '-' + (lastM < 10 ? '0' + lastM : lastM) + '-' + (lastD < 10 ? '0' + lastD : lastD) //三十天之前日期
+      return startData
     },
     GetPreMonthDay(date, monthNum, type) {
-      var dateArr = date.split('-');
-      var year = dateArr[0]; //获取当前日期的年份
-      var month = dateArr[1]; //获取当前日期的月份
-      var day = dateArr[2]; //获取当前日期的日
-      var days = new Date(year, month, 0);
-      days = days.getDate(); //获取当前日期中月的天数
-      var year2 = year;
-      var month2 = parseInt(month) - monthNum;
+      var dateArr = date.split('-')
+      var year = dateArr[0] //获取当前日期的年份
+      var month = dateArr[1] //获取当前日期的月份
+      var day = dateArr[2] //获取当前日期的日
+      var days = new Date(year, month, 0)
+      days = days.getDate() //获取当前日期中月的天数
+      var year2 = year
+      var month2 = parseInt(month) - monthNum
       if (month2 <= 0) {
-        var absM = Math.abs(month2);
-        year2 = parseInt(year2) - Math.ceil(absM / 12 == 0 ? 1 : parseInt(absM) / 12);
-        month2 = 12 - (absM % 12);
+        var absM = Math.abs(month2)
+        year2 = parseInt(year2) - Math.ceil(absM / 12 == 0 ? 1 : parseInt(absM) / 12)
+        month2 = 12 - (absM % 12)
       }
-      var day2 = day;
-      var days2 = new Date(year2, month2, 0);
-      days2 = days2.getDate();
+      var day2 = day
+      var days2 = new Date(year2, month2, 0)
+      days2 = days2.getDate()
       if (day2 > days2) {
-        day2 = days2;
+        day2 = days2
       }
       if (month2 < 10) {
-        month2 = '0' + month2;
+        month2 = '0' + month2
       }
-      var t2 = '';
+      var t2 = ''
       if (monthNum > 0) {
-        t2 = year2 + '-' + month2 + '-01';
+        t2 = year2 + '-' + month2 + '-01'
       } else {
         if (type == 'end') {
-          var Months = new Date().getMonth() + 1;
-          var days111 = new Date().getDate();
+          var Months = new Date().getMonth() + 1
+          var days111 = new Date().getDate()
           if (Months < 10) {
-            Months = '0' + Months;
+            Months = '0' + Months
           }
           if (days111 < 10) {
-            days111 = '0' + days111;
+            days111 = '0' + days111
           }
           if (parseInt(month2) >= new Date().getMonth() + 1) {
-            t2 = year2 + '-' + Months + '-' + days111;
+            t2 = year2 + '-' + Months + '-' + days111
           } else {
-            var daysd = this.getMonthDays(year2, month2);
-            t2 = year2 + '-' + month2 + '-' + daysd;
+            var daysd = this.getMonthDays(year2, month2)
+            t2 = year2 + '-' + month2 + '-' + daysd
           }
         } else {
-          t2 = year2 + '-' + month2 + '-' + day2;
+          t2 = year2 + '-' + month2 + '-' + day2
         }
       }
-      return t2;
+      return t2
     },
     getMonthDays(year, month) {
       var stratDate = new Date(year, month - 1, 1),
-        endData = new Date(year, month, 1);
-      var days = (endData - stratDate) / (1000 * 60 * 60 * 24);
-      return days;
+        endData = new Date(year, month, 1)
+      var days = (endData - stratDate) / (1000 * 60 * 60 * 24)
+      return days
     },
     getDeptInfo(type, grade) {
-      this.deptForm.type = type;
+      this.deptForm.type = type
       if (grade == '1') {
-        this.deptForm.parentId = this.companyCode;
+        this.deptForm.parentId = this.companyCode
       } else if (grade == '2') {
-        this.deptForm.parentId = this.regionCode;
+        this.deptForm.parentId = this.regionCode
       } else {
-        this.deptForm.type = '';
-        this.deptForm.parentId = '';
+        this.deptForm.type = ''
+        this.deptForm.parentId = ''
       }
       getDeptInfo(this.deptForm).then((res) => {
         res.data.forEach((item) => {
-          delete item.children;
-        });
+          delete item.children
+        })
         if (grade == '1') {
-          this.regionList = res.data;
+          this.regionList = res.data
         } else if (grade == '2') {
-          this.deptList = res.data;
+          this.deptList = res.data
         } else {
-          this.companyList = res.data;
+          this.companyList = res.data
         }
-      });
+      })
     },
     onClickLeft() {
-      this.$router.go(-1);
+      this.$router.go(-1)
     },
     regionClick() {
-      this.RegionShow = true;
+      this.RegionShow = true
     },
     SalesRegionClick(val) {
-      this.SalesRegionShow = true;
+      this.SalesRegionShow = true
     },
     SalesDepartmentClick() {
-      this.SalesDepartmentShow = true;
+      this.SalesDepartmentShow = true
     },
     StaffClick() {
-      this.StaffShow = true;
+      this.StaffShow = true
     },
     StartTimeClick() {
-      this.StartTimeShow = true;
+      this.StartTimeShow = true
     },
     EndTimeClick() {
-      this.EndTimeShow = true;
+      this.EndTimeShow = true
     },
     onregionConfirm(val) {
-      this.RegionShow = false;
-      this.companyName = val.deptName;
-      this.companyCode = val.deptId;
-      this.regionName = '请选择大区';
-      this.regionCode = '';
-      this.deptName = '请选择销售部';
-      this.deptCode = '';
-      this.getDeptInfo('dept', 1);
+      this.RegionShow = false
+      this.companyName = val.deptName
+      this.companyCode = val.deptId
+      this.regionName = '请选择大区'
+      this.regionCode = ''
+      this.deptName = '请选择销售部'
+      this.deptCode = ''
+      this.getDeptInfo('dept', 1)
     },
     onSalesRegionConfirm(val) {
-      this.SalesRegionShow = false;
-      this.regionName = val.deptName;
-      this.regionCode = val.deptId;
+      this.SalesRegionShow = false
+      this.regionName = val.deptName
+      this.regionCode = val.deptId
       if (val.deptId != '') {
-        this.getDeptInfo('dept', 2);
+        this.getDeptInfo('dept', 2)
       }
-      this.deptName = '全部销售部';
-      this.deptCode = '';
+      this.deptName = '全部销售部'
+      this.deptCode = ''
     },
     onSalesDepartmentConfirm(val) {
-      this.SalesDepartmentShow = false;
-      this.deptName = val.deptName;
+      this.SalesDepartmentShow = false
+      this.deptName = val.deptName
       if (val.deptId != '') {
-        this.deptCode = val.deptId;
-        this.getDeptInfo('user');
+        this.deptCode = val.deptId
+        this.getDeptInfo('user')
       }
-      this.userName = '全部业务员';
-      this.userCode = '';
+      this.userName = '全部业务员'
+      this.userCode = ''
     },
     onStaffConfirm(val) {
-      this.StaffShow = false;
-      this.userName = val.nickName;
-      this.userCode = val.userId;
+      this.StaffShow = false
+      this.userName = val.nickName
+      this.userCode = val.userId
     },
     onStartTimeConfirm(val) {
-      this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
-      this.StartTimeShow = false;
-      this.endminDate = new Date(val);
-      this.endmaxDate = new Date(this.GetPreMonthDay(this.formData.startTime, -2, 'end'));
+      this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + ''
+      this.StartTimeShow = false
+      this.endminDate = new Date(val)
+      this.endmaxDate = new Date(this.GetPreMonthDay(this.formData.startTime, -2, 'end'))
       if (
         new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime() ||
         new Date(this.endmaxDate).getTime() < new Date(this.formData.endTime).getTime()
       ) {
-        this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
-        this.endcurrentDate = this.GetPreMonthDay(this.formData.startTime, -2);
+        this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + ''
+        this.endcurrentDate = this.GetPreMonthDay(this.formData.startTime, -2)
       }
-      this.list = [];
-      this.formData.pageNum = 1;
+      this.list = []
+      this.formData.pageNum = 1
     },
     onEndTimeConfirm(val) {
-      this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}');
-      this.strtmaxDate = new Date(val);
+      this.formData.endTime = this.parseTime(new Date(val), '{y}-{m}-{d}')
+      this.strtmaxDate = new Date(val)
       if (new Date(this.formData.startTime).getTime() > new Date(this.formData.endTime).getTime()) {
-        this.formData.startTime = this.formData.endTime;
+        this.formData.startTime = this.formData.endTime
       }
-      this.list = [];
-      this.formData.pageNum = 1;
-      this.EndTimeShow = false;
+      this.list = []
+      this.formData.pageNum = 1
+      this.EndTimeShow = false
     },
   },
-};
+}
 </script>
 <style scoped>
 .container {
@@ -1204,4 +1221,8 @@ export default {
 .radioboxss .van-radio {
   margin-bottom: 6px;
 }
+.fieldNumber {
+  border: 1px solid #f1f1f1;
+  padding-left: 5px !important;
+}
 </style>