Browse Source

修改销售政策 销售订单

lichao 3 years ago
parent
commit
e5f93258a9

+ 4 - 3
src/api/basicData/customerInquiry.js

@@ -46,11 +46,12 @@ export function remove(data) {
   })
 }
 //获取商品
-export const getGoods = (current, size, goodsTypeId) => {
+export const getGoods = (current, size, goodsTypeId, params) => {
   return request({
-    url: '/api//blade-client/goodsdesc/selectGoods',
+    url: '/api/blade-client/goodsdesc/selectGoods',
     method: 'get',
     params: {
+      ...params,
       current,
       size,
       goodsTypeId,
@@ -119,4 +120,4 @@ export function gainUser(query) {
     method: 'get',
     params: query
   })
-}
+}

+ 18 - 0
src/api/basicData/fees.js

@@ -0,0 +1,18 @@
+import request from '@/router/axios';
+
+// 获取销售价格
+export function getMarketPrice(data) {
+  return request({
+    url: '/api/blade-mocha-item/client/getMarketPrice',
+    method: 'get',
+    params: data
+  })
+}
+// 获取采购价格
+export function getPurchasePrice(data) {
+  return request({
+    url: '/api/blade-mocha-item/client/getPurchasePrice',
+    method: 'get',
+    params: data
+  })
+}

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

@@ -309,6 +309,7 @@
                        @refresh-change="refreshChangeCost"
                        @selection-change="selectionChangeCost"
                        :page.sync="pageCost"
+                       @searchChange="feesSearch"
                        @on-load="onLoadCost">
             </avue-crud>
           </basic-container>
@@ -1097,6 +1098,11 @@ export default {
         this.loading = false;
       });
     },
+    // 费用查询按钮
+    feesSearch(params, done) {
+      this.onLoadCost(this.pageCost, params)
+      done()
+    },
     //费用查询
     onLoadCost(page, params = {}) {
       this.loadingCost = true;

+ 6 - 0
src/views/businessManagement/purchaseOrder/detailsPageEdit.vue

@@ -302,6 +302,7 @@
                        @refresh-change="refreshChangeCost"
                        @selection-change="selectionChangeCost"
                        :page.sync="pageCost"
+                       @searchChange="feesSearch"
                        @on-load="onLoadCost">
             </avue-crud>
           </basic-container>
@@ -952,6 +953,11 @@ export default {
         this.loading = false;
       });
     },
+    // 费用查询按钮
+    feesSearch(params, done) {
+      this.onLoadCost(this.pageCost, params)
+      done()
+    },
     //费用查询
     onLoadCost(page, params = {}) {
       this.loadingCost = true;

+ 6 - 0
src/views/businessManagement/receipt/detailsPageEdit.vue

@@ -302,6 +302,7 @@
                        @refresh-change="refreshChangeCost"
                        @selection-change="selectionChangeCost"
                        :page.sync="pageCost"
+                       @searchChange="feesSearch"
                        @on-load="onLoadCost">
             </avue-crud>
           </basic-container>
@@ -1056,6 +1057,11 @@ export default {
         this.loading = false;
       });
     },
+    // 费用查询按钮
+    feesSearch(params, done) {
+      this.onLoadCost(this.pageCost, params)
+      done()
+    },
     //费用查询
     onLoadCost(page, params = {}) {
       this.loadingCost = true;

+ 1 - 1
src/views/businessManagement/salesOrder/configuration/BuyFree.json

@@ -124,7 +124,7 @@
       ]
     },{
       "label": "操作员",
-      "prop": "updateUser",
+      "prop": "updateUserName",
       "index": 6,
       "width":100,
       "cell": true,

+ 16 - 0
src/views/businessManagement/salesOrder/configuration/customerContact.json

@@ -156,6 +156,22 @@
           "trigger": "blur"
         }
       ]
