Browse Source

修改bug

QuKatie 3 years ago
parent
commit
f9eab4da61

+ 0 - 1
src/components/crop-dialog/configuration/mainList.json

@@ -10,7 +10,6 @@
     "menu":false,
     "selection":true,
     "tip":false,
-    "header":false,
     "column":[
         {
             "label": "编码",

+ 6 - 5
src/components/crop-dialog/main.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog
-      title="客户信息"
+      title="客户"
       top="5vh"
       class="el-dialogDeep"
       :visible.sync="portinfoVisible"
@@ -19,6 +19,7 @@
                   :option="treeOption"
                   :data="treeData"
                   @node-click="nodeClick"
+                  :style="treeStyle"
                 />
               </basic-container>
             </el-scrollbar>
@@ -81,7 +82,7 @@ export default {
         lazy: true,
         treeLoad: function(node, resolve) {
           const parentId = node.level === 0 ? 0 : node.data.id;
-          getDeptLazyTree({ parentId: parentId, corpType: "KH"}).then(res => {
+          getDeptLazyTree({ parentId: parentId, corpType: "KH" }).then(res => {
             resolve(
               res.data.data.map(item => {
                 return {
@@ -103,12 +104,12 @@ export default {
         }
       },
       portinfoVisible: false,
-      selectionList: []
+      selectionList: [],
+      treeStyle: "height:" + (window.innerHeight - 315) + "px"
     };
   },
   created() {},
-  mounted() {
-  },
+  mounted() {},
   methods: {
     cellStyle() {
       return "padding:0;height:40px;";

+ 2 - 3
src/components/customer-dialog/configuration/mainList.json

@@ -8,15 +8,14 @@
     "menu":false,
     "selection":true,
     "tip":false,
-    "header":false,
     "column":[
         {
-            "label": "客户编码",
+            "label": "编码",
             "prop": "code",
             "index": 1,
             "width":100
         },{
-            "label": "客户全称",
+            "label": "称",
             "prop": "cname",
             "index": 2,
             "width":180

+ 7 - 6
src/components/customer-dialog/main.vue

@@ -10,7 +10,7 @@
       />
     </div>
     <el-dialog
-      title="客户信息"
+      title="客户"
       top="5vh"
       :visible.sync="portinfoVisible"
       width="60%"
@@ -27,6 +27,7 @@
                   :option="treeOption"
                   :data="treeData"
                   @node-click="nodeClick"
+                  :style="treeStyle"
                 />
               </basic-container>
             </el-scrollbar>
@@ -90,7 +91,7 @@ export default {
         lazy: true,
         treeLoad: function(node, resolve) {
           const parentId = node.level === 0 ? 0 : node.data.id;
-          getDeptLazyTree({parentId:parentId,corpType:"GYS"}).then(res => {
+          getDeptLazyTree({ parentId: parentId, corpType: "GYS" }).then(res => {
             resolve(
               res.data.data.map(item => {
                 return {
@@ -112,7 +113,8 @@ export default {
         }
       },
       portinfoVisible: false,
-      selectionList: []
+      selectionList: [],
+      treeStyle: "height:" + (window.innerHeight - 315) + "px"
     };
   },
   props: {
@@ -125,8 +127,7 @@ export default {
     event: "balabala"
   },
   created() {},
-  mounted() {
-  },
+  mounted() {},
   methods: {
     closed() {
       this.$refs.crud.toggleSelection();
@@ -144,7 +145,7 @@ export default {
         size: page.pageSize,
         current: page.currentPage,
         corpsTypeId: this.treeDeptId,
-        corpType:"GYS"
+        corpType: "GYS"
       });
       customerList(queryParams).then(res => {
         this.dataList = res.data.data.records;

+ 52 - 17
src/components/part-dialog/main.vue

@@ -66,14 +66,7 @@
             <span v-else>{{ row.goodNumber }}</span>
           </template>
           <template slot="price" slot-scope="{ row }">
-            <el-input
-              v-if="row.$cellEdit"
-              v-model="row.price"
-              size="small"
-              oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-              @change="priceChange(row)"
-            ></el-input>
-            <span v-else>{{ row.price | micrometerFormat }}</span>
+            <span>{{ row.price | micrometerFormat }}</span>
           </template>
         </avue-crud>
       </span>
@@ -82,12 +75,14 @@
         <el-button type="primary" @click="importPart">确 定</el-button>
       </span>
     </el-dialog>
+    <price-library ref="library" @librayToPart="librayToPart" />
   </div>
 </template>
 
 <script>
 import option from "./configuration/mainList.json";
 import { micrometerFormat } from "@/util/validate";
+import priceLibrary from "@/components/price-Library/main";
 import _ from "lodash";
 export default {
   data() {
@@ -103,9 +98,13 @@ export default {
       partVisible: false,
       selectionList: [],
       goodsIndex: null,
-      amoutSum: 0
+      amoutSum: 0,
+      partreData: null
     };
   },
+  components: {
+    priceLibrary
+  },
   props: {
     partList: Array
   },
@@ -120,14 +119,11 @@ export default {
       return "padding:0;height:40px;";
     },
     rePick(row, index) {
-      this.$emit("partReData", {
+      this.partreData = {
         ...row,
         index: index
-      });
-      // this.$message({
-      //   type: "warning",
-      //   message: "正在开发中!"
-      // });
+      };
+      this.$refs.library.init(true, this.partreData);
     },
     priceChange(row) {
       row.amout = Number(
@@ -152,7 +148,7 @@ export default {
       }
     },
     rowAdd() {
-      this.$emit("partOpen", true);
+      this.$refs.library.init(true);
     },
     init(index) {
       // this.data = rows;
@@ -161,6 +157,7 @@ export default {
     },
     closed() {
       this.amoutSum = 0;
+      this.partreData = null;
       this.$refs.crud.toggleSelection();
       this.$emit("partClosed");
     },
@@ -171,6 +168,44 @@ export default {
       this.$emit("importPart", this.data, this.amoutSum, this.goodsIndex);
       this.partVisible = false;
     },
+    librayToPart(rows, partreData) {
+      this.partreData = partreData;
+      console.log(this.partreData);
+      if (this.partreData) {
+        rows.forEach(e => {
+          this.data.forEach((item, index) => {
+            if (index == this.partreData.index) {
+              item.goodId = e.itemId;
+              item.goodTypeId = e.goodTypeId;
+              item.goodTypeName = e.goodsTypeName;
+              item.goodName = e.cname;
+              item.price = e.purchaseAmount;
+              item.goodNumber = this.partreData.goodNumber;
+              item.amout = _.multiply(
+                Number(
+                  this.partreData.goodNumber ? this.partreData.goodNumber : 0
+                ),
+                Number(e.purchaseAmount ? e.purchaseAmount : 0)
+              );
+              item.$cellEdit = true;
+            }
+          });
+        });
+      } else {
+        rows.forEach(e => {
+          this.data.push({
+            goodId: e.itemId,
+            goodTypeId: e.goodTypeId,
+            goodTypeName: e.goodsTypeName,
+            goodName: e.cname,
+            price: e.purchaseAmount,
+            goodNumber: 1,
+            amout: e.purchaseAmount,
+            $cellEdit: true
+          });
+        });
+      }
+    },
     sizeChange(val) {
       this.page.pageSize = val;
       this.getList();
@@ -215,7 +250,7 @@ export default {
   },
   watch: {
     partList: function(arr) {
-      this.data = arr;
+      this.data = this.deepClone(arr);
     }
   }
 };

+ 6 - 1
src/components/price-Library/main.vue

@@ -107,7 +107,12 @@ export default {
         }
       }
       this.visible = false;
-      this.$emit("importLibray", this.selectionList, this.partType);
+      console.log(this.partType)
+      if(this.partType){
+        this.$emit("librayToPart", this.selectionList,this.partreData);
+      }else{
+        this.$emit("importLibray", this.selectionList);
+      }
     },
     currentChange(val) {
       this.page.currentPage = val;

+ 38 - 0
src/util/calculate.js

@@ -0,0 +1,38 @@
+import _ from "lodash";
+//采购价格乘以(1+客户FOB系数)计算出产品价格
+export function productCal(num, num2) {
+  //采购价格
+  const price = Number(num ? num : 0)
+  //FOB
+  const fob = Number(num2 ? num2 : 0)
+  const sum = _.multiply(price, _.add(1, _.divide(fob, 100)))
+  return Number(sum).toFixed(2)
+}
+//(产品价格+配件价格)乘以(1+客户FOB系数)/汇率 计算出销售价格
+export function sellingCal(num, num2, num3, num4) {
+  //产品价格
+  const product = Number(num ? num : 0)
+  //配件价格
+  const fitting = Number(num2 ? num2 : 0)
+  //fob
+  const fob = Number(num3 ? num3 : 0)
+  //汇率
+  const exchangeRate = Number(Number(num4) ? num4 : 1)
+  const sum = _.divide(_.multiply(_.add(product, fitting), _.add(1, _.divide(fob, 100))), exchangeRate)
+  return Number(sum).toFixed(2)
+}
+//销售价格乘以数量加运费加保险乘以(折扣除以10) 计算出金额
+export function amountCall(num, num2, num3, num4, num5) {
+  //销售价
+  const sell = Number(num ? num : 0)
+  //数量
+  const quantity = Number(num2 ? num2 : 0)
+  //运费
+  const freight = Number(num3 ? num3 : 0)
+  //保险
+  const insurance = Number(num4 ? num4 : 0)
+  //折扣
+  const discount = Number(num5 || num5 === 0 ? num : 10)
+  const sum = _.multiply(_.add(_.multiply(sell, quantity), _.add(freight, insurance)), _.divide(discount, 10))
+  return Number(sum).toFixed(2)
+}

+ 0 - 0
src/views/exportTrade/customerInquiry/components/goods-info.vue


+ 1 - 1
src/views/exportTrade/customerInquiry/config/customerContact.json

@@ -99,7 +99,7 @@
       "label": "供应商",
       "prop": "corpId",
       "index": 12,
-      "width": 100,
+      "width": 150,
       "overHidden": true
     },
     {

+ 60 - 116
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -284,13 +284,14 @@
             />
           </template>
           <template slot="corpId" slot-scope="{ row, index }">
-            <customer-dialog
-              v-if="row.$cellEdit"
-              v-model="row.corpName"
+            <crop-select
+              v-show="row.$cellEdit"
+              v-model="row.corpId"
               :cropIndex="index"
-              @getcorpId="getcorpId"
-            ></customer-dialog>
-            <span v-else>{{ row.corpName }}</span>
+              @getCorpData="rowCorpData"
+              corpType="GYS"
+            ></crop-select>
+            <span v-show="!row.$cellEdit">{{ row.corpName }}</span>
           </template>
           <template slot="purchaseAmount" slot-scope="{ row }">
             <el-input
@@ -393,8 +394,8 @@
           <el-col :span="5">
             <div>
               <el-scrollbar>
-                <basic-container style="margin-top:45px">
-                  <avue-tree :option="treeOption" @node-click="nodeClick" />
+                <basic-container>
+                  <avue-tree :option="treeOption" @node-click="nodeClick" :style="treeStyle"/>
                 </basic-container>
               </el-scrollbar>
             </div>
@@ -435,11 +436,9 @@
     ></report-dialog>
     <part-dialog
       ref="part"
-      @partOpen="partOpen()"
       :partList="partList"
       @importPart="importPart"
       @partClosed="partClosed"
-      @partReData="partReData"
     />
     <price-library ref="library" @importLibray="importLibray" />
   </div>
@@ -474,6 +473,7 @@ export default {
   name: "detailsPageEdit",
   data() {
     return {
+      treeStyle: "height:" + (window.innerHeight - 360) + "px",
       itemtypeList: [],
       configuration: {
         multipleChoices: false,
@@ -662,8 +662,7 @@ export default {
             prop: "exchangeRate",
             span: 8,
             slot: true,
-            row: true,
-            disabled: true
+            row: true
           },
           {
             label: "箱型",
@@ -787,8 +786,6 @@ export default {
       subLoading: false,
       pageLoading: false,
       showBut: true,
-      partreData: null,
-      partType: false,
       partList: [],
       goodsoptions: [],
       priceTermsList: [],
@@ -860,8 +857,11 @@ export default {
     cellStyle() {
       return "padding:0;height:40px;";
     },
-    getCorpData(row){
-      this.form.coefficient=row.coefficient
+    getCorpData(row) {
+      this.form.coefficient = row.coefficient;
+    },
+    rowCorpData(row) {
+      this.data[row.index].corpName = row.cname;
     },
     priceTermsChange(row) {
       this.priceTermsList.forEach(e => {
@@ -884,10 +884,7 @@ export default {
       if (!this.form.currency) {
         return this.$message.error("请选择币别");
       }
-      this.$refs.library.init(this.partType, this.partreData != null);
-    },
-    rowCorpdata(row) {
-      this.form.coefficient = row.coefficient;
+      this.$refs.library.init(false);
     },
     cnameChange(row) {
       this.goodsoptions.forEach(e => {
@@ -901,10 +898,6 @@ export default {
         }
       });
     },
-    partReData(row) {
-      this.partreData = row;
-      this.partOpen();
-    },
     saveSell() {
       if (!this.form.id) {
         return this.$message.error("此单据没有提交记录,请先提交");
@@ -922,10 +915,6 @@ export default {
         });
       });
     },
-    partOpen() {
-      this.partType = true;
-      this.addLibrary();
-    },
     rePick(row, index) {
       this.reData = {
         ...row,
@@ -995,14 +984,7 @@ export default {
     },
     partClosed() {
       this.partList = [];
-      this.partreData = null;
-      if (this.partType) {
-        this.partType = false;
-      }
     },
-    // getcorpId(row) {
-    //   this.data[row.index].corpId = row.id;
-    // },
     rowCell(row, index) {
       if (row.$cellEdit == true) {
         this.$set(row, "$cellEdit", false);
@@ -1239,88 +1221,50 @@ export default {
           this.loading = false;
         });
     },
-    importLibray(rows, status) {
-      if (status) {
-        if (this.partreData) {
-          rows.forEach(e => {
-            this.partList.forEach((item, index) => {
-              if (index == this.partreData.index) {
-                item.goodId = e.itemId;
-                item.goodTypeId = e.goodTypeId;
-                item.goodTypeName = e.goodsTypeName;
-                item.goodName = e.cname;
-                item.price = e.purchaseAmount;
-                item.goodNumber = this.partreData.goodNumber;
-                item.amout = _.multiply(
-                  Number(
-                    this.partreData.goodNumber ? this.partreData.goodNumber : 0
-                  ),
-                  Number(e.purchaseAmount ? e.purchaseAmount : 0)
-                );
-                this.partreData.amout;
-                item.$cellEdit = true;
-              }
-            });
-          });
-        } else {
-          rows.forEach(e => {
-            this.partList.push({
-              goodId: e.itemId,
-              goodTypeId: e.goodTypeId,
-              goodTypeName: e.goodsTypeName,
-              goodName: e.cname,
-              price: e.purchaseAmount,
-              goodNumber: 1,
-              amout: e.purchaseAmount,
-              $cellEdit: true
-            });
-          });
-        }
-      } else {
-        rows.forEach(e => {
-          this.data.push({
-            itemId: e.itemId,
-            code: e.code,
-            cname: e.cname,
-            priceCategory: e.goodsTypeName,
-            purchaseAmount: e.purchaseAmount,
-            itemProp: e.goodNature,
-            corpId: e.corpId,
-            corpName: e.corpName,
-            itemDescription: e.cnameDescription,
-            partsList: [],
-            partsPrice: 0,
-            itemType: e.specs,
-            tradeTerms: null,
-            productPrice: Number(
-              _.multiply(
-                Number(e.purchaseAmount),
-                Number(_.add(1, _.divide(Number(this.form.coefficient), 100)))
-              )
-            ).toFixed(2),
-            price: Number(
-              _.multiply(
-                Number(e.purchaseAmount),
-                Number(_.add(1, _.divide(Number(this.form.coefficient), 100)))
-              )
-            ).toFixed(2),
-            orderQuantity: 1,
-            insurance: 0,
-            freight: 0,
-            discount: null,
-            amount: Number(
-              _.multiply(
-                Number(e.purchaseAmount),
-                Number(_.add(1, _.divide(Number(this.form.coefficient), 100)))
-              )
-            ).toFixed(2),
-            taxRate: 0,
-            unit: e.unit,
-            remarks: null,
-            $cellEdit: true
-          });
+    importLibray(rows) {
+      rows.forEach(e => {
+        this.data.push({
+          itemId: e.itemId,
+          code: e.code,
+          cname: e.cname,
+          priceCategory: e.goodsTypeName,
+          purchaseAmount: e.purchaseAmount,
+          itemProp: e.goodNature,
+          corpId: e.corpId,
+          corpName: e.corpName,
+          itemDescription: e.cnameDescription,
+          partsList: [],
+          partsPrice: 0,
+          itemType: e.specs,
+          tradeTerms: null,
+          productPrice: Number(
+            _.multiply(
+              Number(e.purchaseAmount),
+              Number(_.add(1, _.divide(Number(this.form.coefficient), 100)))
+            )
+          ).toFixed(2),
+          price: Number(
+            _.multiply(
+              Number(e.purchaseAmount),
+              Number(_.add(1, _.divide(Number(this.form.coefficient), 100)))
+            )
+          ).toFixed(2),
+          orderQuantity: 1,
+          insurance: 0,
+          freight: 0,
+          discount: null,
+          amount: Number(
+            _.multiply(
+              Number(e.purchaseAmount),
+              Number(_.add(1, _.divide(Number(this.form.coefficient), 100)))
+            )
+          ).toFixed(2),
+          taxRate: 0,
+          unit: e.unit,
+          remarks: null,
+          $cellEdit: true
         });
-      }
+      });
     },
     //商品明细导入
     newDetails() {

+ 10 - 16
src/views/exportTrade/purchaseInquiry/detailsPage.vue

@@ -174,19 +174,14 @@
             />
           </template>
           <template slot="corpId" slot-scope="{ row, index }">
-            <customer-dialog
-              v-if="row.$cellEdit"
-              v-model="row.corpName"
+            <crop-select
+              v-show="row.$cellEdit"
+              v-model="row.corpId"
               :cropIndex="index"
-              @getcorpId="getcorpId"
-            ></customer-dialog>
-            <!-- <select-component
-                v-if="row.$cellEdit"
-              v-model="form.corpId"
-              :configuration="configuration"
-              :disabled="detailData.status == 1"
-            ></select-component> -->
-            <span v-else>{{ row.corpName }}</span>
+              @getCorpData="rowCorpData"
+              corpType="GYS"
+            ></crop-select>
+            <span v-show="!row.$cellEdit">{{ row.corpName }}</span>
           </template>
           <template slot="purchaseAmount" slot-scope="{ row }">
             <span>{{ row.purchaseAmount | micrometerFormat }}</span>
@@ -514,6 +509,9 @@ export default {
     cellStyle() {
       return "padding:0;height:40px;";
     },
+    rowCorpData(row) {
+      this.data[row.index].corpName = row.cname;
+    },
     rePick(row, index) {
       this.reData = {
         ...row,
@@ -533,10 +531,6 @@ export default {
         }
       });
     },
-    getcorpId(row) {
-      console.log(row);
-      this.data[row.index].corpId = row.id;
-    },
     rowCell(row, index) {
       if (row.$cellEdit == true) {
         this.$set(row, "$cellEdit", false);

+ 10 - 9
src/views/exportTrade/salesContract/detailsPage.vue

@@ -229,13 +229,14 @@
               />
             </template>
             <template slot="corpId" slot-scope="{ row, index }">
-              <customer-dialog
-                v-if="row.$cellEdit"
-                v-model="row.corpName"
+              <crop-select
+                v-show="row.$cellEdit"
+                v-model="row.corpId"
                 :cropIndex="index"
-                @getcorpId="getcorpId"
-              ></customer-dialog>
-              <span v-else>{{ row.corpName }}</span>
+                @getCorpData="rowCorpData"
+                corpType="GYS"
+              ></crop-select>
+              <span v-show="!row.$cellEdit">{{ row.corpName }}</span>
             </template>
             <template slot="purchaseAmount" slot-scope="{ row }">
               <el-input
@@ -922,6 +923,9 @@ export default {
     cellStyle() {
       return "padding:0;height:40px;";
     },
+    rowCorpData(row) {
+      this.data[row.index].corpName = row.cname;
+    },
     priceTermsChange(row) {
       this.priceTermsList.forEach(e => {
         if (row == e.dictValue) {
@@ -1005,9 +1009,6 @@ export default {
         });
       });
     },
-    getcorpId(row) {
-      this.data[row.index].corpId = row.id;
-    },
     rePick(row, index) {
       this.reData = {
         ...row,

+ 13 - 18
src/views/exportTrade/shippingInquiry/detailsPage.vue

@@ -40,16 +40,10 @@
           :option="option"
         >
           <template slot="portOfLoad">
-            <port-info
-              v-model="form.portOfLoad"
-              :disabled="true"
-            />
+            <port-info v-model="form.portOfLoad" :disabled="true" />
           </template>
           <template slot="portOfDestination">
-            <port-info
-              v-model="form.portOfDestination"
-              :disabled="true"
-            />
+            <port-info v-model="form.portOfDestination" :disabled="true" />
           </template>
         </avue-form>
       </basic-container>
@@ -86,13 +80,14 @@
           :cell-style="cellStyle"
         >
           <template slot="shippingHouse" slot-scope="{ row, index }">
-            <customer-dialog
-              v-if="row.$cellEdit"
-              v-model="row.shippingHouseName"
+            <crop-select
+              v-show="row.$cellEdit"
+              v-model="row.shippingHouse"
               :cropIndex="index"
-              @getcorpId="getcorpId"
-            ></customer-dialog>
-            <span v-else>{{ row.shippingHouseName }}</span>
+              @getCorpData="rowCorpData"
+              corpType="GYS"
+            ></crop-select>
+            <span v-show="!row.$cellEdit">{{ row.shippingHouseName }}</span>
           </template>
           <template slot="priorityReferrer" slot-scope="{ row }">
             <el-checkbox
@@ -399,6 +394,9 @@ export default {
     cellStyle() {
       return "padding:0;height:40px;";
     },
+    rowCorpData(row) {
+      this.data[row.index].shippingHouseName = row.cname;
+    },
     rowCell(row, index) {
       if (row.$cellEdit == true) {
         this.$set(row, "$cellEdit", false);
@@ -429,9 +427,6 @@ export default {
         }
       });
     },
-    getcorpId(row) {
-      this.freightData[row.index].shippingHouse = row.id;
-    },
     rowSave(row) {
       this.$set(row, "$cellEdit", false);
     },
@@ -566,7 +561,7 @@ export default {
                 : [];
               this.oldform = res.data.data;
               this.olddata = this.deepClone(
-                res.data.data.orderItemsList? res.data.data.orderItemsList : []
+                res.data.data.orderItemsList ? res.data.data.orderItemsList : []
               );
               this.oldfreightData = this.deepClone(
                 res.data.data.orderFreightList