提交 bb9ce402 编写于 作者: shuang.zhou's avatar shuang.zhou

商品分类修复

上级 47e82fc0
......@@ -45,7 +45,7 @@
color: #f56c6c;
margin-right: 4px;
}
.project-req {
.goods-category,.project-req {
.el-form-item__label::before {
content: "*";
color: #f56c6c;
......
......@@ -22,7 +22,7 @@
<div class="basic-item-icon">
<div class="part-tit">基本信息</div>
<el-form-item label="商品分类" prop="goodsCategoryIdList">
<el-form-item label="商品分类" class="goods-category">
<el-cascader
size="small"
ref="cascader"
......@@ -30,9 +30,10 @@
:props="cascaderProps"
clearable
filterable
v-model="formData3.goodsCategoryIdList"
v-model="goodsCategoryIdList"
@change="searchCategoryChange"
/>
<div v-if="isgoodsCategory" :style="{color: '#f56c6c',fontSize: '12px'}">请选择商品分类</div>
</el-form-item>
<el-form-item label="项目-合同名称" prop="cooperationProjectId" class="project-req">
<el-select
......@@ -56,7 +57,9 @@
placeholder="请选择"
size="small"
clearable
:disabled="isEdit && isContract">
:disabled="isEdit && isContract"
@change="contractChange"
>
<el-option
v-for="(item,index) in contractList"
:key="item.contractName+'-'+index"
......@@ -64,6 +67,7 @@
:value="item.contractId"
></el-option>
</el-select>
<div v-if="isProjectId" :style="{color: '#f56c6c',fontSize: '12px'}">请关联项目名称</div>
</el-form-item>
<el-form-item label="选择基础药品" prop="choiceGoods" class="choice-goods">
<el-col :span="16">
......@@ -662,7 +666,9 @@
pageSize: 10,
totalRows: 0,
isAddServe: false, // 新增药品时 添加的是否为服务类 || 虚拟商品
goodsCategoryList: []
goodsCategoryList: [],
isgoodsCategory: false, // 是否选择商品分类
isProjectId: false
}
},
computed: {
......@@ -718,7 +724,6 @@
const subArr = item.filter(i=> {
return i !== -1;
})
console.log()
newoodsList.push(subArr)
})
return newoodsList;
......@@ -794,11 +799,22 @@
}).catch(() => {
});
},
contractChange(val) {
if (val) {
this.isProjectId = false;
} else {
this.isProjectId = true;
}
},
// 商品分类级联多选
searchCategoryChange(value) {
console.log(value, '商品分类级联多选')
this.formData3.goodsCategoryIdList = value;
if (value.length > 0) {
this.isgoodsCategory = false;
} else {
this.isgoodsCategory = true;
}
this.goodsCategoryIdList = value;
this.$refs.cascader.toggleDropDownVisible();
},
// 确认选择药品
......@@ -835,7 +851,6 @@
this.isCheckServe = val.categoryName == 5? true : false;
let current = [this.currentRow];
this.choiceMedData = current;
console.log(val.categoryName, 'categoryNamecategoryName')
}
},
// 新增药品
......@@ -932,7 +947,6 @@
getContractList(projectId || 0).then(res => {
if(res.code == '000000') {
this.contractList = res.data;
console.log(this.contractList, 'this.contractList');
}
})
},
......@@ -1007,8 +1021,7 @@
this.formData3 = { goodsName, goodsDescription, goodsHeaderImages, goodsVideoList, goodsType, expressLimitFlag,contractId, cooperationProjectId };
this.formData3.medicationId = medicationInfo.tradeMedicalLibId;
this.formData3.medicationDetailId = medicationInfo.id;
this.formData3.goodsCategoryIdList = this.getArr(goodsCategoryIdArr);
console.log(this.formData3.goodsCategoryIdList, 'this.formData3.goodsCategoryIdListthis.formData3.goodsCategoryIdList')
this.goodsCategoryIdList = this.getArr(goodsCategoryIdArr);
this.hasRepoFlag = hasRepoFlag;
this.buyLimitDtoList = this.formData.buyLimitDtoList;
this.formData.optPrice = this.formData.costPrice/100;
......@@ -1156,30 +1169,38 @@
this.formData.goodsVideoList = this.videoList;
this.formData.goodsDetailImages = this.fileIntrList; // 商品详情图
this.formData.buyLimitDtoList = this.buyLimitDtoList;
this.formData.goodsCategoryIdList = this.goodsCategoryIdList;
this.isgoodsImages = this.formData.goodsImages.length == 0 ? false :true;
this.isSpecification_url = this.formData.goodsDetailImages.length == 0 ? false :true;
// 判断是否只选择了项目-合同名称的其中一项
const {cooperationProjectId, contractId} = this.formData3;
if (!cooperationProjectId) {
const {cooperationProjectId,contractId,goodsCategoryIdList} = this.formData;
if (!goodsCategoryIdList.length) {
this.isgoodsCategory = true;
return this.$message({
message: '请选择商品分类',
type: 'error'
});
}
if (!cooperationProjectId || !contractId) {
this.isProjectId = true;
return this.$message({
message: '请关联项目名称',
type: 'error'
});
}
if ((cooperationProjectId && !contractId) || (!cooperationProjectId && contractId)) {
return this.$message({
message: '请选择项目-合同名称',
type: 'warning'
// 是否选择新增药品
if (this.choiceMedData.length == 0) {
this.isShowGoodsMsg = true;
this.$message({
message: '请选择基础药品',
type: 'error'
});
return;
}
let isTrue = false;
console.log(formNameList.length, 'formNameListformNameList')
let item = "";
for(let i = 0; i < formNameList.length; i++){
console.log(formNameList[i],'formNameList[i]')
item = formNameList[i];
console.log(item, 'itieuieutieutiu')
this.$refs[item].validate((valid,object) => {
isTrue = valid;
if (!valid) return false;
......@@ -1188,17 +1209,9 @@
return;
}
}
// 是否上传商品头图 || 是否上传商品详情图片 || 库存是否为0 || 单次购买上线是否符合要求
if(!this.isgoodsImages || !this.isSpecification_url ||!this.isgoodStock || !this.checkCount()) return;
// 是否选择新增药品
if (this.choiceMedData.length == 0) {
this.isShowGoodsMsg = true;
this.$message({
message: '请选择基础药品',
type: 'warning'
});
return;
}
if(!isTrue){
return false;
......@@ -1546,7 +1559,6 @@
},
// 视频
deleteVideo(videoList) {
console.log(videoList,'item,fileGoodsListitem,fileGoodsListv')
this.videoList = [];
this.videoModel.videoFullPath='';
},
......@@ -1562,7 +1574,6 @@
}
},
handleRemoveVideo(file, videoList) {
//console.log(this.videoList);
for (let i = 0; i < this.videoList.length; i++) {
if (this.videoList[i].name == file.name) {
this.videoList.splice(i, 1);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册