+    },
+    {
+      "label": "采购价格",
+      "prop": "purchaseAmount",
+      "index": 6,
+      "width":100,
+      "cell": false,
+      "slot": true,
+      "overHidden": true,
+      "rules": [
+        {
+          "required": false,
+          "message": "请输入最新单价",
+          "trigger": "blur"
+        }
+      ]
     },{
       "label": "最新单价",
       "prop": "price",

+ 1 - 1
src/views/businessManagement/salesOrder/configuration/optionPolicy.json

@@ -111,7 +111,7 @@
       ]
     },{
       "label": "操作员",
-      "prop": "updateUser",
+      "prop": "updateUserName",
       "index": 6,
       "width":100,
       "cell": true,

+ 77 - 20
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -42,6 +42,7 @@
                                 size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled"/>
                 <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
                                 size="small" type="date" placeholder="选择日期"
+                                value-format="yyyy-MM-dd HH:mm:ss"
                                 :disabled="detailData.seeDisabled"/>
                 <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"
                                  :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"/>
@@ -62,6 +63,7 @@
                 <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled || detailData.seeDisabled"/>
                 <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
                                 size="small" type="date" placeholder="选择日期"
+                                value-format="yyyy-MM-dd HH:mm:ss"
                                 :disabled="detailData.seeDisabled"/>
                 <selectComponent v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]" :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"/>
                 <el-input
@@ -106,6 +108,22 @@
                 :disabled="detailData.seeDisabled">选择</el-button>
               <span>{{ row.code }}</span>
             </template>
+            <template slot="purchaseAmount" slot-scope="{ row }">
+              <el-select
+                v-if="row.$cellEdit"
+                v-model="row.purchaseAmount"
+                @focus="getPurchasePrice(row)"
+                allow-create
+                filterable
+              >
+                <el-option
+                  v-for="(item, index) in purchasePriceOption"
+                  :key="index"
+                  :label="item.purchasePrice"
+                  :value="item.purchasePrice"></el-option>
+              </el-select>
+              <span v-else>{{ row.purchaseAmount }}</span>
+            </template>
             <template slot="orderQuantity" slot-scope="{ row }">
               <el-input
                 v-if="row.$cellEdit"
@@ -304,7 +322,7 @@
     </el-dialog>
 
     <el-dialog
-        title="导入"
+        title="导入政策"
         append-to-body
         class="el-dialogDeep"
         :visible.sync="policyDialog"
@@ -381,6 +399,7 @@
                        @refresh-change="refreshChangeCost"
                        @selection-change="selectionChangeCost"
                        :page.sync="pageCost"
+                       @search-change="feesSearch"
                        @on-load="onLoadCost">
             </avue-crud>
           </basic-container>
