Przeglądaj źródła

Merge branch 'develop_cuxiao' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_cuxiao

lilei 1 rok temu
rodzic
commit
c995881c75

+ 5 - 0
src/views/common/chooseBrandModal.vue

@@ -216,6 +216,11 @@ export default {
           item.isDisabled = false
         }
       })
+      // this.$forceUpdate()
+    },
+    // 获取品牌长度
+    getAllBrandLength () {
+      return this.brandList.length
     }
   },
   watch: {

+ 1 - 0
src/views/common/chooseTypeModal.vue

@@ -143,6 +143,7 @@ export default {
       }
     },
     handleAllDisabled (list) {
+      console.log('111111111:', list)
       this.chooseList = list
     },
     // 禁用递归

+ 99 - 92
src/views/promotionRulesManagement/dealerPromotions/chooseProductsModal.vue

@@ -10,94 +10,92 @@
     :width="900">
     <a-spin :spinning="spinning" tip="Loading...">
       <div class="products-con">
-        <div>
-          <!-- 搜索条件 -->
-          <div class="table-page-search-wrapper">
-            <a-form-model
-              ref="ruleForm"
-              class="form-model-con"
-              layout="inline"
-              :model="queryParam"
-              @keyup.enter.native="handleSearch"
-              :label-col="formItemLayout.labelCol"
-              :wrapper-col="formItemLayout.wrapperCol">
-              <a-row :gutter="15">
-                <a-col :md="6" :sm="24">
-                  <a-form-model-item label="产品编码">
-                    <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
-                  </a-form-model-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
-                  <a-form-model-item label="产品名称">
-                    <a-input id="chooseProducts-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
-                  </a-form-model-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
-                  <a-form-model-item label="产品分类">
-                    <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="queryParam.productType" id="chooseProducts-productType"></productTypeAll>
-                  </a-form-model-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
-                  <a-form-model-item label="产品品牌">
-                    <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
-                  </a-form-model-item>
-                </a-col>
-                <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-                  <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chooseProducts-refresh">查询</a-button>
-                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
-                </a-col>
-              </a-row>
-            </a-form-model>
-          </div>
-          <div style="margin-bottom: 10px">
-            <a-button type="primary" ghost :loading="loading" @click="handleSave">批量添加</a-button>
-            <span style="margin-left: 5px">
-              <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
-            </span>
-          </div>
-          <!-- 列表 -->
-          <s-table
-            class="sTable"
-            ref="table"
-            size="small"
-            :rowKey="(record) => record.productSn"
-            rowKeyName="productSn"
-            :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: this.chooseDataList && this.chooseDataList.indexOf(record.productSn) > -1 }}) }"
-            @rowSelection="rowSelectionFun"
-            :columns="columns"
-            :data="loadData"
-            :defaultLoadData="false"
-            style="max-height:580px;"
-            :scroll="{ y: 520 }"
-            bordered>
-            <!-- 产品分类 -->
-            <template slot="productType" slot-scope="text, record">
-              <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
-              <span v-else>--</span>
-            </template>
-            <!-- 包装数 -->
-            <template slot="productQty" slot-scope="text, record">
-              <span v-if="record.packQty">
-                {{ record.packQty }}{{ record.unit }}{{ '/'+record.packQtyUnit }}
-              </span>
-              <span v-else>--</span>
-            </template>
-          </s-table>
+        <!-- 搜索条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form-model
+            ref="ruleForm"
+            class="form-model-con"
+            layout="inline"
+            :model="queryParam"
+            :label-col="formItemLayout.labelCol"
+            :wrapper-col="formItemLayout.wrapperCol">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品编码">
+                  <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品名称">
+                  <a-input id="chooseProducts-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品分类">
+                  <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="queryParam.productType" id="chooseProducts-productType"></productTypeAll>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品品牌">
+                  <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chooseProducts-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetData" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form-model>
+        </div>
+        <div style="margin-bottom: 10px">
+          <a-button type="primary" ghost :loading="loading" @click="handleSave">批量添加</a-button>
+          <span style="margin-left: 5px">
+            <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
+          </span>
         </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.productSn"
+          rowKeyName="productSn"
+          :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: this.chooseDataList && this.chooseDataList.indexOf(record.productSn) > -1 } })}"
+          @rowSelection="rowSelectionFun"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          style="max-height:460px;"
+          :scroll="{ y: 400 }"
+          bordered>
+          <!-- 产品分类 -->
+          <template slot="productType" slot-scope="text, record">
+            <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
+            <span v-else>--</span>
+          </template>
+          <!-- 包装数 -->
+          <template slot="productQty" slot-scope="text, record">
+            <span v-if="record.packQty">
+              {{ record.packQty }}{{ record.unit }}{{ record.packQtyUnit?'/'+record.packQtyUnit:'' }}
+            </span>
+            <span v-else>--</span>
+          </template>
+        </s-table>
       </div>
     </a-spin>
   </a-modal>
 </template>
 
 <script>
