Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into dev

qinbai 4 лет назад
Родитель
Сommit
dc34ee245c
30 измененных файлов с 907 добавлено и 652 удалено
  1. 11 0
      src/api/exportTrade/part.js
  2. 5 1
      src/components/crop-select/main.vue
  3. 35 6
      src/components/part-dialog/main.vue
  4. 0 5
      src/components/price-Library/main.vue
  5. 54 15
      src/components/procurement/config/market.json
  6. 11 9
      src/components/procurement/market.vue
  7. 0 6
      src/components/property-dialog/main.vue
  8. 2 2
      src/page/index/tags.vue
  9. 5 5
      src/router/views/index.js
  10. 2 2
      src/store/modules/ifdetail.js
  11. 5 0
      src/util/validate.js
  12. 4 0
      src/views/basicData/customerInformation/detailsPageEdit.vue
  13. 28 10
      src/views/basicData/productInformation/detailsPageEdit.vue
  14. 117 96
      src/views/basicData/productInformation/index.vue
  15. 15 0
      src/views/businessManagement/deliveryNotice/configuration/customerContact.json
  16. 48 0
      src/views/businessManagement/deliveryNotice/detailsPageEdit.vue
  17. 31 10
      src/views/businessManagement/purchaseOrder/detailsPageEdit.vue
  18. 9 11
      src/views/businessManagement/salesOrder/detailsPageEdit.vue
  19. 1 0
      src/views/businessManagement/salesOrder/index.vue
  20. 31 91
      src/views/exportTrade/customerInquiry/config/commodity.json
  21. 13 29
      src/views/exportTrade/customerInquiry/detailsPage.vue
  22. 1 8
      src/views/exportTrade/purchaseInquiry/config/customerContact.json
  23. 38 63
      src/views/exportTrade/purchaseInquiry/detailsPage.vue
  24. 32 79
      src/views/exportTrade/salesContract/config/commodity.json
  25. 4 11
      src/views/exportTrade/salesContract/config/customerContact.json
  26. 296 171
      src/views/exportTrade/salesContract/detailsPage.vue
  27. 14 0
      src/views/maintenance/salesPolicy/configuration/BuyFree.json
  28. 1 1
      src/views/maintenance/salesPolicy/configuration/commodity.json
  29. 14 0
      src/views/maintenance/salesPolicy/configuration/customerContact.json
  30. 80 21
      src/views/maintenance/salesPolicy/detailsPageEdit.vue

+ 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
+    }
+  })
+}

+ 5 - 1
src/components/crop-select/main.vue

@@ -10,6 +10,8 @@
         filterable
         clearable
         style="width:100%"
+        :multiple="multiple? multiple : false"
+        :collapse-tags="collapseTags?collapseTags: false"
         @change="corpChange"
       >
         <el-option
@@ -132,7 +134,9 @@ export default {
     value: String,
     disabled: Boolean,
     cropIndex: Number,
-    corpType: String
+    corpType: String,
+    multiple: Boolean,
+    collapseTags: Boolean,
   },
   model: {
     prop: "value",

+ 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();
     },

+ 54 - 15
src/components/procurement/config/market.json

@@ -9,7 +9,9 @@
   "cellBtn":false,
   "cancelBtn":false,
   "refreshBtn": false,
-  "searchMenuSpan": 6,
+  "searchIcon": true,
+  "searchIndex": 2,
+  "searchSpan": 8,
   "align": "center",
   "delBtn":true,
   "dialogWidth": "60%",
@@ -26,74 +28,97 @@
       "prop": "orgOrderNo",
       "search": true,
       "index": 1,
