Forráskód Böngészése

国内贸易修改

lichao 3 éve
szülő
commit
04ad6fe9a6

+ 5 - 2
src/views/businessManagement/purchaseOrder/configuration/commodity.json

@@ -6,14 +6,17 @@
   "addBtn": false,
   "searchShow": true,
   "searchShowBtn": false,
-  "menu": false,
+  "menu": true,
+  "viewBtn": false,
+  "editBtn": false,
+  "delBtn": false,
+  "menuWidth": 80,
   "searchSpan": 8,
   "searchMenuSpan": 8,
   "searchMenuPosition": "right",
   "border": true,
   "index": true,
   "selection": true,
-  "viewBtn": true,
   "dialogClickModal": false,
   "column": [
     {

+ 91 - 9
src/views/businessManagement/purchaseOrder/detailsPageEdit.vue

@@ -129,7 +129,7 @@
           <avue-crud
               :option="customerContact"
               v-model="contactsForm"
-              :data="contactsData"
+              :data="goodsShowData"
               ref="crudContact"
               @row-save="rowSave"
               @row-click="handleRowClick"
@@ -225,6 +225,7 @@
           :orderFeesList="advantageProjectData"
           :disabled="detailData.seeDisabled"
           feeUrl="/trade-purchase/purchase-order/removeByFees"
+          optionType="GN"
         />
 <!--        <containerTitle title="费用明细"></containerTitle>-->
 <!--        <basic-container style="margin-bottom: 10px">-->
@@ -357,13 +358,39 @@
           <basic-container>
             <avue-crud :option="optionTwo"
                        :table-loading="loading"
-                       :data="data"
+                       :data="goodsListShow"
                        ref="crud"
                        @refresh-change="refreshChange"
                        @selection-change="selectionChange"
                        :page.sync="page"
                        @search-change="goodsSearch"
-                       @on-load="onLoad"></avue-crud>
+                       @on-load="onLoad">
+              <template slot="menuLeft" slot-scope="{size}">
+                <el-tabs v-model="activeName" @tab-click="tabHandle">
+                  <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
+                  <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
+                </el-tabs>
+              </template>
+              <template slot-scope="scope" slot="menu">
+                <el-button
+                  type="text"
+                  icon="el-icon-edit"
+                  size="small"
+                  @click.stop="importStagList(scope.row,scope.index)"
+                  v-if="activeName=='searchList'"
+                  :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
+                >选择
+                </el-button>
+                <el-button
+                  type="text"
+                  icon="el-icon-delete"
+                  size="small"
+                  @click.stop="removeStagList(scope.row,scope.index)"
+                  v-else
+                >移除
+                </el-button>
+              </template>
+            </avue-crud>
           </basic-container>
         </el-col>
       </el-row>
@@ -741,6 +768,18 @@ export default {
       pageLoading: false,
       // 银行账号下拉
       bankList: [],
+      activeName: 'searchList',
+      // 商品列表数据合计
+      goodsListShow: [],
+      // 商品列表暂存
+      goodsListSave: [],
+      goodsListTotal: 0,
+      goodsListSaveTotal: 0,
+      pageList: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
     }
   },
   mounted() {
@@ -984,6 +1023,7 @@ export default {
       this.dialogVisible = !this.dialogVisible
       this.tableData = []
       this.commodityData = false
+      this.goodsListSave = [];
     },
     //点击费用明细选择触发
     choice(row) {
@@ -1051,8 +1091,30 @@ export default {
     },
     //确认导入触发
     importGoods() {
-      // this.contactsData = this.contactsData.concat(this.tableData)
-      if (this.tableData.length > 0) {
+      if (this.goodsListSave.length > 0) {
+        for (let item in this.goodsListSave) {
+          selectGoodsNum({
+            goodsId: this.goodsListSave[item].id,
+            itemType: this.goodsListSave[item].typeno
+          }).then(res => {
+            this.$set(this.goodsListSave[item], 'storageQuantity', res.data.data)
+            this.goodsListSave[item].itemId = this.goodsListSave[item].id
+            this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
+            delete this.tableData[item].id
+            this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
+            this.$set(this.goodsListSave[item], 'specificationAndModel', this.goodsListSave[item].typeno)
+            this.$set(this.goodsListSave[item], 'priceType', '一般')
+            this.$set(this.goodsListSave[item], 'orderQuantity', 0)
+            this.$set(this.goodsListSave[item], 'actualQuantity', 0)
+            this.goodsListSave[item].price = 0
+            this.goodsListSave[item].amount = 0
+            this.goodsListSave[item].sort = this.maxGoodsNum + 1
+            this.maxGoodsNum++
+            this.$refs.crudContact.rowCellAdd(this.goodsListSave[item]);
+            // this.$refs.crudContact.rowCell(this.goodsListSave[item], this.goodsListSave.length - 1)
+          })
+        }
+      } else {
         for (let item in this.tableData) {
           selectGoodsNum({
             goodsId: this.tableData[item].id,
@@ -1072,15 +1134,18 @@ export default {
             this.tableData[item].sort = this.maxGoodsNum + 1
             this.maxGoodsNum++
             this.$refs.crudContact.rowCellAdd(this.tableData[item]);
-            this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
+            // this.$refs.crudContact.rowCell(this.tableData[item], this.tableData.length - 1)
           })
         }
       }
+      if (this.tableData.length > 0) {
+      }
       this.dialogVisible = false
     },
     closeGoods() {
       this.treeDataGoods = [];
       this.treeDeptId = "";
+      this.activeName = "searchList";
     },
     closeFees() {
       this.treeDeptIdCost = "";
@@ -1145,14 +1210,14 @@ export default {
               type: "success",
               message: "操作成功!"
             });
-            this.contactsData.splice(index, 1);
+            this.goodsShowData.splice(index, 1);
           })
         } else {
           this.$message({
             type: "success",
             message: "操作成功!"
           });
-          this.contactsData.splice(index, 1);
+          this.goodsShowData.splice(index, 1);
         }
       })
     },
