ccjgmwz 3 年之前
父节点
当前提交
81bd50ba97
共有 1 个文件被更改,包括 89 次插入53 次删除
  1. 89 53
      src/views/houseSelfCollect/acquisitionManagementAdd.vue

+ 89 - 53
src/views/houseSelfCollect/acquisitionManagementAdd.vue

@@ -75,9 +75,9 @@
         </div>
         <div class="content" v-for="(item,index) in priceList" :key="index">
           <div class="top">
-            <div class="left">
-              <div class="text">基准单价(元/公斤)</div>
-              <el-input type="number" @mousewheel.native.prevent v-model="item.basicUnitPrice" :disabled="!isEdit"></el-input>
+            <div  class="left">
+              <div v-if="baseInfoForm.paramType == '2'"class="text">基准单价(元/公斤)</div>
+              <el-input v-if="baseInfoForm.paramType == '2'"type="number" @mousewheel.native.prevent v-model="item.basicUnitPrice" :disabled="!isEdit"></el-input>
             </div>
             <el-button @click="delSetPrice(item,index)" :disabled="!isEdit">删除</el-button>
           </div>
@@ -774,8 +774,8 @@
         }
         for (let i = 0; i < this.priceList.length; i++) {
           let _item = this.priceList[i]
-          if (_item.basicUnitPrice == '' || _baseWaterValidate(0, 50, 8, '', 'deductWeight', parseFloat(_item
-              .basicUnitPrice))) {
+          if (this.baseInfoForm.paramType == '2' &&(_item.basicUnitPrice == '' || _baseWaterValidate(0, 50, 8, '', 'deductWeight', parseFloat(_item
+              .basicUnitPrice)))) {
             if (_item.basicUnitPrice == '') {
               that.$message.error('基准单价不能为空!');
             } else {
@@ -863,6 +863,7 @@
             case '新增':
               isValidate = this.validate()
               if (isValidate) {
+                debugger
                 purchasePriceAdd(this.baseInfoForm).toPromise().then((response) => {
                   // this.tableData = response.records
                   this.isCountShow = false
@@ -936,52 +937,83 @@
         let _waterMin = parseFloat(this.baseInfoForm.waterMin)
         let _waterMax = parseFloat(this.baseInfoForm.waterBase)
         let _count = (_waterMax - _waterMin) / 0.1 
-        for (let i = 0; i < _count; i++) {
-          // if (i == 0) {
-          //   _waterMax -= 0.1
-          // } 
-          // else {
-          //   _waterMax -= 0.5
-          // }
-          _waterMax -= 0.1
-          let priceList = this.calculatePrice(this.keepOneDecimal(_waterMax ))
-          
-          _obj = {
-            waterMin: this.keepOneDecimal(_waterMax ),
-            waterMax: this.keepOneDecimal(_waterMax + 0.09),
-            price1: this.keepTwoDecimal(priceList[0]),
-            price2: this.keepTwoDecimal(priceList[1]),
-            price3: this.keepTwoDecimal(priceList[2]),
-            priceOther: this.keepTwoDecimal(priceList[3]),
-          }
-          _list.unshift(_obj)
-        }
-        _obj = {}
-        _waterMin = parseFloat(this.baseInfoForm.waterBase)
-        _waterMax = parseFloat(this.baseInfoForm.waterMax)
-        _count = (_waterMax - _waterMin) / 0.1
-        for (let i = 0; i < _count; i++) {
-          // if (i == 0) {
-          //   _waterMin += 0.4
-          // } else {
-          //   _waterMin += 0.5
-          // }
-          if (i != 0) {
-            _waterMin += 0.1
+        if(this.baseInfoForm.paramType == '2'){
+          for (let i = 0; i < _count; i++) {
+            // if (i == 0) {
+            //   _waterMax -= 0.1
+            // } 
+            // else {
+            //   _waterMax -= 0.5
+            // }
+            _waterMax -= 0.1
+            let priceList = this.calculatePrice(this.keepOneDecimal(_waterMax ))
+            
+            _obj = {
+              waterMin: this.keepOneDecimal(_waterMax ),
+              waterMax: this.keepOneDecimal(_waterMax + 0.09),
+              price1: this.keepTwoDecimal(priceList[0]),
+              price2: this.keepTwoDecimal(priceList[1]),
+              price3: this.keepTwoDecimal(priceList[2]),
+              priceOther: this.keepTwoDecimal(priceList[3]),
+            }
+            _list.unshift(_obj)
           }
-          
-          let priceList = this.calculatePriceRight(this.keepOneDecimal(_waterMin ))
-          _obj = {
-            waterMin: this.keepOneDecimal(_waterMin ),
-            waterMax: this.keepOneDecimal(_waterMin + 0.09),
-            price1: this.keepTwoDecimal(priceList[0]),
-            price2: this.keepTwoDecimal(priceList[1]),
-            price3: this.keepTwoDecimal(priceList[2]),
-            priceOther: this.keepTwoDecimal(priceList[3]),
+          _obj = {}
+          _waterMin = parseFloat(this.baseInfoForm.waterBase)
+          _waterMax = parseFloat(this.baseInfoForm.waterMax)
+          _count = (_waterMax - _waterMin) / 0.1
+          for (let i = 0; i < _count; i++) {
+            // if (i == 0) {
+            //   _waterMin += 0.4
+            // } else {
+            //   _waterMin += 0.5
+            // }
+            if (i != 0) {
+              _waterMin += 0.1
+            }
+            
+            let priceList = this.calculatePriceRight(this.keepOneDecimal(_waterMin ))
+            _obj = {
+              waterMin: this.keepOneDecimal(_waterMin ),
+              waterMax: this.keepOneDecimal(_waterMin + 0.09),
+              price1: this.keepTwoDecimal(priceList[0]),
+              price2: this.keepTwoDecimal(priceList[1]),
+              price3: this.keepTwoDecimal(priceList[2]),
+              priceOther: this.keepTwoDecimal(priceList[3]),
+            }
+            _list.push(_obj)
+            console.log('_list', _list)
+
           }
-          _list.push(_obj)
-          console.log('_list', _list)
+        }
+        else{
+          _obj = {}
+          _waterMin = parseFloat(this.baseInfoForm.waterMin)
+          _waterMax = parseFloat(this.baseInfoForm.waterMax)
+          _count = (_waterMax - _waterMin) / 0.1
+          for (let i = 0; i < _count; i++) {
+            // if (i == 0) {
+            //   _waterMin += 0.4
+            // } else {
+            //   _waterMin += 0.5
+            // }
+            if (i != 0) {
+              _waterMin += 0.1
+            }
+            
+            let priceList = this.calculatePriceRight(this.keepOneDecimal(_waterMin ))
+            _obj = {
+              waterMin: this.keepOneDecimal(_waterMin ),
+              waterMax: this.keepOneDecimal(_waterMin + 0.09),
+              price1: this.keepTwoDecimal(priceList[0]),
+              price2: this.keepTwoDecimal(priceList[1]),
+              price3: this.keepTwoDecimal(priceList[2]),
+              priceOther: this.keepTwoDecimal(priceList[3]),
+            }
+            _list.push(_obj)
+            console.log('_list', _list)
 
+          }
         }
         this.baseInfoForm.detailPrints = _list
         this.tableData = _list
@@ -1015,7 +1047,8 @@
             }
           }
            console.log(index)
-          for (let j = index; j >= 0; j--) {
+          if(this.baseInfoForm.paramType == '2'){
+            for (let j = index; j >= 0; j--) {
               if (_priceList[i].detailList[j] && _priceList[i].detailList[j].type != 4) {
                 if (_priceList[i].detailList[j].type != 1) {
                   let baseprice = ''
@@ -1066,6 +1099,8 @@
                 }
               }
             }
+          }
+          
             // for (let j = (_priceList[i].detailList.length + 1) / 2 - 1; j > 0; j--) {
             //   if (_priceList[i].detailList[j] && _priceList[i].detailList[j].type != 4) {
             //     if (_priceList[i].detailList[j].type != 1) {
@@ -1093,16 +1128,16 @@
             // }
             this.left.push(_leftObj)
             console.log('this.left', this.left)
-                  for (let k = index; k <= _priceList[i].detailList.length; k++) {
+            for (let k = index; k <= _priceList[i].detailList.length; k++) {
               if (_priceList[i].detailList[k] && _priceList[i].detailList[k].type != 4) {
                 if (_priceList[i].detailList[k].type != 3) {
                   let baseprice = ''
                   if(this.baseInfoForm.paramType == '1'){
                     if (k == index) {
-                      baseprice = parseFloat(_priceList[i].basicUnitPrice)
+                      baseprice = parseFloat(this.baseInfoForm.dryGrainPrice)
                     } else {
-                      baseprice = parseFloat(parseFloat(_priceList[i].basicUnitPrice) - (parseFloat(_priceList[i].detailList[k]
-                        .water) - parseFloat(_priceList[i].detailList[k - 2].water)) / 0.1 * (this.baseInfoForm.dryGrainPrice * (parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
+                      baseprice = parseFloat(parseFloat(this.baseInfoForm.dryGrainPrice) - (parseFloat(_priceList[i].detailList[k+2]
+                        .water) - parseFloat(_priceList[i].detailList[k].water)) / 0.1 * (this.baseInfoForm.dryGrainPrice * (parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
                         k].water))*parseFloat(_priceList[i].detailList[k + 1].jfprice)/100/((parseFloat(_priceList[i].detailList[k + 2].water) - parseFloat(_priceList[i].detailList[
                         k].water))/0.1)))
                     }
@@ -1179,6 +1214,7 @@
       // 获取当前价格左右价格区间数据
       getOtherPrice(list, water, direction) {},
       calculatePriceRight(_waterMax) {
+        debugger
         //获取每个分界值
         let _listResult = []
         for (let i = 0; i < this.right.length; i++) {