Переглянути джерело

经销权设置 校验产品是否被包含在品牌分类中

chenrui 4 роки тому
батько
коміт
60399d62d6

+ 8 - 0
src/api/dealerScope.js

@@ -34,3 +34,11 @@ export const dealerScopeDel = (params) => {
     method: 'get'
   })
 }
+//  经销权  校验产品是否被包含在品牌分类中
+export const dealerScopeValidProduct = (params) => {
+  return axios({
+    url: '/dealerScope/validProductIsIncloude',
+    data: params,
+    method: 'post'
+  })
+}

+ 44 - 1
src/views/common/chooseProductsModal.vue

@@ -100,6 +100,7 @@
 import { STable } from '@/components'
 import { productBrandQuery } from '@/api/productBrand'
 import { productTypeQuery } from '@/api/productType'
+import { dealerScopeValidProduct } from '@/api/dealerScope'
 import { productList } from '@/api/product'
 export default {
   name: 'ChooseProductsModal',
@@ -118,6 +119,10 @@ export default {
     type: { //  类型,经销权设置dealership
       type: String,
       default: ''
+    },
+    dealerSn: {
+      type: String || Number,
+      default: ''
     }
   },
   data () {
@@ -168,7 +173,45 @@ export default {
       const _this = this
       _this.$refs.ruleForm.validate(valid => {
         if (valid) {
-          _this.getProductList(1)
+          if (_this.type == 'dealership') { //  设置经销权时选择产品
+            // 校验产品是否被包含在品牌分类中
+            const params = []
+            if (_this.queryParam.productBrandSn) {
+              params.push({
+                dealerSn: _this.dealerSn,
+                goodsType: 'BRAND',
+                goodsSn: _this.queryParam.productBrandSn
+              })
+            }
+            if (_this.queryParam.productTypeSn1) {
+              params.push({
+                dealerSn: _this.dealerSn,
+                goodsType: 'CATEGORY',
+                goodsSn: _this.queryParam.productTypeSn1
+              })
+            }
+            if (_this.queryParam.productTypeSn2) {
+              params.push({
+                dealerSn: _this.dealerSn,
+                goodsType: 'CATEGORY',
+                goodsSn: _this.queryParam.productTypeSn2
+              })
+            }
+            if (_this.queryParam.productTypeSn3) {
+              params.push({
+                dealerSn: _this.dealerSn,
+                goodsType: 'CATEGORY',
+                goodsSn: _this.queryParam.productTypeSn3
+              })
+            }
+            dealerScopeValidProduct(params).then(res => {
+              if (res.status == 200) {
+                _this.getProductList(1)
+              }
+            })
+          } else {
+            _this.getProductList(1)
+          }
         } else {
           return false
         }

+ 9 - 2
src/views/dealerManagement/merchantInfoManagement/permissionSetting.vue

@@ -91,7 +91,13 @@
     <!-- 选择产品分类 -->
     <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
     <!-- 选择产品 -->
-    <chooseProductsModal type="dealership" :openModal="openProductsModal" :chooseData="chooseProducts" @close="openProductsModal=false" @ok="handleProductsOk" />
+    <chooseProductsModal
+      type="dealership"
+      :dealerSn="$route.params.sn"
+      :openModal="openProductsModal"
+      :chooseData="chooseProducts"
+      @close="openProductsModal=false"
+      @ok="handleProductsOk" />
   </div>
 </template>
 
@@ -212,7 +218,8 @@ export default {
             }
           })
           if (type == 'PRODUCT') { //  选择产品
-            this.chooseProducts = productList
+            // this.chooseProducts = productList  //  包含先前所选产品
+            this.chooseProducts = [] //  不包含先前所选产品
             this.openProductsModal = true
           } else if (type == 'BRAND') { //  选择品牌
             this.chooseBrand = brandList