@@ -1174,10 +1239,10 @@ export default {
     onLoad(page, params = {}) {
       this.loading = true;
       getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
-        console.log(res)
         const data = res.data.data;
         this.page.total = data.total;
         this.data = data.records;
+        this.goodsListShow = data.records;
         this.loading = false;
       });
     },
@@ -1362,6 +1427,7 @@ export default {
         exchangeRate: '1',
         taxRate: '0',
         accDate: this.form.businesDate,
+        srcType: 1,
       }
       if(bool){ //申请货款
         this.billData.srcId = -1
@@ -1478,6 +1544,22 @@ export default {
         this.$set(this.form, 'accountBank', null)
       }
     },
+    // 标签页切换
+    tabHandle(data) {
+      if (data.name == 'searchList') {
+        this.goodsListShow = this.data;
+        this.page.total = this.pageList.total
+      } else if (data.name == 'importStaging') {
+        this.goodsListShow = this.goodsListSave;
+        this.page.total = 0
+      }
+    },
+    removeStagList(row, index) {
+      this.goodsListSave.splice(index, 1)
+    },
+    importStagList(row, index) {
+      this.goodsListSave.push(row);
+    },
   }
 }
 </script>

+ 0 - 5
src/views/businessManagement/purchaseOrder/index.vue

