Browse Source

Merge branch 'master' of http://47.100.3.209:3000/gdc/yiliangyiyun-pc

zhongtianhaoyuan 3 years ago
parent
commit
89cdbf8e28

+ 2 - 1
.env.production

@@ -4,7 +4,8 @@
 
 NODE_ENV = 'production'
 # base api
-VUE_APP_BASE_API = 'http://api.eliangeyun.com'
+#VUE_APP_BASE_API = 'http://api2.eliangeyun.com'
+VUE_APP_BASE_API = 'http://apitest.eliangeyun.com'
 
 # 微服务相关接口配置
 ## 任务消息

+ 60 - 50
src/views/home/index.vue

@@ -7,10 +7,14 @@
         <!-- 任务、消息、提醒、超期 -->
         <Panel :data-list="panelList"
                @click="gotoNewRw"></Panel>
-        <button @click="openPort">测试</button>
-        <button @click="closePort">关闭</button>
-        <div>{{text}}</div>
-               <!-- <img style='width:100%;margin-top:10px;' src="../../../public/img/tmt.gif" alt=""> -->
+        <div v-show="true">
+          <el-button @click="test">test</el-button>
+          <el-button @click="test1">test1</el-button>
+          <el-button @click="openPort">openPort</el-button>
+          <el-button @click="closePort">closePort</el-button>
+          <div>{{text}}</div>
+        </div>
+       <!-- <img style='width:100%;margin-top:10px;' src="../../../public/img/tmt.gif" alt=""> -->
       </div>
     </div>
     <div id="mapXY"></div>
@@ -115,7 +119,8 @@ export default {
       },
       vesselBankFlag: sessionStorage.getItem('ws-pf_vesselBankFlag'),
       shezhiVal: '',