-      "width":180
+      "width":180,
+      "overHidden": true
     },
     {
       "label": "提单号",
       "prop": "billNo",
       "index": 2,
-      "width":180
+      "width":180,
+      "overHidden": true
+    },
+    {
+      "label": "客户",
+      "prop": "corp",
+      "search": true,
+      "index": 3,
+      "width":180,
+      "overHidden": true
     },
     {
       "label": "客户",
       "prop": "corpName",
       "search": true,
       "index": 3,
-      "width":180
+      "width":180,
+      "overHidden": true
     },
     {
       "label": "商品名称",
       "prop": "cname",
+      "search": true,
       "index": 4,
-      "width":120
+      "width":120,
+      "overHidden": true
     },
     {
       "label": "编码",
       "prop": "code",
+      "search": true,
       "index": 5,
-      "width":120
+      "width":120,
+      "overHidden": true
     },
     {
       "label": "规格型号",
       "prop": "typeno",
       "index": 6,
-      "width":120
+      "width":120,
+      "overHidden": true
     },
     {
       "label": "货物品种",
       "prop": "priceCategoryNames",
       "index": 7,
-      "width":120
+      "width":120,
+      "overHidden": true
     },{
       "label": "规格名称",
       "prop": "itemType",
       "index": 8,
-      "width":120
+      "width":120,
+      "overHidden": true
     },{
       "label": "件数",
       "prop": "orderQuantity",
       "index": 9,
-      "width":120
+      "width":120,
+      "overHidden": true
     },{
       "label": "发票净重(吨)",
       "prop": "invoiceWeight",
       "index": 10,
-      "width":120
+      "width":120,
+      "overHidden": true
     },{
       "label": "码单重量(吨)",
       "prop": "billWeight",
       "index": 11,
-      "width":120
+      "width":120,
+      "overHidden": true
     },{
       "label": "单价",
       "prop": "price",
       "index": 12,
-      "width":120
+      "width":120,
+      "overHidden": true
     },{
       "label": "合同金额",
       "prop": "amount",
       "index": 13,
-      "width":120
+      "width":120,
+      "overHidden": true
     },{
       "label": "订单日期",
       "prop": "marketDate",
@@ -105,7 +130,21 @@
       "searchRange": true,
       "search": true,
       "index": 14,
-      "width":150
+      "width":150,
+      "overHidden": true
+    },{
+      "label": "订单日期",
+      "prop": "businesDate",
+      "hide": false,
+      "type": "date",
+      "format": "yyyy-MM-dd",
+      "valueFormat": "yyyy-MM-dd",
+      "unlinkPanels": true,
+      "searchRange": true,
+      "search": true,
+      "index": 14,
+      "width":150,
+      "overHidden": true
     }
   ]
 }

+ 11 - 9
src/components/procurement/market.vue

@@ -10,6 +10,7 @@
                @saveColumn="saveColumn"
                :page.sync="page"
                @on-load="onLoad">
+      <template slot-scope="scope"></template>
     </avue-crud>
     <div class="botoom">
        <span slot="footer" class="dialog-footer">
