Przeglądaj źródła

店铺增加店铺营业执照检查,检查店铺的经营许可证是否允许上传该类商品,店铺审核页面点击详情和点击修改一致

Guos 15 godzin temu
rodzic
commit
f4bf756e69

+ 11 - 0
src/api/hisStore/store.js

@@ -98,3 +98,14 @@ export function getStoreColumns(query) {
     params: query
   })
 }
+
+//营业执照范围检测
+// 确保 businessLicenseCheck 接口定义类似这样
+export function businessLicenseCheck(imageUrl) {
+  return request({
+    url: '/store/his/store/businessLicenseCheck',
+    method: 'get',
+    params: { imageUrl: imageUrl }
+  })
+}
+

+ 20 - 0
src/api/hisStore/storeProduct.js

@@ -154,3 +154,23 @@ export function copyProduct(data) {
     data: data
   })
 }
+
+// 店铺营业执照检查
+export function businessLicenseCheck(imageUrl) {
+  return request({
+    url: '/store/his/store/businessLicenseCheck',
+    method: 'get',
+    params: { imageUrl: imageUrl }
+  })
+}
+
+
+// 检查店铺的经营许可证是否允许上传该类商品
+export function checkStoreLicense(storeId, cateId) {
+  return request({
+    url: '/store/store/storeProduct/checkStoreDrugLicense',
+    method: 'post',
+    data: { storeId: storeId, cateId: cateId }
+  })
+}
+

+ 228 - 54
src/views/hisStore/store/audit.vue

@@ -142,8 +142,7 @@
             size="mini"
             type="text"
             icon="el-icon-s-promotion"
-            @click="handledetails(scope.row)"
-          >
+            @click="handledetails(scope.row)">
             <span v-if="scope.row.isAudit===0">审核</span>
             <span v-else>详情</span>
           </el-button>
@@ -184,13 +183,149 @@
       @pagination="getList"
     />
 
+    <!-- 使用与index.vue相同的对话框展示,但添加审核功能 -->
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false">
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="top" :disabled="!isAuditMode">
 
-    <el-drawer
-      :with-header="false"
-      size="75%"
-      :title="show.title" :visible.sync="show.open" >
-      <storeDetails  ref="Details" @fresh="getList" @showClose="this.show.open = false"/>
-    </el-drawer>
+        <el-divider content-position="left">基础信息</el-divider>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="店铺名称">
+              <el-input v-model="form.storeName" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="电话">
+              <el-input v-model="form.phone" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="企业全称">
+          <el-input v-model="form.fullName" disabled />
+        </el-form-item>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="店铺LOGO">
+              <img v-if="form.logoUrl" :src="form.logoUrl" width="200px">
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="店铺介绍">
+              <el-input v-model="form.descs" type="textarea" :rows="3" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="地址">
+              <el-input v-model="form.address" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="法人姓名">
+              <el-input v-model="form.legalPersonName" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="统一社会信用代码">
+              <el-input v-model="form.unifiedSocialCreditCode" disabled />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="商家ID">
+              <el-input v-model="form.merchantId" disabled />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="营业范围">
+          <el-input v-model="form.businessScope" type="textarea" disabled />
+        </el-form-item>
+
+        <!-- 证书信息 -->
+        <el-divider content-position="left">资质证书信息</el-divider>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="营业执照">
+              <el-image v-if="form.businessLicense" style="width: 200px" :src="form.businessLicense" :preview-src-list="[form.businessLicense]"></el-image>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="营业执照编号">
+              <el-input v-model="form.businessCode" disabled />
+            </el-form-item>
+            <el-form-item label="营业执照有效期">
+              <span v-if="form.isBusinessLicensePermanent == 1">长期有效</span>
+              <span v-else>{{form.businessLicenseExpireStart}} - {{form.businessLicenseExpireEnd}}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <!-- 其他证书显示略... -->
+
+        <el-divider content-position="left">店铺配置信息</el-divider>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="状态">
+              <dict-tag :options="statusOptions" :value="form.status"/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="审核状态">
+              <dict-tag :options="isAuditOptions" :value="form.isAudit"/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="登录帐号">
+          <el-input v-model="form.account" disabled />
+        </el-form-item>
+
+        <!-- 审核记录显示(已审核的店铺) -->
+        <div v-if="form.isAudit !== 0 && medicalMallConfig.isAudit">
+          <el-divider content-position="left">审核记录</el-divider>
+          <el-table :data="auditLogs" border>
+            <el-table-column label="描述" align="center" prop="des" :show-overflow-tooltip="true" />
+            <el-table-column label="操作人员" align="center" prop="operName" width="100" />
+            <el-table-column label="操作日期" align="center" prop="operTime" width="180">
+              <template slot-scope="scope">
+                <span>{{ parseTime(scope.row.operTime) }}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="审核理由" align="center" prop="reason" />
+            <el-table-column label="图片" align="center" prop="attachImage" width="100">
+              <template slot-scope="scope">
+                <el-image v-if="scope.row.attachImage" style="width: 100px" :src="scope.row.attachImage" :preview-src-list="[scope.row.attachImage]"></el-image>
+                <span v-else>无图片</span>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+
+        <!-- 审核表单(仅未审核时显示) -->
+        <div v-if="form.isAudit === 0 && isAuditMode">
+          <el-divider content-position="left">审核</el-divider>
+          <el-form-item label="审核理由" prop="auditReason">
+            <el-input v-model="auditForm.reason" type="textarea" placeholder="请输入审核理由" />
+          </el-form-item>
+          <el-form-item label="图片说明">
+            <ImageUpload v-model="auditForm.attachImage" :limit="5" :width="150" :height="150" />
+          </el-form-item>
+        </div>
+      </el-form>
+
+      <!-- 对话框底部按钮 -->
+      <div slot="footer" class="dialog-footer">
+        <!-- 审核按钮(只在审核模式且未审核时显示) -->
+        <template v-if="isAuditMode && form.isAudit === 0">
+          <el-button type="success" @click="handleAuditPass">审核通过</el-button>
+          <el-button type="danger" @click="handleAuditReject">审核驳回</el-button>
+        </template>
+        <el-button @click="cancel">关 闭</el-button>
+      </div>
+    </el-dialog>
 
   </div>
 