-      text:"数据"
+      text:"数据",
+      reader:null
     }
   },
   computed: {
@@ -179,11 +184,11 @@ export default {
   async created () {
     //获取快捷路口列表
     this.getRouteList()
-    this.checkUserInfoDialog()
+    // this.checkUserInfoDialog()
   },
   async mounted () {
     //获取新闻列表
-    this.getNewList()
+    // this.getNewList()
     noticeNumber().toPromise().then(res => {
       const { task = 0, remind = 0, overdue = 0, news = 0 } = res
       this.number.task = task
@@ -191,16 +196,16 @@ export default {
       this.number.overdue = overdue
       this.number.news = news
     })
-    if (this.vesselBankFlag !== 'V') {
-      EventBus.$emit('addShipScript', () => {
-        this.initShipMap()
-      })
-    }
-    setTimeout(() => {
-      this.showEchart = true
-    }, 900)
+    // if (this.vesselBankFlag !== 'V') {
+    //   EventBus.$emit('addShipScript', () => {
+    //     this.initShipMap()
+    //   })
+    // }
+    // setTimeout(() => {
+    //   this.showEchart = true
+    // }, 900)
 
-    this.showBlockList = []
+    // this.showBlockList = []
     // if (this.vesselBankFlag === 'V') {
     //   this.$refs.noticeList.style.width = 'calc(50% - 7px)'
     //   this.$refs.newsList.style.width = 'calc(50% - 7px)'
@@ -216,9 +221,9 @@ export default {
     // }
   },
   watch: {
-    getLanguage: function () {
-      this.getShipList()
-    }
+    // getLanguage: function () {
+    //   this.getShipList()
+    // }
   },
   methods: {
     ...mapActions('user', ['toSetShow', 'changeVesslBank']),
@@ -531,42 +536,47 @@ export default {
         this.$router.push({ name: 'workNotification', query: { types: data } })
       }
     },
+    test(){
+      console.log('testtesttesttest');
+    },
+    async test1(){
+      console.log('testtesttesttest111111');
+    },
     async openPort(){
-      if ("serial" in navigator) {
-      // The Web Serial API is supported.
-      console.log("the Web Serial API is supported.");
-      const port = await navigator.serial.requestPort();
-      await port.open({ baudRate: 9600 }); // set baud rate
-      const reader = port.readable.getReader();
-      // 监听来自串行设备的数据
-      while (true) {
-        const { value, done } = await reader.read();
-        console.log(value,done);
-        if (done) {
-          // 允许稍后关闭串口。
-          reader.releaseLock();
-          break;
-        }
-        var result="";
-        if(value.length < 5){
-          debugger
-        }
-        for(var i=0;i<value.length;i++){
-          result += String.fromCharCode(value[i])
+      console.log('openPort');
+      if ('serial' in navigator) {
+        // The Web Serial API is supported.
+        console.log('the Web Serial API is supported.');
+        const port = await navigator.serial.requestPort();
+        await port.open({ baudRate: 9600 }); // set baud rate
+        this.reader = port.readable.getReader();
+        // 监听来自串行设备的数据
+        while (true) {
+          const { value, done } = await this.reader.read();
+          console.log(value,done);
+          if (done) {
+            // 允许稍后关闭串口。
+            this.reader.releaseLock();
+            break;
+          }
+          var result="";
+          if(value.length < 5){
+          }
+          for(var i=0;i<value.length;i++){
+            result += String.fromCharCode(value[i])
+          }
+          this.text = result
+          // value 是一个 Uint8Array
         }
-        this.text = result
-        // value 是一个 Uint8Array
+         await port.close();
+      }
+      else{
+        console.log('the Web Serial API is not supported.',navigator);
       }
-     
-    }
     },
     async closePort(){
-      
-      const port = await navigator.serial.requestPort();
-      await port.open({ baudRate: 9600 }); // set baud rate
-      const reader = port.readable.getReader();
-      reader.cancel()
-      port.close();
+      console.log('closePort');
+      this.reader.cancel()
     }
   }
 }

+ 25 - 50
src/views/houseSelfCollect/acquisitionManagement.vue

@@ -84,46 +84,12 @@
         compId: '',
         accountName: '',
         tableData: [],
-        // tableData: [{
-        //   date: '2016-05-02',
-        //   name: '王小虎',
-        //   address: '上海市普陀区金沙江路 1518 弄'
-        // }, {
-        //   date: '2016-05-04',
-        //   name: '王小虎',
-        //   address: '上海市普陀区金沙江路 1517 弄'
-        // }, {
-        //   date: '2016-05-01',
-        //   name: '王小虎',
-        //   address: '上海市普陀区金沙江路 1519 弄'
-        // }, {
-        //   date: '2016-05-03',
-        //   name: '王小虎',
-        //   address: '上海市普陀区金沙江路 1516 弄'
-        // }],
-        warehouseList: [],
-        // warehouseList: [{
-        //   value: '选项1',
-        //   label: '黄金糕'
-        // }, {
-        //   value: '选项2',
-        //   label: '双皮奶'
-        // }, {
-        //   value: '选项3',
-        //   label: '蚵仔煎'
-        // }, {
-        //   value: '选项4',
-        //   label: '龙须面'
-        // }, {
-        //   value: '选项5',
-        //   label: '北京烤鸭'
-        // }],
-        selectVal: ''
+        selectVal: '',
+        goodsNameList:[],
+        warehouseList:[]
       }
     },
-    activated() {
-      this.getList()
-    },
+    activated() {},
     computed() {},
     created() {
       debugger
@@ -150,8 +116,8 @@
       },
       newAcquisition(index, row, type) {
         debugger
-          let _obj = {}
-          let _query = {}
+        let _obj = {}
+        let _query = {}
         switch (type) {
           case '新增':
             _obj = this.warehouseList.find((item) => {
@@ -159,19 +125,20 @@
             });
             console.log(_obj)
             _query = {
-            warehouseId: _obj.id,
-            warehouseName: _obj.warehouseName,
-            compId: this.compId,
-            type:type
-          }
+              warehouseId: _obj.id,
+              warehouseName: _obj.warehouseName,
+              compId: this.compId,
+              type: type,
+              goodsNameList:this.goodsNameList
+            }
             break
           case '编辑':
             break
           case "查看":
-          _query = {
-            data:row,
-            type:type
-          }
+            _query = {
+              data: row,
+              type: type
+            }
             break
           default:
             break
@@ -187,10 +154,13 @@
           compId: this.compId,
           personCharge: this.accountName,
         }).toPromise().then((response) => {
+          debugger
           console.log(response)
           this.warehouseList = response
           this.selectVal = this.warehouseList[0].id
           // this.tableData = response.records
+          this.getList()
+
 
         })
       },
