chenrui il y a 1 an
Parent
commit
81a209a877

+ 89 - 1
src/views/common/chooseBrandModal.vue

@@ -11,6 +11,10 @@
     <div class="chooseBrand-con">
       <div>
         <a-checkbox :checked="checkAll" @change="onCheckAllChange">全选</a-checkbox>
+        <span v-if="pageType==='1'">
+          <a-checkbox :checked="checkOwn" @change="onCheckOwnChange">自主品牌</a-checkbox>
+          <a-checkbox :checked="checkAgent" @change="onCheckAgentChange">代理品牌</a-checkbox>
+        </span>
       </div>
       <a-divider />
       <a-checkbox-group v-model="checkedList" @change="onChange" style="width: 100%;">
@@ -44,6 +48,7 @@
 
 <script>
 import { productBrandQuery } from '@/api/productBrand'
+import { forEach } from 'core-js/library/fn/dict'
 export default {
   name: 'ChooseBrandModal',
   props: {
@@ -56,15 +61,23 @@ export default {
       default: () => {
         return []
       }
+    },
+    pageType: { //  弹框显示状态
+      type: [String, Number],
+      default: ''
     }
   },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
       checkAll: false, //  全选
+      checkOwn: false, // 自主品牌
+      checkAgent: false, // 代理品牌
       checkedList: [], //  选中项
       checkedRowList: [], //  选中项
-      brandList: [] //  品牌数据
+      brandList: [], //  品牌数据
+      brandOwnList: [],
+      brandAgentList: []
     }
   },
   methods: {
@@ -93,11 +106,24 @@ export default {
           _this.checkedRowList.push(item)
         }
       })
