|
|
@@ -2380,61 +2380,71 @@ export default {
|
|
|
// 验证证件有效期
|
|
|
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. 检查生产企业营业执照
|
|
|
+ // 1. 检查生产企业营业执照
|
|
|
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. 检查生产企业的生产许可证/备案凭证
|
|
|
+ // 2. 检查生产企业的生产许可证/备案凭证
|
|
|
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;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ // 3. 检查商品注册证/备案凭证
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
return true; // 所有验证通过
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ checkImages(){
|
|
|
+ if(!this.form.business){
|
|
|
+ this.$message.warning('生产企业营业执照不能为空');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(!this.form.license){
|
|
|
+ this.$message.warning('生产企业的生产许可证/备案凭证不能为空');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(!this.form.certificate){
|
|
|
+ this.$message.warning('商品注册证/备案凭证');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
- // 检查证件有效期相关逻辑
|
|
|
- if (!this.validateCertificates()) {
|
|
|
- return; // 如果验证失败,阻止提交
|
|
|
- }
|
|
|
-
|
|
|
+ // if(this.form.isShow === '1'){
|
|
|
+ //检查必要照片上传
|
|
|
+ if(!this.checkImages()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 检查证件有效期相关逻辑
|
|
|
+ if (!this.validateCertificates()) {
|
|
|
+ return; // 如果验证失败,阻止提交
|
|
|
+ }
|
|
|
+ // }
|
|
|
// 检查商品名称是否有效
|
|
|
if (!this.isProductNameValid) {
|
|
|
this.$message.warning('商品名称包含违禁词,请修改后重新提交');
|
|
|
@@ -2451,7 +2461,6 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//接着再提交
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|