@@ -203,6 +173,9 @@
           compId: this.compId,
         }).toPromise().then((response) => {
           console.log(response)
+          for(let i=0;i<response.records.length;i++){
+            this.goodsNameList.push(response.records[i].goodsName)
+          }
           this.tableData = response.records
         })
       },
@@ -220,7 +193,9 @@
         this.visible = true
         console.log(index, row);
       },
-      print() {}
+      print() {
+        window.location.href="../../../static/print.html"
+      }
     },
   }
 </script>

+ 118 - 28
src/views/houseSelfCollect/acquisitionManagementAdd.vue

@@ -14,7 +14,12 @@
         <div class="row1">
           <div class="grid-content">
             <el-form-item label="货名">
-              <el-input v-model="baseInfoForm.goodsName"></el-input>
+              <!-- <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">
+                </el-option>
+              </el-select>
             </el-form-item>
           </div>
           <div class="grid-content">
@@ -104,7 +109,6 @@
             </div>
           </div>
         </div>
-
         <el-button class="submit" @click="submit">提交</el-button>
       </el-row>
     </el-main>
@@ -124,11 +128,13 @@
           </el-table-column>
           <el-table-column prop="price3" label="三等单价">
           </el-table-column>
-          <el-table-column prop="price4" label="等外单价">
+          <el-table-column prop="priceOther" label="等外单价">
           </el-table-column>
         </el-table>
       </div>
       <el-button class="submit" @click="closeCount">关闭</el-button>
+      <el-button class="submit" @click="print">打印</el-button>
+
     </el-main>
   </el-container>
 </template>
@@ -136,6 +142,9 @@
   import {
     purchasePriceAdd
   } from '@/model/houseSelfCollect/index'