+      if (this.pageType == '1') {
+        const newCheckList = []
+        this.brandList.forEach(con => {
+          if (checkedList.includes(con.brandSn)) {
+            newCheckList.push(con)
+          }
+        })
+        const obj = _this.handleArr(newCheckList)
+        this.checkOwn = obj.ownList.length === this.brandOwnList.length
+        this.checkAgent = obj.agentList.length === this.brandAgentList.length
+      }
     },
     // 全选
     onCheckAllChange (e) {
       const _this = this
       this.checkAll = e.target.checked
+      this.checkOwn = e.target.checked
+      this.checkAgent = e.target.checked
       if (e.target.checked) {
         this.checkedList = []
         this.checkedRowList = []
@@ -110,16 +136,76 @@ export default {
         this.checkedRowList = []
       }
     },
+    onCheckOwnChange (e) {
+      const _this = this
+      this.checkOwn = e.target.checked
+      if (e.target.checked) {
+        this.checkedList = []
+        this.checkedRowList = []
+        this.brandList.map(item => {
+          if (item.brandType == 1) {
+            _this.checkedList.push(item.brandSn)
+            _this.checkedRowList.push(item)
+          }
+        })
+      } else {
+        const noArr = this.getDifferData(this.checkedList, this.brandOwnList)
+        _this.checkedList = noArr
+      }
+      _this.onChange(_this.checkedList)
+    },
+    getDifferData (list1, list2) {
+      list2.forEach(item => {
+        const pos = list1.indexOf(item.brandSn)
+        if (pos != -1) {
+          list1.splice(pos, 1)
+        }
+      })
+      return list1
+    },
+    onCheckAgentChange (e) {
+      const _this = this
+      this.checkAgent = e.target.checked
+      if (e.target.checked) {
+        this.checkedList = []
+        this.checkedRowList = []
+        this.brandList.map(item => {
+          if (item.brandType == 2) {
+            _this.checkedList.push(item.brandSn)
+            _this.checkedRowList.push(item)
+          }
+        })
+      } else {
+        const noArr = this.getDifferData(this.checkedList, this.brandAgentList)
+        _this.checkedList = noArr
+      }
+      _this.onChange(_this.checkedList)
+    },
     // 获取品牌数据
     getBrandList () {
       productBrandQuery({}).then(res => {
         if (res.status == 200) {
+          const obj = this.handleArr(res.data)
           this.brandList = res.data
+          this.brandOwnList = obj.ownList
+          this.brandAgentList = obj.agentList
         } else {
           this.brandList = []
         }
       })
     },
+    handleArr (list) {
+      const ownList = []
+      const agentList = []
+      list.forEach(item => {
+        if (item.brandType == 1) {
+          ownList.push(item)
+        } else {
+          agentList.push(item)
+        }
+      })
+      return { ownList, agentList }
+    },
     // 禁用
     handleDisabled (list) {
       this.brandList.map(item => {
@@ -141,6 +227,8 @@ export default {
       if (!newValue) {
         this.$emit('close')
         this.checkAll = false
+        this.checkOwn = false
+        this.checkAgent = false
       } else {
         const _this = this
         this.checkedRowList = this.chooseData

+ 38 - 10
src/views/promotionRulesManagement/dealerPromotions/chooseImportModal.vue

@@ -77,8 +77,6 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { hdExportExcel } from '@/libs/exportExcel'
-import { salesReturnDetailImportError } from '@/api/salesReturn.js'
 export default {
   name: 'ChooseImportModal',
   mixins: [commonMixin],
@@ -92,25 +90,55 @@ export default {
       default: () => {
         return {}
       }
+    },
+    goodsFlag: {
+      type: [String, Number],
+      default: '0'
     }
   },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
-      nowColumns: [
+      loadData: [],
+      unLoadData: [],
+      loading: false
+    }
+  },
+  computed: {
+    nowColumns () {
+      const _this = this
+      let columnsArr = [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名字', dataIndex: 'product.name', width: '70%', align: 'center', customRender: function (text) { return text || '--' } }
-      ],
-      loadData: [],
-      nowUnColumns: [
+        { title: '产品名称', dataIndex: 'product.name', width: '70%', align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+      if (_this.goodsFlag == '1') {
+        const arr = [
+          { title: '省价特价', dataIndex: 'provinceDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '市价特价', dataIndex: 'cityDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '特约特价', dataIndex: 'specialDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        ]
+        columnsArr = columnsArr.concat(arr)
+      }
+      return columnsArr
+    },
+    nowUnColumns () {
+      const _this = this
+      let unColumnsArr = [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'product.name', width: '60%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '错误说明', scopedSlots: { customRender: 'errorMsg' }, width: '20%', align: 'center' }
-      ],
-      unLoadData: [],
-      loading: false
+      ]
+      if (_this.goodsFlag == '1') {
+        const arr = [
+          { title: '省价特价', dataIndex: 'provinceDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '市价特价', dataIndex: 'cityDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+          { title: '特约特价', dataIndex: 'specialDiscountPriceText', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+        ]
+        unColumnsArr = unColumnsArr.concat(arr)
+      }
+      return unColumnsArr
     }
   },
   methods: {

+ 2 - 0
src/views/promotionRulesManagement/dealerPromotions/chooseProductsModal.vue

@@ -67,6 +67,8 @@
             :columns="columns"
             :data="loadData"
             :defaultLoadData="false"
+             style="max-height:580px;"
+            :scroll="{ y: 520 }"
             bordered>
             <!-- 产品分类 -->
             <template slot="productType" slot-scope="text, record">

+ 4 - 4
src/views/promotionRulesManagement/dealerPromotions/importGuideModal.vue

@@ -15,7 +15,7 @@
             <span>1</span>准备导入
           </div>
           <ul>
-            <li v-if="goodFlag==1">1) 导入的Excel文件中必须包含名为“产品编码”的列,“产品编码”必填</li>
+            <li v-if="goodFlag==='1'">1) 导入的Excel文件中必须包含名为“产品编码”的列,“产品编码”必填</li>
             <li v-else>1) 导入的Excel文件中必须包含名为“产品编码”、“省价特价”、“市价特价”和“特约特价”的列,都为必填</li>
             <li>2) 如果导入的产品已经存在,则不会导入该行</li>
             <li>
@@ -62,7 +62,7 @@
       </div>
     </div>
     <!-- 导入 -->
-    <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
+    <chooseImportModal :goodsFlag="goodFlag" :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
   </a-modal>
 </template>
 
@@ -83,7 +83,7 @@ export default {
     },
     goodFlag: {
       type: [String, Number],
-      default: ''
+      default: '0'
     }
   },
   data () {
@@ -143,7 +143,7 @@ export default {
         this.$emit('close')
         this.resetSearchForm()
       } else {
-        this.filePath = location.protocol + '//' + location.host + (this.goodFlag == 1 ? '/templ/促销规则导入产品.xlsx' : '/templ/促销规则导入特价产品.xlsx')
+        this.filePath = location.protocol + '//' + location.host + (this.goodFlag === '1' ? '/templ/促销规则导入产品.xlsx' : '/templ/促销规则导入特价产品.xlsx')
       }
     }
   }

+ 23 - 13
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -50,13 +50,13 @@
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/> 不限制配额。
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :max="999999" :min="0" :precision="2" size="small"/> 不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买满
-              <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>
               元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :max="form.gateAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.quotaAmount" :min="0" :max="999999" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
@@ -77,7 +77,8 @@
               @blur="calculatePrice"
               :min="0"
               :step="1"
-              :precision="0"
+              :precision="2"
+              :max="999999"
               size="small"/>
             元正价产品,送
             <a-input-number
@@ -85,8 +86,8 @@
               @blur="calculatePrice"
               :min="0"
               :step="1"
-              :max="form.regularAmount"
-              :precision="0"
+              :max="999999"
+              :precision="2"
               size="small"/>
             元{{ scaleNum }}%促销品采购额
           </div>
@@ -104,9 +105,9 @@
         </a-form-model-item>
         <a-form-model-item prop="minOrderFlag">
           <span slot="label">
-            <a-tooltip title="What do you want others to call you?">
+            <!-- <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
-            </a-tooltip>
+            </a-tooltip> -->
             订单起订金额
           </span>
           <a-select default-value="1" v-model="form.minOrderFlag" style="width: 160px" size="small">
@@ -124,14 +125,15 @@
             v-model="form.minOrderAmount"
             :min="0"
             :step="1"
+            :max="999999"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
         <a-form-model-item prop="upperLimitFlag">
           <span slot="label">
-            <a-tooltip title="What do you want others to call you?">
+            <!-- <a-tooltip title="What do you want others to call you?">
               <a-icon type="info-circle" />
-            </a-tooltip>
+            </a-tooltip> -->
             活动经费上限
           </span>
           <a-select default-value="1" v-model="form.upperLimitFlag" style="width: 160px" size="small">
@@ -149,6 +151,7 @@
             v-model="form.upperLimitAmount"
             :min="0"
             :step="1"
+            :max="999999"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
@@ -193,7 +196,7 @@
       </div>
     </a-spin>
     <!-- 导入产品 -->
-    <importGuideModal goodsFlag="1" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
+    <importGuideModal goodFlag="1" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
   </a-modal>
 </template>
 
@@ -443,11 +446,18 @@ export default {
             const num = 3
             for (var i = 0; i < num; i++) {
               if (item['productTypeName' + (i + 1)]) {
-                item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
+                // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
                 typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
               }
             }
-            item.title = item.title.slice(0, item.title.length - 1)
+            // item.title = item.title.slice(0, item.title.length - 1)
+            if (item.productTypeName3) {
+              item.title = item.productTypeName2 + '/' + item.productTypeName3
+            } else if (!item.productTypeName3 && item.productTypeName2) {
+              item.title = item.productTypeName2
+            } else {
+              item.title = item.productTypeName1
+            }
             item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
             typeList.push(typeObj)
           })

+ 17 - 8
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -50,13 +50,13 @@
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/> 不限制配额。
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/> 不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买满
-              <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/>
               元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :max="form.gateAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.quotaAmount" :min="0" :max="999999" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
@@ -76,10 +76,10 @@
             个正价产品,送
             <a-input-number
               v-model="form.promotionQty"
-              :max="form.regularQty"
               :min="0"
               :step="1"
               :precision="0"
+              :max="999999"
               size="small"/>
             个促销产品
           </div>
@@ -92,6 +92,7 @@
               v-model="form.restrictCategory"
               :min="0"
               :step="1"
+              :max="999999"
               :precision="0"
               size="small"/>
           </div>
@@ -128,6 +129,7 @@
             style="margin-left:10px;width:300px;"
             v-model="form.minOrderAmount"
             :min="0"
+            :max="999999"
             :step="1"
             :precision="2"
             placeholder="请输入金额"/>
@@ -154,6 +156,7 @@
             v-model="form.upperLimitAmount"
             :min="0"
             :step="1"
+            :max="999999"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
@@ -198,7 +201,7 @@
       </div>
     </a-spin>
     <!-- 导入产品 -->
-    <importGuideModal goodsFlag="1" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
+    <importGuideModal goodFlag="1" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
   </a-modal>
 </template>
 
@@ -449,15 +452,21 @@ export default {
           const typeList = []
           con.productTypeList.forEach(item => {
             const typeObj = {}
-            item.title = ''
             const num = 3
             for (var i = 0; i < num; i++) {
               if (item['productTypeName' + (i + 1)]) {
-                item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
+                // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
                 typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
               }
             }
-            item.title = item.title.slice(0, item.title.length - 1)
+            // item.title = item.title.slice(0, item.title.length - 1)
+            if (item.productTypeName3) {
+              item.title = item.productTypeName2 + '/' + item.productTypeName3
+            } else if (!item.productTypeName3 && item.productTypeName2) {
+              item.title = item.productTypeName2
+            } else {
+              item.title = item.productTypeName1
+            }
             item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
             typeList.push(typeObj)
           })

+ 18 - 8
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -50,13 +50,13 @@
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/> 不限制配额。
+              购买门槛产品满最低金额 <a-input-number v-model="form.gateAmount" :min="0" :max="999999" :precision="2" size="small"/> 不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买满
-              <a-input-number v-model="form.gateAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.gateAmount" :max="999999" :min="0" :precision="2" size="small"/>
               元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :max="form.gateAmount" :min="0" :precision="2" size="small"/>
+              <a-input-number v-model="form.quotaAmount" :max="999999" :min="0" :precision="2" size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
@@ -83,6 +83,7 @@
             v-model="form.minOrderAmount"
             :min="0"
             :step="1"
+            :max="999999"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
@@ -108,6 +109,7 @@
             v-model="form.upperLimitAmount"
             :min="0"
             :step="1"
+            :max="999999"
             :precision="2"
             placeholder="请输入金额"/>
         </a-form-model-item>
@@ -355,11 +357,18 @@ export default {
             const num = 3
             for (var i = 0; i < num; i++) {
               if (item['productTypeName' + (i + 1)]) {
-                item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
+                // item.title += item['productTypeName' + (i + 1)] + (item['productTypeName' + (i + 1)] ? '/' : '')
                 typeObj['productTypeSn' + (i + 1)] = item['productTypeSn' + (i + 1)] ? item['productTypeSn' + (i + 1)] : ''
               }
             }
-            item.title = item.title.slice(0, item.title.length - 1)
+            // item.title = item.title.slice(0, item.title.length - 1)
+            if (item.productTypeName3) {
+              item.title = item.productTypeName2 + '/' + item.productTypeName3
+            } else if (!item.productTypeName3 && item.productTypeName2) {
+              item.title = item.productTypeName2
+            } else {
+              item.title = item.productTypeName1
+            }
             item.id = item.productTypeSn3 ? item.productTypeSn3 : item.productTypeSn2 ? item.productTypeSn2 : item.productTypeSn1
             typeList.push(typeObj)
           })
@@ -413,7 +422,9 @@ export default {
               specialPrice: item.specialPrice,
               provinceDiscountPrice: item.provinceDiscountPriceText,
               cityDiscountPrice: item.cityDiscountPriceText,
-              specialDiscountPrice: item.specialDiscountPriceText
+              specialDiscountPrice: item.specialDiscountPriceText,
+              unitType: 'SL',
+              unitQty: 1
             }
             const obj = {}
             if (item.productTypeSn1) {
@@ -442,8 +453,7 @@ export default {
             _this.$refs.specialProduct.setSourceData(chooseProductsList)
           }
         })
-      })s
-      
+      })
     }
   },
   watch: {

+ 52 - 27
src/views/promotionRulesManagement/dealerPromotions/tableType1.vue

@@ -13,9 +13,9 @@
       bordered>
       <!-- 产品分类 -->
       <template slot="productType" slot-scope="text, record,index">
-        <div style="max-height:80px;width:100%;overflow-y:scroll;">
+        <div style="max-height:126px;width:100%;overflow-y:scroll;">
           <a-row v-if="record.productTypeArr && record.productTypeArr.length>0">
-            <a-col :span="18">
+            <a-col :span="16">
               <div v-for="con in record.productTypeArr" :key="con.id">
                 <a-tooltip v-if="con.title&&con.title.length > 6" :title="con.title">
                   <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
@@ -44,13 +44,21 @@
       </template>
       <!-- 品牌 -->
       <template slot="productBrand" slot-scope="text, record,index">
-        <div style="max-height:106spx;overflow-y:scroll;">
+        <div style="max-height:126px;overflow-y:scroll;">
           <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
-            <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.brandSn">
-                {{ item.brandName }}
-              </a-tag>
+            <a-col :span="16">
+              <div v-for="item in record.productBrandArr" :key="item.brandSn">
+                <a-tooltip v-if="item.brandName&&item.brandName.length > 6" :title="item.brandName">
+                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
+                    {{ `${item.brandName.slice(0, 6)}...` }}
+                  </a-tag>
+                </a-tooltip>
+                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
+                  {{ item.brandName }}
+                </a-tag>
+              </div>
             </a-col>
+
             <a-col :span="4" style="text-align:right;">
               <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
                 <a-icon type="plus" /> 选择
@@ -68,9 +76,9 @@
       </template>
       <!-- 产品 -->
       <template slot="product" slot-scope="text, record,index">
-        <div style="max-height:64px;overflow-y:scroll;">
+        <div style="max-height:126px;overflow-y:scroll;">
           <a-row v-if="record.productThisList && record.productThisList.length>0">
-            <a-col :span="20">
+            <a-col :span="16">
               <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'productList')" v-for="item in record.productThisList" :key="item.productSn">
                 {{ item.productCode }}
               </a-tag>
