|
|
@@ -941,7 +941,7 @@
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item v-if="form.isShow === '1' && businessArr.length > 0 && !businessValue" prop="businessExpire">
|
|
|
+ <el-form-item label="生产企业营业执照有效期" v-if="form.isShow === '1' && businessArr.length > 0 && !businessValue" prop="businessExpire">
|
|
|
<el-date-picker
|
|
|
v-model="form.businessExpire"
|
|
|
type="daterange"
|
|
|
@@ -965,7 +965,7 @@
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item v-if="form.isShow === '1' && licenseArr.length > 0 && !licenseValue" prop="licenseExpire">
|
|
|
+ <el-form-item label="生产企业的生产许可证/备案凭证有效期" v-if="form.isShow === '1' && licenseArr.length > 0 && !licenseValue" prop="licenseExpire">
|
|
|
<el-date-picker
|
|
|
v-model="form.licenseExpire"
|
|
|
type="daterange"
|
|
|
@@ -989,7 +989,7 @@
|
|
|
</el-switch>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item v-if="form.isShow === '1' && certificateArr.length > 0 && !certificateValue" prop="certificateExpire">
|
|
|
+ <el-form-item label="商品注册证/备案凭证有效期" v-if="form.isShow === '1' && certificateArr.length > 0 && !certificateValue" prop="certificateExpire">
|
|
|
<el-date-picker
|
|
|
v-model="form.certificateExpire"
|
|
|
type="daterange"
|
|
|
@@ -2375,8 +2375,65 @@ export default {
|
|
|
this.title = "修改商品";
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+ // 验证证件有效期
|
|
|
+ validateCertificates() {
|
|
|
+ const currentDate = new Date();
|
|
|
+
|
|
|
+ // 1. 检查商品注册证/备案凭证
|
|
|
+ if (!this.certificateValue) { // 不是长期有效
|
|
|
+ if (!this.form.certificateExpire || this.form.certificateExpire.length !== 2) {
|
|
|
+ this.$message.warning('商品注册证/备案凭证有效期不能为空!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ const certificateEndDate = new Date(this.form.certificateExpire[1]);
|
|
|
+ if (certificateEndDate < currentDate) {
|
|
|
+ this.$message.warning('商品注册证/备案凭证已过期,无法提交');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 检查生产企业营业执照
|
|
|
+ if (!this.businessValue) { // 不是长期有效
|
|
|
+ if (!this.form.businessExpire || this.form.businessExpire.length !== 2) {
|
|
|
+ this.$message.warning('生产企业营业执照有效期不能为空!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ const businessEndDate = new Date(this.form.businessExpire[1]);
|
|
|
+ if (businessEndDate < currentDate) {
|
|
|
+ this.$message.warning('生产企业营业执照已过期,无法提交');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3. 检查生产企业的生产许可证/备案凭证
|
|
|
+ if (!this.licenseValue) { // 不是长期有效
|
|
|
+ if (!this.form.licenseExpire || this.form.licenseExpire.length !== 2) {
|
|
|
+ this.$message.warning('生产企业的生产许可证/备案凭证有效期不能为空!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ const licenseEndDate = new Date(this.form.licenseExpire[1]);
|
|
|
+ if (licenseEndDate < currentDate) {
|
|
|
+ this.$message.warning('生产企业的生产许可证/备案凭证已过期,无法提交');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true; // 所有验证通过
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
+ // 检查证件有效期相关逻辑
|
|
|
+ if (!this.validateCertificates()) {
|
|
|
+ return; // 如果验证失败,阻止提交
|
|
|
+ }
|
|
|
+
|
|
|
// 检查商品名称是否有效
|
|
|
if (!this.isProductNameValid) {
|
|
|
this.$message.warning('商品名称包含违禁词,请修改后重新提交');
|
|
|
@@ -2392,6 +2449,8 @@ export default {
|
|
|
this.$message.warning('当前分类许可证检查未通过,无法提交');
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//接着再提交
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
@@ -2434,29 +2493,11 @@ export default {
|
|
|
this.form.qualificationCertificateEnd = this.form.qualificationExpire[1];
|
|
|
}
|
|
|
|
|
|
- if(!!this.businessValue){
|
|
|
- this.form.isBusinessPermanent=1;
|
|
|
- }else {
|
|
|
- this.form.isBusinessPermanent=0;
|
|
|
- }
|
|
|
-
|
|
|
- if(!!this.licenseValue){
|
|
|
- this.form.isLicensePermanent=1;
|
|
|
- }else {
|
|
|
- this.form.isLicensePermanent=0;
|
|
|
- }
|
|
|
-
|
|
|
- if(!!this.certificateValue){
|
|
|
- this.form.isCertificatePermanent=1;
|
|
|
- }else {
|
|
|
- this.form.isCertificatePermanent=0;
|
|
|
- }
|
|
|
-
|
|
|
- if(!!this.gmpAuthValue){
|
|
|
- this.form.isGmpAuthPermanent=1;
|
|
|
- }else {
|
|
|
- this.form.isGmpAuthPermanent=0;
|
|
|
- }
|
|
|
+ // 优化永久有效的设置逻辑
|
|
|
+ this.form.isBusinessPermanent = this.businessValue ? 1 : 0;
|
|
|
+ this.form.isLicensePermanent = this.licenseValue ? 1 : 0;
|
|
|
+ this.form.isCertificatePermanent = this.certificateValue ? 1 : 0;
|
|
|
+ this.form.isGmpAuthPermanent = this.gmpAuthValue ? 1 : 0;
|
|
|
|
|
|
addOrEdit(this.form).then(response => {
|
|
|
if (response.code === 200) {
|