+  import {
+    packList,
+  } from '@/model/contarct/index'
   export default {
 
     components: {
@@ -146,34 +155,36 @@
     },
     data() {
       return {
+        selectVal: "",
+        goodnameList: [],
         tableData: [{
           waterMin: '10',
           waterMax: '20',
           price1: '30',
           price2: '30',
           price3: '30',
-          price4: '30',
+          priceOther: '30',
         }, {
           waterMin: '11',
           waterMax: '20',
           price1: '30',
           price2: '30',
           price3: '30',
-          price4: '30',
+          priceOther: '30',
         }, {
           waterMin: '12',
           waterMax: '20',
           price1: '30',
           price2: '30',
           price3: '30',
-          price4: '30',
+          priceOther: '30',
         }, {
           waterMin: '13',
           waterMax: '20',
           price1: '30',
           price2: '30',
           price3: '30',
-          price4: '30',
+          priceOther: '30',
         }],
         isCountShow: true,
         priceList: [{
@@ -235,17 +246,40 @@
       }
     },
     created() {
-      debugger
+      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
       switch (this.$route.query.type) {
         case "新增":
+          // 货名
+          packList({
+              constId: 'CON2'
+            })
+            .toPromise()
+            .then((response) => {
+              let _list = []
+              for (let i = 0; i < response.length; i++) {
+                let _isAll = true
+                for (let j = 0; j < _goodsNameList.length; j++) {
+                  if (response[i].constValue != _goodsNameList[j]) {
+                    if (j == _goodsNameList.length - 1 && _isAll) {
+                      _list.push(response[i])
+                    }
+                  } else {
+                    _isAll = false
+                  }
+                }
+              }
+              this.goodnameList = _list
+              this.selectVal = _list[0].constValue
+            })
           break;
         case "编辑":
           break;
@@ -256,12 +290,11 @@
           break
       }
     },
-    mounted() {
-      debugger
-
-
-    },
+    mounted() {},
     methods: {
+      goodsChange(e) {
+        console.log(e)
+      },
       changeBaseWater(val) {
         console.log('val', val)
         for (let i = 0; i < this.priceList.length; i++) {
@@ -358,6 +391,28 @@
           }
         }
       },
+      // 算价格纠正精度不准
+      accMul(arg1, arg2) {
+        var m = 0,
+          s1 = arg1.toString(),
+          s2 = arg2.toString();
+        try {
+          m += s1.split(".")[1].length
+        } catch (e) {}
+        try {
+          m += s2.split(".")[1].length
+        } catch (e) {}
+        return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
+      },
+      keepTwoDecimal(num) {
+        var result = parseFloat(num);
+        if (isNaN(result)) {
+          console.log('传递参数错误,请检查!');
+          return false;
+        }
+        result = Math.round(result * 100) / 100;
+        return result;
+      },
       newSetPrice() {
         let _newObj = {
           unitPrice: '',
@@ -410,10 +465,9 @@
             return false
           })
       },
-      // 提交
-      submit() {
-        debugger
-        this.isCountShow = false
+
+      //构造新增价格数据
+      makePriceDataList() {
         for (let k = 0; k < this.priceList.length; k++) {
           // 新增
           let _detailsObj = {
@@ -448,13 +502,21 @@
               _detailsObj.point += ',' + this.priceList[k].detailList[i].water
             }
           }
-
-          debugger
           this.baseInfoForm.details.push(_detailsObj)
 
         }
+      },
 
+      //打印
+      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
@@ -463,6 +525,9 @@
       closeCount() {
         this.isCountShow = true
         this.splitPriceList = []
+        this.$router.push({
+          name: 'acquisitionManagement',
+        })
       },
       //处理表格数据
       makeTableList() {
@@ -480,7 +545,7 @@
         let _list = []
         let _obj = {}
         let _waterMin = parseFloat(this.baseInfoForm.waterMin)
-        let _waterMax = this.baseInfoForm.waterMax
+        let _waterMax = parseFloat(this.baseInfoForm.waterMax)
         let _count = (_waterMax - _waterMin) / 0.5 + 1
         for (let i = 0; i < _count; i++) {
           if (i == 0) {
@@ -491,7 +556,7 @@
               price1: priceList[0],
               price2: priceList[1],
               price3: priceList[2],
-              price4: priceList[3],
+              priceOther: priceList[3],
             }
           } else {
             _waterMin += 0.5
@@ -502,10 +567,11 @@
               price1: priceList[0],
               price2: priceList[1],
               price3: priceList[2],
-              price4: priceList[3],
+              priceOther: priceList[3],
             }
           }
           _list.push(_obj)
+          this.baseInfoForm.detailPrints.push(_obj)
         }
         this.tableData = _list
       },
@@ -517,7 +583,7 @@
           for (let k = 0; k < _priceList[i].checkList.length; k++) {
             let _obj = {}
             _obj.level = _priceList[i].checkList[k]
-            _obj.basicUnitPrice = _priceList[i].basicUnitPrice
+            _obj.basicUnitPrice = parseFloat(_priceList[i].basicUnitPrice)
             _obj.priceList = []
             _obj.haveSplit = false
             for (let j = 0; j < _priceList[i].detailList.length; j++) {
@@ -558,12 +624,18 @@
             .waterBase) * 0.01
           for (let k = 0; k < _list.length; k++) {
             //基准左边
+            debugger
             if (_waterMin < parseFloat(this.baseInfoForm.waterBase)) {
               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
-                prcieList.push(_price)
+                console.log(basePrice)
+                console.log(this.keepTwoDecimal(basePrice))
+                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;
+                console.log(_price)
+                prcieList.push(this.keepTwoDecimal(_price))
               } else if (_waterMin >= _list[k].priceStart && _waterMin < _list[k].priceEnd) {
                 // 当前段价格+其他段价格
                 let _otherPice = this.getOtherPrice(_list[k])
@@ -577,12 +649,30 @@
 
             }
             //基准值
-            else if (_waterMin = parseFloat(this.baseInfoForm.waterBase)) {
-
+            else if (_waterMin == parseFloat(this.baseInfoForm.waterBase)) {
+                   prcieList.push(this.keepTwoDecimal(basePrice))
             }
             // 基准右边
             else {
 
+            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;
+                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 _price1 = (_list[k].priceEnd - _waterMin) / 0.5 * _list[k].betweenPrice + _otherPice;
+
+
+
+                // _price+=_list[k].totalPrice
+
+              }
+
+
             }