浏览代码

update:所属公司多选

ct 3 天之前
父节点
当前提交
f12323e733
共有 1 个文件被更改,包括 18 次插入16 次删除
  1. 18 16
      src/views/hisStore/storeProductPackage/index.vue

+ 18 - 16
src/views/hisStore/storeProductPackage/index.vue

@@ -479,22 +479,22 @@ export default {
   methods: {
     handleCompanyChange(){
       if (!this.products || this.products.length === 0) {
-        this.$message.warning('请先选择商品');
-        return;
-      }
-      const productIds = this.products
-        .map(item => {
-          const id = item.productId
-          return id ? Number(id) : null;
-        })
-        .filter(id => id != null && !isNaN(id));
+        // this.$message.warning('请先选择商品');
+        // return;
+      } else {
+        const productIds = this.products
+          .map(item => {
+            const id = item.productId
+            return id ? Number(id) : null;
+          })
+          .filter(id => id != null && !isNaN(id));
 
-      if (productIds.length === 0) {
-        this.$message.warning('没有有效的商品ID');
-        return;
-      }
-      // 查询所选公司是否有该商品
-      getProductsCompanyIds(productIds).then(response => {
+        if (productIds.length === 0) {
+          this.$message.warning('没有有效的商品ID');
+          return;
+        }
+        // 查询所选公司是否有该商品
+        getProductsCompanyIds(productIds).then(response => {
           const availableCompanyIds = (response.companyIds || [])
             .map(id => {
               const numId = Number(id);
@@ -515,6 +515,8 @@ export default {
             );
           }
         })
+      }
+
     },
     /** 获取公司下拉列表*/
     getCompanyList() {
@@ -555,7 +557,7 @@ export default {
       this.$message.success("商品已添加!");
     },
     handleAddProduct(){
-      if(!this.form.companyId) {
+      if(!this.form.companyId && (!this.form.companyIds || this.form.companyIds.length === 0)) {
         this.$message.error("请选择套餐所属公司!");
         return;
       }