+import { commonMixin } from '@/utils/mixin'
 import { STable } from '@/components'
-import tablePagination from '@/views/common/tablePagination.vue'
+import { productList } from '@/api/product'
 import ProductBrand from '@/views/common/productBrand.js'
 import productTypeAll from '@/views/common/productTypeAll.js'
-import { productList } from '@/api/product'
 export default {
   name: 'ChooseProductsModal',
-  components: { STable, tablePagination, ProductBrand, productTypeAll },
+  components: { STable, ProductBrand, productTypeAll },
+  mixins: [commonMixin],
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -111,6 +109,7 @@ export default {
     }
   },
   data () {
+    const _this = this
     return {
       spinning: false,
       isShow: this.openModal, //  是否打开弹框
@@ -135,6 +134,9 @@ export default {
         { title: '产品编码', dataIndex: 'code', align: 'center' },
         { title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
         { title: '原厂编码', dataIndex: 'origCode', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '品牌', dataIndex: 'productBrandName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
         { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '10%', align: 'center' },
         { title: '包装数', scopedSlots: { customRender: 'productQty' }, align: 'center' },
@@ -181,22 +183,23 @@ export default {
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
       this.queryParam.productType = []
-    },
-    //  重置
-    resetSearchForm () {
-      this.resetData()
       this.$nextTick(() => {
         this.$refs.table.refresh()
-        this.$refs.table.clearTable()
       })
     },
+    //  清空选项
+    resetSearchForm () {
+      this.rowSelectionInfo = null
+      this.$refs.table.clearSelected()
+    },
     // 保存
     handleSave () {
       if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
-      this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows)
+      const resultList = JSON.parse(JSON.stringify(this.rowSelectionInfo && this.rowSelectionInfo.selectedRows))
+      this.$emit('ok', resultList)
       this.isShow = false
     },
     //  产品分类  change
@@ -205,6 +208,7 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     },
+    // 禁用
     handleDisabled (list) {
       this.chooseDataList = list
     }
@@ -217,19 +221,22 @@ export default {
     //  重定义的弹框状态
     isShow (newValue, oldValue) {
       if (!newValue) {
+        this.resetSearchForm()
         this.$emit('close')
       } else {
         const _this = this
-        _this.resetSearchForm()
-        let selectedRows = []
-        const selectedRowKeys = []
-        selectedRows = _this.chooseData
-        _this.chooseData.map(item => {
-          selectedRowKeys.push(item.goodsSn)
-        })
-        this.$nextTick(() => { // 页面渲染完成后的回调
-          _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
-        })
+        _this.resetData()
+        if (_this.chooseData && _this.chooseData.length > 0) {
+          let selectedRows = []
+          const selectedRowKeys = []
+          _this.chooseData.forEach(item => {
+            selectedRowKeys.push(item.goodsSn)
+          })
+          selectedRows = _this.chooseData
+          this.$nextTick(() => { // 页面渲染完成后的回调
+            _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
+          })
+        }
       }
     }
   }

+ 10 - 2
src/views/promotionRulesManagement/dealerPromotions/detail.vue

@@ -105,7 +105,13 @@
           </template>
         </s-table>
         <div style="text-align:center;margin-top:20px;" v-if="$route.query.type=='rule'">
-          <a-button type="primary" size="large" style="padding:0 30px;" @click="handleSubmit" :disabled="disabled">提交</a-button>
+          <a-button
+            type="primary"
+            size="large"
+            style="padding:0 30px;"
+            @click="handleSubmit"
+            :disabled="disabled"
+            v-if="mainContentList&&mainContentList.length>0">提交</a-button>
         </div>
       </a-card>
     </a-spin>
@@ -168,10 +174,12 @@ export default {
             this.disabled = false
           }
           this.spinning = false
+          this.mainContentList = data.list
           return data
         })
       },
