mxx 3 роки тому
батько
коміт
007dbf6bb4

+ 86 - 28
src/views/houseSelfCollect/acquisitionManagement.vue

@@ -32,6 +32,8 @@
         <el-table-column prop="waterBase" label="基准水分(%)"></el-table-column>
         <el-table-column prop="deductWeight" label="扣重比"></el-table-column>
         <el-table-column prop="saleLimit" label="销量上线"></el-table-column>
+        <el-table-column prop="dryGrainPrice" label="干粮收购价"></el-table-column>
+
         <el-table-column prop="status" label="状态"></el-table-column>
         <el-table-column prop="passDate" label="通过时间"></el-table-column>
         <el-table-column label="操作" width="300">
@@ -47,13 +49,7 @@
         :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper"
         :total="deptBudgetTotal">
       </el-pagination>
-      <el-popover placement="center" width="160" v-model="visible">
-        <p>这是一段内容这是一段内容确定删除吗?</p>
-        <div style="text-align: right; margin: 0">
-          <el-button size="mini" type="text" @click="visible = false">取消</el-button>
-          <el-button type="primary" size="mini" @click="visible = false">确定</el-button>
-        </div>
-      </el-popover>
+
     </div>
   </div>
 </template>
@@ -62,7 +58,8 @@
     getPurchasePrice,
     selectWarehouseSelf,
     purchasePriceAllowEdit,
-    purchasePriceLook
+    purchasePriceLook,
+    purchasePriceDel
   } from '@/model/houseSelfCollect/index'
   import acquisitionManagementAdd from './acquisitionManagementAdd.vue'
   export default {
@@ -86,21 +83,35 @@
         accountName: '',
         tableData: [],
         selectVal: '',
-        goodsNameList:[],
-        warehouseList:[]
+        goodsNameList: [],
+        warehouseList: [],
+        userJurisdiction:0
       }
     },
-    activated() {},
-    computed() {},
-    created() {
+    activated() {
       //获取公司id
       this.compId = sessionStorage.getItem('ws-pf_compId')
       //用户名
       this.accountName = sessionStorage.getItem('ws-pf_staffName')
       this.getWarehouseSelf()
+      //获取用户权限,决策人、统计
+      this.getUserJurisdiction()
+    },
+    computed() {},
+    created() {
+
 
     },
     methods: {
+      getUserJurisdiction(){
+       if(true){
+         //决策人
+         this.userJurisdiction = 1
+       }else{
+         // 统计
+          this.userJurisdiction = 0
+       }
+      },
       handleSizeChange(val) {
         console.log(`每页 ${val} 条`)
         this.pageSize = val
@@ -113,6 +124,17 @@
       },
       warehouseChange(e) {
         console.log(e)
+        let _obj = this.warehouseList.find((item) => {
+          return item.id === this.selectVal;
+        });
+        if (_obj.allowEdit == 1) {
+
+          this.checked = true
+        } else {
+          this.checked = false
+        }
+        console.log(_obj)
+
       },
       newAcquisition(index, row, type) {
         let _obj = {}
@@ -128,14 +150,14 @@
               warehouseName: _obj.warehouseName,
               compId: this.compId,
               type: type,
-              goodsNameList:this.goodsNameList
+              goodsNameList: this.goodsNameList
             }
             break
           case '编辑':
             break
           case "查看":
             _query = {
-              data:JSON.stringify(row),
+              data: JSON.stringify(row),
               type: type
             }
             break
@@ -156,6 +178,12 @@
           console.log(response)
           this.warehouseList = response
           this.selectVal = this.warehouseList[0].id
+          if (this.warehouseList[0].allowEdit == 1) {
+
+            this.checked = true
+          } else {
+            this.checked = false
+          }
           // this.tableData = response.records
           this.getList()
         })