@@ -126,7 +134,13 @@
       <a-button id="tableType1-add" type="primary" class="button-gray" @click="handleAddRow">+新增一行</a-button>
     </div>
     <!-- 选择产品品牌 -->
-    <chooseBrandModal ref="brandBox" :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
+    <chooseBrandModal
+      pageType="1"
+      ref="brandBox"
+      :openModal="openBrandModal"
+      :chooseData="chooseBrand"
+      @close="openBrandModal=false"
+      @ok="handleBrandOk" />
     <!-- 选择产品分类 -->
     <chooseTypeModal
       ref="typeBox"
@@ -161,11 +175,11 @@ export default {
     return {
       spinning: false,
       columns: [
-        { title: '产品分类', width: '20%', scopedSlots: { customRender: 'productType' }, align: 'center' },
-        { title: '品牌', width: '20%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
-        { title: '产品', width: '25%', scopedSlots: { customRender: 'product' }, align: 'center' },
-        { title: '设置起订量', width: '25%', scopedSlots: { customRender: 'setNum' }, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+        { title: '产品分类', width: '24%', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '品牌', width: '24%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
+        { title: '产品', width: '24%', scopedSlots: { customRender: 'product' }, align: 'center' },
+        { title: '设置起订量', width: '20%', scopedSlots: { customRender: 'setNum' }, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ],
       dataSource: [],
       openBrandModal: false,
@@ -192,7 +206,9 @@ export default {
             productTypeList: [],
             productBrandArr: [],
             productBrandList: [],
-            productThisList: []
+            productThisList: [],
+            unitType: 'SL',
+            unitQty: 1
           }
           _this.dataSource.push(newData)
         } else {
@@ -214,7 +230,9 @@ export default {
           if (res.status == 200) {
             const newData = {
               productScopeSn: res.data,
-              productThisList: list
+              productThisList: list,
+              unitType: 'SL',
+              unitQty: 1
             }
             _this.dataSource.push(newData)
           } else {
@@ -261,7 +279,8 @@ export default {
             }
             newClassifyArr.push(objType2)
             const obj = JSON.parse(JSON.stringify(objType2))
-            obj.title = item.namePaths.replace(/,/g, '/')
+            const newName = item.namePaths.split(',')
+            obj.title = newName[1]
             obj.id = typeArr1[1]
             classifyArr.push(obj)
           }
@@ -275,7 +294,8 @@ export default {
           }
           newClassifyArr.push(objType3)
           const obj = JSON.parse(JSON.stringify(objType3))
-          obj.title = item.namePaths.replace(/,/g, '/')
+          const newName = item.namePaths.split(',')
+          obj.title = newName[1] + '/' + newName[2]
           obj.id = typeArr2[2]
           classifyArr.push(obj)
         }
@@ -338,14 +358,18 @@ export default {
       return snArr
     },
     handleEchoData (name, conArr) {
-      conArr.map(item => {
-        if (name === 'This') {
-          item.code = item.productCode
-          item.goodsSn = item.productSn
-        } else {
-          item.goodsSn = item['product' + name + 'Sn']
-        }
-      })
+      if (conArr) {
+        conArr.map(item => {
+          if (name === 'This') {
+            item.code = item.productCode
+            item.goodsSn = item.productSn
+          } else {
+            item.goodsSn = item['product' + name + 'Sn']
+          }
+        })
+      } else {
+        conArr = []
+      }
       return conArr
     },
     handleRowData (row) {
@@ -419,6 +443,7 @@ export default {
         const k = this.dataSource[pos].productThisList.findIndex(con => con.productSn == row.productSn)
         this.dataSource[pos].productThisList.splice(k, 1)
       }
+      this.$forceUpdate()
     }
   }
 }

+ 56 - 27
src/views/promotionRulesManagement/dealerPromotions/tableType2.vue

@@ -13,12 +13,19 @@
       bordered>
       <!-- 产品分类 -->
       <template slot="productType" slot-scope="text, record,index">
-        <div style="max-height:80px;width:100%;overflow-y:scroll;">
+        <div style="max-height:126px;width:100%;overflow-y:scroll;">
           <a-row v-if="record.productTypeArr && record.productTypeArr.length>0">
-            <a-col :span="18">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')" v-for="con in record.productTypeArr" :key="con.id">
-                {{ con.title }}
-              </a-tag>
+            <a-col :span="16">
+              <div v-for="con in record.productTypeArr" :key="con.id">
+                <a-tooltip v-if="con.title&&con.title.length > 6" :title="con.title">
+                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
+                    {{ `${con.title.slice(0, 6)}...` }}
+                  </a-tag>
+                </a-tooltip>
+                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
+                  {{ con.title }}
+                </a-tag>
+              </div>
             </a-col>
             <a-col :span="4" style="text-align:right;">
               <a-tag style="background: #fff; borderStyle: dashed;" @click="addClassifyTag(index, record)" color="blue">
@@ -37,13 +44,21 @@
       </template>
       <!-- 品牌 -->
       <template slot="productBrand" slot-scope="text, record,index">
-        <div style="max-height:106spx;overflow-y:scroll;">
+        <div style="max-height:126px;overflow-y:scroll;">
           <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
-            <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.brandSn">
-                {{ item.brandName }}
-              </a-tag>
+            <a-col :span="16">
+              <div v-for="item in record.productBrandArr" :key="item.brandSn">
+                <a-tooltip v-if="item.brandName&&item.brandName.length > 6" :title="item.brandName">
+                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
+                    {{ `${item.brandName.slice(0, 6)}...` }}
+                  </a-tag>
+                </a-tooltip>
+                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
+                  {{ item.brandName }}
+                </a-tag>
+              </div>
             </a-col>
+
             <a-col :span="4" style="text-align:right;">
               <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
                 <a-icon type="plus" /> 选择
@@ -61,9 +76,9 @@
       </template>
       <!-- 产品 -->
       <template slot="product" slot-scope="text, record,index">
-        <div style="max-height:64px;overflow-y:scroll;">
+        <div style="max-height:126px;overflow-y:scroll;">
           <a-row v-if="record.productThisList && record.productThisList.length>0">
-            <a-col :span="20">
+            <a-col :span="16">
               <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'productList')" v-for="item in record.productThisList" :key="item.productSn">
                 {{ item.productCode }}
               </a-tag>
@@ -98,7 +113,13 @@
       <a-button id="tableType1-add" type="primary" class="button-gray" @click="handleAddRow">+新增一行</a-button>
     </div>
     <!-- 选择产品品牌 -->
-    <chooseBrandModal ref="brandBox" :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
+    <chooseBrandModal
+      pageType="1"
+      ref="brandBox"
+      :openModal="openBrandModal"
+      :chooseData="chooseBrand"
+      @close="openBrandModal=false"
+      @ok="handleBrandOk" />
     <!-- 选择产品分类 -->
     <chooseTypeModal
       ref="typeBox"
@@ -133,10 +154,10 @@ export default {
     return {
       spinning: false,
       columns: [
-        { title: '产品分类', width: '20%', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '产品分类', width: '30%', scopedSlots: { customRender: 'productType' }, align: 'center' },
         { title: '品牌', width: '30%', scopedSlots: { customRender: 'productBrand' }, align: 'center' },
-        { title: '产品', width: '35%', scopedSlots: { customRender: 'product' }, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
+        { title: '产品', width: '30%', scopedSlots: { customRender: 'product' }, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       dataSource: [],
       openBrandModal: false,
@@ -230,7 +251,8 @@ export default {
             }
             newClassifyArr.push(objType2)
             const obj = JSON.parse(JSON.stringify(objType2))
-            obj.title = item.namePaths.replace(/,/g, '/')
+            const newName = item.namePaths.split(',')
+            obj.title = newName[1]
             classifyArr.push(obj)
           }
         }
@@ -243,7 +265,9 @@ export default {
           }
           newClassifyArr.push(objType3)
           const obj = JSON.parse(JSON.stringify(objType3))
-          obj.title = item.namePaths.replace(/,/g, '/')
+          const newName = item.namePaths.split(',')
+          obj.title = newName[1] + '/' + newName[2]
+          obj.id = typeArr2[2]
           classifyArr.push(obj)
         }
       })
@@ -305,14 +329,18 @@ export default {
       return snArr
     },
     handleEchoData (name, conArr) {
-      conArr.map(item => {
-        if (name === 'This') {
-          item.code = item.productCode
-          item.goodsSn = item.productSn
-        } else {
-          item.goodsSn = item['product' + name + 'Sn']
-        }
-      })
+      if (conArr) {
+        conArr.map(item => {
+          if (name === 'This') {
+            item.code = item.productCode
+            item.goodsSn = item.productSn
+          } else {
+            item.goodsSn = item['product' + name + 'Sn']
+          }
+        })
+      } else {
+        conArr = []
+      }
       return conArr
     },
     handleRowData (row) {
@@ -379,13 +407,14 @@ export default {
         this.dataSource[pos].productTypeArr.splice(i, 1)
         this.dataSource[pos].productTypeList.splice(i, 1)
       } else if (type === 'brandList') {
-        const j = this.dataSource[pos].productBrandArr.findIndex(con => con.brandSn == row.productBrandSn)
+        const j = this.dataSource[pos].productBrandArr.findIndex(con => con.brandSn == row.brandSn)
         this.dataSource[pos].productBrandArr.splice(j, 1)
         this.dataSource[pos].productBrandList.splice(j, 1)
       } else {
         const k = this.dataSource[pos].productThisList.findIndex(con => con.productSn == row.productSn)
         this.dataSource[pos].productThisList.splice(k, 1)
       }
+      this.$forceUpdate()
     }
   }
 }

+ 40 - 18
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -13,12 +13,19 @@
       bordered>
       <!-- 产品分类 -->
       <template slot="productType" slot-scope="text, record,index">
-        <div style="max-height:64px;overflow-y:scroll;" v-if="record.dataSourceOrigin=='0'">
+        <div style="max-height:126px;width:100%;overflow-y:scroll;">
           <a-row v-if="record.productTypeArr && record.productTypeArr.length>0">
-            <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')" v-for="con in record.productTypeArr" :key="con.id">
-                {{ con.title }}
-              </a-tag>
+            <a-col :span="16">
+              <div v-for="con in record.productTypeArr" :key="con.id">
+                <a-tooltip v-if="con.title&&con.title.length > 3" :title="con.title">
+                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
+                    {{ `${con.title.slice(0, 3)}...` }}
+                  </a-tag>
+                </a-tooltip>
+                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,con,'typeList')">
+                  {{ con.title }}
+                </a-tag>
+              </div>
             </a-col>
             <a-col :span="4" style="text-align:right;">
               <a-tag style="background: #fff; borderStyle: dashed;" @click="addClassifyTag(index, record)" color="blue">