@@ -342,11 +342,6 @@ export default {
     gobackSearch(params) {
       let data = {};
       data = Object.assign({}, params)
-      if (data.requiredArrivalDate && data.requiredArrivalDate != '') {
-        this.$set(data, 'requiredArrivalStartDate', data.requiredArrivalDate[0]+ " " + "00:00:00")
-        this.$set(data, 'requiredArrivalEndDate', data.requiredArrivalDate[1]+ " " + "23:59:59")
-        this.$delete(data,'requiredArrivalDate')
-      }
       if (data.createTime && data.createTime != '') {
         data.createStartTime = data.createTime[0]+ " " + "00:00:00"
         data.createEndTime = data.createTime[1]+ " " + "23:59:59"

+ 1 - 7
src/views/businessManagement/receipt/index.vue

@@ -363,7 +363,7 @@ export default {
     },
     goBack() {
       this.detailData=this.$options.data().detailData
-      if (this.$route.query) {
+      if (this.$route.query.form) {
         this.$router.$avueRouter.closeTag();
         this.$router.push({
           path: "/businessManagement/receipt/index"
@@ -376,12 +376,6 @@ export default {
     gobackSearch(params) {
       let data = {};
       data = Object.assign({}, params)
-      console.log(data)
-      if (data.businessDate && data.businessDate != '') {
-        this.$set(data, 'businessStartDate', data.businessDate[0]+ " " + "00:00:00")
-        this.$set(data, 'businessEndDate', data.businessDate[1]+ " " + "23:59:59")
-        this.$delete(data,'businessDate')
-      }
       if (data.createTime && data.createTime != '') {
         this.$set(data, 'createStartTime', data.createTime[0]+ " " + "00:00:00")
         this.$set(data, 'createEndTime', data.createTime[1]+ " " + "23:59:59")

+ 31 - 1
src/views/businessManagement/salesOrder/configuration/customerContact.json

@@ -185,7 +185,7 @@
       "rules": [
         {
           "required": false,
-          "message": "请输入最新单价",
+          "message": "请输入采购价格",
           "trigger": "blur"
         }
       ]
@@ -218,6 +218,36 @@
           "trigger": "blur"
         }
       ]
+    },
+    {
+      "label": "积分倍数",
+      "prop": "integralMultiples",
+      "index": 6,
+      "width":100,
+      "cell": false,
+      "overHidden": true,
+      "rules": [
+        {
+          "required": false,
+          "message": "请输入积分",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "赠送积分",
+      "prop": "integral",
+      "index": 6,
+      "width":100,
+      "cell": false,
+      "overHidden": true,
+      "rules": [
+        {
+          "required": false,
+          "message": "请输入积分",
+          "trigger": "blur"
+        }
+      ]
     }
   ]
 }

+ 263 - 135
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -44,6 +44,11 @@
               :disabled="detailData.seeDisabled"
               @click.native="applySettlement('申请')"
             >申请退款</el-dropdown-item>
+            <el-dropdown-item
+              @click.native="openApplicationDialog"
+              :disabled="!form.id"
+            >查看账单
+            </el-dropdown-item>
           </el-dropdown-menu>
         </el-dropdown>
         <el-dropdown style="margin-right: 8px;">
@@ -264,6 +269,7 @@
                 allow-create
                 filterable
                 v-input-limit="2"
+                default-first-option
               >
                 <el-option
                   v-for="(item, index) in purchasePriceOption"
@@ -282,6 +288,7 @@
                 allow-create
                 filterable
                 v-input-limit="2"
+                default-first-option
               >
                 <el-option
                   v-for="(item, index) in salesPriceOtion"
@@ -326,10 +333,10 @@
               >删 除</el-button>
             </template>
             <template slot="menuLeft" slot-scope="{size}">
-              <el-tabs v-model="goodsActives" @tab-click="handleClick">
-                <el-tab-pane label="商品" name="goods" :key="'first'" :disabled="goodsDisabled">
+              <el-tabs v-model="goodsActives" @tab-click="handleClick" :before-leave="beforeLeave">
+                <el-tab-pane label="商品" name="goods" :key="'first'" :disabled="goodsDisabled || goodsActives == 'goods'">
                 </el-tab-pane>
-                <el-tab-pane label="赠品" name="gift" :key="'second'" :disabled="goodsDisabled">
+                <el-tab-pane label="赠品" name="gift" :key="'second'" :disabled="goodsDisabled || goodsActives == 'gift'">
                 </el-tab-pane>
               </el-tabs>
               <el-button type="primary"
@@ -393,6 +400,7 @@
           :orderFeesList="advantageProjectData"
           :disabled="detailData.seeDisabled"
           feeUrl="/blade-purchase-sales/orderfees/update"
+          optionType="GN"
         />
 <!--        <containerTitle title="费用明细"></containerTitle>-->
 <!--        <basic-container style="margin-bottom: 10px">-->
@@ -686,6 +694,24 @@
       reportName="销售明细(N)"
       @onClose="onClose()"
     ></report-dialog>
+
+    <el-dialog
+      title="申请记录"
+      append-to-body
+      class="el-dialogDeep"
+      :visible.sync="applicationDialog"
+      width="60%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false"
+      v-dialog-drag
+    >
+      <bill-application
+        :billId="form.id"
+        @choceApplication="choceApplication"
+      >
+      </bill-application>
+    </el-dialog>
   </div>
 </template>
 
@@ -730,6 +756,7 @@ import { getToken } from "@/util/auth";
 import Cookies from 'js-cookie'
 import feeInfo from "@/components/fee-info/main";
 import {corpsAddrSelect}  from "@/api/basicData/customerInformation";
+import  billApplication from "@/components/bill/billApplication";
 
 export default {
   name: "detailsPage",
@@ -743,6 +770,7 @@ export default {
     ApplyPayment,
     reportDialog,
     feeInfo,
+    billApplication,
   },
   data() {
     return {
@@ -1111,10 +1139,9 @@ export default {
               }
             ]
           },{
-            label: '制单日期',
-            prop: 'createTime',
-            type: 'datetime',
-            disabled:true,
+            label: '特价占比',
+            prop: 'specialOfferOf',
+            disabled: false,
             rules: [
               {
                 required: false,
@@ -1122,10 +1149,21 @@ export default {
                 trigger: 'blur'
               }
             ]
-          }, {
-            label: '特价占比',
-            prop: 'specialOfferOf',
-            disabled: false,
+          },{
+            label: '赠送积分',
+            prop: 'presenterIntegral',
+            disabled: true,
+            rules: [
+              {
+                required: false,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          },{
+            label: '兑换积分',
+            prop: 'convertIntegral',
+            disabled: true,
             rules: [
               {
                 required: false,
@@ -1145,6 +1183,18 @@ export default {
               }
             ]
           },{
+            label: '制单日期',
+            prop: 'createTime',
+            type: 'datetime',
+            disabled:true,
+            rules: [
+              {
+                required: false,
+                message: ' ',
+                trigger: 'blur'
+              }
+            ]
+          }, {
             label: '特别提醒',
             prop: 'specialRemarks',
             type: 'textarea',
@@ -1373,6 +1423,7 @@ export default {
       goodsShowData: [],
       arrivalOptions: [],
       shippingOptions: [],
+      applicationDialog:false,
     }
   },
   mounted() {
@@ -1399,6 +1450,8 @@ export default {
     this.$set(this.form, 'overPayment', 0)
     this.$set(this.form, 'orderAmount', 0)
     this.$set(this.form, 'predictOceanFreight', 0)
+    this.$set(this.form, 'presenterIntegral' , 0)
+    this.$set(this.form, 'convertIntegral' , 0)
     let date = new Date();
     let year = date.getFullYear();
     let month = date.getMonth() + 1;
@@ -1423,8 +1476,7 @@ export default {
     if (this.detailData.copyId) {
       this.queryData(this.detailData.copyId, true)
     }
-  },
-  watch: {
+    this.oldForm = Object.assign({}, this.form)
   },
   methods: {
     getGoodsRow(event,row) {
@@ -1621,6 +1673,7 @@ export default {
       this.dialogVisible = !this.dialogVisible
       this.tableData = []
       this.commodityData = false
+      this.goodsListSave = [];
     },
     //政策价格导入
     policy() {
@@ -1752,7 +1805,10 @@ export default {
           this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
           this.$router.push({
             path: "/businessManagement/deliveryNotice/index",
-            query: {form: JSON.stringify(res.data.data)},
+            query: {
+              form: JSON.stringify(res.data.data),
+              pageType: "Generate",
+            },
           });
         })
       }
@@ -1790,6 +1846,7 @@ export default {
         exchangeRate: '1',
         taxRate: '0',
         accDate: this.form.businesDate,
+        srcType: 1,
       }
       if(bool){ //申请货款
         this.billData.srcId = -1
@@ -1941,116 +1998,133 @@ export default {
       this.dialogCost = false
     },
     //确认导入触发
-    importGoods() {
+    async importGoods() {
       if (this.goodsListSave.length > 0) {
-        for (let item in this.goodsListSave) {
-          selectGoodsNum({
-            goodsId: this.goodsListSave[item].id,
-            itemType: this.goodsListSave[item].typeno
-          }).then(res => {
-            this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
-            this.goodsListSave[item].storageQuantity =  res.data.data
-            delete this.goodsListSave[item].goodsTypeName
-            this.goodsListSave[item].itemId = this.goodsListSave[item].id
-            this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
-            this.$set(this.goodsListSave[item], 'orderQuantity', 0)
-            this.$set(this.goodsListSave[item], 'actualQuantity', 0)
+        this.goodsListSaveHandle()
+      } else {
+        if (this.tableData.length > 0) {
+          this.tableDataHandle()
+        }
+      }
+    },
+    goodsListSaveHandle() {
+      for (let item in this.goodsListSave) {
+        getMarketPrice({code: this.goodsListSave[item].code}).then(res => {
+          if (res.data.data.length > 0) {
+            this.$set(this.goodsListSave[item], 'price', res.data.data[0].salesPrice)
+          } else {
+            this.$set(this.goodsListSave[item], 'price', '0')
+          }
+        })
+        getPurchasePrice({code: this.goodsListSave[item].code}).then(res => {
+          if (res.data.data.length > 0) {
+            this.$set(this.goodsListSave[item], 'purchaseAmount', res.data.data[0].purchasePrice)
+          } else {
             this.$set(this.goodsListSave[item], 'purchaseAmount', '0')
-            this.$set(this.goodsListSave[item], 'invoiceWeight', this.goodsListSave[item].cartonWeight)
-            getMarketPrice({code: this.goodsListSave[item].code}).then(res => {
-              if (res.data.data.length > 0) {
-                this.$set(this.goodsListSave[item], 'price', res.data.data[0].salesPrice)
-              } else {
-                this.$set(this.goodsListSave[item], 'price', '0')
-              }
-            })
-            getPurchasePrice({code: this.goodsListSave[item].code}).then(res => {
-              if (res.data.data.length > 0) {
-                this.$set(this.goodsListSave[item], 'purchaseAmount', res.data.data[0].purchasePrice)
-              } else {
-                this.$set(this.goodsListSave[item], 'purchaseAmount', '0')
-              }
-            })
-            this.goodsListSave[item].amount = 0
-            if (this.goodsActives == "goods") {
-              this.$set(this.goodsListSave[item], 'goodType', 0)
-            } else {
-              this.$set(this.goodsListSave[item], 'goodType', 1)
-            }
-            this.goodsListSave[item].sort = this.maxGoodsNum + 1
-            if (this.form.packageRemarks) {
-              this.goodsListSave[item].packageRemarks = this.form.packageRemarks
-            }
-            delete this.goodsListSave[item].id
-            delete this.goodsListSave[item].pid
-            delete this.goodsListSave[item].isDeleted
-            delete this.goodsListSave[item].status
-            delete this.goodsListSave[item].tenantId
-            delete this.goodsListSave[item].updateTime
-            delete this.goodsListSave[item].updateUser
-            delete this.goodsListSave[item].updateUserName
-            this.maxGoodsNum++
+          }
+        })
+        selectGoodsNum({
+          goodsId: this.goodsListSave[item].id,
+          itemType: this.goodsListSave[item].typeno
+        }).then(res => {
+          this.$set(this.goodsListSave[item], 'storageQuantity', res.data.data)
+          // this.goodsListSave[item].storageQuantity =  res.data.data
+          this.$set(this.goodsListSave[item], 'priceCategory', this.goodsListSave[item].goodsTypeName)
+          // this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
+          delete this.goodsListSave[item].goodsTypeName
+          this.goodsListSave[item].itemId = this.goodsListSave[item].id
+          this.$set(this.goodsListSave[item], 'corpName', this.goodsListSave[item].cname)
+          this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
+          this.$set(this.goodsListSave[item], 'orderQuantity', 1)
+          this.$set(this.goodsListSave[item], 'actualQuantity', 0)
+          this.$set(this.goodsListSave[item], 'integral', '0')
+          this.$set(this.goodsListSave[item], 'invoiceWeight', this.goodsListSave[item].cartonWeight)
+          this.goodsListSave[item].amount = 0
+          if (this.goodsActives == "goods") {
+            this.$set(this.goodsListSave[item], 'goodType', 0)
+          } else {
+            this.$set(this.goodsListSave[item], 'goodType', 1)
+          }
+          this.goodsListSave[item].sort = this.maxGoodsNum + 1
+          if (this.form.packageRemarks) {
+            this.goodsListSave[item].packageRemarks = this.form.packageRemarks
+          }
+          delete this.goodsListSave[item].id
+          delete this.goodsListSave[item].pid
+          delete this.goodsListSave[item].isDeleted
+          delete this.goodsListSave[item].status
+          delete this.goodsListSave[item].tenantId
+          delete this.goodsListSave[item].updateTime
+          delete this.goodsListSave[item].updateUser
+          delete this.goodsListSave[item].updateUserName
+          this.maxGoodsNum++
+          this.quantityChange(this.goodsListSave[item])
+          this.$nextTick(() => {
             this.$refs.crudContact.rowCellAdd(this.goodsListSave[item]);
-            this.$refs.crudContact.rowCell(this.goodsListSave[item], this.contactsData.length - 1)
           })
-        }
-        this.dialogVisible = false
-      } else {
-        if (this.tableData.length > 0) {
-          for (let item in this.tableData) {
-            selectGoodsNum({
-              goodsId: this.tableData[item].id,
-              itemType: this.tableData[item].typeno
-            }).then(res => {
-              this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
-              this.tableData[item].storageQuantity =  res.data.data
-              delete this.tableData[item].goodsTypeName
-              this.tableData[item].itemId = this.tableData[item].id
-              this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno)
-              this.$set(this.tableData[item], 'orderQuantity', 0)
-              this.$set(this.tableData[item], 'actualQuantity', 0)
-              this.$set(this.tableData[item], 'purchaseAmount', '0')
-              this.$set(this.tableData[item], 'invoiceWeight', this.tableData[item].cartonWeight)
-              getMarketPrice({code: this.tableData[item].code}).then(res => {
-                if (res.data.data.length > 0) {
-                  this.$set(this.tableData[item], 'price', res.data.data[0].salesPrice)
-                } else {
-                  this.$set(this.tableData[item], 'price', '0')
-                }
-              })
-              getPurchasePrice({code: this.tableData[item].code}).then(res => {
-                if (res.data.data.length > 0) {
-                  this.$set(this.tableData[item], 'purchaseAmount', res.data.data[0].purchasePrice)
-                } else {
-                  this.$set(this.tableData[item], 'purchaseAmount', '0')
-                }
-              })
-              this.tableData[item].amount = 0
-              if (this.goodsActives == "goods") {
-                this.$set(this.tableData[item], 'goodType', 0)
-              } else {
-                this.$set(this.tableData[item], 'goodType', 1)
-              }
-              this.tableData[item].sort = this.maxGoodsNum + 1
-              if (this.form.packageRemarks) {
-                this.tableData[item].packageRemarks = this.form.packageRemarks
-              }
-              delete this.tableData[item].id
-              delete this.tableData[item].pid
-              delete this.tableData[item].isDeleted
-              delete this.tableData[item].status
-              delete this.tableData[item].tenantId
-              delete this.tableData[item].updateTime
-              delete this.tableData[item].updateUser
-              delete this.tableData[item].updateUserName
-              this.maxGoodsNum++
-              this.$refs.crudContact.rowCellAdd(this.tableData[item]);
-              this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
-            })
+          // this.$refs.crudContact.rowCell(this.goodsListSave[item], this.goodsListSave.length - 1)
+        })
+      }
+      this.dialogVisible = false
+    },
+    tableDataHandle() {
+      for (let item=0;item<this.tableData.length;item++) {
+        getMarketPrice({code: this.tableData[item].code}).then(res => {
+          if (res.data.data.length > 0) {
+            this.$set(this.tableData[item], 'price', res.data.data[0].salesPrice)
+          } else {
+            this.$set(this.tableData[item], 'price', '0')
           }
-          this.dialogVisible = false
-        }
+        })
+        getPurchasePrice({code: this.tableData[item].code}).then(res => {
+          if (res.data.data.length > 0) {
+            this.$set(this.tableData[item], 'purchaseAmount', res.data.data[0].purchasePrice)
+          } else {
+            this.$set(this.tableData[item], 'purchaseAmount', '0')
+          }
+        })
+        // debugger
+        selectGoodsNum({
+          goodsId: this.tableData[item].id,
+          itemType: this.tableData[item].typeno
+        }).then(res => {
+          this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
+          this.tableData[item].storageQuantity =  res.data.data
+          delete this.tableData[item].goodsTypeName
+          this.tableData[item].itemId = this.tableData[item].id
+          this.$set(this.tableData[item], 'corpName', this.tableData[item].cname)
+          this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno)
+          this.$set(this.tableData[item], 'orderQuantity', 1)
+          this.$set(this.tableData[item], 'actualQuantity', 0)
+          this.$set(this.tableData[item], 'integral', '0')
+          this.$set(this.tableData[item], 'invoiceWeight', this.tableData[item].cartonWeight)
+          this.tableData[item].amount = 0
+          if (this.goodsActives == "goods") {
+            this.$set(this.tableData[item], 'goodType', 0)
+          } else {
+            this.$set(this.tableData[item], 'goodType', 1)
+          }
+          this.tableData[item].sort = this.maxGoodsNum + 1
+          if (this.form.packageRemarks) {
+            this.tableData[item].packageRemarks = this.form.packageRemarks
+          }
+          delete this.tableData[item].id
+          delete this.tableData[item].pid
+          delete this.tableData[item].isDeleted
+          delete this.tableData[item].status
+          delete this.tableData[item].tenantId
+          delete this.tableData[item].updateTime
+          delete this.tableData[item].updateUser
+          delete this.tableData[item].updateUserName
+          this.maxGoodsNum++
+          this.quantityChange(this.tableData[item])
+          this.$nextTick(() => {
+            this.$refs.crudContact.rowCellAdd(this.tableData[item]);
+          })
+          // this.$refs.crudContact.rowCell(this.tableData[item], this.tableData.length - 1)
+        })
       }
+      this.dialogVisible = false
     },
     closeGoods() {
       this.treeDataGoods = [];
@@ -2246,14 +2320,14 @@ export default {
               type: "success",
               message: "操作成功!"
             });
-            this.contactsData.splice(index, 1);
+            this.goodsShowData.splice(index, 1);
           })
         } else {
           this.$message({
             type: "success",
             message: "操作成功!"
           });
-          this.contactsData.splice(index, 1);
+          this.goodsShowData.splice(index, 1);
         }
       })
     },
@@ -2292,7 +2366,6 @@ export default {
     },
     //商品列表查询
     onLoad(page, params = {}) {
-      console.log(params)
       this.loading = true;
       getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
         const data = res.data.data;
@@ -2427,8 +2500,17 @@ export default {
             this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
           }
           //商品信息
-          this.form.orderItemsList = this.contactsData.concat(this.giftData)
-          console.log(this.form.orderItemsList)
+          if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
+            this.form.orderItemsList = this.goodsShowData.concat(this.contactsData)
+          } else {
+            this.form.orderItemsList = this.goodsShowData.concat(this.giftData)
+          }
+          // 判断订货数量不能小于等于0
+          for (let item in this.form.orderItemsList) {
+            if (Number(this.form.orderItemsList[item].orderQuantity) <= 0) {
+              return this.$message.error('订货数量不能小于等于0')
+            }
+          }
           this.form.orderFeesList = this.advantageProjectData
           this.form.orderFilesList = this.bankOfDepositData
           if (typeof this.form.corpsTypeId == 'object') {
@@ -2458,7 +2540,7 @@ export default {
                 this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
                 this.$router.push({
                   path: "/businessManagement/deliveryNotice/index",
-                  query: {form: JSON.stringify(res.data.data)},
+                  query: {form: JSON.stringify(res.data.data),pageType: "Generate",},
                 });
               })
             } else if (type == '采购') {
@@ -2509,6 +2591,23 @@ export default {
         // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
         row.amount = (row.price * row.orderQuantity).toFixed(2)
       }
+      if (!row.integralMultiples) {
+        row.integralMultiples = 0
+      }
+      row.integral = (Number(row.orderQuantity) * Number(row.integralMultiples)).toFixed(2)
+
+
+      if (this.goodsActives == 'goods') {
+        this.$set(this.form, 'presenterIntegral' , 0)
+        this.goodsShowData.forEach(item => {
+          this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
+        })
+      } else {
+        this.$set(this.form, 'convertIntegral' , 0)
+        this.goodsShowData.forEach(item => {
+          this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
+        })
+      }
     },
     priceChange(row) {
       console.log(row.price)
@@ -2604,16 +2703,19 @@ export default {
           if (
             item.property == "amount" ||
             item.property == "orderQuantity" ||
-            item.property == "actualQuantity"
+            item.property == "actualQuantity" ||
+            item.property == "integral"
           ) {
             let amountSum = 0;
             let orderQuantitySum = 0;
             let actualQuantitySum = 0;
+            let integralSum = 0;
             if (this.selection.length > 0) {
               this.selection.forEach(e => {
                 amountSum = _.add(amountSum, Number(e.amount));
                 orderQuantitySum = _.add(orderQuantitySum, Number(e.orderQuantity));
                 actualQuantitySum = _.add(actualQuantitySum, Number(e.actualQuantity));
+                integralSum = _.add(integralSum, Number(e.integral));
               })
             };
             // 订货数量合计
@@ -2628,6 +2730,10 @@ export default {
             if (item.property == "amount") {
               sums[index] = amountSum ? amountSum.toFixed(2) : "0.00";
             }
+            // 积分合计
+            if (item.property == "integral") {
+              sums[index] = integralSum ? integralSum.toFixed(2) : "0.00";
+            }
           }
         })
       }
@@ -2656,39 +2762,61 @@ export default {
         this.giftData = this.goodsShowData
         // 显示
         this.customerContact.column.forEach(item => {
-          if (item.prop == 'amount') item.label = '金额'
+          if (item.prop == 'integralMultiples') item.label = '积分倍数'
+          if (item.prop == 'integral') item.label = '赠送积分'
+          if (item.prop == 'orderQuantity') item.label = '订货数量'
           if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
-            || item.prop == 'orderQuantity' || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
-            || item.prop == 'purchaseAmount' || item.prop == 'price'
+            || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
+            || item.prop == 'purchaseAmount' || item.prop == 'price' || item.prop == 'amount'
           ) {
             item.hide = false;
             item.showColumn = true;
           }
         })
-        this.goodsShowData = this.contactsData;
+        // contactsData它是商品的数组    giftData它是赠品的数组   goodsShowData它是展示页面的数组一共三个
+        this.goodsShowData = this.deepClone(this.contactsData);
         setTimeout(() => {
           this.goodsDisabled = false
         },500)
       } else {
         // 隐藏字段
-        this.contactsData = this.goodsShowData
+        this.contactsData = this.deepClone(this.goodsShowData)
+        // this.contactsData=this.goodsShowData.filter(e=>e.typegood==0)
+        console.log(this.contactsData)
         this.customerContact.column.forEach(item => {
-          if (item.prop == 'amount') item.label = '积分'
+          if (item.prop == 'deliveryAmount') item.label = '积分'
+          if (item.prop == 'actualQuantity') item.label = '数量'
+          if (item.prop == 'integralMultiples') item.label = '积分'
+          if (item.prop == 'integral') item.label = '兑换积分'
+          if (item.prop == 'orderQuantity') item.label = '数量'
           if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
-            || item.prop == 'orderQuantity' || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
-            || item.prop == 'purchaseAmount' || item.prop == 'price'
+            || item.prop == 'actualQuantity' || item.prop == 'storageQuantity'
+            || item.prop == 'purchaseAmount' || item.prop == 'price' || item.prop == 'amount'
           ) {
             item.hide = true;
             item.showColumn = false;
           }
         })
-        this.goodsShowData = this.giftData;
+        // this.giftData=this.goodsShowData.filter(e=>e.typegood==1)
+        this.goodsShowData = this.deepClone(this.giftData);
         setTimeout(() => {
           this.goodsDisabled = false
         },500)
       }
     },
-  }
+    // 切换之前
+    beforeLeave(activeName, oldActiveName) {
+    },
+    // 查看账单
+    // 查看申请记录
+    openApplicationDialog(){
+      this.applicationDialog = true
+    },
+    //关闭记录
+    choceApplication(){
+      this.applicationDialog = false
+    },
+  },
 }
 </script>