QuKatie 3 年之前
父节点
当前提交
84dae1273c

+ 6 - 1
src/components/part-dialog/configuration/mainList.json

@@ -18,7 +18,12 @@
     {
       "label": "名称",
       "prop": "goodName",
-      "width": 250
+      "width": 200
+    },
+    {
+      "label": "供应商",
+      "prop": "corpId",
+      "width": 200
     },
     {
       "label": "数量",

+ 10 - 0
src/components/part-dialog/main.vue

@@ -68,6 +68,9 @@
           <template slot="price" slot-scope="{ row }">
             <span>{{ row.price | micrometerFormat }}</span>
           </template>
+          <template slot="corpId" slot-scope="{ row}">
+            <span>{{ row.corpName }}</span>
+          </template>
         </avue-crud>
       </span>
       <span slot="footer" class="dialog-footer">
@@ -125,6 +128,9 @@ export default {
       };
       this.$refs.library.init(true, this.partreData);
     },
+    rowCorpData(row) {
+      this.data[row.index].corpName = row.cname;
+    },
     priceChange(row) {
       row.amout = Number(
         _.multiply(
@@ -178,6 +184,8 @@ export default {
               item.goodId = e.itemId;
               item.goodTypeId = e.goodTypeId;
               item.goodTypeName = e.goodsTypeName;
+              item.corpId = e.corpId;
+              item.corpName = e.corpName;
               item.goodName = e.cname;
               item.price = e.purchaseAmount;
               item.goodNumber = this.partreData.goodNumber;
@@ -197,6 +205,8 @@ export default {
             goodId: e.itemId,
             goodTypeId: e.goodTypeId,
             goodTypeName: e.goodsTypeName,
+            corpId: e.corpId,
+            corpName: e.corpName,
             goodName: e.cname,
             price: e.purchaseAmount,
             goodNumber: 1,

+ 37 - 50
src/components/price-Library/configuration/mainList.json

@@ -11,40 +11,43 @@
   "menuWidth": "180",
   "selection": true,
   "tip": false,
-  "column": [{
-      "label": "商品名称",
+  "column": [
+    {
+      "label": "商品类别",
+      "prop": "goodsTypeName",
       "search": true,
       "searchSpan": 8,
-      "prop": "cname",
       "index": 1,
       "width": 100,
+      "type": "select",
+      "filterable": true,
+      "dicData": [],
+      "props": {
+        "value": "cname",
+        "label": "cname"
+      },
       "overHidden": true
     },
     {
-      "label": "规格",
-      "prop": "specs",
+      "label": "商品名称",
+      "search": true,
+      "searchSpan": 8,
+      "prop": "cname",
       "index": 2,
       "width": 100,
       "overHidden": true
     },
     {
-      "label": "产品属性",
-      "prop": "goodNature",
-      "index": 3,
-      "width": 100,
-      "overHidden": true
-    },
-    {
       "label": "供应商",
       "prop": "corpId",
-      "index": 4,
+      "index": 3,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "币别",
       "prop": "currency",
-      "index": 5,
+      "index": 4,
       "width": 100,
       "overHidden": true
     },
@@ -52,20 +55,20 @@
       "label": "汇率",
       "prop": "exchangeRate",
       "width": 100,
-      "index": 6,
+      "index": 5,
       "overHidden": true
     },
     {
       "label": "FOB系数",
       "prop": "coefficient",
-      "index": 7,
+      "index": 6,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "价格类型",
       "prop": "billType",
-      "index": 8,
+      "index": 7,
       "width": 100,
       "overHidden": true,
       "dicData": [],
@@ -77,135 +80,119 @@
     {
       "label": "最新价格",
       "prop": "price",
-      "index": 9,
+      "index": 8,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "美元价格",
       "prop": "greenback",
-      "index": 10,
+      "index": 9,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "采购价格",
       "prop": "purchaseAmount",
-      "index": 11,
+      "index": 10,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "税率",
       "prop": "taxRate",
-      "index": 12,
-      "width": 100,
-      "overHidden": true
-    },
-    {
-      "label": "商品类别",
-      "prop": "goodsTypeName",
-      "search": true,
-      "searchSpan": 8,
-      "index": 13,
+      "index": 11,
       "width": 100,
-      "type": "select",
-      "filterable": true,
-      "dicData": [],
-      "props": {
-        "value": "cname",
-        "label": "cname"
-      },
       "overHidden": true
     },
     {
       "label": "是否重点推荐",
       "prop": "priorityReferrer",
-      "index": 14,
+      "index": 12,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "推荐理由",
       "prop": "referrerReason",
-      "index": 15,
+      "index": 13,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "历史价格1",
       "prop": "priceOne",
-      "index": 16,
+      "index": 14,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "历史日期1",
       "prop": "priceOneTime",
-      "index": 17,
+      "index": 15,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "历史价格2",
       "prop": "priceTwo",
-      "index": 18,
+      "index": 16,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "历史日期2",
       "prop": "priceTwoTime",
-      "index": 19,
+      "index": 17,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "历史价格3",
       "prop": "priceThree",
-      "index": 20,
+      "index": 18,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "历史日期3",
       "prop": "priceThreeTime",
-      "index": 21,
+      "index": 19,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "备注",
       "prop": "remarks",
-      "index": 22,
+      "index": 20,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "有效期开始",
       "prop": "startTime",
-      "index": 23,
+      "index": 21,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "有效期结束",
       "prop": "endTime",
-      "index": 24,
+      "index": 22,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "业务员",
       "prop": "person",
-      "index": 25,
+      "index": 23,
       "width": 100,
       "overHidden": true
     },
     {
       "label": "状态",
       "prop": "status",
-      "index": 26,
+      "index": 24,
       "width": 100,
       "overHidden": true
     }

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

@@ -4,6 +4,7 @@
       title="出口价格库"
       class="el-dialogDeep"
       :visible.sync="visible"
+      top="5vh"
       width="60%"
       append-to-body
       @closed="closed"
@@ -143,7 +144,7 @@ export default {
           this.data = res.data.data.records ? res.data.data.records : [];
           this.page.total = res.data.data.total;
           if (this.page.total > 0) {
-            this.tableOption.height = window.innerHeight - 500;
+            this.tableOption.height = window.innerHeight - 350;
           }
         })
         .finally(() => {

+ 129 - 0
src/components/property-dialog/main.vue

@@ -0,0 +1,129 @@
+<template>
+  <div>
+    <el-dialog
+      title="属性编辑"
+      class="el-dialogDeep"
+      :visible.sync="visible"
+      top="10vh"
+      width="60%"
+      append-to-body
+      @closed="closed"
+      v-dialog-drag
+    >
+      <span>
+        <avue-form ref="form" v-model="form" :option="option" />
+      </span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="visible = false">取 消</el-button>
+        <el-button type="primary" @click="importData">确 认</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "property-dialog",
+  data() {
+    return {
+      form: {},
+      visible: false,
+      fromIndex: null,
+      option: {
+        menuBtn: false,
+        labelWidth: 100,
+        column: [
+          {
+            label: "螺纹",
+            prop: "remarksOne",
+            span: 12,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=Thread",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
+            }
+          },
+          {
+            label: "介质",
+            prop: "customTwo",
+            span: 12,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=medium",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
+            }
+          },
+          {
+            label: "颜色",
+            prop: "customThree",
+            span: 12,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=property_color",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
+            }
+          },
+          {
+            label: "钢印",
+            prop: "customFour",
+            span: 12,
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=stencil",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
+            }
+          },
+          {
+            label: "特别提示",
+            prop: "customFive",
+            span: 24
+          }
+        ]
+      }
+    };
+  },
+  props: {},
+  created() {},
+  methods: {
+    init(row, index) {
+      this.form = {
+        remarksOne: row.remarksOne,
+        customTwo: row.customTwo,
+        customThree: row.customThree,
+        customFour: row.customFour,
+        customFive: row.customFive
+      };
+      this.fromIndex = index;
+      this.visible = true;
+    },
+    closed() {
+      this.form = {};
+      this.fromIndex = null;
+    },
+    importData() {
+      const data = {
+        remarksOne: this.form.remarksOne,
+        customTwo: this.form.customTwo,
+        customThree: this.form.customThree,
+        customFour: this.form.customFour,
+        customFive: this.form.customFive
+      };
+      this.$emit("importProperty", data, this.fromIndex);
+      this.visible = false;
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.trading-form ::v-deep .el-form-item {
+  margin-bottom: 8px !important;
+}
+::v-deep .el-form-item__error {
+  display: none !important;
+}
+</style>

+ 14 - 2
src/util/calculate.js

@@ -22,7 +22,7 @@ export function sellingCal(num, num2, num3, num4) {
   return Number(sum).toFixed(2)
 }
 //销售价格乘以数量加运费加保险乘以(折扣除以10) 计算出金额
-export function amountCall(num, num2, num3, num4, num5) {
+export function amountCal(num, num2, num3, num4, num5) {
   //销售价
   const sell = Number(num ? num : 0)
   //数量
@@ -32,7 +32,19 @@ export function amountCall(num, num2, num3, num4, num5) {
   //保险
   const insurance = Number(num4 ? num4 : 0)
   //折扣
-  const discount = Number(num5 || num5 === 0 ? num : 10)
+  const discount = Number(num5 || num5 === 0 ? num5 : 10)
+  
   const sum = _.multiply(_.add(_.multiply(sell, quantity), _.add(freight, insurance)), _.divide(discount, 10))
   return Number(sum).toFixed(2)
 }
+//保险、运费转换汇率
+export function transformCal(num, num2,num3) {
+  //采购价格
+  const cost = Number(num ? num : 0)
+  //旧汇率
+  const oldExchangeRate=Number(Number(num2) ? num2 : 1)
+  //汇率
+  const exchangeRate = Number(Number(num3) ? num3 : 1)
+  const sum =_.divide(_.multiply(cost,oldExchangeRate),exchangeRate) 
+  return Number(sum).toFixed(2)
+}

+ 0 - 1
src/util/contrastData.js

@@ -1,6 +1,5 @@
 //比较对象的值
 export function contrastObj(newval, oldval) {
-  console.log(newval, oldval)
   let reg = /^[A-Za-z]+$/;
   for (let key in newval) {
     if (reg.test(key)&&!(newval[key] instanceof Array) && (newval[key] != oldval[key] && (newval[key] || oldval[key]))) {

+ 3 - 10
src/views/exportTrade/customerInquiry/config/customerContact.json

@@ -36,15 +36,8 @@
       "label": "产品属性",
       "prop": "itemProp",
       "index": 4,
-      "width": 100,
-      "overHidden": true,
-      "cell": true,
-      "type": "select",
-      "dicData": [],
-      "props": {
-        "label": "dictValue",
-        "value": "dictKey"
-      }
+      "width": 200,
+      "overHidden": true
     },
     {
       "label": "产品描述",
@@ -99,7 +92,7 @@
       "label": "供应商",
       "prop": "corpId",
       "index": 12,
-      "width": 150,
+      "width": 200,
       "overHidden": true
     },
     {

+ 261 - 141
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -57,6 +57,13 @@
               :disabled="detailData.status == 1"
             ></crop-select>
           </template>
+          <template slot="belongToCorpId">
+            <crop-select
+              v-model="form.belongToCorpId"
+              corpType="GS"
+              :disabled="detailData.status == 1"
+            ></crop-select>
+          </template>
           <template slot="priceTerms">
             <el-select
               size="small"
@@ -91,9 +98,36 @@
               </el-option>
             </el-select>
           </template>
+          <template slot="currency">
+            <el-select
+              size="small"
+              v-model="form.currency"
+              placeholder="请选择"
+              @change="currencyChange"
+            >
+              <el-option
+                v-for="item in currencyList"
+                :key="item.id"
+                :label="item.dictValue"
+                :value="item.dictValue"
+              >
+              </el-option>
+            </el-select>
+          </template>
+          <template slot="exchangeRate">
+            <el-input
+              size="small"
+              v-model="form.exchangeRate"
+              oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d).*$/,
+            "$1.$2")'
+              placeholder="请输入 汇率"
+              :disabled="detailData.status == 1"
+              @change="exchangeRateChange"
+            />
+          </template>
           <template slot="boxNumber">
             <el-input
-              size="mini"
+              size="small"
               v-model="form.boxNumber"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
             "$1.$2")'
@@ -103,7 +137,7 @@
           </template>
           <template slot="minOrder">
             <el-input
-              size="mini"
+              size="small"
               v-model="form.minOrder"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
             "$1.$2")'
@@ -113,7 +147,7 @@
           </template>
           <template slot="predictOceanFreight">
             <el-input
-              size="mini"
+              size="small"
               v-model="form.predictOceanFreight"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
             "$1.$2")'
@@ -123,7 +157,7 @@
           </template>
           <template slot="referenceOceanFreight">
             <el-input
-              size="mini"
+              size="small"
               v-model="form.referenceOceanFreight"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
             "$1.$2")'
@@ -133,7 +167,7 @@
           </template>
           <template slot="oceanFreight">
             <el-input
-              size="mini"
+              size="small"
               v-model="form.oceanFreight"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/,
             "$1.$2")'
@@ -232,15 +266,23 @@
             </el-select>
             <span v-else>{{ row.itemType }}</span>
           </template>
+          <template slot="itemProp" slot-scope="{ row, index }">
+            <span v-if="row.$cellEdit" style="display:flex">
+              <el-input
+                v-model="row.itemProp"
+                :readonly="true"
+                size="small"
+                placeholder="请点击右边按钮"
+              ></el-input>
+              <el-button
+                icon="el-icon-edit"
+                size="mini"
+                @click="openProperty(row, index)"
+              ></el-button>
+            </span>
+            <span v-else>{{ row.itemProp }}</span>
+          </template>
           <template slot="cname" slot-scope="{ row, index }">
-            <!-- <el-button
-              size="small"
-              type="text"
-              @click="rePick(row, index)"
-              :disabled="disabled"
-              style="padding:4px 10px;float:left"
-              >选择</el-button
-            > -->
             <span v-if="row.$cellEdit" style="display:flex">
               <el-select
                 v-model="row.cname"
@@ -299,7 +341,7 @@
               v-model="row.purchaseAmount"
               size="small"
               placeholder="请输入"
-              @change="priceChange(row)"
+              @change="purchaseAmountChange(row)"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
             ></el-input>
             <span v-else>{{ row.purchaseAmount | micrometerFormat }}</span>
@@ -395,7 +437,11 @@
             <div>
               <el-scrollbar>
                 <basic-container>
-                  <avue-tree :option="treeOption" @node-click="nodeClick" :style="treeStyle"/>
+                  <avue-tree
+                    :option="treeOption"
+                    @node-click="nodeClick"
+                    :style="treeStyle"
+                  />
                 </basic-container>
               </el-scrollbar>
             </div>
@@ -440,6 +486,7 @@
       @importPart="importPart"
       @partClosed="partClosed"
     />
+    <property-dialog ref="property" @importProperty="importProperty" />
     <price-library ref="library" @importLibray="importLibray" />
   </div>
 </template>
@@ -450,6 +497,7 @@ import goodsOption from "./config/commodity.json";
 import feeInfo from "@/components/fee-info/main";
 import customerDialog from "@/components/customer-dialog/main";
 import partDialog from "@/components/part-dialog/main";
+import propertyDialog from "@/components/property-dialog/main";
 import {
   detail,
   submit,
@@ -467,12 +515,18 @@ import priceLibrary from "@/components/price-Library/main";
 import { isDiscount, isPercentage, micrometerFormat } from "@/util/validate";
 import { contrastObj, contrastList } from "@/util/contrastData";
 import { dateFormat } from "@/util/date";
-
+import {
+  productCal,
+  sellingCal,
+  amountCal,
+  transformCal
+} from "@/util/calculate";
 import _ from "lodash";
 export default {
   name: "detailsPageEdit",
   data() {
     return {
+      oldExchange: 1,
       treeStyle: "height:" + (window.innerHeight - 360) + "px",
       itemtypeList: [],
       configuration: {
@@ -516,6 +570,12 @@ export default {
             disabled: true
           },
           {
+            label: "公司主体",
+            prop: "belongToCorpId",
+            span: 16,
+            row: true
+          },
+          {
             label: "联系人",
             prop: "corpAttn",
             span: 8
@@ -635,20 +695,20 @@ export default {
             label: "币别",
             prop: "currency",
             span: 8,
-            type: "select",
-            dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
-            props: {
-              label: "dictValue",
-              value: "dictValue"
-            },
-            change: ({ value }) => {
-              if (value == "CNY") {
-                this.form.exchangeRate = 1;
-              }
-              if (value == "USD") {
-                this.form.exchangeRate = 6.3843;
-              }
-            },
+            // type: "select",
+            // dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
+            // props: {
+            //   label: "dictValue",
+            //   value: "dictValue"
+            // },
+            // change: ({ value }) => {
+            //   if (value == "CNY") {
+            //     this.form.exchangeRate = 1;
+            //   }
+            //   if (value == "USD") {
+            //     this.form.exchangeRate = 6.3843;
+            //   }
+            // },
             rules: [
               {
                 required: true,
@@ -789,7 +849,8 @@ export default {
       partList: [],
       goodsoptions: [],
       priceTermsList: [],
-      paymentTermList: []
+      paymentTermList: [],
+      currencyList: []
     };
   },
   props: {
@@ -802,7 +863,8 @@ export default {
     feeInfo,
     customerDialog,
     partDialog,
-    priceLibrary
+    priceLibrary,
+    propertyDialog
   },
   async created() {
     if (this.detailData.id) {
@@ -833,6 +895,9 @@ export default {
     this.getWorkDicts("payment_term").then(res => {
       this.paymentTermList = res.data.data;
     });
+    this.getWorkDicts("currency").then(res => {
+      this.currencyList = res.data.data;
+    });
     getPorts().then(res => {
       this.findObject(this.option.column, "portOfLoad").dicData = res.data;
       this.findObject(this.option.column, "portOfDestination").dicData =
@@ -859,6 +924,24 @@ export default {
     },
     getCorpData(row) {
       this.form.coefficient = row.coefficient;
+      if (this.data.length > 0) {
+        this.data.forEach(e => {
+          e.productPrice = productCal(e.purchaseAmount, this.form.coefficient);
+          e.price = sellingCal(
+            e.productPrice,
+            e.partsPrice,
+            this.form.coefficient,
+            this.form.exchangeRate
+          );
+          e.amount = amountCal(
+            e.price,
+            e.orderQuantity,
+            e.freight,
+            e.insurance,
+            e.discount
+          );
+        });
+      }
     },
     rowCorpData(row) {
       this.data[row.index].corpName = row.cname;
@@ -930,48 +1013,23 @@ export default {
       this.data[index].partsList = rows;
       this.data[index].partsPrice = sum;
       // 销售价=(配件采购价格+产品价格)/汇率 *(1+客户FOB系数/100)
-      // this.data[index].price=_.multiply(multiplier, multiplicand)
-      this.data[index].productPrice = Number(
-        _.multiply(
-          _.add(
-            Number(sum),
-            Number(
-              this.data[index].purchaseAmount
-                ? this.data[index].purchaseAmount
-                : 0
-            )
-          ),
-          _.add(
-            1,
-            _.divide(
-              Number(this.form.coefficient ? this.form.coefficient : 0),
-              100
-            )
-          )
-        )
-      ).toFixed(2);
-      this.data[index].price = Number(
-        _.divide(
-          _.multiply(
-            _.add(
-              Number(sum),
-              Number(
-                this.data[index].purchaseAmount
-                  ? this.data[index].purchaseAmount
-                  : 0
-              )
-            ),
-            _.add(
-              1,
-              _.divide(
-                Number(this.form.coefficient ? this.form.coefficient : 0),
-                100
-              )
-            )
-          ),
-          Number(this.form.exchangeRate ? this.form.exchangeRate : 1)
-        )
-      ).toFixed(2);
+      this.data[index].productPrice = productCal(
+        this.data[index].purchaseAmount,
+        this.form.coefficient
+      );
+      this.data[index].price = sellingCal(
+        this.data[index].productPrice,
+        this.data[index].partsPrice,
+        this.form.coefficient,
+        this.form.exchangeRate
+      );
+      this.data[index].amount = amountCal(
+        this.data[index].price,
+        this.data[index].orderQuantity,
+        this.data[index].freight,
+        this.data[index].insurance,
+        this.data[index].discount
+      );
       const names = [];
       const namePrices = [];
       rows.map(e => {
@@ -982,6 +1040,20 @@ export default {
       this.data[index].partsPriceDescribe = namePrices.join(";");
       this.priceChange(this.data[index]);
     },
+    importProperty(row, index) {
+      const arr = [];
+      for (let key in row) {
+        if (row[key]) {
+          arr.push(row[key]);
+        }
+      }
+      this.data[index].itemProp = arr.join(",");
+      this.data[index].remarksOne = row.remarksOne;
+      this.data[index].customTwo = row.customTwo;
+      this.data[index].customThree = row.customThree;
+      this.data[index].customFour = row.customFour;
+      this.data[index].customFive = row.customFive;
+    },
     partClosed() {
       this.partList = [];
     },
@@ -999,56 +1071,89 @@ export default {
         this.itemtypeList = data.map(item => ({ value: item }));
       });
     },
+    purchaseAmountChange(row) {
+      row.productPrice = productCal(row.purchaseAmount, this.form.coefficient);
+      row.price = sellingCal(
+        row.productPrice,
+        row.partsPrice,
+        this.form.coefficient,
+        this.form.exchangeRate
+      );
+      row.amount = amountCal(
+        row.price,
+        row.orderQuantity,
+        row.freight,
+        row.insurance,
+        row.discount
+      );
+    },
     priceChange(row) {
-      const sum = _.multiply(
-        _.add(
-          Number(
-            _.multiply(
-              row.price ? row.price : 0,
-              row.orderQuantity ? row.orderQuantity : 0
-            )
-          ),
-          Number(
-            _.add(
-              Number(row.insurance ? row.insurance : 0),
-              Number(row.freight ? row.freight : 0)
-            )
-          )
-        ),
-        _.divide(row.discount ? row.discount : 10, 10)
+      row.amount = amountCal(
+        row.price,
+        row.orderQuantity,
+        row.freight,
+        row.insurance,
+        row.discount
       );
-      row.amount = Number(sum ? sum : 0).toFixed(2);
-      // let amountSum = 0;
-      // let purchaseAmountSum = 0;
-      // let grossProfitRate = 0;
-      // let grossProfit = 0;
-      // this.data.forEach(e => {
-      //   amountSum = _.add(amountSum, Number(e.amount));
-      //   purchaseAmountSum = _.add(
-      //     purchaseAmountSum,
-      //     Number(
-      //       _.multiply(
-      //         Number(e.purchaseAmount ? e.purchaseAmount : 0),
-      //         Number(e.orderQuantity)
-      //       )
-      //     )
-      //   );
-      //   grossProfit = _.subtract(amountSum, purchaseAmountSum);
-      //   grossProfitRate =
-      //     amountSum != 0
-      //       ? _.multiply(
-      //           _.divide(_.subtract(amountSum, purchaseAmountSum), amountSum),
-      //           100
-      //         )
-      //       : 0;
-      //   this.form.grossProfit = Number(grossProfit ? grossProfit : 0).toFixed(
-      //     2
-      //   );
-
-      //   this.form.grossProfitRate = Number(
-      //     grossProfitRate ? grossProfitRate : 0
-      //   ).toFixed(2);
-      // });
+    },
+    currencyChange(row) {
+      if (row == "CNY") {
+        this.form.exchangeRate = 1;
+      } else if (row == "USD") {
+        this.form.exchangeRate = 6.3843;
+      } else {
+        this.form.exchangeRate = 1;
+      }
+      if (this.data.length > 0) {
+        this.data.forEach(e => {
+          e.freight = transformCal(
+            e.freight,
+            this.oldExchange,
+            this.form.exchangeRate
+          );
+          e.insurance = transformCal(
+            e.insurance,
+            this.oldExchange,
+            this.form.exchangeRate
+          );
+          e.price = sellingCal(
+            e.productPrice,
+            e.partsPrice,
+            this.form.coefficient,
+            this.form.exchangeRate
+          );
+          e.amount = amountCal(
+            e.price,
+            e.orderQuantity,
+            e.freight,
+            e.insurance,
+            e.discount
+          );
+        });
+      }
+      this.oldExchange = this.deepClone(this.form.exchangeRate);
+    },
+    exchangeRateChange(row) {
+      if (this.data.length > 0) {
+        this.data.forEach(e => {
+          e.freight = transformCal(e.freight, this.oldExchange, row);
+          e.insurance = transformCal(e.insurance, this.oldExchange, row);
+          e.price = sellingCal(
+            e.productPrice,
+            e.partsPrice,
+            this.form.coefficient,
+            row
+          );
+          e.amount = amountCal(
+            e.price,
+            e.orderQuantity,
+            e.freight,
+            e.insurance,
+            e.discount
+          );
+        });
+      }
+      this.oldExchange = this.deepClone(row);
     },
     discountChange(row) {
       if (row.discount >= 10) {
@@ -1141,6 +1246,11 @@ export default {
                 item.priceCategory = e.goodsTypeName;
                 item.itemUrl = e.url;
                 item.itemProp = this.reData.itemProp;
+                item.remarksOne = this.reData.remarksOne;
+                item.customTwo = this.reData.customTwo;
+                item.customThree = this.reData.customThree;
+                item.customFour = this.reData.customFour;
+                item.customFive = this.reData.customFive;
                 item.partsList = this.reData.partsList;
                 item.partsPrice = this.reData.ppartsPrice;
                 item.itemDescription = e.cnameDescription;
@@ -1169,6 +1279,11 @@ export default {
             priceCategory: e.goodsTypeName,
             itemUrl: e.url,
             itemProp: null,
+            remarksOne: null,
+            customTwo: null,
+            customThree: null,
+            customFour: null,
+            customFive: null,
             itemDescription: e.cnameDescription,
             partsList: [],
             partsPrice: 0,
@@ -1229,7 +1344,12 @@ export default {
           cname: e.cname,
           priceCategory: e.goodsTypeName,
           purchaseAmount: e.purchaseAmount,
-          itemProp: e.goodNature,
+          itemProp: null,
+          remarksOne: null,
+          customTwo: null,
+          customThree: null,
+          customFour: null,
+          customFive: null,
           corpId: e.corpId,
           corpName: e.corpName,
           itemDescription: e.cnameDescription,
@@ -1237,28 +1357,23 @@ export default {
           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),
+          productPrice: productCal(e.purchaseAmount, this.form.coefficient),
+          price: sellingCal(
+            productCal(e.purchaseAmount, this.form.coefficient),
+            0,
+            this.form.coefficient,
+            this.form.exchangeRate
+          ),
           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),
+          amount: sellingCal(
+            productCal(e.purchaseAmount, this.form.coefficient),
+            0,
+            this.form.coefficient,
+            this.form.exchangeRate
+          ),
           taxRate: 0,
           unit: e.unit,
           remarks: null,
@@ -1285,6 +1400,7 @@ export default {
           this.oldform = res.data.data;
           this.olddata = this.deepClone(res.data.data.orderItemsList);
           this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
+          this.oldExchange = this.deepClone(this.form.exchangeRate);
         })
         .finally(() => {
           this.loading = false;
@@ -1333,6 +1449,7 @@ export default {
                 this.oldorderFeesList = this.deepClone(
                   res.data.data.orderFeesList
                 );
+                this.oldExchange = this.deepClone(this.form.exchangeRate);
                 if (status == "goBack") {
                   this.$emit("goBack");
                 }
@@ -1372,6 +1489,9 @@ export default {
     openReport() {
       this.switchDialog = !this.switchDialog;
     },
+    openProperty(row, index) {
+      this.$refs.property.init(row, index);
+    },
     onClose(val) {
       this.switchDialog = val;
     },

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

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

+ 13 - 0
src/views/exportTrade/salesContract/detailsPage.vue

@@ -57,6 +57,13 @@
               :disabled="detailData.status == 1"
             ></crop-select>
           </template>
+          <template slot="belongToCorpId">
+            <crop-select
+              v-model="form.belongToCorpId"
+              corpType="GS"
+              :disabled="detailData.status == 1"
+            ></crop-select>
+          </template>
           <template slot="priceTerms">
             <el-select
               size="small"
@@ -548,6 +555,12 @@ export default {
             disabled: true
           },
           {
+            label: "公司主体",
+            prop: "belongToCorpId",
+            span: 16,
+            row: true
+          },
+          {
             label: "联系人",
             prop: "corpAttn",
             span: 8