QuKatie hace 3 años
padre
commit
716ec14fbc

+ 11 - 0
src/api/exportTrade/part.js

@@ -0,0 +1,11 @@
+import request from '@/router/axios';
+//明细表删除
+export function delItem(data) {
+  return request({
+    url: "/api/blade-purchase-sales/orderparts/remove",
+    method: 'post',
+    params: {
+      ids: data
+    }
+  })
+}

+ 35 - 6
src/components/part-dialog/main.vue

@@ -4,6 +4,7 @@
       title="配件信息"
       :visible.sync="partVisible"
       width="60%"
+      top="5vh"
       append-to-body
       @closed="closed"
       class="el-dialogDeep"
@@ -68,7 +69,7 @@
           <template slot="price" slot-scope="{ row }">
             <span>{{ row.price | micrometerFormat }}</span>
           </template>
-          <template slot="corpId" slot-scope="{ row}">
+          <template slot="corpId" slot-scope="{ row }">
             <span>{{ row.corpName }}</span>
           </template>
         </avue-crud>
@@ -86,6 +87,7 @@
 import option from "./configuration/mainList.json";
 import { micrometerFormat } from "@/util/validate";
 import priceLibrary from "@/components/price-Library/main";
+import { delItem } from "@/api/exportTrade/part";
 import _ from "lodash";
 export default {
   data() {
@@ -116,7 +118,9 @@ export default {
       return micrometerFormat(val);
     }
   },
-  created() {},
+  created() {
+    this.tableOption.height = window.innerHeight - 350;
+  },
   methods: {
     cellStyle() {
       return "padding:0;height:40px;";
@@ -140,11 +144,36 @@ export default {
       ).toFixed(2);
     },
     rowDel(row, index) {
-      this.$message({
-        type: "success",
-        message: "删除成功!"
+      this.$confirm("确定删除数据?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        if (row.id) {
+          delItem(row.id)
+            .then(res => {
+              this.$message({
+                type: "success",
+                message: "删除成功!"
+              });
+              this.data.splice(index, 1);
+            })
+            .finally(() => {
+              this.$emit(
+                "importPart",
+                this.data,
+                this.amoutSum,
+                this.goodsIndex
+              );
+            });
+        } else {
+          this.$message({
+            type: "success",
+            message: "删除成功!"
+          });
+          this.data.splice(index, 1);
+        }
       });
-      this.data.splice(index, 1);
     },
     rowEdit(row, index) {
       if (row.$cellEdit == true) {

+ 0 - 5
src/components/price-Library/main.vue

@@ -124,11 +124,6 @@ export default {
     },
     //点击搜索按钮触发
     searchChange(params, done) {
-      if (params.dateValidity) {
-        params.dateValidityStart = params.dateValidity[0];
-        params.dateValidityEnd = params.dateValidity[1];
-      }
-      delete params.dateValidity;
       this.getList(this.page, params);
       done();
     },

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

@@ -120,10 +120,4 @@ export default {
 </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>

+ 5 - 0
src/util/validate.js

@@ -1,3 +1,8 @@
+//数字取整
+export function IntegerFormat(num){
+  num=Number(num?num:0)
+  return parseInt(num)
+}
 /**
  * 单数据转千分符
  *

+ 31 - 91
src/views/exportTrade/customerInquiry/config/commodity.json

@@ -1,136 +1,76 @@
 
 {
-  "calcHeight": 80,
-  "tip": false,
-  "addBtn": false,
-  "searchShow": false,
-  "searchShowBtn": false,
-  "menu": false,
-  "searchMenuSpan": 6,
   "border": true,
+  "searchMenuSpan": 16,
   "index": true,
+  "viewBtn": false,
+  "editBtn": false,
+  "delBtn": false,
+  "addBtn": false,
+  "menu": false,
+  "align": "center",
+  "menuWidth": "180",
   "selection": true,
-  "viewBtn": true,
-  "dialogClickModal": false,
+  "tip": false,
   "column": [
     {
-      "label": "商品编码",
-      "prop": "code",
-      "search": true,
+      "label": "商品类别",
+      "prop": "goodsTypeName",
+      "index": 1,
       "width": 100,
-      "rules": [
-        {
-          "required": true,
-          "message": " ",
-          "trigger": "blur"
-        }
-      ]
+      "overHidden": true
     },
     {
       "label": "商品名称",
+      "search": true,
+      "searchSpan": 8,
       "prop": "cname",
-      "slot": true,
+      "index": 2,
       "width": 100,
-      "rules": [
-        {
-          "required": true,
-          "message": " ",
-          "trigger": "blur"
-        }
-      ]
-    },
-    {
-      "label": "商品类别",
-      "prop": "goodsTypeId",
-      "dicData": [],
-      "type": "tree",
-      "hide": true,
-      "addDisabled": false,
-      "multiple": true,
-      "width": 100,
-      "props": {
-        "label": "title"
-      },
-      "rules": [{
-        "required": true,
-        "message": " ",
-        "trigger": "click"
-      }]
-    },
-    {
-      "label": "规格编码",
-      "prop": "typeno",
-      "search": true,
-      "width": 100
-    },
-    {
-      "label": "品牌",
-      "prop": "brand",
-      "slot": true,
-      "width": 100
-    },
-    {
-      "label": "花纹",
-      "prop": "brandItem",
-      "slot": true,
-      "width": 100
+      "overHidden": true
     },
     {
       "label": "规格尺寸",
       "prop": "specs",
-      "slot": true,
-      "width": 100
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "产品类别",
       "prop": "category",
-      "slot": true,
-      "width": 100
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "产品分类",
       "prop": "categoryitem",
-      "slot": true,
-      "width": 100
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "供应商",
       "prop": "providers",
-      "slot": true,
-      "width": 100
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "计量单位",
       "prop": "unit",
-      "slot": true,
-      "width": 100
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "包装单位",
       "prop": "packgeunit",
       "slot": true,
-      "width": 100
-    },
-    {
-      "label": "商品图片",
-      "prop": "url",
-      "type": "upload",
-      "listType": "picture-img",
-      "dataType": "string",
-      "action": "/api/blade-resource/oss/endpoint/put-file",
-      "propsHttp": {
-        "res": "data",
-        "url": "link"
-      },
-      "hide": true,
-      "span": 24,
-      "width": 100
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "备注",
       "prop": "remarks",
-      "slot": true,
-      "width": 100
+      "width": 100,
+      "overHidden": true
     }
   ]
 }

+ 13 - 29
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -452,6 +452,7 @@
               :table-loading="loading"
               :data="goodsList"
               ref="goodsCrud"
+              @search-change="searchChange"
               @refresh-change="refreshChange"
               @selection-change="selectionChange"
               @row-click="rowClick"
@@ -527,7 +528,7 @@ export default {
   data() {
     return {
       oldExchange: 1,
-      treeStyle: "height:" + (window.innerHeight - 360) + "px",
+      treeStyle: "height:" + (window.innerHeight - 315) + "px",
       itemtypeList: [],
       configuration: {
         multipleChoices: false,
@@ -570,12 +571,6 @@ export default {
             disabled: true
           },
           {
-            label: "公司主体",
-            prop: "belongToCorpId",
-            span: 16,
-            row: true
-          },
-          {
             label: "联系人",
             prop: "corpAttn",
             span: 8
@@ -597,6 +592,12 @@ export default {
             }
           },
           {
+            label: "公司主体",
+            prop: "belongToCorpId",
+            span: 16,
+            row: true
+          },
+          {
             label: "起运港",
             prop: "portOfLoad",
             span: 8,
@@ -695,20 +696,6 @@ 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;
-            //   }
-            // },
             rules: [
               {
                 required: true,
@@ -721,7 +708,6 @@ export default {
             label: "汇率",
             prop: "exchangeRate",
             span: 8,
-            slot: true,
             row: true
           },
           {
@@ -1168,12 +1154,6 @@ export default {
         this.$message.error("请正确输入税率");
       }
     },
-    grossProfitRateChange(row) {
-      if (row >= 100) {
-        this.form.grossProfitRate = 0;
-        this.$message.error("毛利率不能超过100%");
-      }
-    },
     saveShipping() {
       if (!this.form.id) {
         return this.$message.error("此单据没有提交记录,请先提交");
@@ -1320,10 +1300,14 @@ export default {
       this.page.currentPage = 1;
       this.onLoad(this.page);
     },
+    searchChange(params, done) {
+      this.onLoad(this.page, params);
+      done();
+    },
     //费用查询
     onLoad(page, params = {}) {
       this.loading = true;
-      getGoods(page.currentPage, page.pageSize, this.treeDeptId)
+      getGoods(page.currentPage, page.pageSize, this.treeDeptId, params)
         .then(res => {
           const data = res.data.data;
           this.page.total = data.total;

+ 1 - 8
src/views/exportTrade/purchaseInquiry/config/customerContact.json

@@ -85,7 +85,7 @@
       "label": "供应商",
       "prop": "corpId",
       "index": 10,
-      "width": 100,
+      "width": 200,
       "overHidden": true
     },
     {
@@ -138,13 +138,6 @@
       "overHidden": true
     },
     {
-      "label": "美元价格",
-      "prop": "greenback",
-      "index": 19,
-      "width": 100,
-      "overHidden": true
-    },
-    {
       "label": "重点推荐",
       "prop": "priorityReferrer",
       "index": 11,

+ 38 - 63
src/views/exportTrade/purchaseInquiry/detailsPage.vue

@@ -116,24 +116,6 @@
             ></el-input>
             <span v-else>{{ row.coefficient ? row.coefficient : 0 }}%</span>
           </template>
-          <template slot="currency" slot-scope="{ row }">
-            <el-select
-              v-if="row.$cellEdit"
-              v-model="row.currency"
-              placeholder="请选择"
-              size="small"
-              @change="currencyChange(row)"
-            >
-              <el-option
-                v-for="(item, index) in currencyList"
-                :key="index"
-                :label="item.dictValue"
-                :value="item.dictValue"
-              >
-              </el-option>
-            </el-select>
-            <span v-else>{{ row.currency }}</span>
-          </template>
           <template slot="orderQuantity" slot-scope="{ row }">
             <el-input
               v-if="row.$cellEdit"
@@ -315,7 +297,9 @@ export default {
       },
       switchDialog: false,
       form: {
-        orderStatus: "录入"
+        orderStatus: "录入",
+        currency: "CNY",
+        exchangeRate: "1"
       },
       disabled: false,
       dialogVisible: false,
@@ -328,8 +312,7 @@ export default {
           {
             label: "客户名称",
             prop: "corpId",
-            span: 16,
-            slot: true
+            span: 16
           },
           {
             label: "系统号",
@@ -345,7 +328,8 @@ export default {
             props: {
               label: "dictValue",
               value: "dictValue"
-            }
+            },
+            disabled: true
           },
           {
             label: "询价日期",
@@ -353,7 +337,14 @@ export default {
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd 00:00:00"
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "有效日期",
@@ -361,7 +352,14 @@ export default {
             span: 8,
             type: "date",
             format: "yyyy-MM-dd",
-            valueFormat: "yyyy-MM-dd 00:00:00"
+            valueFormat: "yyyy-MM-dd 00:00:00",
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "订单号",
@@ -385,7 +383,8 @@ export default {
               if (value == "USD") {
                 this.form.exchangeRate = 6.3843;
               }
-            }
+            },
+            disabled: true
           },
           {
             label: "汇率",
@@ -457,7 +456,9 @@ export default {
       itemtypeList: [],
       reData: null,
       oldform: {
-        orderStatus: "录入"
+        orderStatus: "录入",
+        currency: "CNY",
+        exchangeRate: "1"
       },
       olddata: [],
       subLoading: false,
@@ -650,9 +651,9 @@ export default {
                 item.purchaseAmount = this.reData.purchaseAmount;
                 item.exchangeRate = this.reData.exchangeRate;
                 item.currency = this.reData.currency;
-                item.greenback = this.reData.greenback;
                 item.taxRate = this.reData.taxRate;
                 item.corpId = this.reData.corpId;
+                item.priorityReferrer = this.reData.priorityReferrer;
                 item.$cellEdit = true;
               }
             });
@@ -668,6 +669,7 @@ export default {
             itemUrl: e.url,
             itemProp: null,
             corpId: null,
+            priorityReferrer: 0,
             itemDescription: e.cnameDescription,
             itemType: null,
             tradeTerms: null,
@@ -679,9 +681,8 @@ export default {
             amount: 0,
             coefficient: 0,
             purchaseAmount: 0,
-            exchangeRate: null,
-            currency: null,
-            greenback: null,
+            exchangeRate: 1,
+            currency: "CNY",
             taxRate: 0,
             unit: e.unit,
             remarks: null,
@@ -696,14 +697,6 @@ export default {
       this.treeDeptId = "";
       this.reData = null;
     },
-    currencyChange(row) {
-      if (row.currency == "CNY") {
-        row.exchangeRate = 1;
-      }
-      if (row.currency == "USD") {
-        row.exchangeRate = 6.3843;
-      }
-    },
     selectionChange(list) {
       this.selectionList = list;
     },
@@ -758,17 +751,17 @@ export default {
         if (valid) {
           if (this.data) {
             for (let i = 0; i < this.data.length; i++) {
-              if (!this.data[i].price) {
+              if (!this.data[i].price || this.data[i].price == "0") {
                 return this.$message.error(
-                  "第" + (Number(i) + 1) + "行的单价不能为空"
+                  "第" + (Number(i) + 1) + "行的单价不能为空或不能为0"
                 );
               }
-              if (!this.data[i].taxRate) {
+              if (this.data[i].taxRate=="") {
                 return this.$message.error(
                   "第" + (Number(i) + 1) + "行的税率不能为空"
                 );
               }
-              if (!this.data[i].coefficient) {
+              if (this.data[i].coefficient=="") {
                 return this.$message.error(
                   "第" + (Number(i) + 1) + "行的FOB系数不能为空"
                 );
@@ -778,27 +771,6 @@ export default {
                   "第" + (Number(i) + 1) + "行的供应商不能为空"
                 );
               }
-              if (!this.data[i].purchaseAmount) {
-                return this.$message.error(
-                  "第" + (Number(i) + 1) + "行的采购价不能为空"
-                );
-              }
-              if (!this.data[i].currency) {
-                return this.$message.error(
-                  "第" + (Number(i) + 1) + "行的币别不能为空"
-                );
-              }
-
-              if (!this.data[i].exchangeRate) {
-                return this.$message.error(
-                  "第" + (Number(i) + 1) + "行的汇率不能为空"
-                );
-              }
-              if (!this.data[i].greenback) {
-                return this.$message.error(
-                  "第" + (Number(i) + 1) + "行的美元价格不能为空"
-                );
-              }
             }
           }
 
@@ -829,6 +801,9 @@ export default {
               });
           }
           if (status == "submit") {
+            if (this.data.length == 0) {
+              return this.$message.error("明细表不能为空");
+            }
             submitMessage({
               ...this.form,
               orderItemsList: this.data

+ 32 - 79
src/views/exportTrade/salesContract/config/commodity.json

@@ -1,123 +1,76 @@
 
 {
-  "tip": false,
-  "addBtn": false,
-  "searchShow": false,
-  "searchShowBtn": false,
-  "menu": false,
-  "searchMenuSpan": 6,
   "border": true,
+  "searchMenuSpan": 16,
   "index": true,
+  "viewBtn": false,
+  "editBtn": false,
+  "delBtn": false,
+  "addBtn": false,
+  "menu": false,
+  "align": "center",
+  "menuWidth": "180",
   "selection": true,
-  "viewBtn": true,
-  "dialogClickModal": false,
+  "tip": false,
   "column": [
     {
-      "label": "商品编码",
-      "prop": "code",
-      "search": true,
+      "label": "商品类别",
+      "prop": "goodsTypeName",
+      "index": 1,
       "width": 100,
-      "rules": [
-        {
-          "required": true,
-          "message": " ",
-          "trigger": "blur"
-        }
-      ]
+      "overHidden": true
     },
     {
       "label": "商品名称",
+      "search": true,
+      "searchSpan": 8,
       "prop": "cname",
-      "slot": true,
+      "index": 2,
       "width": 100,
-      "rules": [
-        {
-          "required": true,
-          "message": " ",
-          "trigger": "blur"
-        }
-      ]
-    },
-    {
-      "label": "商品类别",
-      "prop": "goodsTypeId",
-      "dicData": [],
-      "type": "tree",
-      "hide": true,
-      "addDisabled": false,
-      "multiple": true,
-      "props": {
-        "label": "title"
-      },
-      "rules": [{
-        "required": true,
-        "message": " ",
-        "trigger": "click"
-      }]
-    },
-    {
-      "label": "规格编码",
-      "prop": "typeno",
-      "search": true
-    },
-    {
-      "label": "品牌",
-      "prop": "brand",
-      "slot": true
-    },
-    {
-      "label": "花纹",
-      "prop": "brandItem",
-      "slot": true
+      "overHidden": true
     },
     {
       "label": "规格尺寸",
       "prop": "specs",
-      "slot": true
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "产品类别",
       "prop": "category",
-      "slot": true
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "产品分类",
       "prop": "categoryitem",
-      "slot": true
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "供应商",
       "prop": "providers",
-      "slot": true
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "计量单位",
       "prop": "unit",
-      "slot": true
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "包装单位",
       "prop": "packgeunit",
-      "slot": true
-    },
-    {
-      "label": "商品图片",
-      "prop": "url",
-      "type": "upload",
-      "listType": "picture-img",
-      "dataType": "string",
-      "action": "/api/blade-resource/oss/endpoint/put-file",
-      "propsHttp": {
-        "res": "data",
-        "url": "link"
-      },
-      "hide": true,
-      "span": 24
+      "slot": true,
+      "width": 100,
+      "overHidden": true
     },
     {
       "label": "备注",
       "prop": "remarks",
-      "slot": true
+      "width": 100,
+      "overHidden": true
     }
   ]
 }

+ 4 - 11
src/views/exportTrade/salesContract/config/customerContact.json

@@ -12,7 +12,7 @@
   "refreshBtn": false,
   "showSummary": true,
   "selection": true,
-  "tip":false,
+  "tip": false,
   "column": [{
       "label": "产品类别",
       "prop": "priceCategory",
@@ -38,15 +38,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": "产品描述",
@@ -134,7 +127,7 @@
       "overHidden": true,
       "cell": true,
       "type": "select",
-      "dicData":[],
+      "dicData": [],
       "props": {
         "label": "dictValue",
         "value": "dictValue"

+ 296 - 171
src/views/exportTrade/salesContract/detailsPage.vue

@@ -98,6 +98,33 @@
               </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"
@@ -227,6 +254,22 @@
               </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="priorityReferrer" slot-scope="{ row }">
               <el-checkbox
                 :disabled="!row.$cellEdit"
@@ -251,7 +294,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>
@@ -438,8 +481,12 @@
           <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>
@@ -480,13 +527,12 @@
     ></report-dialog>
     <part-dialog
       ref="part"
-      @partOpen="partOpen()"
       :partList="partList"
       @importPart="importPart"
       @partClosed="partClosed"
-      @partReData="partReData"
     />
     <price-library ref="library" @importLibray="importLibray" />
+    <property-dialog ref="property" @importProperty="importProperty" />
   </div>
 </template>
 
@@ -513,10 +559,19 @@ import { micrometerFormat } from "@/util/validate";
 import { contrastObj, contrastList } from "@/util/contrastData";
 import customerDialog from "@/components/customer-dialog/main";
 import priceLibrary from "@/components/price-Library/main";
+import propertyDialog from "@/components/property-dialog/main";
+import { dateFormat } from "@/util/date";
+import {
+  productCal,
+  sellingCal,
+  amountCal,
+  transformCal
+} from "@/util/calculate";
 export default {
   name: "detailsPageEdit",
   data() {
     return {
+      treeStyle: "height:" + (window.innerHeight - 315) + "px",
       configuration: {
         multipleChoices: false,
         multiple: false,
@@ -526,7 +581,10 @@ export default {
       },
       switchDialog: false,
       form: {
-        orderStatus: "录入"
+        orderStatus: "录入",
+        businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
+        currency: "CNY",
+        exchangeRate: "1"
       },
       disabled: false,
       dialogVisible: false,
@@ -555,12 +613,6 @@ export default {
             disabled: true
           },
           {
-            label: "公司主体",
-            prop: "belongToCorpId",
-            span: 16,
-            row: true
-          },
-          {
             label: "联系人",
             prop: "corpAttn",
             span: 8
@@ -582,6 +634,12 @@ export default {
             }
           },
           {
+            label: "公司主体",
+            prop: "belongToCorpId",
+            span: 16,
+            row: true
+          },
+          {
             label: "起运港",
             prop: "portOfLoad",
             span: 8,
@@ -681,28 +739,19 @@ 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;
+            rules: [
+              {
+                required: true,
+                message: "",
+                trigger: "blur"
               }
-            }
+            ]
           },
           {
             label: "汇率",
             prop: "exchangeRate",
             span: 8,
-            slot: true,
-            row: true,
-            disabled: true
+            row: true
           },
           {
             label: "箱型",
@@ -863,7 +912,10 @@ export default {
       itemtypeList: [],
       reData: null,
       oldform: {
-        orderStatus: "录入"
+        orderStatus: "录入",
+        businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
+        currency: "CNY",
+        exchangeRate: "1"
       },
       olddata: [],
       oldorderFeesList: [],
@@ -871,12 +923,12 @@ export default {
       subLoading: false,
       pageLoading: false,
       showBut: true,
-      partreData: null,
       partType: false,
       partList: [],
       goodsoptions: [],
       priceTermsList: [],
-      paymentTermList: []
+      paymentTermList: [],
+      currencyList: []
     };
   },
   props: {
@@ -890,7 +942,8 @@ export default {
     uploadFile,
     customerDialog,
     partDialog,
-    priceLibrary
+    priceLibrary,
+    propertyDialog
   },
   async created() {
     if (this.detailData.id) {
@@ -928,6 +981,9 @@ export default {
     this.getWorkDicts("payment_term").then(res => {
       this.paymentTermList = res.data.data;
     });
+    this.getWorkDicts("currency").then(res => {
+      this.currencyList = res.data.data;
+    });
     getGoods(1, 500).then(res => {
       this.goodsoptions = res.data.data.records;
     });
@@ -955,6 +1011,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
+          );
+        });
+      }
     },
     cnameChange(row) {
       this.goodsoptions.forEach(e => {
@@ -968,19 +1042,14 @@ export default {
         }
       });
     },
-    partReData(row) {
-      this.partreData = row;
-      this.partOpen();
-    },
-    partOpen() {
-      this.partType = true;
-      this.addLibrary();
-    },
     addLibrary() {
       if (!this.form.corpId) {
         return this.$message.error("请选择客户名称");
       }
-      this.$refs.library.init(this.partType, this.partreData != null);
+      if (!this.form.currency) {
+        return this.$message.error("请选择币别");
+      }
+      this.$refs.library.init(false);
     },
     partrePick(row, index) {
       this.partList = row.partsList;
@@ -989,22 +1058,50 @@ export default {
     importPart(rows, sum, index) {
       this.data[index].partsList = rows;
       this.data[index].partsPrice = sum;
+      // 销售价=(配件采购价格+产品价格)/汇率 *(1+客户FOB系数/100)
+      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 => {
         names.push(e.goodName);
-        namePrices.push(e.goodName + ":" + e.price);
+        namePrices.push(e.goodName + ":" + e.amout);
       });
       this.data[index].partsDescribe = names.join(",");
       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 = [];
-      this.partreData = null;
-      if (this.partType) {
-        this.partType = false;
-      }
     },
     saveSell() {
       if (!this.form.id) {
@@ -1043,54 +1140,30 @@ 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(
-          _.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)
-              )
-            )
-          ),
-          Number(row.partsPrice ? row.partsPrice : 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;
-      // this.data.forEach(e => {
-      //   amountSum = _.add(amountSum, Number(e.amount));
-      //   purchaseAmountSum = _.add(
-      //     purchaseAmountSum,
-      //     Number(
-      //       _.multiply(
-      //         Number(e.purchaseAmount ? e.purchaseAmount : 0),
-      //         Number(e.orderQuantity)
-      //       )
-      //     )
-      //   );
-      //   this.form.grossProfit = _.subtract(amountSum, purchaseAmountSum);
-      //   grossProfitRate =
-      //     amountSum != 0
-      //       ? _.multiply(
-      //           _.divide(_.subtract(amountSum, purchaseAmountSum), amountSum),
-      //           100
-      //         )
-      //       : 0;
-      //   this.form.grossProfitRate = Number(
-      //     grossProfitRate ? grossProfitRate : 0
-      //   ).toFixed(2);
-      // });
     },
     quantityChange(row) {
       if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
@@ -1100,23 +1173,88 @@ export default {
       if (!row.orderQuantity) {
         row.orderQuantity = 0;
       } else {
-        row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
+        row.amount = amountCal(
+          row.price,
+          row.orderQuantity,
+          row.freight,
+          row.insurance,
+          row.discount
+        );
       }
     },
+    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) {
+        row.discount = null;
+        this.$message.error("请正确输入折扣");
+      }
+      this.priceChange(row);
+    },
     taxRateChange(row) {
       if (Number(row.taxRate) >= 100) {
         row.taxRate = 0;
         this.$message.error("税率不能超过100%");
       }
     },
-    grossProfitRateChange(row) {
-      if (row >= 100) {
-        this.form.grossProfitRate = 0;
-        this.$message.error("毛利率不能超过100%");
-      }
-    },
     rowSave(row) {
-      console.log(row);
       this.$set(row, "$cellEdit", false);
     },
     rowDel(row, index) {
@@ -1154,10 +1292,15 @@ export default {
                 item.code = e.code;
                 item.cname = e.cname;
                 item.priceCategory = e.goodsTypeName;
-                item.partsList = this.reData.partsList;
-                item.partsPrice = this.reData.partsPrice;
                 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;
                 item.itemType = this.reData.itemType;
                 item.tradeTerms = this.reData.tradeTerms;
@@ -1184,6 +1327,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,
@@ -1239,76 +1387,50 @@ export default {
         }
       });
     },
-    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)
-                );
-                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: 0,
-              amout: 0,
-              $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,
-            price: Number(
-              _.multiply(
-                Number(e.purchaseAmount),
-                Number(_.add(1, _.divide(Number(this.form.coefficient), 100)))
-              )
-            ).toFixed(2),
-            orderQuantity: 0,
-            insurance: 0,
-            freight: 0,
-            discount: null,
-            amount: 0,
-            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: null,
+          remarksOne: null,
+          customTwo: null,
+          customThree: null,
+          customFour: null,
+          customFive: null,
+          corpId: e.corpId,
+          corpName: e.corpName,
+          itemDescription: e.cnameDescription,
+          partsList: [],
+          partsPrice: 0,
+          itemType: e.specs,
+          tradeTerms: null,
+          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: sellingCal(
+            productCal(e.purchaseAmount, this.form.coefficient),
+            0,
+            this.form.coefficient,
+            this.form.exchangeRate
+          ),
+          taxRate: 0,
+          unit: e.unit,
+          remarks: null,
+          $cellEdit: true
         });
-      }
+      });
     },
     //商品明细导入
     newDetails() {
@@ -1422,6 +1544,9 @@ export default {
     openReport() {
       this.switchDialog = !this.switchDialog;
     },
+    openProperty(row, index) {
+      this.$refs.property.init(row, index);
+    },
     onClose(val) {
       this.switchDialog = val;
     },