@@ -169,15 +197,18 @@
           compId: this.compId,
         }).toPromise().then((response) => {
           console.log(response)
-          for(let i=0;i<response.records.length;i++){
+          for (let i = 0; i < response.records.length; i++) {
             this.goodsNameList.push(response.records[i].goodsName)
           }
           this.tableData = response.records
         })
       },
       allowEdit(val) {
-        console.log(val)
-        purchasePriceAllowEdit({}).toPromise().then((response) => {
+        console.log(this.selectVal)
+        purchasePriceAllowEdit({
+          warehouseId: this.selectVal
+        }).toPromise().then((response) => {
+
           console.log(response)
           // this.tableData = response.records
         })
@@ -185,19 +216,46 @@
       handleEdit(index, row) {
         console.log(index, row);
       },
+      // 删除
       delRow(index, row) {
-        this.visible = true
         console.log(index, row);
-      },
-      print(index,row) {
-      // 打印价格对照表
-     purchasePriceLook({id:row.id}).toPromise().then((response) => {
-            console.log(response.detailPrints)
-            // this.tableData = response.records
-            // this.getList()
-            localStorage.setItem('pricePrintList', JSON.stringify(response.detailPrints));
-            window.location.href="../../../static/print.html?name="+row.goodsName
+        //删除
+        this.$confirm('确定删除该条设置?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          })
+          .then(() => {
+            purchasePriceDel({
+                id: row.id,
+              })
+              .toPromise()
+              .then((response) => {
+                this.$notify.success({
+                  title: '成功',
+                  message: '删除成功',
+                })
+                this.getList()
+              })
+              .catch((response) => {
+                // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
+              })
           })
+          .catch(() => {
+            return false
+          })
+      },
+      print(index, row) {
+        // 打印价格对照表
+        purchasePriceLook({
+          id: row.id
+        }).toPromise().then((response) => {
+          console.log(response.detailPrints)
+          // this.tableData = response.records
+          // this.getList()
+          localStorage.setItem('pricePrintList', JSON.stringify(response.detailPrints));
+          window.location.href = "../../../static/print.html?name=" + row.goodsName
+        })
       }
     },
   }

+ 88 - 54
src/views/houseSelfCollect/acquisitionManagementAdd.vue

@@ -32,6 +32,11 @@
               <el-input v-model="baseInfoForm.deductWeight"></el-input>
             </el-form-item>
           </div>
+          <div class="grid-content">
+            <el-form-item label="干粮收购价格">
+              <el-input v-model="baseInfoForm.dryGrainPrice"></el-input>
+            </el-form-item>
+          </div>
         </div>
         <div class="row2">
           <div class="grid-content">
@@ -238,6 +243,7 @@
           workflowId: '',
           approveStatus: '',
           passDate: '',
+          dryGrainPrice: '',
           details: [],
           detailPrints: []
         },
@@ -249,16 +255,16 @@
     activated() {
       switch (this.$route.query.type) {
         case "新增":
-        let _goodsNameList = []
-        this.baseInfoForm.warehouseId = this.$route.query.warehouseId
-        this.baseInfoForm.warehouseName = this.$route.query.warehouseName
-        this.baseInfoForm.compId = this.$route.query.compId
-        this.type = this.$route.query.type
-        console.log(this.baseInfoForm)
-        _goodsNameList = this.$route.query.goodsNameList
-        this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
-        this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
-        this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
+          let _goodsNameList = []
+          this.baseInfoForm.warehouseId = this.$route.query.warehouseId
+          this.baseInfoForm.warehouseName = this.$route.query.warehouseName
+          this.baseInfoForm.compId = this.$route.query.compId
+          this.type = this.$route.query.type
+          console.log(this.baseInfoForm)
+          _goodsNameList = this.$route.query.goodsNameList
+          this.priceList[0].detailList[0].water = this.baseInfoForm.waterMin
+          this.priceList[0].detailList[2].water = this.baseInfoForm.waterBase
+          this.priceList[0].detailList[4].water = this.baseInfoForm.waterMax
           // 货名
           packList({
               constId: 'CON2'
@@ -285,12 +291,14 @@
         case "编辑":
           break;
         case "查看":
-         this.baseInfoForm =JSON.parse(this.$route.query.data)
-       purchasePriceLook({id:this.baseInfoForm.id}).toPromise().then((response) => {
-              console.log(response)
-              // this.tableData = response.records
-              // this.getList()
-            })
+          this.baseInfoForm = JSON.parse(this.$route.query.data)
+          purchasePriceLook({
+            id: this.baseInfoForm.id
+          }).toPromise().then((response) => {
+            console.log(response)
+            // this.tableData = response.records
+            // this.getList()
+          })
           break;
         default:
           break
@@ -530,10 +538,10 @@
       },
       closeCount() {
         this.isCountShow = true
-        this.splitPriceList = []
-        this.$router.push({
-          name: 'acquisitionManagement',
-        })
+        // this.splitPriceList = []
+        // this.$router.push({
+        //   name: 'acquisitionManagement',
+        // })
       },
       //处理表格数据
       makeTableList() {
@@ -546,8 +554,7 @@
 
         // 获取等级对应分界钱数
         this.getSplitPrice()
-        // 分界价钱数据
-        // this.splitPriceList
+        // 构造表格等差数列
         let _list = []
         let _obj = {}
         let _waterMin = parseFloat(this.baseInfoForm.waterMin)
@@ -581,9 +588,8 @@
         }
         this.tableData = _list
       },
-      // 获取分界价格数据
+      // 获取分界价格数据,构造分界价格区间数据
       getSplitPrice() {
-
         let _priceList = this.priceList
         for (let i = 0; i < _priceList.length; i++) {
           for (let k = 0; k < _priceList[i].checkList.length; k++) {
@@ -598,6 +604,7 @@
               }
               if (_priceList[i].detailList[j].type != 4 && _priceList[i].detailList[j].type != 3) {
                 _obj.priceList.push({
+                  index: j,
                   type: parseFloat(_priceList[i].detailList[j].type),
                   priceStart: parseFloat(_priceList[i].detailList[j].water),
                   priceEnd: parseFloat(_priceList[i].detailList[j + 2].water),
@@ -609,13 +616,56 @@
             }
             console.log(_obj)
             this.splitPriceList.push(_obj)
-
             console.log(this.splitPriceList)
           }
         }
       },
-      getOtherPrice(list) {
-
+      // 获取当前价格左右价格区间数据
+      getOtherPrice(list, nowList, direction) {
+
+        //判断当前价格左右各有几个分界
+        let _left = []
+        let _right = []
+        let _leftTotalPrice = 0
+        let _rightTotalPrice = 0
+        if (direction == "leftBasic") {
+          for (let i = 0; i < list.length; i++) {
+            if (nowList.index <= list[i].index && list[i].priceStart < 30) {
+              _right.push(list[i])
+            } else if (list[i].priceStart < 30) {
+              _left.push(list[i])
+            }
+          }
+          if (_left.length > 0) {
+            for (let j = 0; j < _left.length; j++) {
+              _leftTotalPrice += _left[j].totalPrice
+            }
+          }
+          if (_right.length > 0) {
+            for (let k = 0; k < _right.length; k++) {
+              _rightTotalPrice += _right[k].totalPrice
+            }
+          }
+        } else {
+          for (let m = 0; m < list.length; m++) {
+            if (nowList.index <= list[m].index && list[m].priceStart > 30) {
+              _left.push(list[m])
+            } else if (list[m].priceStart > 30) {
+              _right.push(list[m])
+            }
+          }
+        }
+        if (_left.length > 0) {
+          for (let j = 0; j < _left.length; j++) {
+            _leftTotalPrice += _left[j].totalPrice
+          }
+        }
+        if (_right.length > 0) {
+          for (let k = 0; k < _right.length; k++) {
+            _rightTotalPrice += _right[k].totalPrice
+          }
+        }
+        return _leftTotalPrice + _rightTotalPrice
       },
       // 计算价格
       calculatePrice(_waterMin) {
@@ -638,56 +688,40 @@
                 console.log(this.keepTwoDecimal(((parseFloat(this.baseInfoForm.waterBase) - _waterMin) / 0.5) * _list[k]
                   .betweenPrice))
                 _price = basePrice + (parseFloat(this.baseInfoForm.waterBase) - _waterMin) / 0.5 * _list[k]
-                .betweenPrice;
+                  .betweenPrice;
                 console.log(_price)
                 prcieList.push(this.keepTwoDecimal(_price))
               } else if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd) {
                 // 当前段价格+其他段价格
-                let _otherPice = this.getOtherPrice(_list[k])
+                let _otherPice = this.getOtherPrice(_list, _list[k], "leftBasic")
                 let _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice + _otherPice;
-
-
-
-                // _price+=_list[k].totalPrice
+                prcieList.push(basePrice + _price1)
 
               }
-
             }
             //基准值
             else if (_waterMin == parseFloat(this.baseInfoForm.waterBase)) {
-                   prcieList.push(this.keepTwoDecimal(basePrice))
+              prcieList.push(this.keepTwoDecimal(basePrice))
             }
             // 基准右边
             else {
-
-            if (_waterMin > _list[k].priceStart && _waterMin <=_list[k].priceEnd && !this.splitPriceList[i]
+              if (_waterMin > _list[k].priceStart && _waterMin <= _list[k].priceEnd && !this.splitPriceList[i]
                 .haveSplit) {
-                _price = basePrice - (parseFloat(this.baseInfoForm.waterBase) - _waterMin) / 0.5 * _list[k]
-                .betweenPrice;
+                _price = basePrice - (_waterMin - parseFloat(this.baseInfoForm.waterBase)) / 0.5 * _list[k]
+                  .betweenPrice;
                 console.log(_price)
                 prcieList.push(this.keepTwoDecimal(_price))
-              } else if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd) {
+              } else if (_waterMin > _list[k].priceStart && _waterMin <= _list[k].priceEnd) {
                 // 当前段价格+其他段价格
-                let _otherPice = this.getOtherPrice(_list[k])
-                let _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice + _otherPice;
-
-
-
-                // _price+=_list[k].totalPrice
-
+                let _otherPice2 = this.getOtherPrice(_list, _list[k], "rightBasic")
+                let _price2 = (_waterMin - _list[k].priceEnd) / 0.5 * _list[k].betweenPrice + _otherPice2;
+                prcieList.push(basePrice - _price2)
               }
-
-
             }
-
-
           }
         }
         return prcieList
-
       }
-
-
     },
   }
 </script>

+ 3 - 3
src/views/houseSelfCollect/component/routers/route.js

@@ -8,7 +8,7 @@ const houseSelfCollectRouter = {
   alwaysShow: true, // will always show the root menu
   meta: {
     title: 'houseSelfCollect',
-    module: 'contractManagement',
+    module: 'acquisitionManagement',
     icon: '-hetongguanli'
   },
   children: [
@@ -65,7 +65,7 @@ const houseSelfCollectRouter = {
       meta: {
         title: 'acquisitionManagement',
         shortcutEntrance: 'houseSelfCollect',
-        module: 'procurement.procurementOrder.delete',
+        module: 'acquisitionManagement.acquisition.view',
         permissicon: [],
         keepAlive: true
       }
@@ -79,7 +79,7 @@ const houseSelfCollectRouter = {
       meta: {
         title: 'acquisitionManagementAdd',
         shortcutEntrance: 'houseSelfCollect',
-        module: 'procurement.procurementOrder.delete',
+        module: 'acquisitionManagement.acquisition.add',
         permissicon: [],
         keepAlive: true
       },