Browse Source

修改收货查看逻辑

mxx 3 years ago
parent
commit
b3eeaf876a

+ 2 - 3
src/lang/zh.js

@@ -1,4 +1,4 @@
-export default {
+export default {
   logoName: '船舶管理平台',
   tip: '提示',
   title: 'WinSea企业级开发平台',
@@ -993,7 +993,7 @@
     paymentManagement:'付款管理',
     weighingManagement:'检斤管理',
     houseSelfCollectPrint:'查看',
-    acquisitionManagementAdd:'收购管理新增',
+    acquisitionManagementAdd:'收购管理',
     acquisitionManagementEdit:'收购管理编辑',
     customerManagementEdit:'客户管理编辑',
     customerManagementAdd:'客户管理添加',
@@ -7424,7 +7424,6 @@
   houseSelfCollect:{
     customerManagement:'客户管理',
     acquisitionManagement:'仓库设置',
-    acquisitionManagementAdd:'收购管理新增',
     acquisitionManagementEdit:'收购管理编辑',
     inspectionManagement:'质检管理',
     paymentManagement:'付款管理',

+ 13 - 12
src/views/houseSelfCollect/acquisitionManagement.vue

@@ -7,7 +7,7 @@
           <el-option v-for="item in warehouseList" :key="item.id" :label="item.warehouseName" :value="item.id">
           </el-option>
         </el-select>
-        <el-checkbox v-model="checked" @change="allowEdit">允许手动编辑重量</el-checkbox>
+        <el-checkbox v-model="checked" @change="allowEdit" :disabled="userJurisdiction">允许手动编辑重量</el-checkbox>
       </div>
       <el-button type="primary" @click="newAcquisition('','','新增')">新增</el-button>
     </div>
@@ -62,6 +62,7 @@
     purchasePriceDel
   } from '@/model/houseSelfCollect/index'
   import acquisitionManagementAdd from './acquisitionManagementAdd.vue'
+  import { getHp } from '@/utils/getHasPermission'
   export default {
 
     components: {
@@ -85,7 +86,7 @@
         selectVal: '',
         goodsNameList: [],
         warehouseList: [],
-        userJurisdiction:0
+        userJurisdiction:false
       }
     },
     activated() {
@@ -103,14 +104,8 @@
 
     },
     methods: {
-      getUserJurisdiction(){
-       if(true){
-         //决策人
-         this.userJurisdiction = 1
-       }else{
-         // 统计
-          this.userJurisdiction = 0
-       }
+      getUserJurisdiction(){debugger
+        let userJurisdiction = getHp('acquisitionManagement.acquisition.allow')
       },
       handleSizeChange(val) {
         console.log(`每页 ${val} 条`)
@@ -133,6 +128,9 @@
         } else {
           this.checked = false
         }
+  this.currentPage=1
+   this.pageSize = 10
+        this.getList()
         console.log(_obj)
 
       },
@@ -174,9 +172,11 @@
         selectWarehouseSelf({
           compId: this.compId,
           personCharge: this.accountName,
-        }).toPromise().then((response) => {
+        }).toPromise().then((response) => {debugger
           console.log(response)
           this.warehouseList = response
+          this.warehouseList.unshift({warehouseName:response[0].flag})
+          console.log(this.warehouseList)
           this.selectVal = this.warehouseList[0].id
           if (this.warehouseList[0].allowEdit == 1) {
 
@@ -189,12 +189,13 @@
         })
       },
       //获取列表数据
-      getList() {
+      getList() {debugger
         getPurchasePrice({
           currentPage: this.currentPage,
           pageSize: this.pageSize,
           warehouseId: this.selectVal,
           compId: this.compId,
+
         }).toPromise().then((response) => {
           console.log(response)
           for (let i = 0; i < response.records.length; i++) {

+ 140 - 74
src/views/houseSelfCollect/acquisitionManagementAdd.vue

@@ -14,7 +14,6 @@
         <div class="row1">
           <div class="grid-content">
             <el-form-item label="货名">
-              <!-- <el-input v-model="baseInfoForm.goodsName"></el-input> -->
               <el-select v-model="selectVal" placeholder="请选择" @change="goodsChange">
                 <el-option v-for="item in goodnameList" :key="item.constValue" :label="item.constValue"
                   :value="item.constValue">
@@ -24,34 +23,34 @@
           </div>
           <div class="grid-content">
             <el-form-item label="基准水分(%)">
-              <el-input v-model="baseInfoForm.waterBase" @input="changeBaseWater"></el-input>
+              <el-input v-model="baseInfoForm.waterBase" @input="changeBaseWater" :disabled="!isEdit"></el-input>
             </el-form-item>
           </div>
           <div class="grid-content">
             <el-form-item label="扣重比">
-              <el-input v-model="baseInfoForm.deductWeight"></el-input>
+              <el-input v-model="baseInfoForm.deductWeight" :disabled="!isEdit"></el-input>
             </el-form-item>
           </div>
           <div class="grid-content">
             <el-form-item label="干粮收购价格">
-              <el-input v-model="baseInfoForm.dryGrainPrice"></el-input>
+              <el-input v-model="baseInfoForm.dryGrainPrice" :disabled="!isEdit"></el-input>
             </el-form-item>
           </div>
         </div>
         <div class="row2">
           <div class="grid-content">
             <el-form-item label="干粮水分">
-              <el-input v-model="baseInfoForm.waterMin" @input="changeMinWater"></el-input>
+              <el-input v-model="baseInfoForm.waterMin" @input="changeMinWater" :disabled="!isEdit"></el-input>
             </el-form-item>
           </div>
           <div class="grid-content">
             <el-form-item label="水分上限">
-              <el-input v-model="baseInfoForm.waterMax" @input="changeMaxWater"></el-input>
+              <el-input v-model="baseInfoForm.waterMax" @input="changeMaxWater" :disabled="!isEdit"></el-input>
             </el-form-item>
           </div>
           <div class="grid-content">
             <el-form-item label="销售上限(年/吨)">
-              <el-input v-model="baseInfoForm.saleLimit"></el-input>
+              <el-input v-model="baseInfoForm.saleLimit" :disabled="!isEdit"></el-input>
             </el-form-item>
           </div>
         </div>
@@ -59,23 +58,23 @@
       <el-row class="row3">
         <div class="top">
           <div class="title">粮价设置</div>
-          <el-button class="btn" @click="newSetPrice">新增</el-button>
+          <el-button class="btn" @click="newSetPrice" :disabled="!isEdit">新增</el-button>
         </div>
         <div class="content" v-for="(item,index) in priceList" :key="index">
           <div class="top">
             <div class="left">
               <div class="text">基准单价(元/公斤)</div>
-              <el-input v-model="item.basicUnitPrice"></el-input>
+              <el-input v-model="item.basicUnitPrice" :disabled="!isEdit"></el-input>
             </div>
-            <el-button @click="delSetPrice(item,index)">删除</el-button>
+            <el-button @click="delSetPrice(item,index)" :disabled="!isEdit">删除</el-button>
           </div>
           {{item}}
           <div class="level">
             <el-checkbox-group v-model="item.checkList" @change="changeLevel($event,index)">
-              <el-checkbox label="一等"></el-checkbox>
-              <el-checkbox label="二等"></el-checkbox>
-              <el-checkbox label="三等"></el-checkbox>
-              <el-checkbox label="等外"></el-checkbox>
+              <el-checkbox label="一等" :disabled="!isEdit"></el-checkbox>
+              <el-checkbox label="二等" :disabled="!isEdit"></el-checkbox>
+              <el-checkbox label="三等" :disabled="!isEdit"></el-checkbox>
+              <el-checkbox label="等外" :disabled="!isEdit"></el-checkbox>
             </el-checkbox-group>
           </div>
           <div class="count">
@@ -91,9 +90,10 @@
                 <div class="item-style">
                   <div v-if="item1.type!=4" class="item-style-title">
                     <span>{{item1.name}}{{item1.index}}</span>
-                    <span class="add" @click="add(item,item1,index)" v-if="item1.type!=3">+</span>
-                    <span class="reduce" @click="reduce(item,item1,index)"
-                      v-show="item1.type!=1&&item1.type!=2&&item1.type!=3">-</span>
+                    <el-button class="add" @click="add(item,item1,index)" v-if="item1.type!=3" :disabled="!isEdit">+
+                    </el-button>
+                    <el-button class="reduce" @click="reduce(item,item1,index)"
+                      v-show="item1.type!=1&&item1.type!=2&&item1.type!=3" :disabled="!isEdit">-</el-button>
                   </div>
                   <div v-show="item1.type!=4">
                     <input v-if='item1.type==1' class="water-price" v-model="baseInfoForm.waterMin"
@@ -108,7 +108,7 @@
                   <div class="circle" v-if="item1.type!=4"></div>
                 </div>
                 <div class="bottom-price">
-                  <input v-if="item1.type==4" class="water-price" v-model="item1.jfprice"></input>
+                  <input v-if="item1.type==4" class="water-price" v-model="item1.jfprice" :disabled="!isEdit"></input>
                 </div>
               </div>
             </div>
@@ -163,38 +163,38 @@
       return {
         selectVal: "",
         goodnameList: [],
-        tableData: [{
-          waterMin: '10',
-          waterMax: '20',
-          price1: '30',
-          price2: '30',
-          price3: '30',
-          priceOther: '30',
-        }, {
-          waterMin: '11',
-          waterMax: '20',
-          price1: '30',
-          price2: '30',
-          price3: '30',
-          priceOther: '30',
-        }, {
-          waterMin: '12',
-          waterMax: '20',
-          price1: '30',
-          price2: '30',
-          price3: '30',
-          priceOther: '30',
-        }, {
-          waterMin: '13',
-          waterMax: '20',
-          price1: '30',
-          price2: '30',
-          price3: '30',
-          priceOther: '30',
-        }],
+        tableData: [],
+        // tableData: [{
+        //   waterMin: '10',
+        //   waterMax: '20',
+        //   price1: '30',
+        //   price2: '30',
+        //   price3: '30',
+        //   priceOther: '30',
+        // }, {
+        //   waterMin: '11',
+        //   waterMax: '20',
+        //   price1: '30',
+        //   price2: '30',
+        //   price3: '30',
+        //   priceOther: '30',
+        // }, {
+        //   waterMin: '12',
+        //   waterMax: '20',
+        //   price1: '30',
+        //   price2: '30',
+        //   price3: '30',
+        //   priceOther: '30',
+        // }, {
+        //   waterMin: '13',
+        //   waterMax: '20',
+        //   price1: '30',
+        //   price2: '30',
+        //   price3: '30',
+        //   priceOther: '30',
+        // }],
         isCountShow: true,
         priceList: [{
-          unitPrice: '',
           index: 0,
           checkList: [],
           basicUnitPrice: "",
@@ -291,13 +291,17 @@
         case "编辑":
           break;
         case "查看":
+          this.isEdit = false;
+          this.type = this.$route.query.type
           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 = response
+            //构造查看priceList数据
+            this.priceList = []
+            this.makeLookPriceList()
           })
           break;
         default:
@@ -339,6 +343,7 @@
           }
         }
       },
+      // 设置表格颜色
       tableRowClassName({
         row,
         rowIndex
@@ -418,6 +423,7 @@
         } catch (e) {}
         return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
       },
+      //保留两位小数
       keepTwoDecimal(num) {
         var result = parseFloat(num);
         if (isNaN(result)) {
@@ -427,9 +433,9 @@
         result = Math.round(result * 100) / 100;
         return result;
       },
+      // 添加粮价设置
       newSetPrice() {
         let _newObj = {
-          unitPrice: '',
           index: 0,
           checkList: [],
           detailList: [{
@@ -479,7 +485,6 @@
             return false
           })
       },
-
       //构造新增价格数据
       makePriceDataList() {
         for (let k = 0; k < this.priceList.length; k++) {
@@ -520,22 +525,20 @@
 
         }
       },
-
       //打印
-      print() {
-
-      },
+      print() {},
       // 提交
       submit() {
         this.isCountShow = false
         this.makeTableList()
         this.makePriceDataList()
         this.baseInfoForm.goodsName = this.selectVal
-        purchasePriceAdd(this.baseInfoForm).toPromise().then((response) => {
-          console.log(response)
-          // this.tableData = response.records
-        })
+        // purchasePriceAdd(this.baseInfoForm).toPromise().then((response) => {
+        //   console.log(response)
+        //   this.tableData = response.records
+        // })
       },
+      // 关闭
       closeCount() {
         this.isCountShow = true
         // this.splitPriceList = []
@@ -543,15 +546,8 @@
         //   name: 'acquisitionManagement',
         // })
       },
-      //处理表格数据
+      //处理价格表格数据
       makeTableList() {
-        // this.tableData
-        //水分下限
-        // this.baseInfoForm.waterMin
-        // 水分上限
-        // this.baseInfoForm.waterMax
-        // price1
-
         // 获取等级对应分界钱数
         this.getSplitPrice()
         // 构造表格等差数列
@@ -622,12 +618,12 @@
       },
       // 获取当前价格左右价格区间数据
       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) {
@@ -681,6 +677,7 @@
           for (let k = 0; k < _list.length; k++) {
             //基准左边
             if (_waterMin < parseFloat(this.baseInfoForm.waterBase)) {
+              // 未设置分界
               if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd && !this.splitPriceList[i]
                 .haveSplit) {
                 console.log(basePrice)
@@ -692,7 +689,7 @@
                 console.log(_price)
                 prcieList.push(this.keepTwoDecimal(_price))
               } else if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd) {
-                // 当前段价格+其他段价格
+                // 当前区间段价格+其他区间段价格
                 let _otherPice = this.getOtherPrice(_list, _list[k], "leftBasic")
                 let _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice + _otherPice;
                 prcieList.push(basePrice + _price1)
@@ -721,6 +718,70 @@
           }
         }
         return prcieList
+      },
+      // 构造查看粮价设置数据
+      makeLookPriceList() {
+        this.selectVal = this.baseInfoForm.goodsName
+        let _priceList = this.baseInfoForm.details
+        let _checkList = []
+        let _detailList = []
+        let _pointPrice = []
+        let _basePrice = 0
+        for (let i = 0; i < _priceList.length; i++) {
+          _checkList = _priceList[i].level.split(',')
+          _detailList = _priceList[i].point.split(',')
+          _pointPrice = _priceList[i].pointPrice.split(',')
+          let _newDetailList = []
+          for (let k = 0; k < _detailList.length; k++) {
+            let _obj = {}
+            if (_detailList[k] == this.baseInfoForm.waterMin) {
+              _obj = {
+                type: 1,
+                name: "干粮",
+                water: _detailList[k],
+                isWrite: false
+              }
+
+            } else if (_detailList[k] == this.baseInfoForm.waterMax) {
+              _obj = {
+                type: 3,
+                name: "上限",
+                water: _detailList[k],
+                isWrite: false
+              }
+            } else if (_detailList[k] == this.baseInfoForm.waterMax) {
+              _obj = {
+                type: 2,
+                name: "基准",
+                water: _detailList[k],
+                isWrite: false
+              }
+            } else {
+              _obj = {
+                name: "分界",
+                water: _detailList[k],
+                type: 5,
+                index: k,
+                isWrite: false
+              }
+
+            }
+            _newDetailList.push(_obj)
+            if (k != _detailList.length - 1) {
+              _newDetailList.push({
+                type: 4,
+                jfprice: _pointPrice[k]
+              })
+            }
+          }
+          let _obj = {
+            basicUnitPrice: _priceList[i].basePrice,
+            index: i,
+            checkList: _checkList,
+            detailList: _newDetailList
+          }
+          this.priceList.push(_obj)
+        }
       }
     },
   }
@@ -893,9 +954,14 @@
           background: #5473E8;
           border-radius: 2px;
           color: white;
-          display: inline-block;
-          text-align: center;
-          line-height: 16px;
+          background: #5473E8;
+          border-radius: 2px;
+          color: white;
+          padding: 0 !important;
+          display: inline-flex;
+          justify-content: center;
+          align-items: center;
+          font-size: 14px;
         }
 
         .reduce {