@@ -428,6 +447,7 @@ import {
 import _ from "lodash";
 import option from "./configuration/mainList.json";
 import { contrastObj, contrastList } from "@/util/contrastData";
+import { getMarketPrice, getPurchasePrice } from "@/api/basicData/fees"
 
 export default {
   name: "detailsPage",
@@ -491,7 +511,8 @@ export default {
         lazy: true,
         treeLoad: function (node, resolve) {
           const parentId = (node.level === 0) ? 0 : node.data.id;
-          policyColumn(parentId).then(res => {
+          const newTime = new Date().toLocaleString('chinese',{hour12:false})
+          policyColumn({newTime: newTime,parentId: parentId}).then(res => {
             resolve(res.data.data.map(item => {
               return {
                 ...item,
@@ -961,6 +982,8 @@ export default {
       oldGoodsList: [],
       oldFeesList: [],
       oldUploadList: [],
+      // 采购价格
+      purchasePriceOption: [],
     }
   },
   //初始化查询
@@ -1035,11 +1058,11 @@ export default {
           goodsNum.push(item.sort)
           purchaseAmount += Number(item.purchaseAmount)
         })
-        if (Number(this.form.grossProfit) != 0) {
-          this.form.grossProfitRate = (((Number(this.form.grossProfit) - Number(purchaseAmount)) / Number(this.form.grossProfit)) * 100).toFixed(2)
-        } else {
-          this.form.grossProfitRate = '0.00'
-        }
+        // if (Number(this.form.grossProfit) != 0) {
+        //   this.form.grossProfitRate = (((Number(this.form.grossProfit) - Number(purchaseAmount)) / Number(this.form.grossProfit)) * 100).toFixed(2)
+        // } else {
+        //   this.form.grossProfitRate = '0.00'
+        // }
         if (goodsNum.length == 0) {
           this.maxGoodsNum = 0;
         } else {
@@ -1079,6 +1102,12 @@ export default {
     copyOrder() {
       this.queryData(this.form.id, true)
     },
+    // 采购金额获取
+    getPurchasePrice(row) {
+      getPurchasePrice({code: '3ELX978F'}).then(res => {
+        this.purchasePriceOption = res.data.data
+      })
+    },
     // 生成采购单
     saveSell() {
       if (!this.form.id) {
@@ -1273,11 +1302,19 @@ export default {
             this.$set(this.tableData[item], 'priceType', '一般')
             this.$set(this.tableData[item], 'orderQuantity', 0)
             this.$set(this.tableData[item], 'actualQuantity', 0)
+            this.$set(this.tableData[item], 'purchaseAmount', 0)
             this.tableData[item].price = 0
             this.tableData[item].amount = 0
             this.tableData[item].sort = this.maxGoodsNum + 1
-            this.maxGoodsNum++
             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)
           })
@@ -1339,8 +1376,7 @@ export default {
     },
     //销售政策特价促销选中触发
     selectionChangePolicy(list) {
-      console.log(list)
-      this.policyData = this.policyData.concat(list)
+      this.policyData = list
       // this.policyData.forEach(item => {
       //   this.$set(item, 'price', item.specialOffer)
       // })
@@ -1352,7 +1388,7 @@ export default {
     },
     //销售政策买赠促销选中触发
     selectionChangePolicyTwo(list) {
-      this.policyDataTwo = this.policyDataTwo.concat(list)
+      this.policyDataTwo = list
       // this.policyDataTwo.forEach(item => {
       //   this.$set(item, 'price', item.salesPrice)
       // })
@@ -1367,7 +1403,7 @@ export default {
       let list = this.policyData.concat(this.policyDataTwo)
       for (let item in list) {
         selectGoodsNum({
-          goodsId: list[item].id,
+          goodsId: list[item].itemId,
           typeno: list[item].typeno
         }).then(res => {
           this.$set(list[item], 'storageQuantity', res.data.data)
@@ -1385,6 +1421,14 @@ export default {
         this.$set(list[item], 'cname', list[item].productCategory)
         this.$set(list[item], 'sort', this.maxGoodsNum + 1)
         this.$set(list[item], 'purchaseAmount', list[item].purchasePrice)
+        delete list[item].id
+        delete list[item].pid
+        delete list[item].isDeleted
+        delete list[item].status
+        delete list[item].tenantId
+        delete list[item].updateTime
+        delete list[item].updateUser
+        delete list[item].updateUserName
         this.maxGoodsNum++
         this.$refs.crudContact.rowCellAdd(list[item]);
         this.$refs.crudContact.rowCell(list[item], this.contactsData.length - 1)
@@ -1447,9 +1491,17 @@ export default {
       detailList(this.treePolicyId).then(res => {
         this.policyForm = res.data.data
         //特价促销
-        this.dataPolicy = res.data.data.specialItemList
+        if(res.data.data.specialItemList) {
+          this.dataPolicy = res.data.data.specialItemList
+        } else {
+          this.dataPolicy = []
+        }
         //买赠促销
-        this.contactsDataBuyFree = res.data.data.presentItemList
+        if (res.data.data.presentItemList) {
+          this.contactsDataBuyFree = res.data.data.presentItemList
+        } else {
+          this.contactsDataBuyFree = []
+        }
       })
     },
     //
@@ -1469,6 +1521,11 @@ export default {
         this.loading = false;
       });
     },
+    // 费用查询按钮
+    feesSearch(params, done) {
+      this.onLoadCost(this.pageCost, params)
+      done()
+    },
     //费用查询
     onLoadCost(page, params = {}) {
       this.loadingCost = true;
@@ -1563,7 +1620,7 @@ export default {
             }
           }
           // 计算毛利额
-          this.$set(this.form, 'grossProfit', 0)
+          // this.$set(this.form, 'grossProfit', 0)
           this.$set(this.form, 'orderAmount', 0)
           // 成本价
           let purchaseAmount = 0
@@ -1573,12 +1630,12 @@ export default {
               purchaseAmount += (Number(item.purchaseAmount) * Number(item.orderQuantity)).toFixed(2)
             }
             // this.form.grossProfit += Number(item.amount)
-            this.form.orderAmount += Number(item.amount).toFixed(2)
+            this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
           })
-          this.form.grossProfit = (Number(this.form.orderAmount) - Number(purchaseAmount)).toFixed(2)
-          if (this.form.orderAmount && this.form.overPayment) {
-            this.form.debitAmount = Number(this.form.orderAmount) - Number(this.form.overPayment)
-          }
+          // this.form.grossProfit = (Number(this.form.orderAmount) - Number(purchaseAmount)).toFixed(2)
+          // if (this.form.orderAmount && this.form.overPayment) {
+          //   this.form.debitAmount = Number(this.form.orderAmount) - Number(this.form.overPayment)
+          // }
           if (this.form.orderAmount && this.form.settlmentAmount) {
             this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
           }

+ 15 - 1
src/views/maintenance/salesPolicy/configuration/BuyFree.json

@@ -5,7 +5,8 @@
   "searchShow": true,
   "addBtn":false,
   "editBtn":false,
-  "addRowBtn":true,
+  "addRowBtn":false,
+  "delBtn": false,
   "cellBtn":false,
   "cancelBtn":false,
   "refreshBtn": false,
@@ -71,6 +72,19 @@
         }
       ]
     },{
+      "label": "花纹",
+      "prop": "brandItem",
+      "index": 3,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
       "label": "采购价(元)",
       "prop": "purchasePrice",
       "index": 4,

+ 139 - 0
src/views/maintenance/salesPolicy/configuration/commodity.json

@@ -0,0 +1,139 @@
+
+{
+  "calcHeight": 80,
+  "tip": false,
+  "addBtn": false,
+  "searchShow": true,
+  "searchShowBtn": false,
+  "menu": false,
+  "searchSpan": 8,
+  "searchMenuSpan": 8,
+  "searchMenuPosition": "right",
+  "border": true,
+  "index": true,
+  "selection": true,
+  "viewBtn": true,
+  "dialogClickModal": false,
+  "column": [
+    {
+      "label": "商品编码",
+      "prop": "code",
+      "search": true,
+      "width": 100,
+      "rules": [
+        {
+          "required": true,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "商品名称",
+      "prop": "cname",
+      "slot": true,
+      "search": true,
+      "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": false,
+      "width": 100
+    },
+    {
+      "label": "品牌",
+      "prop": "brand",
+      "slot": true,
+      "width": 100
+    },
+    {
+      "label": "花纹",
+      "prop": "brandItem",
+      "slot": true,
+      "width": 100
+    },
+    {
+      "label": "规格尺寸",
+      "prop": "specs",
+      "slot": true,
+      "width": 100
+    },
+    {
+      "label": "产品类别",
+      "prop": "category",
+      "slot": true,
+      "width": 100
+    },
+    {
+      "label": "产品分类",
+      "prop": "categoryitem",
+      "slot": true,
+      "width": 100
+    },
+    {
+      "label": "供应商",
+      "prop": "providers",
+      "slot": true,
+      "width": 100
+    },
+    {
+      "label": "计量单位",
+      "prop": "unit",
+      "slot": true,
+      "width": 100
+    },
+    {
+      "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
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "slot": true,
+      "width": 100
+    }
+  ]
+}

+ 15 - 1
src/views/maintenance/salesPolicy/configuration/customerContact.json

@@ -5,7 +5,8 @@
   "searchShow": true,
   "addBtn":false,
   "editBtn":false,
-  "addRowBtn":true,
+  "addRowBtn":false,
+  "delBtn": false,
   "cellBtn":false,
   "cancelBtn":false,
   "refreshBtn": false,
@@ -71,6 +72,19 @@
         }
       ]
     },{
+      "label": "花纹",
+      "prop": "brandItem",
+      "index": 3,
+      "width":100,
+      "cell": true,
+      "rules": [
+        {
+          "required": false,
+          "message": " ",
+          "trigger": "blur"
+        }
+      ]
+    },{
       "label": "采购价(元)",
       "prop": "purchasePrice",
       "index": 4,

+ 310 - 9
src/views/maintenance/salesPolicy/detailsPageEdit.vue

@@ -48,10 +48,26 @@
               @row-click="handleRowClick"
               @row-update="rowUpdate"
               @row-del="rowDel">
-<!--            <template slot="code" slot-scope="{row,index}">-->
-<!--              <span style="float: left;padding-top: 2px">{{ row.code }}</span>-->
-<!--              <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>-->
-<!--            </template>-->
+            <template slot="code" slot-scope="{ row, index }">
+              <el-button
+                size="small"
+                type="text"
+                @click="rePick(row, index, 1)"
+                :disabled="disabled"
+                class="picker"
+                style="padding:4px 10px;float:left"
+              >选择</el-button
+              >
+              <span> {{ row.code }}</span>
+            </template>
+            <template slot="menuLeft">
+              <el-button
+                type="primary"
+                icon="el-icon-plus"
+                size="small"
+                @click.stop="newSpecial"
+              >新增明细</el-button>
+            </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
                   type="text"
@@ -59,6 +75,12 @@
                   @click="rowCell(row,index)"
               >{{ row.$cellEdit ? '保存' : '修改' }}
               </el-button>
+              <el-button
+                size="small"
+                icon="el-icon-delete"
+                type="text"
+                @click="rowDel(row, index)"
+              >删 除</el-button>
             </template>
           </avue-crud>
         </basic-container>
@@ -73,10 +95,26 @@
               @row-click="handleRowClickBuyFree"
               @row-update="rowUpdateBuyFree"
               @row-del="rowDelBuyFree">
-<!--            <template slot="code" slot-scope="{row,index}">-->
-<!--              <span style="float: left;padding-top: 2px">{{ row.code }}</span>-->
-<!--              <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>-->
-<!--            </template>-->
+            <template slot="code" slot-scope="{ row, index }">
+              <el-button
+                size="small"
+                type="text"
+                @click="rePick(row, index, 2)"
+                :disabled="disabled"
+                class="picker"
+                style="padding:4px 10px;float:left"
+              >选择</el-button
+              >
+              <span> {{ row.code }}</span>
+            </template>
+            <template slot="menuLeft">
+              <el-button
+                type="primary"
+                icon="el-icon-plus"
+                size="small"
+                @click.stop="newBuyFree"
+              >新增明细</el-button>
+            </template>
             <template slot-scope="{row,index}" slot="menu">
               <el-button
                   type="text"
@@ -84,10 +122,67 @@
                   @click="rowCellE(row,index)"
               >{{ row.$cellEdit ? '保存' : '修改' }}
               </el-button>
+              <el-button
+                size="small"
+                icon="el-icon-delete"
+                type="text"
+                @click="rowDelBuyFree(row, index)"
+              >删 除</el-button>
             </template>
           </avue-crud>
         </basic-container>
       </el-form>
+      <el-dialog
+        title="导入商品"
+        append-to-body
+        class="el-dialogDeep"
+        :visible.sync="dialogVisible"
+        width="60%"
+        :close-on-click-modal="false"
+        :destroy-on-close="true"
+        :close-on-press-escape="false"
+        @close="closeGoods"
+        top="10vh"
+        v-dialogdrag
+      >
+      <span>
+        <el-row>
+          <el-col :span="5">
+            <div>
+              <el-scrollbar>
+                <basic-container style="margin-top:45px">
+                  <avue-tree :option="treeOption" @node-click="nodeClick" />
+                </basic-container>
+              </el-scrollbar>
+            </div>
+          </el-col>
+          <el-col :span="19">
+            <avue-crud
+              :option="goodsOption"
+              :table-loading="loading"
+              :data="goodsList"
+              ref="goodsCrud"
+              @refresh-change="refreshChange"
+              @selection-change="selectionChange"
+              @row-click="rowClick"
+              :page.sync="page"
+              @on-load="onLoad"
+              @saveColumn="saveGoodsColumn"
+              @search-change="goodsSearch"
+            ></avue-crud>
+          </el-col>
+        </el-row>
+      </span>
+
+        <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="importGoods"
+          :disabled="selectionList.length == 0"
+        >导入</el-button>
+      </span>
+      </el-dialog>
     </div>
   </div>
 </template>
@@ -96,6 +191,18 @@
 import customerContact from "./configuration/customerContact.json"
 import BuyFree from "./configuration/BuyFree.json"
 import {detail,corpsattn,typeSave} from "@/api/maintenance/salesPolicy"
+import {
+  submit,
+  delItem,
+  getDeptLazyTree,
+  getGoods,
+  savePurchase,
+  saveShipping,
+  getPorts,
+  getSpecification,
+  saveSell
+} from "@/api/basicData/customerInquiry";
+import goodsOption from "./configuration/commodity.json";
 
 export default {
   name: "detailsPage",
@@ -212,7 +319,46 @@ export default {
             }
           }
         ]
-      }
+      },
+      dialogVisible: false,
+      selectionList: [],
+      treeDeptId: null,
+      treeOption: {
+        nodeKey: "id",
+        lazy: true,
+        treeLoad: function(node, resolve) {
+          const parentId = node.level === 0 ? 0 : node.data.id;
+          getDeptLazyTree(parentId).then(res => {
+            resolve(
+              res.data.data.map(item => {
+                return {
+                  ...item,
+                  leaf: !item.hasChildren
+                };
+              })
+            );
+          });
+        },
+        addBtn: false,
+        menu: false,
+        size: "small",
+        props: {
+          label: "title",
+          value: "value",
+          children: "children"
+        }
+      },
+      goodsOption: goodsOption,
+      loading: false,
+      goodsList: [],
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      // 1特价 2买赠
+      salesType: 1,
+      reData: null,
     }
   },
   //初始化查询
@@ -245,6 +391,150 @@ export default {
     }
   },
   methods: {
+    rePick(row, index,type) {
+      this.reData = {
+        ...row,
+        index: index
+      };
+      if (type == 1) {
+        this.newSpecial();
+      } else {
+        this.newBuyFree()
+      }
+    },
+    // 新增特价弹窗
+    newSpecial() {
+      this.salesType = 1
+      this.dialogVisible = !this.dialogVisible
+    },
+    // 买赠弹窗
+    newBuyFree() {
+      this.salesType = 2
+      this.dialogVisible = !this.dialogVisible
+    },
+    closeGoods() {
+      this.selectionList = [];
+      this.treeDeptId = "";
+      this.reData = null;
+    },
+    nodeClick(data) {
+      this.treeDeptId = data.id;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    rowClick(row) {
+      this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
+    },
+    goodsSearch(params, done) {
+      this.onLoad(this.page, params);
+      done()
+    },
+    //商品查询
+    onLoad(page, params = {}) {
+      this.loading = true;
+      getGoods(page.currentPage, page.pageSize, this.treeDeptId,params)
+        .then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.goodsList = data.records;
+          if (this.page.total) {
+            this.goodsOption.height = window.innerHeight - 550;
+          } else {
+            this.goodsOption.height = window.innerHeight - 475;
+          }
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    // 确认导入商品
+    importGoods() {
+      if (this.reData) {
+        if (this.selectionList.length != 1) {
+          return this.$message.error("重新选择的时候只能选择一条数据");
+        } else {
+          this.selectionList.forEach(e => {
+            if (this.reData.salesType == 1) {
+              this.contactsData.forEach((item, index) => {
+                if (index == this.reData.index) {
+                  item.itemId = e.id
+                  item.code = e.code
+                  item.cname = e.cname
+                  item.brand = e.brand
+                  item.productCategory = e.goodsTypeName
+                  item.typeno = e.typeno
+                  item.brandItem = e.brandItem
+                  // item.purchasePrice = this.brand.purchasePrice
+                  // item.salesPrice = this.brand.salesPrice
+                  // item.specialOffer = this.brand.specialOffer
+                  // item.updateUserName = this.brand.updateUserName
+                  // item.updateTime = this.brand.updateTime
+                  // item.salesType = this.brand.salesType
+                }
+              })
+            } else {
+              this.contactsDataBuyFree.forEach((item, index) => {
+                item.itemId = e.id
+                item.code = e.code
+                item.cname = e.cname
+                item.brand = e.brand
+                item.productCategory = e.goodsTypeName
+                item.typeno = e.typeno
+                item.brandItem = e.brandItem
+                // item.purchasePrice = this.brand.purchasePrice
+                // item.salesPrice = this.brand.salesPrice
+                // item.salesPrice = this.brand.purchaseAmount
+                // item.updateUserName = this.brand.salesVolume
+                // item.updateUserName = this.brand.updateUserName
+                // item.updateTime = this.brand.updateTime
+                // item.salesType = this.brand.salesType
+              })
+            }
+          })
+        }
+      } else {
+        if (this.salesType == 1) {
+          this.selectionList.forEach(item => {
+            this.contactsData.push({
+              itemId: item.id,
+              code: item.code,
+              brand: item.brand,
+              productCategory: item.goodsTypeName,
+              typeno: item.typeno,
+              brandItem: item.brandItem,
+              purchasePrice: '',
+              salesPrice: '',
+              specialOffer: '',
+              updateUserName: '',
+              updateTime: '',
+              salesType: '1',
+            })
+          })
+        } else if (this.salesType == 2) {
+          this.selectionList.forEach(item => {
+            this.contactsDataBuyFree.push({
+              itemId: item.id,
+              code: item.code,
+              brand: item.brand,
+              productCategory: item.goodsTypeName,
+              typeno: item.typeno,
+              brandItem: item.brandItem,
+              purchasePrice: '',
+              salesPrice: '',
+              purchaseAmount: '',
+              salesVolume: '',
+              updateUserName: '',
+              updateTime: '',
+              salesType: '2',
+            })
+          })
+        }
+      }
+      this.dialogVisible = false;
+    },
     //买赠列表信息保存触发
     rowSaveBuyFree(row, done, loading) {
       console.log(row)
@@ -362,6 +652,17 @@ export default {
         path: '/maintenance/salesPolicy/index',
         query: {}
       });
+    },
+    async saveGoodsColumn() {
+      // const inSave = await this.saveColumnData(
+      //   this.getColumnName(26),
+      //   this.goodsOption
+      // );
+      // if (inSave) {
+      //   this.$message.success("保存成功");
+      //   //关闭窗口
+      //   this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
+      // }
     }
   }
 }