@@ -34,17 +41,24 @@
             </a-col>
           </a-row>
         </div>
-        <span v-else v-for="con in record.productTypeArr" :key="con.id">{{ con.title }}</span>
       </template>
       <!-- 品牌 -->
       <template slot="productBrand" slot-scope="text, record,index">
-        <div style="max-height:64px;overflow-y:scroll;" v-if="record.dataSourceOrigin=='0'">
+        <div style="max-height:126px;overflow-y:scroll;">
           <a-row v-if="record.productBrandArr && record.productBrandArr.length>0">
-            <a-col :span="20">
-              <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')" v-for="item in record.productBrandArr" :key="item.brandSn">
-                {{ item.brandName }}
-              </a-tag>
+            <a-col :span="16">
+              <div v-for="item in record.productBrandArr" :key="item.brandSn">
+                <a-tooltip v-if="item.brandName&&item.brandName.length > 3" :title="item.brandName">
+                  <a-tag style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
+                    {{ `${item.brandName.slice(0, 3)}...` }}
+                  </a-tag>
+                </a-tooltip>
+                <a-tag v-else style="margin-bottom:10px;" closable @close.prevent="delLabel(record.productScopeSn,item,'brandList')">
+                  {{ item.brandName }}
+                </a-tag>
+              </div>
             </a-col>
