Ver Fonte

增加营业执照检查,成分检查,店铺的经营许可证与商品分类检查

Guos há 2 semanas atrás
pai
commit
b6285bcaed

+ 10 - 1
src/api/hisStore/store.js

@@ -1,6 +1,6 @@
 import request from '@/utils/request'
 
-// 查询城市列表
+// 获取店铺管理详细信息
 export function getStoreInfo() {
   return request({
     url: '/store/store/getStoreInfo',
@@ -16,3 +16,12 @@ export function getAuthInfo() {
     method: 'get'
   })
 }
+
+//营业执照检查
+export function businessLicenseCheck(imageUrl) {
+  return request({
+    url: '/store/store/businessLicenseCheck',
+    method: 'get',
+    params: imageUrl
+  })
+}

+ 17 - 0
src/api/store/storeProduct.js

@@ -215,3 +215,20 @@ export function copyProduct(data) {
 }
 
 
+export function checkStoreDrugLicense(data) {
+  return request({
+    url: '/store/storeProduct/checkStoreDrugLicense',
+    method: 'post',
+    data: data
+  })
+}
+
+
+export function selectForbiddenKeywords(keywords) {
+  return request({
+    url: '/store/storeProduct/selectForbiddenKeywords/'+keywords,
+    method: 'get',
+  })
+}
+
+

+ 44 - 16
src/views/store/storeConfig/userInfo.vue

@@ -509,10 +509,10 @@
 </template>
 
 <script>
-import { addStore, updateStore, editData } from '@/api/store/store'
+import { addStore, updateStore, editData} from '@/api/store/store'
 import { getConfigByKey } from '@/api/system/config'
 import { getCitys } from '@/api/store/city'
-import { getStoreInfo } from '@/api/hisStore/store'
+import { getStoreInfo, businessLicenseCheck} from '@/api/hisStore/store'
 
 export default {
   data() {
@@ -659,7 +659,6 @@ export default {
     });
   },
   methods: {
-
     handleAvatarSuccess(res, file) {
       if (res.code == 200) {
         this.form.logoUrl = res.url
@@ -676,15 +675,6 @@ export default {
       return isLt1M
     },
 
-    submit() {
-      this.$refs['form'].validate(valid => {
-        if (valid) {
-          editData(this.user).then(response => {
-            this.msgSuccess('修改成功')
-          })
-        }
-      })
-    },
     close() {
       this.$store.dispatch('tagsView/delView', this.$route)
       this.$router.push({ path: '/index' })
@@ -692,10 +682,25 @@ export default {
     // 通用文件上传成功处理函数
     handleFileSuccess(response, file, field) {
       if (response.code === 200) {
-        this.$set(this.form, field, response.url)
-        this.$forceUpdate()
+        this.$set(this.form, field, response.url);
+        // 如果是营业执照上传,进行校验
+        if (field === 'businessLicense') {
+          businessLicenseCheck({ imageUrl: response.url }).then(checkResponse => {
+            if (checkResponse.data.flag === false) {
+              this.$message.error(checkResponse.data.message || '营业执照校验失败');
+              // 清除已上传的营业执照图片
+              this.$set(this.form, field, '');
+              this.$forceUpdate();
+            }
+          }).catch(error => {
+            this.$message.error('营业执照校验异常');
+            this.$set(this.form, field, '');
+            this.$forceUpdate();
+          });
+        }
+        this.$forceUpdate();
       } else {
-        this.msgError(response.msg)
+        this.msgError(response.msg);
       }
     },
     // 表单重置
@@ -771,8 +776,31 @@ export default {
       };
       this.resetForm('form')
     },
-    /** 提交按钮 */
     submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          // 如果存在营业执照且不为空,先进行校验
+          if (this.form.businessLicense) {
+            businessLicenseCheck({ imageUrl: this.form.businessLicense }).then(checkResponse => {
+              if (checkResponse.data.flag === false) {
+                this.$message.error(checkResponse.data.message || '营业执照校验失败');
+                return;
+              }
+              // 校验通过,继续提交流程
+              this.submitFormData();
+            }).catch(error => {
+              this.$message.error('营业执照校验异常');
+            });
+          } else {
+            // 无营业执照直接提交
+            this.submitFormData();
+          }
+        }
+      });
+    },
+
+    /** 提交按钮 */
+    submitFormData() {
       this.$refs["form"].validate(valid => {
         if (valid) {
           // 处理表单数据

+ 67 - 2
src/views/store/storeProduct/index.vue

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