@@ -198,19 +333,28 @@
 </template>
 
 <script>
-import { audit,listStore, exportStore } from "@/api/hisStore/store";
-import storeDetails from '../components/storeDetails.vue';
-import {getCitys} from "@/api/store/city";
-import { getConfigByKey } from '@/api/system/config'
+import { audit, listStore, exportStore, getStore, getStoreAuditLog } from "@/api/hisStore/store";
+import { getCitys } from "@/api/store/city";
+import { getConfigByKey } from '@/api/system/config';
+import ImageUpload from '@/components/ImageUpload';
+
 export default {
   name: "adutstore",
-  components: { storeDetails },
+  components: { ImageUpload },
   data() {
     return {
-      show:{
-        title:"店铺详情",
-        open:false,
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      isAuditMode: false,
+      // 审核表单
+      auditForm: {
+        reason: '',
+        attachImage: ''
       },
+      // 审核记录
+      auditLogs: [],
       medicalMallConfig:{},
       citys:[],
       licenseuploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
@@ -242,10 +386,6 @@ export default {
       total: 0,
       // 店铺管理表格数据
       storeList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
       // 状态字典
       statusOptions: [],
       // 审核状态字典
@@ -307,45 +447,77 @@ export default {
     });
   },
   methods: {
-    handleUpdate(row){
-      var that=this;
-      var the=null;
-      this.$confirm('是否确认审核?', "审核", {
-        distinguishCancelAndClose: true,
-        confirmButtonText: "确定",
-        cancelButtonText: "驳回",
-        type: "warning"
-      }).then(function() {
-        var data={
-          storeId:row.storeId,
-          isAudit:1
-        }
-        return audit(data);
+    /** 审核/详情按钮操作 */
+    handledetails(row) {
+      this.reset();
+      this.isAuditMode = row.isAudit === 0; // 未审核的进入审核模式
+      this.title = row.isAudit === 0 ? "店铺审核" : "店铺详情";
+
+      const storeId = row.storeId;
+      // 调用后端接口获取详情和审核记录
+      Promise.all([getStore(storeId), getStoreAuditLog(storeId)])
+        .then(([storeResponse, auditResponse]) => {
+          this.form = storeResponse.data;
+          this.auditLogs = auditResponse.auditLog || [];
+          this.open = true;
+        })
+        .catch(() => {
+          this.msgError("获取店铺详情失败");
+        });
+    },
+
+    /** 审核通过 */
+    handleAuditPass() {
+      this.$confirm('确认审核通过该店铺?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
       }).then(() => {
-        this.msgSuccess("操作成功");
-        this.getList();
-      }).catch(function(action) {
-        if (action === 'cancel') {
-          var data={
-            storeId:row.storeId,
-            isAudit:-1
-          }
-          the='cancel';
-          return audit(data);
+        const data = {
+          storeId: this.form.storeId,
+          isAudit: 1,
+          reason: this.auditForm.reason,
+          attachImage: this.auditForm.attachImage
+        };
+        return audit(data);
+      }).then(res => {
+        if (res.code === 200) {
+          this.msgSuccess("审核通过成功");
+          this.open = false;
+          this.getList();
+          // 清空审核表单
+          this.auditForm = { reason: '', attachImage: '' };
+        } else {
+          this.msgError("审核失败");
         }
+      }).catch(() => {});
+    },
+
+    /** 审核驳回 */
+    handleAuditReject() {
+      this.$confirm('确认驳回该店铺审核?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
       }).then(() => {
-        if(the==='cancel'){
-          this.msgSuccess("操作成功");
+        const data = {
+          storeId: this.form.storeId,
+          isAudit: -1,
+          reason: this.auditForm.reason,
+          attachImage: this.auditForm.attachImage
+        };
+        return audit(data);
+      }).then(res => {
+        if (res.code === 200) {
+          this.msgSuccess("审核驳回成功");
+          this.open = false;
           this.getList();
+          // 清空审核表单
+          this.auditForm = { reason: '', attachImage: '' };
+        } else {
+          this.msgError("审核失败");
         }
-
-      });
-    },
-    handledetails(row){
-      this.show.open=true;
-      setTimeout(() => {
-        this.$refs.Details.getDetails(row.storeId);
-      }, 1);
+      }).catch(() => {});
     },
 
     handleCityChange(value) {
@@ -401,6 +573,8 @@ export default {
     cancel() {
       this.open = false;
       this.reset();
+      // 清空审核表单
+      this.auditForm = { reason: '', attachImage: '' };
     },
     // 表单重置
     reset() {

+ 38 - 25
src/views/hisStore/store/index.vue

@@ -192,14 +192,14 @@
             size="mini"
             type="text"
             icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
+            @click="handleUpdate(scope.row, true)"
             v-hasPermi="['his:store:edit']"
           >修改</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-s-promotion"
-            @click="handledetails(scope.row)"
+            @click="handleUpdate(scope.row, false)"
           >详情
           </el-button>
           <el-button
@@ -235,7 +235,7 @@
     />
     <!-- 添加或修改店铺管理对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false">
-      <el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="top">
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="top" :disabled="isViewMode">
 
         <el-divider content-position="left">基础信息</el-divider>
         <el-row>
@@ -1003,16 +1003,11 @@
         <span class="tip-text" v-if="title !== '修改店铺管理'">请及时修改密码,初试密码XyzAbc~12</span>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
+        <el-button v-if="!isViewMode" type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">{{ isViewMode ? '关 闭' : '取 消' }}</el-button>
       </div>
     </el-dialog>
-    <el-drawer
-      :with-header="false"
-      size="75%"
-      :title="show.title" :visible.sync="show.open">
-      <storeDetails  ref="Details" />
-    </el-drawer>
+
 
 
     <el-dialog
@@ -1030,7 +1025,7 @@
 </template>
 
 <script>
-import { listStore, getStore, delStore, addStore, updateStore, exportStore, refreshPasWod,exportFsStream } from '@/api/hisStore/store'
+import { listStore, getStore, delStore, addStore, updateStore, exportStore, refreshPasWod,exportFsStream, businessLicenseCheck} from '@/api/hisStore/store'
 import storeDetails from '../components/storeDetails.vue';
 import {getCitys} from "@/api/store/city";
 import { getConfigByKey } from '@/api/system/config'
@@ -1044,6 +1039,8 @@ export default {
       isDeleting: false,
       promptList:[],
       dialogVisible: false,
+      // 控制是否为查看模式(只读)
+      isViewMode: false,
       switchValue:false,
       switchMedicalValue:false,
       drugLicenseValue:false,
@@ -1054,10 +1051,6 @@ export default {
       medicalLicenseExpiryValue1:false,//协议有效期控制
       medicalLicenseExpiryValue2:false,//协议有效期控制
       medicalLicenseExpiryValue3:false,//协议有效期控制
-      show: {
-        title: "店铺详情",
-        open: false,
-      },
       shippingType: [],
       medicalMallConfig:{},
       citys: [],
@@ -1279,13 +1272,27 @@ export default {
           this.$message.error("加载通知信息失败,请稍后重试");
         });
     },
-    handledetails(row) {
-      this.show.open = true;
-      setTimeout(() => {
-        this.$refs.Details.getDetails(row.storeId,0);
-      }, 1);
+    // 在 methods 中添加新的方法
+    checkBusinessLicense(imageUrl) {
+      if (!imageUrl) return;
+      // 使用正确的参数格式调用接口
+      businessLicenseCheck(imageUrl).then(response => {
+        if (response.code === 200) {
+          if (!response.data.flag) {
+            // 检查失败,显示错误信息
+            this.$message.error(response.data.message || '营业执照校验失败');
+            // 清除刚上传的图片
+            this.form.businessLicense = '';
+            this.$forceUpdate();
+          }
+        } else {
+          this.$message.error('营业执照校验接口调用失败');
+        }
+      }).catch(error => {
+        console.error('营业执照校验失败:', error);
+        this.$message.error('营业执照校验失败');
+      });
     },
-
     handleCityChange(value) {
       var nodes = this.$refs.citySelect.getCheckedNodes();
       this.form.address = nodes[0].pathLabels[0] + nodes[0].pathLabels[1] + nodes[0].pathLabels[2];
@@ -1342,6 +1349,10 @@ export default {
       if (response.code === 200) {
         this.$set(this.form, field, response.url);
         this.$forceUpdate();
+        // 如果是营业执照上传,则进行检查
+        if (field === 'businessLicense') {
+          this.checkBusinessLicense(response.url);
+        }
       } else {
         this.msgError(response.msg);
       }
@@ -1465,6 +1476,7 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
+      this.isViewMode = false; // 新增时可编辑
       this.open = true;
       this.title = "添加店铺";
 
@@ -1598,9 +1610,10 @@ export default {
         this.$forceUpdate(); // 强制刷新确保状态同步
       });
     },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
+    /** 修改/详情按钮操作 */
+    handleUpdate(row, isEdit = true) {
       this.reset();
+      this.isViewMode = !isEdit; // 设置是否为查看模式
       const storeId = row.storeId || this.ids
       getStore(storeId).then(response => {
         this.form = response.data;
@@ -1635,7 +1648,7 @@ export default {
           this.medicalLicenseExpiryValue3 = true;
         }
         this.open = true;
-        this.title = "修改店铺";
+        this.title = this.isViewMode ? "店铺详情" : "修改店铺";
 
         let str = this.form.shippingType
         this.form.shippingType = str.split(",")

+ 167 - 55
src/views/hisStore/storeProduct/index.vue

@@ -151,7 +151,6 @@
             placeholder="请输入生产企业地址"
             clearable
             size="small"
-
           />
         </el-form-item>
 
@@ -161,7 +160,6 @@
             placeholder="请输入功能主治"
             clearable
             size="small"
-
           />
         </el-form-item>
 
@@ -171,7 +169,6 @@
             placeholder="请输入用法用量"
             clearable
             size="small"
-
           />
         </el-form-item>
 
@@ -191,7 +188,6 @@
             placeholder="请输入禁忌"
             clearable
             size="small"
-
           />
         </el-form-item>
 
@@ -620,6 +616,17 @@
                   <el-input v-model="form.indications" type="textarea" placeholder="请输入功能主治"/>
                 </el-form-item>
 
+                <el-form-item label="成分" prop="ingredient" v-if="!displayDemo">
+                  <el-input
+                    v-model="form.ingredient"
+                    type="textarea"
+                    placeholder="请输入成分"
+                    @blur="checkForbiddenKeywords"
+                    @input="onIngredientInput"
+                  />
+                  <div v-if="ingredientError" class="el-form-item__error">{{ ingredientError }}</div>
+                </el-form-item>
+
                 <el-form-item label="用法用量" prop="dosage">
                   <el-input v-model="form.dosage" type="textarea" placeholder="请输入用法用量"/>
                 </el-form-item>
@@ -1056,25 +1063,10 @@
 <!--          </el-date-picker>-->
 <!--        </el-form-item>-->
 
-        <!--        GMP/GSP认证证书-->
-        <el-form-item v-if="form.isShow === '1'" label="GMP/GSP认证证书" prop="gmpAuth">
-          <Material v-model="gmpAuthArr" type="image" :num="1" :width="150" :height="150"/>
-        </el-form-item>
-
-        <el-form-item v-if="form.isShow === '1' && gmpAuthArr.length > 0" label="GMP/GSP认证有效期" prop="gmpAuthExpire">
-          <el-date-picker
-            v-model="form.gmpAuthExpire"
-            type="daterange"
-            value-format="yyyy-MM-dd"
-            range-separator="至"
-            start-placeholder="开始日期"
-            end-placeholder="结束日期"
-            @change="validateGmpAuthExpire">
-          </el-date-picker>
-          <div v-if="gmpAuthExpireError" style="color: #F56C6C; font-size: 12px; line-height: 1; padding-top: 4px;">
-            <i class="el-icon-warning"></i> {{ gmpAuthExpireError }}
-          </div>
-        </el-form-item>
+        <!--        GMP/GSP认证证书(后续不需要了)-->
+<!--        <el-form-item v-if="form.isShow === '1'" label="GMP/GSP认证证书" prop="gmpAuth">-->
+<!--          <Material v-model="gmpAuthArr" type="image" :num="1" :width="150" :height="150"/>-->
+<!--        </el-form-item>-->
 
         <el-form-item label="国药准字" v-if="form.productType==2" prop="prescribeCode">
           <el-input v-model="form.prescribeCode" placeholder="请输入国药准字"/>
@@ -1181,7 +1173,7 @@ import {
   importTemplate,
   batchModify,
   sync580,
-  updateIsShow, exportDrugProduct,getAuthInfo,copyProduct
+  updateIsShow, exportDrugProduct,getAuthInfo,copyProduct,selectForbiddenKeywords,checkStoreLicense
 } from "@/api/hisStore/storeProduct";
 import {getAllStoreProductCategory} from "@/api/hisStore/storeProductCategory";
 import {getAllStoreProductRule} from "@/api/hisStore/storeProductRule";
@@ -1321,11 +1313,12 @@ export default {
           // ];
         }
         const cateName = this.cateIdToNameMap[newVal];
-       if(cateName !== undefined && cateName.includes('器械')){
-            this.displayDemo=true;
-       }else {
-         this.displayDemo=false;
-       }
+        if(cateName !== undefined && cateName.includes('器械')){
+          this.displayDemo=true;
+        }else {
+          this.displayDemo=false;
+        }
+        this.ingredientError = '';
         // 清除验证状态
         this.$nextTick(() => {
           if (this.$refs.form) {
@@ -1334,13 +1327,37 @@ export default {
         });
       },
       immediate: true
+    },
+    // 合并监听 form.cateId 和 form.storeId
+    form: {
+      handler(newVal, oldVal) {
+        // 只有当两个值都存在且至少有一个发生变化时才进行检查
+        if (newVal.cateId && newVal.storeId) {
+          // 避免在初始化时重复调用,只在值真正改变时调用
+          const oldCateId = oldVal ? oldVal.cateId : null;
+          const oldStoreId = oldVal ? oldVal.storeId : null;
+
+          // 只有当至少一个值发生变化时才检查
+          if (newVal.cateId !== oldCateId || newVal.storeId !== oldStoreId) {
+            // 添加防抖,避免短时间内多次调用
+            clearTimeout(this.licenseCheckTimer);
+            this.licenseCheckTimer = setTimeout(() => {
+              this.checkStoreLicensePermission();
+            }, 300);
+          }
+        }
+      },
+      deep: true
     }
   },
   data() {
     return {
+      isCheckingLicense: false, // 正在检查许可证标志
+      licenseCheckTimer: null, // 添加防抖定时器
+      storeLicenseCheckFailed: false, // 店铺许可证接口检查是否失败
       auditLogs:[],
       titleValue:null,
-
+      ingredientError: '', // 成分禁止提示
       displayDemo: false,
       cateIdToNameMap: {},
       businessArr: [],
@@ -1352,7 +1369,6 @@ export default {
       businessExpireError: '',
       licenseExpireError: '',
       certificateExpireError: '',
-      gmpAuthExpireError: '',
       activeValue: '1',
       orderOptions: [],
       medicalMallConfig: {},
@@ -1486,6 +1502,7 @@ export default {
       },
       // 表单参数
       form: {
+        ingredient: null,
         cateId: null,
         businessExpire: null,
         indications: '',
@@ -1499,7 +1516,6 @@ export default {
         voucher:null,
         voucherExpire:null,
         gmpAuth:null,
-        gmpAuthExpire:null,
         businessLink:null,
         isGmpAuthPermanent:null,
         isCertificatePermanent:null,
@@ -1508,6 +1524,19 @@ export default {
       },
       // 表单校验
       rules: {
+        ingredient: [
+          { required: true, message: "成分不能为空", trigger: "blur" },
+          {
+            validator: (rule, value, callback) => {
+              if (this.ingredientError) {
+                callback(new Error(this.ingredientError));
+              } else {
+                callback();
+              }
+            },
+            trigger: "blur"
+          }
+        ],
         image: [
           {required: true, message: "商品图片不能为空", trigger: "blur"}
         ],
@@ -1608,9 +1637,6 @@ export default {
         gmpAuth: [
           { required: true, message: "GMP认证不能为空!", trigger: "blur"  }
         ],
-        gmpAuthExpire: [
-          { required: true, message: "GMP认证有效期不能为空!", trigger: "change" }
-        ],
         businessLink: [
           { required: true, message: "非首营链接不能为空!", trigger: "change" }
         ],
@@ -1665,6 +1691,92 @@ export default {
   //   }
   // },
   methods: {
+
+    // 检查店铺许可证权限
+    // 修改 checkStoreLicensePermission 方法
+    checkStoreLicensePermission() {
+      // 确保分类ID和店铺ID都存在
+      if (!this.form.cateId || !this.form.storeId) {
+        return;
+      }
+
+      // 添加检查中标志,防止重复调用
+      if (this.isCheckingLicense) {
+        return;
+      }
+
+      this.isCheckingLicense = true;
+
+      checkStoreLicense(this.form.storeId, this.form.cateId).then(response => {
+        if (response.code === 200) {
+          if (!response.data.flag) {
+            // 权限检查失败
+            this.$message.error(response.data.message || '当前店铺无权限经营该类商品');
+            this.storeLicenseCheckFailed = true;
+          } else {
+            // 权限检查通过
+            this.storeLicenseCheckFailed = false;
+          }
+        } else {
+          this.$message.error('店铺许可证检查接口调用失败');
+        }
+      }).catch(error => {
+        console.error('店铺许可证检查失败:', error);
+        this.$message.error('店铺许可证检查失败');
+        this.storeLicenseCheckFailed = true;
+      }).finally(() => {
+        this.isCheckingLicense = false;
+      });
+    },
+
+
+    // 成分关键字检查
+    checkForbiddenKeywords() {
+      // Clear error first
+      this.ingredientError = '';
+
+      if (this.form.ingredient && this.form.ingredient.trim()) {
+        selectForbiddenKeywords(this.form.ingredient).then(response => {
+          if (response.code === 200) {
+            if (!response.data) {
+              // Forbidden keywords found
+              this.ingredientError = response.msg || '包含禁用关键字';
+              // Trigger validation to show error
+              this.$nextTick(() => {
+                if (this.$refs.form) {
+                  this.$refs.form.validateField('ingredient');
+                }
+              });
+            } else {
+              // No forbidden keywords - clear error (this is the key improvement)
+              this.ingredientError = '';
+              // Clear validation error state
+              this.$nextTick(() => {
+                if (this.$refs.form) {
+                  this.$refs.form.clearValidate('ingredient');
+                }
+              });
+            }
+          }
+        }).catch(error => {
+          console.error('检查禁用关键字失败:', error);
+          this.$message.error('检查禁用关键字失败');
+        });
+      }
+    },
+
+    onIngredientInput() {
+      // Optionally clear error as user types to provide real-time feedback
+      if (this.ingredientError) {
+        this.ingredientError = '';
+        // Clear validation state
+        this.$nextTick(() => {
+          if (this.$refs.form) {
+            this.$refs.form.clearValidate('ingredient');
+          }
+        });
+      }
+    },
     handleNoticeInfo() {
       qualifications()
         .then(response => {
@@ -1927,7 +2039,9 @@ export default {
     },
     // 表单重置
     reset() {
+      this.ingredientError = '';
       this.form = {
+        ingredient: null,
         productId: null,
         image: null,
         video: null,
@@ -2086,7 +2200,6 @@ export default {
       const productId = row.productId || this.ids
       getStoreProduct(productId).then(response => {
         this.form = response.data;
-        console.log("都要xxxxxxxxxxxxxxxxxxx->>>>>",response.data)
         this.form.isShow = response.data.isShow.toString();
         this.form.isHot = response.data.isHot.toString();
         this.form.isGood = response.data.isGood.toString();
@@ -2131,7 +2244,6 @@ export default {
           { expireKey: 'licenseExpire', startKey: 'licenseStart', endKey: 'licenseEnd' },
           { expireKey: 'certificateExpire', startKey: 'certificateStart', endKey: 'certificateEnd' },
           { expireKey: 'voucherExpire', startKey: 'voucherStart', endKey: 'voucherEnd' },
-          { expireKey: 'gmpAuthExpire', startKey: 'gmpAuthStart', endKey: 'gmpAuthEnd' },
           { expireKey: 'qualificationExpire', startKey: 'qualificationCertificateStart', endKey: 'qualificationCertificateEnd' }
         ];
 
@@ -2212,7 +2324,14 @@ export default {
         this.title = "修改商品";
         // 加载数据后立即校验过期状态
         this.$nextTick(() => {
-          this.validateAllExpires();
+          // 清除之前的定时器
+          if (this.licenseCheckTimer) {
+            clearTimeout(this.licenseCheckTimer);
+          }
+          // 直接调用检查方法
+          if (this.form.storeId && this.form.cateId) {
+            this.checkStoreLicensePermission();
+          }
         });
       });
     },
@@ -2220,6 +2339,11 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          // 检查店铺许可证权限
+          if (this.storeLicenseCheckFailed) {
+            this.$message.error('当前店铺无权限经营该类商品,请重新选择分类或店铺');
+            return;
+          }
           // 统一校验所有证书是否过期
           const expireError = this.checkAllCertificatesExpire();
           if (expireError) {
@@ -2258,7 +2382,6 @@ export default {
           this.form.isBusinessPermanent = 0;
           this.form.isLicensePermanent = 0;
           this.form.isCertificatePermanent = 0;
-          this.form.isGmpAuthPermanent = 0;
 
           // // 组装companyIds
           // if (this.form.companyIds != null && this.form.companyIds != undefined) {
@@ -2388,7 +2511,6 @@ export default {
       this.businessExpireError = '';
       this.licenseExpireError = '';
       this.certificateExpireError = '';
-      this.gmpAuthExpireError = '';
     },
 
     // 统一校验证书有效期(返回错误信息或null)
@@ -2408,19 +2530,16 @@ export default {
     checkAllCertificatesExpire() {
       // 按顺序检查,返回第一个过期的证书错误信息
       let error = null;
-      
+
       error = this.checkCertificateExpire(this.form.businessExpire, '营业执照');
       if (error) return error + '后再提交!';
-      
+
       error = this.checkCertificateExpire(this.form.licenseExpire, '生产许可证');
       if (error) return error + '后再提交!';
-      
+
       error = this.checkCertificateExpire(this.form.certificateExpire, '注册证');
       if (error) return error + '后再提交!';
-      
-      error = this.checkCertificateExpire(this.form.gmpAuthExpire, 'GMP/GSP认证');
-      if (error) return error + '后再提交!';
-      
+
       return null;
     },
 
@@ -2429,7 +2548,6 @@ export default {
       this.validateBusinessExpire(this.form.businessExpire);
       this.validateLicenseExpire(this.form.licenseExpire);
       this.validateCertificateExpire(this.form.certificateExpire);
-      this.validateGmpAuthExpire(this.form.gmpAuthExpire);
     },
 
     // 验证营业执照有效期
@@ -2448,13 +2566,7 @@ export default {
     validateCertificateExpire(dates) {
       const error = this.checkCertificateExpire(dates, '注册证');
       this.certificateExpireError = error ? error + '!' : '';
-    },
-
-    // 验证GMP/GSP认证有效期
-    validateGmpAuthExpire(dates) {
-      const error = this.checkCertificateExpire(dates, 'GMP/GSP认证');
-      this.gmpAuthExpireError = error ? error + '!' : '';
     }
   }
 };
-</script>
+</script>