-      detailSn: null
+      detailSn: null,
+      mainContentList: []
     }
   },
   computed: {

+ 1 - 1
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -150,7 +150,7 @@
     <edit-active-end-time ref="editTime" v-drag :openModal="editEndModal" @ok="$refs.table.refresh()" @close="editEndModal=false" />
     <!-- 审核弹窗 -->
     <a-modal
-      :closable="false"
+      closable
       v-model="openAuditModal"
       :footer="null"
       width="416px"

+ 12 - 1
src/views/promotionRulesManagement/dealerPromotions/sendAmountModal.vue

@@ -330,8 +330,14 @@ export default {
             if (form.gateProductList.length == 0) {
               _this.$message.warning('请添加门槛产品!')
               return
+            } else {
+              const qtyFlag = form.gateProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
+              if (qtyFlag) {
+                _this.$message.warning('订单起订量设置不能为空!')
+                return
+              }
+              rowFlag1 = _this.isJudge(form.gateProductList)
             }
-            rowFlag1 = _this.isJudge(form.gateProductList)
           } else {
             form.gateProductList = []
             form.gateAmount = ''
@@ -354,6 +360,11 @@ export default {
             _this.$message.warning('请添加正价产品!')
             return
           } else {
+            const qtyFlag = form.regularProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
+            if (qtyFlag) {
+              _this.$message.warning('订单起订量设置不能为空!')
+              return
+            }
             rowFlag3 = _this.isJudge(form.regularProductList)
           }
 

+ 12 - 2
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -364,8 +364,14 @@ export default {
             if (form.gateProductList.length == 0) {
               _this.$message.warning('请添加门槛产品!')
               return
+            } else {
+              const qtyFlag = form.gateProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
+              if (qtyFlag) {
+                _this.$message.warning('订单起订量设置不能为空!')
+                return
+              }
+              rowFlag1 = _this.isJudge(form.gateProductList)
             }
-            rowFlag1 = _this.isJudge(form.gateProductList)
           } else {
             form.gateProductList = []
             form.gateAmount = ''
@@ -388,11 +394,15 @@ export default {
             _this.$message.warning('请添加正价产品!')
             return
           } else {
+            const qtyFlag = form.regularProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
+            if (qtyFlag) {
+              _this.$message.warning('订单起订量设置不能为空!')
+              return
+            }
             rowFlag3 = _this.isJudge(form.regularProductList)
           }
           if (rowFlag1 || rowFlag2 || rowFlag3) {
             _this.$message.warning('请选择产品分类、品牌或产品!')
-            return
           }
           form.promotionSn = _this.promotionSn
           _this.spinning = true

+ 78 - 6
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -145,7 +145,7 @@
       :openModal="openProductsModal"
       :chooseData="chooseProducts"
       @close="openProductsModal=false"
-      @ok="handleProductsOk" />
+      @ok="handleProductsAdd" />
     <!-- 导入产品 -->
     <importGuideModal :goodFlag="chooseVal=='a'?'1':'0'" :openModal="openGuideModal" @close="closeGuideModel" @ok="hanldeOk" />
   </a-modal>
@@ -258,11 +258,17 @@ export default {
             if (form.gateProductList.length == 0) {
               _this.$message.warning('请添加门槛产品!')
               return
-            }
-            const rowFlag = _this.isJudge(form.gateProductList)
-            if (rowFlag) {
-              _this.$message.warning('请选择产品分类、品牌或产品!')
-              return
+            } else {
+              const qtyFlag = form.gateProductList.some(newCon => { return (!newCon.unitType || !newCon.unitQty) })
+              if (qtyFlag) {
+                _this.$message.warning('订单起订量设置不能为空!')
+                return
+              }
+              const rowFlag = _this.isJudge(form.gateProductList)
+              if (rowFlag) {
+                _this.$message.warning('请选择产品分类、品牌或产品!')
+                return
+              }
             }
           } else {
             form.gateProductList = []
@@ -274,6 +280,28 @@ export default {
           if (form.specialProductList.length == 0) {
             _this.$message.warning('请添加特价产品!')
             return
+          } else {
+            // 为空判断
+            const isTypeEmpty = form.specialProductList.some(item => (item.productTypeList && item.productTypeList.length == 0) && (item.productTypeList && item.productTypeList.length == 0))
+            if (isTypeEmpty) {
+              _this.$message.warning('产品分类或品牌不能为空!')
+              return
+            }
+            const isNumEmpty = form.specialProductList.some(item => (!item.unitType || !item.unitQty))
+            if (isNumEmpty) {
+              _this.$message.warning('订单起订量设置不能为空!')
+              return
+            }
+            const isCountEmpty = _this.isNumEmpty(form.specialProductList)
+            const isMoneyEmpty = _this.isNumEmpty(form.specialProductList)
+            if (isCountEmpty.flag) {
+              _this.$message.warning('促销比例不能为空!')
+              return
+            }
+            if (isCountEmpty.flag1) {
+              _this.$message.warning('促销金额不能为空!')
+              return
+            }
           }
           form.promotionSn = _this.promotionSn
           _this.spinning = true
@@ -294,6 +322,22 @@ export default {
         }
       })
     },
+    isNumEmpty (dataList) {
+      const arr = []
+      const arr1 = []
+      dataList.forEach(item => {
+        if (item.dataSourceOrigin === '0') { // 判断分类品牌
+          if (!item.provinceDiscountRate || !item.cityDiscountRate || !item.specialDiscountRate) {
+            arr.push(item.productScopeSn)
+          }
+        } else {
+          if (!item.cityDiscountPrice || !item.provinceDiscountPrice || !item.specialDiscountPrice) {
+            arr1.push(item.productScopeSn)
+          }
+        }
+      })
+      return { flag: arr.length > 0, flag1: arr1.length > 0 }
+    },
     // 判断门槛产品中品牌,分类,产品其中一个必填
     isJudge (list) {
       const flag = list.some(con => {
@@ -482,6 +526,34 @@ export default {
       })
       return snArr
     },
+    handleProductsAdd (con) {
+      debugger
+      const newArr = []
+      con.forEach(newCon => {
+        if (!newCon.provincePrice || !newCon.cityPrice || !newCon.specialPrice) {
+          newArr.push(newCon.code)
+        }
+      })
+      con.map((list, pos) => {
+        if (!list.provincePrice || !list.cityPrice || !list.specialPrice) {
+          con.splice(pos, 1)
+        }
+      })
+      const _this = this
+      if (newArr && newArr.length > 0) {
+        _this.$info({
+          title: '提示',
+          content: newArr.toString() + '(产品编码),没有定价,不可添加',
+          closable: true,
+          centered: true,
+          onOk () {
+            _this.handleProductsOk(con)
+          }
+        })
+      } else {
+        _this.handleProductsOk(con)
+      }
+    },
     // +新增产品
     handleProductsOk (con) {
       const _this = this

+ 181 - 16
src/views/promotionRulesManagement/dealerPromotions/tableType1.vue

@@ -121,6 +121,7 @@
           v-model="record.unitQty"
           :min="0"
           :step="1"
+          :max="999999"
           :precision="0"
           placeholder="请输入"/>
       </template>
@@ -160,7 +161,7 @@
       ref="productBox"
       :openModal="openProductsModal"
       :chooseData="chooseProducts"
-      @close="openProductsModal=false"
+      @close="closeProductModal"
       @ok="handleProductsOk" />
   </div>
 </template>
@@ -199,7 +200,11 @@ export default {
     }
   },
   methods: {
-  // 新增一行
+    closeProductModal () {
+      this.chooseProducts = []
+      this.openProductsModal = false
+    },
+    // 新增一行
     handleAddRow () {
       const _this = this
       _this.spinning = false
@@ -259,13 +264,44 @@ export default {
       this.openTypeModal = true
       this.chooseType = this.handleRowData(row)
       const getArr = this.setTypeShowData()
-      // 获取所选品牌
-      const dataList = this.setShowData('Brand')
-      if (dataList && dataList.length == 0) {
-        this.$refs.typeBox.handleAllDisabled(getArr)
+      // 无品牌有分类的选择数据
+      const onlyTypeData = this.onlyType()
+      // 获取品牌重复数据
+      var flag = false
+      var c_typeArr = []
+      this.dataSource.forEach(item => {
+        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
+          item.productBrandList.forEach((con) => {
+            row.productBrandList.forEach(newCon => {
+              if (newCon.productBrandSn == con.productBrandSn) {
+                flag = true
+                c_typeArr = c_typeArr.concat(item.productTypeList)
+              }
+            })
+          })
+        }
+      })
+      const disTypeList = []
+      getArr.forEach(con => {
+        c_typeArr.forEach(item => {
+          for (const i in item) {
+            if (item[i] == con.goodsSn) {
+              disTypeList.push(con)
+            }
+          }
+        })
+      })
+      var uniqueArr = [...new Set(disTypeList)]
+
+      if (row.productBrandArr && row.productBrandArr.length == 0) {
+        this.$refs.typeBox.handleAllDisabled(onlyTypeData)
       } else {
-        this.chooseType = []
-        this.$refs.typeBox.handleAllDisabled([])
+        if (flag) {
+          this.$refs.typeBox.handleAllDisabled(uniqueArr)
+        } else {
+          this.chooseType = []
+          this.$refs.typeBox.handleAllDisabled([])
+        }
       }
     },
     handleTypeOk (mainArr) {
@@ -321,12 +357,43 @@ export default {
     addBrandTag (pos, row) {
       const _this = this
       _this.brandTagIndex = pos
-      // 每行品牌都是唯一滴
+      // 选中的所有品牌
       const dataList = _this.setShowData('Brand')
       _this.openBrandModal = true
+      // 回显当前行选中
       const echoData = _this.handleEchoData('Brand', row.productBrandList)
       _this.chooseBrand = echoData
-      _this.$refs.brandBox.handleDisabled(dataList)
+      // 只有品牌没有分类
+      const onlyBrandData = this.onlyBrand()
+      // 同行中分类是否与所选分类相同   已选分类
+      var flag = false
+      var c_brandArr = []
+      this.dataSource.forEach(item => {
+        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
+          item.productTypeArr.forEach((con) => {
+            row.productTypeArr.forEach(newCon => {
+              if (newCon.id == con.id) {
+                flag = true
+                c_brandArr = c_brandArr.concat(item.productBrandList)
+              }
+            })
+          })
+        }
+      })
+
+      const reBrandArr = c_brandArr.map(list => {
+        return list.productBrandSn
+      })
+      if (row.productTypeArr && row.productTypeArr.length == 0) {
+        _this.$refs.brandBox.handleDisabled(onlyBrandData)
+      } else {
+        if (flag) { // 当前行有重复分类
+          _this.$refs.brandBox.handleDisabled(reBrandArr)
+        } else {
+          _this.chooseBrand = []
+          _this.$refs.brandBox.handleDisabled([])
+        }
+      }
     },
     handleBrandOk (conList) {
       const newConList = conList.map(con => {
@@ -371,6 +438,46 @@ export default {
       })
       return snArr
     },
+    // 只有分类
+    onlyType (name, onlyName) {
+      const _this = this
+      const snArr = []
+      _this.dataSource.forEach(item => {
+        if (item.productTypeList && item.productTypeList.length > 0) {
+          if (!item.productBrandList || (item.productBrandList && item.productBrandList.length == 0)) {
+            item.productTypeList.forEach(con => {
+              for (const i in con) {
+                const newObj = {
+                  goodsSn: con[i]
+                }
+                if (i === 'productTypeSn1') {
+                  newObj.disabled = true
+                } else {
+                  newObj.disableCheckbox = true
+                }
+                snArr.push(newObj)
+              }
+            })
+          }
+        }
+      })
+      return snArr
+    },
+    // 只有品牌
+    onlyBrand () {
+      const _this = this
+      var snArr = []
+      _this.dataSource.forEach(item => {
+        if (item.productBrandList && item.productBrandList.length > 0) {
+          if (!item.productTypeArr || (item.productTypeArr && item.productTypeArr.length == 0)) {
+            item.productBrandList.forEach(con => {
+              snArr.push(con.productBrandSn)
+            })
+          }
+        }
+      })
+      return snArr
+    },
     handleEchoData (name, conArr) {
       if (conArr) {
         conArr.map(item => {
@@ -446,18 +553,76 @@ export default {
     delLabel (sn, row, type) {
       const pos = this.dataSource.findIndex(con => con.productScopeSn == sn)
       if (type === 'typeList') {
-        const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
-        this.dataSource[pos].productTypeArr.splice(i, 1)
-        this.dataSource[pos].productTypeList.splice(i, 1)
+        // 判断品牌是否有重复 重复值有无分类
+        const isRepeatBrandFlag = this.isRepeatBrand(this.dataSource[pos])
+        const uniqueArr1 = this.dataSource[pos].productTypeList && this.dataSource[pos].productTypeList.length > 0 ? this.dataSource[pos].productTypeList : []
+        if (isRepeatBrandFlag.flag && isRepeatBrandFlag.noTypeFlag && uniqueArr1.length == 1) {
+          this.dataSource.splice(pos, 1)
+        } else {
+          const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
+          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.brandSn)
-        this.dataSource[pos].productBrandArr.splice(j, 1)
-        this.dataSource[pos].productBrandList.splice(j, 1)
+        const isRepeatTypeFlag = this.isRepeatType(this.dataSource[pos])
+        const uniqueArr = this.dataSource[pos].productBrandList && this.dataSource[pos].productBrandList.length > 0 ? this.dataSource[pos].productBrandList : []
+        if (isRepeatTypeFlag.flag && isRepeatTypeFlag.noTypeFlag && uniqueArr.length == 1) {
+          this.dataSource.splice(pos, 1)
+        } else {
+          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()
+    },
+    // 判断当前行是否有重复品牌
+    isRepeatBrand (row) {
+      var flag = false
+      var noTypeFlag = false
+      var c_typeArr = []
+      this.dataSource.forEach(item => {
+        if (item.productBrandList && item.productBrandList.length > 0) {
+          item.productBrandList.forEach((con) => {
+            row.productBrandList.forEach(newCon => {
+              if (newCon.productBrandSn == con.productBrandSn) {
+                flag = true
+                if (item.productTypeList && item.productTypeList.length == 0) {
+                  noTypeFlag = true
+                } else {
+                  c_typeArr = c_typeArr.concat(item.productTypeList)
+                }
+              }
+            })
+          })
+        }
+      })
+      return { list: c_typeArr, flag: flag, noTypeFlag: noTypeFlag }
+    },
+    isRepeatType (row) {
+      var flag = false
+      var noTypeFlag = false
+      var c_brandArr = []
+      this.dataSource.forEach(item => {
+        if (item.productTypeArr && item.productTypeArr.length > 0) {
+          item.productTypeArr.forEach((con) => {
+            row.productTypeArr.forEach(newCon => {
+              if (newCon.id == con.id) {
+                flag = true
+                if (item.productBrandList && item.productBrandList.length == 0) {
+                  noTypeFlag = true
+                } else {
+                  c_brandArr = c_brandArr.concat(item.productBrandList)
+                }
+              }
+            })
+          })
+        }
+      })
+      return { list: c_brandArr, flag: flag, noTypeFlag: noTypeFlag }
     }
   }
 }

+ 176 - 9
src/views/promotionRulesManagement/dealerPromotions/tableType2.vue

@@ -235,7 +235,45 @@ export default {
       this.openTypeModal = true
       this.chooseType = this.handleRowData(row)
       const getArr = this.setTypeShowData()
-      this.$refs.typeBox.handleAllDisabled(getArr)
+      // 无品牌有分类的选择数据
+      const onlyTypeData = this.onlyType()
+      // 获取品牌重复数据
+      var flag = false
+      var c_typeArr = []
+      this.dataSource.forEach(item => {
+        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
+          item.productBrandList.forEach((con) => {
+            row.productBrandList.forEach(newCon => {
+              if (newCon.productBrandSn == con.productBrandSn) {
+                flag = true
+                c_typeArr = c_typeArr.concat(item.productTypeList)
+              }
+            })
+          })
+        }
+      })
+      const disTypeList = []
+      getArr.forEach(con => {
+        c_typeArr.forEach(item => {
+          for (const i in item) {
+            if (item[i] == con.goodsSn) {
+              disTypeList.push(con)
+            }
+          }
+        })
+      })
+      var uniqueArr = [...new Set(disTypeList)]
+
+      if (row.productBrandArr && row.productBrandArr.length == 0) {
+        this.$refs.typeBox.handleAllDisabled(onlyTypeData)
+      } else {
+        if (flag) {
+          this.$refs.typeBox.handleAllDisabled(uniqueArr)
+        } else {
+          this.chooseType = []
+          this.$refs.typeBox.handleAllDisabled([])
+        }
+      }
     },
     handleTypeOk (mainArr) {
       const classifyArr = []
@@ -288,12 +326,43 @@ export default {
     addBrandTag (pos, row) {
       const _this = this
       _this.brandTagIndex = pos
-      // 每行品牌都是唯一滴
+      // 选中的所有品牌
       const dataList = _this.setShowData('Brand')
       _this.openBrandModal = true
+      // 回显当前行选中
       const echoData = _this.handleEchoData('Brand', row.productBrandList)
       _this.chooseBrand = echoData
-      _this.$refs.brandBox.handleDisabled(dataList)
+      // 只有品牌没有分类
+      const onlyBrandData = this.onlyBrand()
+      // 同行中分类是否与所选分类相同   已选分类
+      var flag = false
+      var c_brandArr = []
+      this.dataSource.forEach(item => {
+        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
+          item.productTypeArr.forEach((con) => {
+            row.productTypeArr.forEach(newCon => {
+              if (newCon.id == con.id) {
+                flag = true
+                c_brandArr = c_brandArr.concat(item.productBrandList)
+              }
+            })
+          })
+        }
+      })
+
+      const reBrandArr = c_brandArr.map(list => {
+        return list.productBrandSn
+      })
+      if (row.productTypeArr && row.productTypeArr.length == 0) {
+        _this.$refs.brandBox.handleDisabled(onlyBrandData)
+      } else {
+        if (flag) { // 当前行有重复分类
+          _this.$refs.brandBox.handleDisabled(reBrandArr)
+        } else {
+          _this.chooseBrand = []
+          _this.$refs.brandBox.handleDisabled([])
+        }
+      }
     },
     handleBrandOk (conList) {
       const newConList = conList.map(con => {
@@ -338,6 +407,46 @@ export default {
       })
       return snArr
     },
+    // 只有分类
+    onlyType (name, onlyName) {
+      const _this = this
+      const snArr = []
+      _this.dataSource.forEach(item => {
+        if (item.productTypeList && item.productTypeList.length > 0) {
+          if (!item.productBrandList || (item.productBrandList && item.productBrandList.length == 0)) {
+            item.productTypeList.forEach(con => {
+              for (const i in con) {
+                const newObj = {
+                  goodsSn: con[i]
+                }
+                if (i === 'productTypeSn1') {
+                  newObj.disabled = true
+                } else {
+                  newObj.disableCheckbox = true
+                }
+                snArr.push(newObj)
+              }
+            })
+          }
+        }
+      })
+      return snArr
+    },
+    // 只有品牌
+    onlyBrand () {
+      const _this = this
+      var snArr = []
+      _this.dataSource.forEach(item => {
+        if (item.productBrandList && item.productBrandList.length > 0) {
+          if (!item.productTypeArr || (item.productTypeArr && item.productTypeArr.length == 0)) {
+            item.productBrandList.forEach(con => {
+              snArr.push(con.productBrandSn)
+            })
+          }
+        }
+      })
+      return snArr
+    },
     handleEchoData (name, conArr) {
       if (conArr) {
         conArr.map(item => {
@@ -413,18 +522,76 @@ export default {
     delLabel (sn, row, type) {
       const pos = this.dataSource.findIndex(con => con.productScopeSn == sn)
       if (type === 'typeList') {
-        const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
-        this.dataSource[pos].productTypeArr.splice(i, 1)
-        this.dataSource[pos].productTypeList.splice(i, 1)
+      // 判断品牌是否有重复 重复值有无分类
+        const isRepeatBrandFlag = this.isRepeatBrand(this.dataSource[pos])
+        const uniqueArr1 = this.dataSource[pos].productTypeList && this.dataSource[pos].productTypeList.length > 0 ? this.dataSource[pos].productTypeList : []
+        if (isRepeatBrandFlag.flag && isRepeatBrandFlag.noTypeFlag && uniqueArr1.length == 1) {
+          this.dataSource.splice(pos, 1)
+        } else {
+          const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
+          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.brandSn)
-        this.dataSource[pos].productBrandArr.splice(j, 1)
-        this.dataSource[pos].productBrandList.splice(j, 1)
+        const isRepeatTypeFlag = this.isRepeatType(this.dataSource[pos])
+        const uniqueArr = this.dataSource[pos].productBrandList && this.dataSource[pos].productBrandList.length > 0 ? this.dataSource[pos].productBrandList : []
+        if (isRepeatTypeFlag.flag && isRepeatTypeFlag.noTypeFlag && uniqueArr.length == 1) {
+          this.dataSource.splice(pos, 1)
+        } else {
+          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()
+    },
+    // 判断当前行是否有重复品牌
+    isRepeatBrand (row) {
+      var flag = false
+      var noTypeFlag = false
+      var c_typeArr = []
+      this.dataSource.forEach(item => {
+        if (item.productBrandList && item.productBrandList.length > 0) {
+          item.productBrandList.forEach((con) => {
+            row.productBrandList.forEach(newCon => {
+              if (newCon.productBrandSn == con.productBrandSn) {
+                flag = true
+                if (item.productTypeList && item.productTypeList.length == 0) {
+                  noTypeFlag = true
+                } else {
+                  c_typeArr = c_typeArr.concat(item.productTypeList)
+                }
+              }
+            })
+          })
+        }
+      })
+      return { list: c_typeArr, flag: flag, noTypeFlag: noTypeFlag }
+    },
+    isRepeatType (row) {
+      var flag = false
+      var noTypeFlag = false
+      var c_brandArr = []
+      this.dataSource.forEach(item => {
+        if (item.productTypeArr && item.productTypeArr.length > 0) {
+          item.productTypeArr.forEach((con) => {
+            row.productTypeArr.forEach(newCon => {
+              if (newCon.id == con.id) {
+                flag = true
+                if (item.productBrandList && item.productBrandList.length == 0) {
+                  noTypeFlag = true
+                } else {
+                  c_brandArr = c_brandArr.concat(item.productBrandList)
+                }
+              }
+            })
+          })
+        }
+      })
+      return { list: c_brandArr, flag: flag, noTypeFlag: noTypeFlag }
     }
   }
 }

+ 180 - 9
src/views/promotionRulesManagement/dealerPromotions/tableType3.vue

@@ -322,7 +322,45 @@ export default {
       this.openTypeModal = true
       this.chooseType = this.handleRowData(row)
       const getArr = this.setTypeShowData()
-      this.$refs.typeBox.handleAllDisabled(getArr)
+      // 无品牌有分类的选择数据
+      const onlyTypeData = this.onlyType()
+      // 获取品牌重复数据
+      var flag = false
+      var c_typeArr = []
+      this.dataSource.forEach(item => {
+        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
+          item.productBrandList.forEach((con) => {
+            row.productBrandList.forEach(newCon => {
+              if (newCon.productBrandSn == con.productBrandSn) {
+                flag = true
+                c_typeArr = c_typeArr.concat(item.productTypeList)
+              }
+            })
+          })
+        }
+      })
+      const disTypeList = []
+      getArr.forEach(con => {
+        c_typeArr.forEach(item => {
+          for (const i in item) {
+            if (item[i] == con.goodsSn) {
+              disTypeList.push(con)
+            }
+          }
+        })
+      })
+      var uniqueArr = [...new Set(disTypeList)]
+
+      if (row.productBrandArr && row.productBrandArr.length == 0) {
+        this.$refs.typeBox.handleAllDisabled(onlyTypeData)
+      } else {
+        if (flag) {
+          this.$refs.typeBox.handleAllDisabled(uniqueArr)
+        } else {
+          this.chooseType = []
+          this.$refs.typeBox.handleAllDisabled([])
+        }
+      }
     },
     handleTypeOk (mainArr) {
       const classifyArr = []
@@ -374,12 +412,43 @@ export default {
     addBrandTag (pos, row) {
       const _this = this
       _this.brandTagIndex = pos
-      // 每行品牌都是唯一滴
+      // 选中的所有品牌
       const dataList = _this.setShowData('Brand')
       _this.openBrandModal = true
+      // 回显当前行选中
       const echoData = _this.handleEchoData('Brand', row.productBrandList)
       _this.chooseBrand = echoData
-      _this.$refs.brandBox.handleDisabled(dataList)
+      // 只有品牌没有分类
+      const onlyBrandData = this.onlyBrand()
+      // 同行中分类是否与所选分类相同   已选分类
+      var flag = false
+      var c_brandArr = []
+      this.dataSource.forEach(item => {
+        if ((item.productTypeArr && item.productTypeArr.length > 0) && (item.productBrandList && item.productBrandList.length > 0)) {
+          item.productTypeArr.forEach((con) => {
+            row.productTypeArr.forEach(newCon => {
+              if (newCon.id == con.id) {
+                flag = true
+                c_brandArr = c_brandArr.concat(item.productBrandList)
+              }
+            })
+          })
+        }
+      })
+
+      const reBrandArr = c_brandArr.map(list => {
+        return list.productBrandSn
+      })
+      if (row.productTypeArr && row.productTypeArr.length == 0) {
+        _this.$refs.brandBox.handleDisabled(onlyBrandData)
+      } else {
+        if (flag) { // 当前行有重复分类
+          _this.$refs.brandBox.handleDisabled(reBrandArr)
+        } else {
+          _this.chooseBrand = []
+          _this.$refs.brandBox.handleDisabled([])
+        }
+      }
     },
     handleBrandOk (conList) {
       const newConList = conList.map(con => {
@@ -404,6 +473,46 @@ export default {
       })
       return snArr
     },
+    // 只有分类
+    onlyType (name, onlyName) {
+      const _this = this
+      const snArr = []
+      _this.dataSource.forEach(item => {
+        if (item.productTypeList && item.productTypeList.length > 0) {
+          if (!item.productBrandList || (item.productBrandList && item.productBrandList.length == 0)) {
+            item.productTypeList.forEach(con => {
+              for (const i in con) {
+                const newObj = {
+                  goodsSn: con[i]
+                }
+                if (i === 'productTypeSn1') {
+                  newObj.disabled = true
+                } else {
+                  newObj.disableCheckbox = true
+                }
+                snArr.push(newObj)
+              }
+            })
+          }
+        }
+      })
+      return snArr
+    },
+    // 只有品牌
+    onlyBrand () {
+      const _this = this
+      var snArr = []
+      _this.dataSource.forEach(item => {
+        if (item.productBrandList && item.productBrandList.length > 0) {
+          if (!item.productTypeArr || (item.productTypeArr && item.productTypeArr.length == 0)) {
+            item.productBrandList.forEach(con => {
+              snArr.push(con.productBrandSn)
+            })
+          }
+        }
+      })
+      return snArr
+    },
     handleEchoData (name, conArr) {
       conArr.map(item => {
         if (name === 'This') {
@@ -472,14 +581,76 @@ export default {
     delLabel (sn, row, type) {
       const pos = this.dataSource.findIndex(con => con.productScopeSn == sn)
       if (type === 'typeList') {
-        const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
-        this.dataSource[pos].productTypeArr.splice(i, 1)
-        this.dataSource[pos].productTypeList.splice(i, 1)
+        // 判断品牌是否有重复 重复值有无分类
+        const isRepeatBrandFlag = this.isRepeatBrand(this.dataSource[pos])
+        const uniqueArr1 = this.dataSource[pos].productTypeList && this.dataSource[pos].productTypeList.length > 0 ? this.dataSource[pos].productTypeList : []
+        if (isRepeatBrandFlag.flag && isRepeatBrandFlag.noTypeFlag && uniqueArr1.length == 1) {
+          this.dataSource.splice(pos, 1)
+        } else {
+          const i = this.dataSource[pos].productTypeArr.findIndex(con => con.id == row.id)
+          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.brandSn)
-        this.dataSource[pos].productBrandArr.splice(j, 1)
-        this.dataSource[pos].productBrandList.splice(j, 1)
+        const isRepeatTypeFlag = this.isRepeatType(this.dataSource[pos])
+        const uniqueArr = this.dataSource[pos].productBrandList && this.dataSource[pos].productBrandList.length > 0 ? this.dataSource[pos].productBrandList : []
+        if (isRepeatTypeFlag.flag && isRepeatTypeFlag.noTypeFlag && uniqueArr.length == 1) {
+          this.dataSource.splice(pos, 1)
+        } else {
+          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()
+    },
+    // 判断当前行是否有重复品牌
+    isRepeatBrand (row) {
+      var flag = false
+      var noTypeFlag = false
+      var c_typeArr = []
+      this.dataSource.forEach(item => {
+        if (item.productBrandList && item.productBrandList.length > 0) {
+          item.productBrandList.forEach((con) => {
+            row.productBrandList.forEach(newCon => {
+              if (newCon.productBrandSn == con.productBrandSn) {
+                flag = true
+                if (item.productTypeList && item.productTypeList.length == 0) {
+                  noTypeFlag = true
+                } else {
+                  c_typeArr = c_typeArr.concat(item.productTypeList)
+                }
+              }
+            })
+          })
+        }
+      })
+      return { list: c_typeArr, flag: flag, noTypeFlag: noTypeFlag }
+    },
+    isRepeatType (row) {
+      var flag = false
+      var noTypeFlag = false
+      var c_brandArr = []
+      this.dataSource.forEach(item => {
+        if (item.productTypeArr && item.productTypeArr.length > 0) {
+          item.productTypeArr.forEach((con) => {
+            row.productTypeArr.forEach(newCon => {
+              if (newCon.id == con.id) {
+                flag = true
+                if (item.productBrandList && item.productBrandList.length == 0) {
+                  noTypeFlag = true
+                } else {
+                  c_brandArr = c_brandArr.concat(item.productBrandList)
+                }
+              }
+            })
+          })
+        }
+      })
+      return { list: c_brandArr, flag: flag, noTypeFlag: noTypeFlag }
     }
   }
 }