소스 검색

国内贸易-销售订单政策导入新增选择暂存

caojunjie 3 년 전
부모
커밋
961d5bdac9

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

@@ -2,11 +2,11 @@
   "align": "center",
   "lazy": true,
   "tip": false,
-  "menu": false,
   "stripe": true,
   "simplePage": true,
   "searchShow": true,
   "addBtn":false,
+  "delBtn":false,
   "editBtn":false,
   "addRowBtn":false,
   "cellBtn":false,
@@ -17,7 +17,7 @@
   "tree": true,
   "border": true,
   "selection": true,
-  "menuWidth": 300,
+  "menuWidth": 100,
   "dialogClickModal": false,
   "column":[
     {

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

@@ -2,8 +2,8 @@
   "align": "center",
   "lazy": true,
   "tip": false,
+  "delBtn": false,
   "stripe": true,
-  "menu": false,
   "simplePage": true,
   "searchShow": true,
   "addBtn":false,
@@ -17,7 +17,7 @@
   "tree": true,
   "border": true,
   "selection": true,
-  "menuWidth": 300,
+  "menuWidth": 100,
   "dialogClickModal": false,
   "column":[
     {

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

@@ -559,6 +559,10 @@
           </div>
         </el-col>
         <el-col :span="19">
+          <el-tabs v-model="activeName" @tab-click="tabHandleTwo">
+            <el-tab-pane label="查询结果" name="searchList"/>
+            <el-tab-pane label="已选定数据" name="importStaging"/>
+          </el-tabs>
           <containerTitle title="特价促销"></containerTitle>
           <basic-container style="margin-bottom: 10px">
             <avue-crud :option="optionPolicy"
@@ -568,6 +572,23 @@
                        :key="policyIndex"
                        @selection-change="selectionChangePolicy"
                        :page.sync="pagePolicy">
+              <template slot-scope="scope" slot="menu">
+                <el-button
+                    type="text"
+                    icon="el-icon-edit"
+                    size="mini"
+                    v-if="activeName=='searchList'"
+                    @click.stop="importStagList(scope.row,scope.index,'policy')"
+                    :disabled="goodsListPolicy.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,'policy')"
+                    v-else
+                >移除</el-button>
+              </template>
               <template slot="menuLeft">
                 <el-button
                   type="info"
@@ -616,6 +637,23 @@
                 @selection-change="selectionChangePolicyTwo"
                 :table-loading="loadingPolicy"
                 ref="crudContactE">
+              <template slot-scope="scope" slot="menu">
+                <el-button
+                    type="text"
+                    icon="el-icon-edit"
+                    size="mini"
+                    v-if="activeName=='searchList'"
+                    @click.stop="importStagList(scope.row,scope.index,'policy_buyAndGive')"
+                    :disabled="buyAndGiveList.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,'policy_buyAndGive')"
+                    v-else
+                >移除</el-button>
+              </template>
             </avue-crud>
           </basic-container>
         </el-col>
@@ -625,11 +663,10 @@
           <el-button
             type="primary"
             @click="importPolicy"
-            :disabled="this.policyData.length == 0 && this.policyDataTwo.length == 0"
+            :disabled="policyData.length === 0 && policyDataTwo.length === 0 && goodsListPolicy.length === 0 && buyAndGiveList.length === 0"
             :loading="saveLoading">导入</el-button>
         </span>
     </el-dialog>
-
     <el-dialog
         title="导入费用"
         append-to-body
@@ -1623,8 +1660,12 @@ export default {
       activeName: 'searchList',
       // 商品列表数据合计
       goodsListShow: [],
+      dataTwo: [],
+      dataThree: [],
       // 商品列表暂存
       goodsListSave: [],
+      goodsListPolicy: [],
+      buyAndGiveList: [],
       goodsListTotal: 0,
       goodsListSaveTotal: 0,
       goodsActives: 'goods',
@@ -2003,6 +2044,13 @@ export default {
     },
     //政策价格导入
     policy() {
+      this.$set(this.customerBuyFree,'menu',true)
+      this.$set(this.optionPolicy,'menu',true)
+      this.customerBuyFree.selection = true
+      this.optionPolicy.selection = true
+      this.activeName = 'searchList'
+      this.goodsListPolicy = []
+      this.buyAndGiveList = []
       this.policyDialog = !this.policyDialog
     },
     // 报表
@@ -2679,15 +2727,16 @@ export default {
     },
     //导入商品政策
     importPolicy() {
-      let list = this.deepClone(this.policyData.concat(this.policyDataTwo))
-      let listLength = this.policyDataTwo.length
+      let list = this.deepClone(this.policyData.concat(this.policyDataTwo).concat(this.goodsListPolicy).concat(this.buyAndGiveList))
+      let listLength = this.policyDataTwo.length + this.buyAndGiveList.length
       // 买赠额外加一条
       let buyFree = []
-      if (this.policyDataTwo.length > 0) {
-        buyFree = this.deepClone(this.policyDataTwo)
+      if (this.policyDataTwo.length > 0 || this.goodsListPolicy.length > 0 || this.buyAndGiveList.length >0) {
+        buyFree = this.deepClone((this.policyDataTwo.concat(this.goodsListPolicy)).concat(this.buyAndGiveList))
       }
+      console.log(buyFree)
       for (let item in list) {
-        if (this.policyData.length > 0) {
+        if (this.policyData.length > 0 || this.buyAndGiveList > 0) {
           if (!list[item].specialOffer) {
             getMarketPrice({code: list[item].code, isFreight: this.form.isFreight, isLabel: this.form.isLabel}).then(response => {
               if (response.data.data.length > 0) {
@@ -3415,11 +3464,55 @@ export default {
         this.page.total = 0
       }
     },
-    removeStagList(row, index) {
-      this.goodsListSave.splice(row.$index, 1)
+    // 政策标签页切换
+    tabHandleTwo(data) {
+      if (data.name == 'searchList') {
+        this.dataPolicy = this.dataTwo;
+        this.contactsDataBuyFree = this.dataThree;
+      } else if (data.name == 'importStaging') {
+        this.dataTwo = this.dataPolicy;
+        this.dataPolicy = this.goodsListPolicy;
+        this.dataThree = this.contactsDataBuyFree;
+        this.contactsDataBuyFree = this.buyAndGiveList;
+      }
+    },
+    removeStagList(row, index,type) {
+      if (type === 'policy'){
+        this.goodsListPolicy.splice(row.$index, 1)
+        if (this.goodsListPolicy.length == 0){
+          this.customerBuyFree.selection = true
+          this.optionPolicy.selection = true
+          this.$set(this.customerBuyFree,'menu',true)
+        }
+      }else if (type === 'policy_buyAndGive'){
+        this.buyAndGiveList.splice(row.$index, 1)
+        if (this.buyAndGiveList.length == 0){
+          this.customerBuyFree.selection = true
+          this.optionPolicy.selection = true
+          this.$set(this.optionPolicy,'menu',true)
+        }
+      }else {
+        this.goodsListSave.splice(row.$index, 1)
+      }
     },
-    importStagList(row, index) {
-      this.goodsListSave.push(row);
+    importStagList(row, index,type) {
+      if (type === 'policy'){
+        this.goodsListPolicy.push(row);
+        if (this.goodsListPolicy.length>0){
+          this.customerBuyFree.selection = false
+          this.optionPolicy.selection = true
+          this.$set(this.customerBuyFree,'menu',false)
+        }
+      }else if (type === 'policy_buyAndGive'){
+        this.buyAndGiveList.push(row);
+        if (this.buyAndGiveList.length>0){
+          this.customerBuyFree.selection = true
+          this.optionPolicy.selection = false
+          this.$set(this.optionPolicy,'menu',false)
+        }
+      }else {
+        this.goodsListSave.push(row);
+      }
     },
     // 商品信息标签页切换
     handleClick(data) {