+
             <a-col :span="4" style="text-align:right;">
               <a-tag style="background: #fff; borderStyle: dashed;" @click="addBrandTag(index, record)" color="blue">
                 <a-icon type="plus" /> 选择
@@ -59,7 +73,6 @@
             </a-col>
           </a-row>
         </div>
-        <span v-else v-for="item in record.productBrandArr" :key="item.brandSn">{{ item.brandName }}</span>
       </template>
       <!-- 产品 -->
       <template slot="product" slot-scope="text, record">
@@ -193,7 +206,13 @@
       <a-button id="tableType1-add" type="primary" class="button-gray" @click="handleAddRow">+新增一行</a-button>
     </div>
     <!-- 选择产品品牌 -->
-    <chooseBrandModal ref="brandBox" :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
+    <chooseBrandModal
+      pageType="1"
+      ref="brandBox"
+      :openModal="openBrandModal"
+      :chooseData="chooseBrand"
+      @close="openBrandModal=false"
+      @ok="handleBrandOk" />
     <!-- 选择产品分类 -->
     <chooseTypeModal
       ref="typeBox"
@@ -264,7 +283,6 @@ export default {
     },
     // 新增产品 数据
     setSourceData (list) {
-      debugger
       this.dataSource = this.dataSource.concat(list)
     },
     // 新增一行
