Browse Source

bug修复

chenrui 3 years ago
parent
commit
cfb488b574

+ 18 - 8
src/views/common/chooseProductsModal.vue

@@ -108,7 +108,7 @@
 <script>
 import { STable } from '@/components'
 import { productBrandQuery } from '@/api/productBrand'
-import { productTypeQuery } from '@/api/productType'
+import { productTypeQuery, productTypeQueryAll } from '@/api/productType'
 import { dealerScopeValidProduct } from '@/api/dealerScope'
 import { productPricedList, productPricingList } from '@/api/product'
 export default {
@@ -368,13 +368,23 @@ export default {
     },
     //  产品分类  列表
     getProductType () {
-      productTypeQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productTypeList = res.data
-        } else {
-          this.productTypeList = []
-        }
-      })
+      if (this.type != 'supplier' && this.type != 'dealership') { //  促销
+        productTypeQueryAll({}).then(res => {
+          if (res.status == 200) {
+            this.productTypeList = res.data
+          } else {
+            this.productTypeList = []
+          }
+        })
+      } else {
+        productTypeQuery({}).then(res => {
+          if (res.status == 200) {
+            this.productTypeList = res.data
+          } else {
+            this.productTypeList = []
+          }
+        })
+      }
     }
   },
   watch: {

+ 22 - 8
src/views/common/chooseTypeModal.vue

@@ -43,7 +43,7 @@
 </template>
 
 <script>
-import { productTypeQuery } from '@/api/productType'
+import { productTypeQuery, productTypeQueryAll } from '@/api/productType'
 export default {
   name: 'ChooseTypeModal',
   props: {
@@ -56,6 +56,10 @@ export default {
       default: () => {
         return []
       }
+    },
+    type: { //  类型,促销规则promo
+      type: String,
+      default: ''
     }
   },
   data () {
@@ -76,13 +80,23 @@ export default {
   methods: {
     //  产品分类  列表
     getProductType () {
-      productTypeQuery({}).then(res => {
-        if (res.status == 200) {
-          this.productTypeList = res.data
-        } else {
-          this.productTypeList = []
-        }
-      })
+      if (this.type == 'promo') {
+        productTypeQueryAll({}).then(res => {
+          if (res.status == 200) {
+            this.productTypeList = res.data
+          } else {
+            this.productTypeList = []
+          }
+        })
+      } else {
+        productTypeQuery({}).then(res => {
+          if (res.status == 200) {
+            this.productTypeList = res.data
+          } else {
+            this.productTypeList = []
+          }
+        })
+      }
     },
     // 保存
     handleSave () {

+ 14 - 14
src/views/common/productType.js

@@ -5,7 +5,7 @@ const ProductType = {
         @change="handleChange"
         change-on-select
         :value="defaultVal"
-		expand-trigger="hover"
+        expand-trigger="hover"
         :options="productTypeList"
         :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
         :id="id"
@@ -15,34 +15,34 @@ const ProductType = {
   props: {
     value: {
       type: Array,
-      defatut: function(){
+      defatut: function () {
         return []
       }
     },
     id: {
       type: String,
       default: ''
-    },
+    }
   },
-  data() {
+  data () {
     return {
       defaultVal: this.value,
       productTypeList: []
-    };
+    }
   },
   watch: {
-    value(newValue, oldValue) {
+    value (newValue, oldValue) {
       this.defaultVal = newValue
     }
   },
-  mounted() {
+  mounted () {
     this.getProductType()
   },
   methods: {
-    handleChange(value) {
-      this.defaultVal = value;
-      this.$emit('change', this.defaultVal);
-      this.$emit('input', this.defaultVal);
+    handleChange (value) {
+      this.defaultVal = value
+      this.$emit('change', this.defaultVal)
+      this.$emit('input', this.defaultVal)
     },
     //  产品分类列表
     getProductType () {
@@ -54,7 +54,7 @@ const ProductType = {
         }
       })
     }
-  },
-};
+  }
+}
 
-export default ProductType
+export default ProductType

+ 1 - 1
src/views/promotionRulesManagement/promotionRules/choosePriceProductsModal.vue

@@ -115,7 +115,7 @@
     <!-- 选择产品品牌 -->
     <chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" />
     <!-- 选择产品分类 -->
-    <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" />
+    <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" type="promo" @close="openTypeModal=false" @ok="handleTypeOk" />
     <!-- 选择产品 -->
     <chooseProductsModal :openModal="openProductsModal" :chooseData="chooseProducts" @close="openProductsModal=false" @ok="handleProductsOk" />
     <!-- 导入产品 -->