|
|
@@ -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;
|
|
|
}
|