Procházet zdrojové kódy

修改提交时候证书不为空情况仍然提示为空bug

Guos před 3 týdny
rodič
revize
f75d382094

+ 3 - 17
src/views/hisStore/platformProduct/index.vue

@@ -2349,23 +2349,9 @@ export default {
         this.form.isDrug = response.data.isDrug === 0 ? "0" :
           (response.data.isDrug ? response.data.isDrug.toString() : "1");
 
-        if (this.form.isBusinessPermanent == 1) {
-          this.businessValue = true
-        } else {
-          this.businessValue = false
-        }
-
-        if (this.form.isLicensePermanent == 1) {
-          this.licenseValue = true
-        } else {
-          this.licenseValue = false
-        }
-
-        if (this.form.isCertificatePermanent == 1) {
-          this.certificateValue = true
-        } else {
-          this.certificateValue = false
-        }
+        this.businessValue = this.form.isBusinessPermanent == 1;
+        this.licenseValue = this.form.isLicensePermanent == 1;
+        this.certificateValue = this.form.isCertificatePermanent == 1;
 
         const expireFieldMap = [
           { expireKey: 'businessExpire', startKey: 'businessStart', endKey: 'businessEnd' },

+ 26 - 0
src/views/hisStore/storeProduct/index.vue

@@ -2554,6 +2554,24 @@ export default {
         });
       });
     },
+    // 新增方法:手动验证证书字段
+    validateCertificates() {
+      const errors = [];
+      // 验证生产企业营业执照
+      if (!this.form.business || this.form.business.trim() === '') {
+        errors.push('生产企业营业执照不能为空!');
+      }
+      // 验证生产企业的生产许可证/备案凭证
+      if (!this.form.license || this.form.license.trim() === '') {
+        errors.push('生产企业的生产许可证/备案凭证不能为空!');
+      }
+      // 验证商品注册证/备案凭证
+      if (!this.form.certificate || this.form.certificate.trim() === '') {
+        errors.push('商品注册证/备案凭证不能为空!');
+      }
+      return errors;
+    },
+
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -2563,6 +2581,14 @@ export default {
             this.$message.error('当前店铺无权限经营该类商品,请重新选择分类或店铺');
             return;
           }
+
+          // 2. 手动验证三个证书字段
+          const manualErrors = this.validateCertificates();
+          if (manualErrors.length > 0) {
+            this.$message.error(manualErrors.join('\n'));
+            return;
+          }
+
           // 统一校验所有证书是否过期
           const expireError = this.checkAllCertificatesExpire();
           if (expireError) {