@@ -279,7 +297,9 @@ export default {
             productTypeArr: [],
             productTypeList: [],
             productBrandArr: [],
-            productBrandList: []
+            productBrandList: [],
+            unitType: 'SL',
+            unitQty: 1
           }
           _this.dataSource.push(newData)
         } else {
@@ -324,7 +344,8 @@ export default {
             }
             newClassifyArr.push(objType2)
             const obj = JSON.parse(JSON.stringify(objType2))
-            obj.title = item.namePaths.replace(/,/g, '/')
+            const newName = item.namePaths.split(',')
+            obj.title = newName[1]
             classifyArr.push(obj)
           }
         }
@@ -337,7 +358,8 @@ export default {
           }
           newClassifyArr.push(objType3)
           const obj = JSON.parse(JSON.stringify(objType3))
-          obj.title = item.namePaths.replace(/,/g, '/')
+          const newName = item.namePaths.split(',')
+          obj.title = newName[1] + '/' + newName[2]
           classifyArr.push(obj)
         }
       })
@@ -449,7 +471,7 @@ export default {
         this.dataSource[pos].productTypeArr.splice(i, 1)
         this.dataSource[pos].productTypeList.splice(i, 1)
       } else if (type === 'brandList') {
-        const j = this.dataSource[pos].productBrandArr.findIndex(con => con.brandSn == row.productBrandSn)
+        const j = this.dataSource[pos].productBrandArr.findIndex(con => con.brandSn == row.brandSn)
         this.dataSource[pos].productBrandArr.splice(j, 1)
         this.dataSource[pos].productBrandList.splice(j, 1)
       }