@@ -60,24 +61,25 @@
       this.option = await this.getColumnData(this.getColumnName(42), option);
       if (this.systemType == 'GN') {
         this.option.column.forEach(item => {
+          if (item.prop == 'corpName') item.label = '供应商'
           if (item.prop == 'billNo' || item.prop == 'invoiceWeight' || item.prop == 'billWeight' || item.prop == 'orgOrderNo'
-            || item.prop == 'priceCategoryNames' || item.prop == 'itemType'
+            || item.prop == 'priceCategoryNames' || item.prop == 'itemType' || item.prop == 'marketDate'
           ) {
             item.hide = true;
             item.showColumn = false;
-          }
-          // 隐藏查询
-          if (item.prop == 'orgOrderNo') {
-            item.search = false
+            // 隐藏查询
+            item.search = false;
           }
         })
       }
       if(this.systemType == 'JK'){
         this.option.column.forEach(item => {
-          if ( item.prop == 'itemType' || item.prop == 'typeno' || item.prop == 'code'  || item.prop == 'corpName'
+          if ( item.prop == 'itemType' || item.prop == 'typeno' || item.prop == 'code'  || item.prop == 'corpName' || item.prop == 'corp'
+            || item.prop == 'businesDate'
           ) {
             item.hide = true;
             item.showColumn = false;
+            item.search = false;
           }
         })
       }
@@ -86,9 +88,9 @@
       this.option.column.forEach(item => {
         if (item.search) i++
       })
-      if (i % 4 !== 0){
-        const num = 4 - Number(i % 4)
-        this.option.searchMenuSpan = num * 6;
+      if (i % 3 !== 0){
+        const num = 3 - Number(i % 3)
+        this.option.searchMenuSpan = num * 8;
         this.option.searchMenuPosition = "right";
       }
     },

+ 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>

+ 2 - 2
src/page/index/tags.vue

@@ -282,10 +282,10 @@ export default {
         if (tag.label == "收货(E)") {
           this.$store.commit("REC_OUT_DETAIL");
         }
-        if (tag.label == "发货单(N)") {
+        if (tag.label == "客户确认(N)") {
           this.$store.commit("IN_OUT_DETAIL");
         }
-        if (tag.label == "收货单(N)") {
+        if (tag.label == "采购确认(N)") {
           this.$store.commit("DOM_OUT_DETAIL");
         }
         if (tag.label == "发货单(I)") {

+ 5 - 5
src/router/views/index.js

@@ -153,12 +153,12 @@ export default [{
     hidden: true,
     children: [
       {
-        path: '/productInfo_detailsPageEdit',
-        name:'产品详情',
+        path: '/basicData/productInformation/index',
+        name:'产品信息',
         meta: {
-          i18n: 'productInfo_detailsPageEdit'
+          i18n: 'basicData/productInformation/index'
         },
-        component: () => import( /* webpackChunkName: "views" */ '@/views/basicData/productInformation/detailsPageEdit')
+        component: () => import( /* webpackChunkName: "views" */ '@/views/basicData/productInformation/index')
       }
     ]
   },
@@ -266,7 +266,7 @@ export default [{
         children: [
             {
                 path: '/businessManagement/receipt/index',
-                name: '收货单(N)',
+                name: '采购确认(N)',
                 meta: {
                     keepAlive: true,
                 },

+ 2 - 2
src/store/modules/ifdetail.js

@@ -111,10 +111,10 @@ const ifdetail = {
       for (let item in state) {
         state[item] = false
       }
-      if (tag.label == '发货单(N)') {
+      if (tag.label == '客户确认(N)') {
         state.inStatus = true;
       }
-      if (tag.label == '收货单(N)') {
+      if (tag.label == '采购确认(N)') {
         state.domTakeStatus = true;
       }
       if (tag.label == '发货单(I)') {

+ 5 - 0
src/util/validate.js

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

+ 4 - 0
src/views/basicData/customerInformation/detailsPageEdit.vue

@@ -445,6 +445,10 @@ export default {
           {
             label: "付款方式",
             prop: "paymentType"
+          },
+          {
+            label: "包装要求",
+            prop: "packageRemarks"
           }
         ]
       },

+ 28 - 10
src/views/basicData/productInformation/detailsPageEdit.vue

@@ -73,6 +73,9 @@ import {
 } from "@/api/basicData/commodityType";
 
 export default {
+  props:{
+    detailData:Object
+  },
   name: "detailsPage",
   data() {
     return {
@@ -286,15 +289,21 @@ export default {
     getDeptTree().then(res => {
       this.dicData = res.data.data;
     });
-    if (this.$route.query.id) {
-      getDetail(JSON.parse(this.$route.query.id)).then(res => {
-        this.form = res.data.data;
-      });
+    if (this.detailData.id) {
+      this.queryData(this.detailData.id)
     } else {
       this.$set(this.form, "goodsTypeId", this.$route.query.treeDeptId);
     }
   },
   methods: {
+    queryData(id) {
+      this.openFullScreen(false, '正在努力的加载...');
+      getDetail(id).then(res => {
+        this.form = res.data.data;
+      }).finally(() => {
+        this.openFullScreen(true);
+      });
+    },
     addSftRow() {
       this.sftData.push({
         $cellEdit: true,
@@ -325,10 +334,13 @@ export default {
             ...this.form,
             type: 0
           };
+          this.openFullScreen(false, '正在努力的加载...');
           updateDetail(params).then(res => {
             if (res.data.success) {
               this.$message.success("操作成功!");
             }
+            this.form = res.data.data
+            this.queryData(res.data.data.id)
           });
         } else {
           return false;
@@ -337,12 +349,18 @@ export default {
     },
     //返回列表
     backToList() {
-      this.$router.$avueRouter.closeTag();
-      this.$router.push({
-        path: "/basicData/productInformation/index",
-        query: {}
+      this.$emit("goBack");
+    },
+    //遮罩层
+    openFullScreen(res, text) {
+      const loading = this.$loading({
+        lock: true,
+        text: text,
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
       });
-    }
+      if (res === true) loading.close();
+    },
   }
 };
 </script>
@@ -355,7 +373,7 @@ export default {
 }
 
 ::v-deep .el-form-item {
-  margin-bottom: 0;
+  margin-bottom: 8px;
 }
 
 .el-dialogDeep {

+ 117 - 96
src/views/basicData/productInformation/index.vue

@@ -1,96 +1,105 @@
 <template>
-  <el-row>
-    <el-col :span="5">
-      <basic-container>
-        <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
-      </basic-container>
-    </el-col>
-    <el-col :span="19">
-      <basic-container>
-        <avue-crud :option="option"
-                   :search.sync="search"
-                   :table-loading="loading"
-                   :data="data"
-                   ref="crud"
-                   v-model="form"
-                   @row-del="rowDel"
-                   @row-update="rowUpdate"
-                   @row-save="rowSave"
-                   :before-open="beforeOpenE"
-                   :page.sync="page"
-                   @search-change="searchChange"
-                   @search-reset="searchReset"
-                   @selection-change="selectionChange"
-                   @current-change="currentChange"
-                   @size-change="sizeChange"
-                   @refresh-change="refreshChange"
-                   @on-load="onLoad">
-          <template slot="menuLeft">
-            <el-button
-              type="primary"
-              size="small"
-              icon="el-icon-bottom"
-              @click="excelBox = true"
-            >导入
-            </el-button>
-            <el-button
-              type="warning"
-              size="small"
-              :disabled="selectionList.length==0"
-              icon="el-icon-delete"
-              @click="batchDelete"
-            >批量删除
-            </el-button>
-          </template>
-          <template slot-scope="scope" slot="corpId">
-            <span>{{ scope.row.corpName }}</span>
-          </template>
-          <template slot-scope="scope" slot="menu">
-<!--            <el-button-->
-<!--                type="text"-->
-<!--                icon="el-icon-view"-->
-<!--                size="small"-->
-<!--                @click.stop="beforeOpenPage(scope.row, scope.index)"-->
-<!--            >查看-->
-<!--            </el-button>-->
-            <el-button
+  <div>
+    <el-row v-if="isShow">
+      <el-col :span="5">
+        <basic-container>
+          <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
+        </basic-container>
+      </el-col>
+      <el-col :span="19">
+        <basic-container>
+          <avue-crud :option="option"
+                     :search.sync="search"
+                     :table-loading="loading"
+                     :data="data"
+                     ref="crud"
+                     v-model="form"
+                     @row-del="rowDel"
+                     @row-update="rowUpdate"
+                     @row-save="rowSave"
+                     :before-open="beforeOpenE"
+                     :page.sync="page"
+                     @search-change="searchChange"
+                     @search-reset="searchReset"
+                     @selection-change="selectionChange"
+                     @current-change="currentChange"
+                     @size-change="sizeChange"
+                     @refresh-change="refreshChange"
+                     @on-load="onLoad">
+            <template slot="menuLeft">
+              <el-button
+                type="primary"
+                size="small"
+                icon="el-icon-bottom"
+                @click="excelBox = true"
+              >导入
+              </el-button>
+              <el-button
+                type="warning"
+                size="small"
+                :disabled="selectionList.length==0"
+                icon="el-icon-delete"
+                @click="batchDelete"
+              >批量删除
+              </el-button>
+            </template>
+            <template slot-scope="scope" slot="corpId">
+              <span>{{ scope.row.corpName }}</span>
+            </template>
+            <template slot-scope="scope" slot="menu">
+              <!--            <el-button-->
+              <!--                type="text"-->
+              <!--                icon="el-icon-view"-->
+              <!--                size="small"-->
+              <!--                @click.stop="beforeOpenPage(scope.row, scope.index)"-->
+              <!--            >查看-->
+              <!--            </el-button>-->
+              <el-button
                 type="text"
                 icon="el-icon-edit"
                 size="small"
                 @click.stop="editOpen(scope.row, scope.index)"
-            >编辑
-            </el-button>
-            <el-button
+              >编辑
+              </el-button>
+              <el-button
                 type="text"
                 icon="el-icon-delete"
                 size="small"
                 @click.stop="rowDel(scope.row, scope.index)"
-            >删除
-            </el-button>
-<!--            <el-button-->
-<!--                type="text"-->
-<!--                icon="el-icon-delete"-->
-<!--                size="small"-->
-<!--            >下架-->
-<!--            </el-button>-->
-          </template>
-        </avue-crud>
-        <el-dialog title="导入产品"
-                   append-to-body
-                   :visible.sync="excelBox"
-                   width="555px">
-          <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
-            <template slot="excelTemplate">
-              <el-button type="primary" @click="derivation">
-                点击下载<i class="el-icon-download el-icon--right"></i>
+              >删除
               </el-button>
+              <!--            <el-button-->
+              <!--                type="text"-->
+              <!--                icon="el-icon-delete"-->
+              <!--                size="small"-->
+              <!--            >下架-->
+              <!--            </el-button>-->
             </template>
-          </avue-form>
-          <p style="text-align: center;color: #DC0505">温馨提示  第一次导入时请先下载模板</p>
-        </el-dialog>
-      </basic-container>
-    </el-col>
-  </el-row>
+          </avue-crud>
+          <el-dialog title="导入产品"
+                     append-to-body
+                     :visible.sync="excelBox"
+                     width="555px">
+            <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+              <template slot="excelTemplate">
+                <el-button type="primary" @click="derivation">
+                  点击下载<i class="el-icon-download el-icon--right"></i>
+                </el-button>
+              </template>
+            </avue-form>
+            <p style="text-align: center;color: #DC0505">温馨提示  第一次导入时请先下载模板</p>
+          </el-dialog>
+        </basic-container>
+      </el-col>
+    </el-row>
+
+    <detail-page
+      ref="detail"
+      @goBack="goBack"
+      :detailData="detailData"
+      v-else
+    ></detail-page>
+  </div>
 </template>
 <script>
 import {getList, getUser, getUserPlatform, remove, updatePlatform, add, grant, getDeptLazyTree, getDeptTree} from "@/api/basicData/commodityType";
@@ -99,7 +108,12 @@ import {mapGetters} from "vuex";
 import website from '@/config/website';
 import {getToken} from '@/util/auth';
 import option from "./configuration/mainList.json";
+import detailPage from "./detailsPageEdit";
+
 export default {
+  components: {
+    detailPage
+  },
   data() {
     return {
       form: {},
@@ -189,7 +203,9 @@ export default {
             action: "/api/blade-client/goodsdesc/import-desc-info",
           },
         ]
-      }
+      },
+      isShow: true,
+      detailData: {},
     };
   },
   methods: {
@@ -275,24 +291,25 @@ export default {
     },
     //查看跳转页面
     beforeOpenPage(row, index) {
-      this.$router.push({
-        path: "/productInfo_detailsPageEdit",
-        query: { id: JSON.stringify(row.id) }
-      });
+      this.detailData = {
+        id: row.id,
+        seeDisabled: true,
+      };
+      this.isShow = false;
     },
     //新增跳转页面
     beforeOpenE(row, index) {
-      this.$router.push({
-        path: "/productInfo_detailsPageEdit",
-        query: { id: JSON.stringify(row.id),treeDeptId:this.treeDeptId }
-      });
+      this.detailData = {
+        id: row.id,
+      };
+      this.isShow = false;
     },
     //编辑跳转页面
     editOpen(row, index) {
-      this.$router.push({
-        path: "/productInfo_detailsPageEdit",
-        query: { id: JSON.stringify(row.id) }
-      });
+      this.detailData = {
+        id: row.id,
+      };
+      this.isShow = false;
     },
     //删除触发
     rowDel(row, index, done) {
@@ -454,7 +471,11 @@ export default {
         this.platformLoading = false;
         this.selectionClear();
       });
-    }
+    },
+    goBack() {
+      this.detailData=this.$options.data().detailData
+      this.isShow = true;
+    },
   }
 };
 </script>

+ 15 - 0
src/views/businessManagement/deliveryNotice/configuration/customerContact.json

@@ -107,6 +107,21 @@
         }
       ]
     },{
+      "label": "供应商",
+      "prop": "corpId",
+      "index": 4,
+      "width":250,
+      "cell": false,
+      "slot": true,
+      "overHidden": true,
+      "rules": [
+        {
+          "required": false,
+          "message": "请输入供应商",
+          "trigger": "blur"
+        }
+      ]
+    },{
       "label": "包装要求",
       "prop": "packageRemarks",
       "index": 5,

+ 48 - 0
src/views/businessManagement/deliveryNotice/detailsPageEdit.vue

@@ -164,6 +164,13 @@
               >录入明细
               </el-button>
               <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
+              <el-button
+                type="warning"
+                icon="el-icon-refresh"
+                size="small"
+                :disabled="detailData.seeDisabled"
+                @click="resetStock"
+              >库存刷新</el-button>
             </template>
             <template slot="actualQuantity" slot-scope="{ row }">
               <el-input
@@ -174,6 +181,17 @@
               ></el-input>
               <span v-else>{{ row.actualQuantity }}</span>
             </template>
+            <template slot="corpId" slot-scope="{ row, index }">
+              <crop-select
+                v-if="row.$cellEdit"
+                v-model="row.corpId"
+                :cropIndex="index"
+                corpType="GYS"
+                @getCorpData="getcorpId"
+                :disabled="detailData.seeDisabled"
+              ></crop-select>
+              <span v-else>{{ row.corpName }}</span>
+            </template>
           </avue-crud>
         </basic-container>
         <containerTitle title="费用明细"></containerTitle>
@@ -695,6 +713,16 @@ export default {
               }
             ]
           }, {
+            label: '包装要求',
+            prop: 'packageRemarks',
+            rules: [
+              {
+                required: false,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          }, {
             label: "备注",
             span: 24,
             type: 'textarea',
@@ -747,6 +775,7 @@ export default {
       this.warehouseTypeOption = res.data.data
     })
     this.$set(this.form,'deliveryStatus','录入')
+    this.$set(this.oldForm,'deliveryStatus','录入')
     wareHouseType().then(res => {
       this.warehouseType = res.data.data.records
       this.warehouseType.forEach(item => {
@@ -928,6 +957,9 @@ export default {
         this.saveLoading = false
       });
     },
+    getcorpId(row) {
+      this.contactsData[row.index].corpId = row.id;
+    },
     // 出库数量变化时调用
     actualQuantityChange(row) {
       if (row.scale) {
@@ -1296,6 +1328,9 @@ export default {
           if (typeof this.form.corpsTypeId == 'object') {
             this.form.corpsTypeId = this.form.corpsTypeId.join(",")
           }
+          this.contactsData.forEach(item => {
+            this.$set(item, 'contractAmount', item.deliveryAmount)
+          })
           this.saveLoading = true
           this.form.billType = 'FH'
           typeSave(this.form).then(res => {
@@ -1478,6 +1513,19 @@ export default {
       }
       return '';
     },
+    // 库存刷新
+    resetStock() {
+      this.contactsData.forEach(item => {
+        selectGoodsNum({
+          goodsId: item.itemId,
+          itemType: item.itemType
+        }).then(res => {
+          item.inventoryNumber = res.data.data
+        }).finally(() => {
+          this.$message.success('刷新成功')
+        })
+      })
+    },
   }
 }
 </script>

+ 31 - 10
src/views/businessManagement/purchaseOrder/detailsPageEdit.vue

@@ -82,8 +82,18 @@
                   corpType="GYS"
                   :disabled="detailData.seeDisabled"
                 ></crop-select>
-<!--                <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" typeData="GYS"-->
-<!--                                 :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"/>-->
+                <el-select v-else-if="item.prop === 'banks'"
+                           v-model="form[item.prop]" placeholder="请选择"
+                           clearable
+                           filterable
+                           allow-create
+                           default-first-option
+                           size="small"
+                           style="width: 100%;"
+                           @change="banksChange"
+                           :disabled="detailData.seeDisabled">
+                  <el-option v-for="(item,index) in bankList" :key="index" :label="item.accountNo" :value="item.accountNo"></el-option>
+                </el-select>
                 <el-input
                   v-else-if="item.type == 'number'"
                   placeholder="请输入"
@@ -93,7 +103,7 @@
                   v-model.trim="form[item.prop]"
                 />
                 <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled"></el-input>
-                <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled"></el-input>
+                <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled" placeholder="请输入"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -447,6 +457,7 @@ import { contrastObj, contrastList } from "@/util/contrastData";
 //账单组件
 import ApplyPayment from "../../../components/finance/applyPayment";
 import  billApplication from "@/components/bill/billApplication";
+import { getlistBankBy } from "@/api/basicData/configuration"
 
 export default {
   name: "detailsPage",
@@ -704,6 +715,8 @@ export default {
       rowHeight: '',
       // 查询时loading页面
       pageLoading: false,
+      // 银行账号下拉
+      bankList: [],
     }
   },
   mounted() {
@@ -729,10 +742,6 @@ export default {
     } else if(this.detailData.copyId) {
       this.queryData(this.detailData.copyId, true)
     } else {
-      // let prefix = 'GN-CG'
-      // getSysNo(prefix).then(res => {
-      //   this.$set(this.form, 'sysNo', res.data.data)
-      // })
     }
   },
   watch: {
@@ -818,9 +827,6 @@ export default {
         if (isCopy) {
           delete this.form.sysNo;
           delete this.form.id
-          getSysNo('GN').then(res => {
-            this.$set(this.form, 'sysNo', res.data.data)
-          })
           this.contactsData.forEach(item => {
             delete item.id
             delete item.pid
@@ -1416,6 +1422,21 @@ export default {
         }
       }
     },
+    // 银行账号变化
+    banksChange(val) {
+      let isTrue = false
+      this.bankList.forEach(item => {
+        if (val == item.accountNo) {
+          this.$set(this.form, 'banksAccountName', item.accountName)
+          this.$set(this.form, 'accountBank', item.accountBank)
+          isTrue = true
+        }
+      })
+      if (!isTrue) {
+        this.$set(this.form, 'banksAccountName', null)
+        this.$set(this.form, 'accountBank', null)
+      }
+    },
   }
 }
 </script>

+ 9 - 11
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -206,12 +206,6 @@
                 @getCorpData="getcorpId"
                 :disabled="detailData.seeDisabled"
               ></crop-select>
-<!--              <customer-dialog-->
-<!--                v-if="row.$cellEdit"-->
-<!--                v-model="row.corpName"-->
-<!--                :cropIndex="index"-->
-<!--                @getcorpId="getcorpId"-->
-<!--              ></customer-dialog>-->
               <span v-else>{{ row.corpName }}</span>
             </template>
             <template slot="code" slot-scope="{row,index}">
@@ -303,7 +297,7 @@
                          icon="el-icon-plus"
                          size="small"
                          @click="policy"
-                         :disabled="detailData.seeDisabled">政策
+                         :disabled="detailData.seeDisabled || !form.corpId">政策
               </el-button>
               <el-button type="warning"
                          icon="el-icon-plus"
@@ -668,7 +662,9 @@ export default {
     return {
       saveLoading: false,
       disabled: false,
-      form: {},
+      form: {
+        corpId: null,
+      },
       billType:"收费",  //账单类型
       billData:{},     //账单需要数据
       applySettlementDialog:false,//生成账单组件
@@ -741,10 +737,10 @@ export default {
       policyOption: {
         nodeKey: 'id',
         lazy: true,
-        treeLoad: function (node, resolve) {
+        treeLoad: (node, resolve)=> {
           const parentId = (node.level === 0) ? 0 : node.data.id;
           const newTime = new Date().toLocaleString('chinese',{hour12:false})
-          policyColumn({newTime: newTime,parentId: parentId}).then(res => {
+          policyColumn({newTime: newTime,parentId: parentId,corps: this.form.corpId}).then(res => {
             resolve(res.data.data.map(item => {
               return {
                 ...item,
@@ -1407,9 +1403,11 @@ export default {
           this.$set(this.form, 'orderStatus', '录入')
           delete this.form.id
           delete this.form.orgOrderNo
+          delete this.form.orderNo
           delete this.form.morderNo
           delete this.form.createUserName
           delete this.form.createTime
+          delete this.form.businesDate
           this.contactsData.forEach(item => {
             delete item.id
             delete item.pid
@@ -1722,7 +1720,7 @@ export default {
     },
     getCorpRow(data) {
       this.$set(this.form, 'paymentType', data.paymentType)
-      this.$set(this.form, 'packageRemarks', data.remarks)
+      this.$set(this.form, 'packageRemarks', data.packageRemarks)
       this.$set(this.form, 'arrivalAddress', data.storageAddr)
     },
     getPlantRow(data) {

+ 1 - 0
src/views/businessManagement/salesOrder/index.vue

@@ -417,6 +417,7 @@ export default {
     gobackSearch(params) {
       let data = {};
       data = Object.assign({}, params)
+      console.log(data.businesDate)
       if (data.businesDate && data.businessDate != '') {
         data.orderStartDate = data.businesDate[0]+ " " + "00:00:00"
         data.orderEndDate = data.businesDate[1]+ " " + "23:59:59"

+ 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;
     },

+ 14 - 0
src/views/maintenance/salesPolicy/configuration/BuyFree.json

@@ -85,6 +85,20 @@
         }
       ]
     },{
+      "label": "供应商",
+      "prop": "corpId",
+      "index": 3,
+      "width":100,
+      "cell": false,
+      "slot": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
       "label": "采购价(元)",
       "prop": "purchasePrice",
       "index": 4,

+ 1 - 1
src/views/maintenance/salesPolicy/configuration/commodity.json

@@ -98,7 +98,7 @@
     },
     {
       "label": "供应商",
-      "prop": "providers",
+      "prop": "corpName",
       "slot": true,
       "width": 100
     },

+ 14 - 0
src/views/maintenance/salesPolicy/configuration/customerContact.json

@@ -85,6 +85,20 @@
         }
       ]
     },{
+      "label": "供应商",
+      "prop": "corpId",
+      "index": 3,
+      "width":100,
+      "cell": false,
+      "slot": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
       "label": "采购价(元)",
       "prop": "purchasePrice",
       "index": 4,

+ 80 - 21
src/views/maintenance/salesPolicy/detailsPageEdit.vue

@@ -30,8 +30,15 @@
                     <el-option v-for="(item,index) in item.dicData" :label="item.label" :value="item.value" :key="index"></el-option>
                   </el-select>
                 </span>
-                <selectComponent v-else-if="item.prop === 'corps'" v-model="form[item.prop]"
-                                 :configuration="configuration" style="width: 100%"/>
+                <crop-select
+                  v-else-if="item.prop === 'corps'"
+                  v-model="form[item.prop]"
+                  :multiple="true"
+                  corpType="KH"
+                  style="width: 100%"
+                ></crop-select>
+<!--                <selectComponent v-else-if="item.prop === 'corps'" v-model="form[item.prop]"-->
+<!--                                 :configuration="configuration" style="width: 100%"/>-->
                 <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
                 <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled?item.disabled:false"></el-input>
               </el-form-item>
@@ -61,6 +68,17 @@
               >
               <span> {{ row.code }}</span>
             </template>
+            <template slot="corpId" slot-scope="{ row, index }">
+              <crop-select
+                v-if="row.$cellEdit"
+                v-model="row.corpId"
+                :cropIndex="index"
+                corpType="GYS"
+                @getCorpData="getcorpId"
+                :disabled="detailData.seeDisabled"
+              ></crop-select>
+              <span v-else>{{ row.corpName }}</span>
+            </template>
             <template slot="menuLeft">
               <el-button
                 type="primary"
@@ -108,6 +126,17 @@
               >
               <span> {{ row.code }}</span>
             </template>
+            <template slot="corpId" slot-scope="{ row, index }">
+              <crop-select
+                v-if="row.$cellEdit"
+                v-model="row.corpId"
+                :cropIndex="index"
+                corpType="GYS"
+                @getCorpData="getcorpFeesId"
+                :disabled="detailData.seeDisabled"
+              ></crop-select>
+              <span v-else>{{ row.corpName }}</span>
+            </template>
             <template slot="menuLeft">
               <el-button
                 type="primary"
@@ -204,6 +233,7 @@ import {
   saveSell
 } from "@/api/basicData/customerInquiry";
 import goodsOption from "./configuration/commodity.json";
+import { contrastObj, contrastList } from "@/util/contrastData";
 
 export default {
   name: "detailsPage",
@@ -363,22 +393,15 @@ export default {
       // 1特价 2买赠
       salesType: 1,
       reData: null,
+      oldForm: {},
+      oldSpecialOffer: [],
+      oldBuyFree: [],
     }
   },
   //初始化查询
   created() {
     if (this.detailData.id) {
-      detail(this.detailData.id).then(res =>{
-        this.form = res.data.data
-        if (this.form.corpNameList) {
-          this.configuration.dicData = this.form.corpNameList
-        }
-        this.form.corps = this.form.corps.split(',')
-        if (res.data.data.specialItemList) this.contactsData = res.data.data.specialItemList
-        if (res.data.data.presentItemList) this.contactsDataBuyFree = res.data.data.presentItemList
-        delete this.form.specialItemList
-        delete this.form.presentItemList
-      })
+      this.queryData(this.detailData.id)
     } else {
       this.form = {}
       this.contactsData = []
@@ -395,6 +418,25 @@ export default {
     }
   },
   methods: {
+    queryData(id) {
+      this.openFullScreen(false, '正在努力的加载...');
+      detail(id).then(res =>{
+        this.form = res.data.data
+        if (this.form.corpNameList) {
+          this.configuration.dicData = this.form.corpNameList
+        }
+        this.form.corps = this.form.corps.split(',')
+        if (res.data.data.specialItemList) this.contactsData = res.data.data.specialItemList
+        if (res.data.data.presentItemList) this.contactsDataBuyFree = res.data.data.presentItemList
+        this.oldForm = Object.assign({}, this.form)
+        this.oldSpecialOffer = this.deepClone(this.contactsData)
+        this.oldBuyFree = this.deepClone(this.contactsDataBuyFree)
+        delete this.form.specialItemList
+        delete this.form.presentItemList
+      }).finally(() => {
+        this.openFullScreen(true);
+      })
+    },
     rePick(row, index,type) {
       this.reData = {
         ...row,
@@ -502,6 +544,7 @@ export default {
       } else {
         if (this.salesType == 1) {
           this.selectionList.forEach(item => {
+            console.log(item)
             this.contactsData.push({
               itemId: item.id,
               code: item.code,
@@ -509,6 +552,8 @@ export default {
               productCategory: item.goodsTypeName,
               typeno: item.typeno,
               brandItem: item.brandItem,
+              corpId:item.corpId,
+              corpName:item.corpName,
               purchasePrice: '',
               salesPrice: '',
               specialOffer: '',
@@ -526,6 +571,7 @@ export default {
               productCategory: item.goodsTypeName,
               typeno: item.typeno,
               brandItem: item.brandItem,
+              corpName:item.corpName,
               purchasePrice: '',
               salesPrice: '',
               purchaseAmount: '',
@@ -538,6 +584,7 @@ export default {
         }
       }
       this.dialogVisible = false;
+      console.log(this.contactsData)
     },
     //买赠列表信息保存触发
     rowSaveBuyFree(row, done, loading) {
@@ -631,18 +678,19 @@ export default {
     },
     //修改提交触发
     editCustomer() {
-      console.log(this.form)
       this.$refs["form"].validate((valid) => {
         if (valid) {
           this.form.corps = this.form.corps.join(',')
           this.form.specialItemList = this.contactsData
           this.form.presentItemList = this.contactsDataBuyFree
+          this.openFullScreen(false, '正在努力的加载...');
           typeSave(this.form).then(res=>{
             this.$message({
               type: "success",
               message: this.form.id ? "修改成功!" : "新增成功!"
             });
-            this.backToList()
+            // this.backToList()
+            this.queryData(res.data.data.id)
           })
         } else {
           return false;
@@ -652,11 +700,6 @@ export default {
     //返回列表
     backToList() {
       this.$emit("goBack");
-      // this.$router.$avueRouter.closeTag();
-      // this.$router.push({
-      //   path: '/maintenance/salesPolicy/index',
-      //   query: {}
-      // });
     },
     async saveGoodsColumn() {
       // const inSave = await this.saveColumnData(
@@ -668,7 +711,23 @@ export default {
       //   //关闭窗口
       //   this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
       // }
-    }
+    },
+    //遮罩层
+    openFullScreen(res, text) {
+      const loading = this.$loading({
+        lock: true,
+        text: text,
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      if (res === true) loading.close();
+    },
+    getcorpId(row) {
+      this.contactsData[row.index].corpId = row.id;
+    },
+    getcorpFeesId(row) {
+      this.contactsDataBuyFree[row.index].corpId = row.id;
+    },
   }
 }
 </script>