|
|
@@ -607,6 +607,10 @@
|
|
|
<el-input v-model="form.indications" type="textarea" placeholder="请输入功能主治"/>
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item label="成分" prop="ingredient">
|
|
|
+ <el-input v-model="form.ingredient" type="textarea" placeholder="请输入成分"/>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item label="用法用量" prop="dosage">
|
|
|
<el-input v-model="form.dosage" type="textarea" placeholder="请输入用法用量"/>
|
|
|
</el-form-item>
|
|
|
@@ -1197,7 +1201,7 @@ import singleImg from '@/components/Material/single'
|
|
|
import {getCompanyList} from "@/api/company/company";
|
|
|
import {listStore} from '@/api/store/store'
|
|
|
import {getConfigByKey} from '@/api/system/config'
|
|
|
-import {qualifications} from "@/api/store/storeProduct";
|
|
|
+import {qualifications, checkStoreDrugLicense, selectForbiddenKeywords} from "@/api/store/storeProduct";
|
|
|
|
|
|
export default {
|
|
|
name: "HisStoreProduct",
|
|
|
@@ -1307,6 +1311,16 @@ export default {
|
|
|
businessArr:function(val) {
|
|
|
this.form.business = val.join(',');
|
|
|
},
|
|
|
+ //药品成分
|
|
|
+ 'form.ingredient': {
|
|
|
+ handler(newVal) {
|
|
|
+ if (newVal) {
|
|
|
+ this.checkForbiddenKeywords(newVal);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: false
|
|
|
+ },
|
|
|
+ //商品分类
|
|
|
'form.cateId': {
|
|
|
handler(newVal) {
|
|
|
// 分类变化时动态修改验证规则
|
|
|
@@ -1327,6 +1341,10 @@ export default {
|
|
|
}else {
|
|
|
this.displayDemo=false;
|
|
|
}
|
|
|
+ // 调用药品许可证检查接口
|
|
|
+ if (newVal) {
|
|
|
+ this.checkStoreDrugLicense(newVal);
|
|
|
+ }
|
|
|
// 清除验证状态
|
|
|
this.$nextTick(() => {
|
|
|
if (this.$refs.form) {
|
|
|
@@ -1339,6 +1357,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ isIngredientValid: true, // 成分是否有效
|
|
|
+ isLicenseValid: true, // 许可证是否有效
|
|
|
authVisible:false,
|
|
|
auditLogs:[],
|
|
|
titleValue:null,
|
|
|
@@ -1353,7 +1373,7 @@ export default {
|
|
|
certificateArr: [],
|
|
|
voucherArr: [],
|
|
|
gmpAuthArr: [],
|
|
|
- activeValue: '0',
|
|
|
+ activeValue: '1',
|
|
|
orderOptions: [],
|
|
|
medicalMallConfig: {},
|
|
|
promptList: [],
|
|
|
@@ -1485,6 +1505,7 @@ export default {
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {
|
|
|
+ ingredient: null, // 成分字段
|
|
|
cateId: null,
|
|
|
businessExpire: null,
|
|
|
indications: '',
|
|
|
@@ -1507,6 +1528,9 @@ export default {
|
|
|
},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
+ ingredient: [
|
|
|
+ { required: true, message: "成分不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
image: [
|
|
|
{required: true, message: "商品图片不能为空", trigger: "blur"}
|
|
|
],
|
|
|
@@ -1664,6 +1688,35 @@ export default {
|
|
|
// }
|
|
|
// },
|
|
|
methods: {
|
|
|
+ // 检查违禁关键词
|
|
|
+ checkForbiddenKeywords(ingredient) {
|
|
|
+ selectForbiddenKeywords(ingredient).then(response => {
|
|
|
+ if (response.data === false) {
|
|
|
+ this.$message.error(response.msg || '包含违禁词');
|
|
|
+ this.isIngredientValid = false;
|
|
|
+ } else {
|
|
|
+ this.isIngredientValid = true;
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error('违禁词检查异常');
|
|
|
+ this.isIngredientValid = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 检查店铺药品许可证
|
|
|
+ checkStoreDrugLicense(cateId) {
|
|
|
+ checkStoreDrugLicense({ cateId: cateId }).then(response => {
|
|
|
+ if (response.data.flag === false) {
|
|
|
+ this.$message.error(response.data.message || '药品许可证检查失败');
|
|
|
+ // 可以设置一个状态变量来控制是否允许提交
|
|
|
+ this.isLicenseValid = false;
|
|
|
+ } else {
|
|
|
+ this.isLicenseValid = true;
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error('药品许可证检查异常');
|
|
|
+ this.isLicenseValid = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
handleNoticeInfo() {
|
|
|
qualifications()
|
|
|
.then(response => {
|
|
|
@@ -1927,6 +1980,7 @@ export default {
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
+ ingredient: null, // 重置成分字段
|
|
|
productId: null,
|
|
|
image: null,
|
|
|
video: null,
|
|
|
@@ -2232,6 +2286,17 @@ export default {
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
+ // 检查成分是否有效
|
|
|
+ if (!this.isIngredientValid) {
|
|
|
+ this.$message.warning('成分包含违禁词,请修改后重新提交');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 先检查许可证是否有效
|
|
|
+ if (!this.isLicenseValid) {
|
|
|
+ this.$message.warning('当前分类许可证检查未通过,无法提交');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //接着再提交
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
let checkBoolean = false
|