|
|
@@ -52,6 +52,7 @@
|
|
|
<u-input border="none" placeholder="请输入统一社会信用代码" v-model="form.unifiedSocialCreditCode" maxlength="60" />
|
|
|
</u-form-item> -->
|
|
|
<u-form-item required labelWidth="auto" borderBottom label="营业执照" prop="businessLicense">
|
|
|
+ <view style="color: red;">{{errMsg}}</view>
|
|
|
<u-upload
|
|
|
:fileList="fileList2"
|
|
|
@afterRead="afterRead"
|
|
|
@@ -92,7 +93,8 @@
|
|
|
</u-form-item>
|
|
|
</template>
|
|
|
<u-form-item required labelWidth="auto" borderBottom label="经营范围" prop="businessScope">
|
|
|
- <u-input border="none" placeholder="请输入经营范围" v-model="form.businessScope" maxlength="1000" />
|
|
|
+ <u--textarea v-model="form.businessScope" placeholder="请输入经营范围" maxlength="2000"></u--textarea>
|
|
|
+ <!-- <u-input border="none" placeholder="请输入经营范围" v-model="form.businessScope" maxlength="1000" /> -->
|
|
|
</u-form-item>
|
|
|
<u-form-item required labelWidth="auto" borderBottom label="药品经营许可证" prop="drugLicense">
|
|
|
<u-upload
|
|
|
@@ -132,6 +134,17 @@
|
|
|
</picker>
|
|
|
</u-form-item>
|
|
|
</template>
|
|
|
+ <u-form-item required labelWidth="auto" borderBottom label="药品经营许可证经营范围" prop="drugLicenseBusinessScope">
|
|
|
+ <u--textarea v-model="form.drugLicenseBusinessScope" placeholder="请输入药品经营许可证经营范围" maxlength="2000"></u--textarea>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item required labelWidth="auto" borderBottom label="药品经营许可证范围是否包含" prop="drugScopeHasFrozen">
|
|
|
+ <u-radio-group placement="row" v-model="form.drugScopeHasFrozen" >
|
|
|
+ <u-radio activeColor="#2583EB" :customStyle="{marginRight: '16px'}" key="0" label="否 " name="0" > </u-radio>
|
|
|
+ <u-radio activeColor="#2583EB" :customStyle="{marginRight: '16px'}" key="1" label="冷冻" name="1" > </u-radio>
|
|
|
+ <u-radio activeColor="#2583EB" :customStyle="{marginRight: '16px'}" key="2" label="冷藏" name="2" > </u-radio>
|
|
|
+ <u-radio activeColor="#2583EB" :customStyle="{marginRight: '16px'}" key="3" label="冷冻、冷藏" name="3" > </u-radio>
|
|
|
+ </u-radio-group>
|
|
|
+ </u-form-item>
|
|
|
<u-form-item labelWidth="auto" borderBottom label="2类器械经营备案" prop="medicalDevice2">
|
|
|
<u-upload
|
|
|
:fileList="fileList4"
|
|
|
@@ -168,6 +181,9 @@
|
|
|
</picker>
|
|
|
</u-form-item>
|
|
|
</template>
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="2类医疗器械经营许可证营业范围" prop="medicalDevice2BusinessScope">
|
|
|
+ <u--textarea v-model="form.medicalDevice2BusinessScope" placeholder="请输入2类医疗器械经营许可证营业范围" maxlength="2000"></u--textarea>
|
|
|
+ </u-form-item>
|
|
|
<!-- <u-form-item labelWidth="auto" borderBottom label="1类器械生产备案" prop="medicalDevice1">
|
|
|
<u-upload
|
|
|
:fileList="fileList5"
|
|
|
@@ -240,26 +256,29 @@
|
|
|
</picker>
|
|
|
</u-form-item>
|
|
|
</template>
|
|
|
- <u-form-item labelWidth="auto" borderBottom label="食品经营许可证" prop="foodLicense">
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="3类医疗器械经营许可证营业范围" prop="medicalDevice3BusinessScope">
|
|
|
+ <u--textarea v-model="form.medicalDevice3BusinessScope" placeholder="请输入3类医疗器械经营许可证营业范围" maxlength="2000"></u--textarea>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="食品经营许可证/备案凭证" prop="foodLicense">
|
|
|
<u-upload
|
|
|
:fileList="fileList7"
|
|
|
@afterRead="afterRead"
|
|
|
@delete="deletePic"
|
|
|
name="7"
|
|
|
- :maxCount="1"
|
|
|
+ :maxCount="3"
|
|
|
></u-upload>
|
|
|
</u-form-item>
|
|
|
- <u-form-item labelWidth="auto" borderBottom label="食品经营许可证编码" prop="foodCode">
|
|
|
- <u-input border="none" placeholder="请输入食品经营许可证编码" v-model="form.foodCode" maxlength="100" />
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="食品经营许可证/备案凭证编码" prop="foodCode">
|
|
|
+ <u-input border="none" placeholder="请输入食品经营许可证/备案凭证编码" v-model="form.foodCode" maxlength="100" />
|
|
|
</u-form-item>
|
|
|
- <!-- <u-form-item labelWidth="auto" borderBottom label="食品经营许可证是否长期有效" prop="isFoodLicenseExpiryPermanent">
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="食品经营许可证/备案凭证是否长期有效" prop="isFoodLicenseExpiryPermanent">
|
|
|
<u-radio-group placement="row" v-model="form.isFoodLicenseExpiryPermanent" >
|
|
|
<u-radio activeColor="#2583EB" :customStyle="{marginRight: '8px'}" key="1" label="是" :name="1" > </u-radio>
|
|
|
<u-radio activeColor="#2583EB" :customStyle="{marginRight: '8px'}" key="0" label="否" :name="0" > </u-radio>
|
|
|
</u-radio-group>
|
|
|
- </u-form-item> -->
|
|
|
+ </u-form-item>
|
|
|
<template v-if="form.isFoodLicenseExpiryPermanent==0">
|
|
|
- <u-form-item labelWidth="auto" borderBottom label="食品经营许可证有效期开始时间" prop="foodLicenseExpiryStart">
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="食品经营许可证/备案凭证有效期开始时间" prop="foodLicenseExpiryStart">
|
|
|
<picker :value="form.foodLicenseExpiryStart" mode="date" fields="day" @change="pickerChange($event,'foodLicenseExpiryStart')">
|
|
|
<view class="x-f" style="justify-content: space-between;">
|
|
|
<u-input disabled disabledColor="#ffffff" border="none" placeholder="请选择开始时间" v-model="form.foodLicenseExpiryStart" />
|
|
|
@@ -267,7 +286,7 @@
|
|
|
</view>
|
|
|
</picker>
|
|
|
</u-form-item>
|
|
|
- <u-form-item labelWidth="auto" borderBottom label="食品经营许可证有效期结束时间" prop="foodLicenseExpiryEnd">
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="食品经营许可证/备案凭证有效期结束时间" prop="foodLicenseExpiryEnd">
|
|
|
<picker :value="form.foodLicenseExpiryEnd" mode="date" fields="day" @change="pickerChange($event,'foodLicenseExpiryEnd')">
|
|
|
<view class="x-f" style="justify-content: space-between;">
|
|
|
<u-input disabled disabledColor="#ffffff" border="none" placeholder="请选择结束时间" v-model="form.foodLicenseExpiryEnd" />
|
|
|
@@ -276,6 +295,9 @@
|
|
|
</picker>
|
|
|
</u-form-item>
|
|
|
</template>
|
|
|
+ <u-form-item labelWidth="auto" borderBottom label="食品经营范围" prop="foodLicenseBusinessScope">
|
|
|
+ <u--textarea v-model="form.foodLicenseBusinessScope" placeholder="请输入食品经营范围" maxlength="2000"></u--textarea>
|
|
|
+ </u-form-item>
|
|
|
<!-- <u-form-item labelWidth="auto" borderBottom label="医疗机构执业许可证" prop="medicalLicense">
|
|
|
<u-upload
|
|
|
:fileList="fileList8"
|
|
|
@@ -358,7 +380,7 @@
|
|
|
|
|
|
<script>
|
|
|
import {getDictByKey,getHospitalList,getDepartmentList,sendSmsCode,uploadOSS,getCitys} from '@/api/common.js'
|
|
|
-import {storeAdd} from './api/shopping.js'
|
|
|
+import {storeAdd,businessLicenseCheck} from './api/shopping.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -389,7 +411,7 @@ export default {
|
|
|
isMedicalDevice1ExpiryPermanent: 1,
|
|
|
isMedicalDevice2ExpiryPermanent: 1,
|
|
|
isMedicalDevice3ExpiryPermanent: 0,
|
|
|
- isFoodLicenseExpiryPermanent: 0,
|
|
|
+ isFoodLicenseExpiryPermanent: 1,
|
|
|
isMedicalLicenseExpiryPermanent: 1,
|
|
|
storeName:'',
|
|
|
fullName:'',
|
|
|
@@ -435,7 +457,12 @@ export default {
|
|
|
medicalDevice2Code: '',
|
|
|
medicalDevice1Code: '',
|
|
|
drugCode: '',
|
|
|
- businessCode: ''
|
|
|
+ businessCode: '',
|
|
|
+ medicalDevice2BusinessScope: '',
|
|
|
+ medicalDevice3BusinessScope:'',
|
|
|
+ drugLicenseBusinessScope: '',
|
|
|
+ drugScopeHasFrozen: 0,
|
|
|
+ foodLicenseBusinessScope:''
|
|
|
},
|
|
|
rules: {
|
|
|
logoUrl: [{required: true, message: '请上传企业LOGO'}],
|
|
|
@@ -451,7 +478,9 @@ export default {
|
|
|
businessLicenseExpireStart: [],
|
|
|
businessLicenseExpireEnd: [],
|
|
|
drugLicense: [{required: true, message: '请上传药品经营许可证'}],
|
|
|
+ drugLicenseBusinessScope: [{required: true, message: '请输入药品经营许可证经营范围'}],
|
|
|
drugCode: [{required: true, message: '请输入药品经营许可证编码'}],
|
|
|
+ drugScopeHasFrozen: [{required: true, message: '药品经营许可证范围是否包含'}],
|
|
|
// drugLicenseExpiryStart: [{required: true, message: '请选择药品经营许可证编号有效期'}],
|
|
|
// medicalDevice2: [{required: true, message: '请上传2类医疗器械备案'}],
|
|
|
// medicalDevice2Code: [{required: true, message: '请输入2类医疗器械备案编码'}],
|
|
|
@@ -479,7 +508,8 @@ export default {
|
|
|
medicalDevice1Expiry:'',
|
|
|
medicalDevice3Expiry:'',
|
|
|
foodLicenseExpiry:'',
|
|
|
- medicalLicenseExpiry:''
|
|
|
+ medicalLicenseExpiry:'',
|
|
|
+ errMsg:'',
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -680,27 +710,58 @@ export default {
|
|
|
const result = await this.uploadFilePromise(lists[i].url)
|
|
|
let item = this[`fileList${event.name}`][fileListLen]
|
|
|
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
|
|
- status: 'success',
|
|
|
- message: '',
|
|
|
- url: result
|
|
|
+ status: result.status,
|
|
|
+ message: result.status == 'failed' ? '上传失败' : '',
|
|
|
+ url: result.url
|
|
|
}))
|
|
|
fileListLen++
|
|
|
+ if(event.name==2&&result.status=='success') {
|
|
|
+ this.form.businessLicense = this.fileList2[0].url
|
|
|
+ this.businessLicenseCheck()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ getSuccessUrls(list) {
|
|
|
+ if (!list || list.length === 0) return '';
|
|
|
+
|
|
|
+ const hasUploading = list.some(v => v.status === 'uploading');
|
|
|
+ const hasFailed = list.some(v => v.status === 'failed');
|
|
|
+
|
|
|
+ if (hasUploading) {
|
|
|
+ uni.showToast({ title: '请等待图片上传完成', icon: 'none' });
|
|
|
+ return 'failed';
|
|
|
+ }
|
|
|
+ if (hasFailed) {
|
|
|
+ uni.showToast({ title: '请检查是否有图片上传失败', icon: 'none' });
|
|
|
+ return 'failed';
|
|
|
+ }
|
|
|
+
|
|
|
+ return list.filter(v => v.status === 'success').map(v => v.url).join(',');
|
|
|
+ },
|
|
|
uploadFilePromise(url) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
let a = uni.uploadFile({
|
|
|
- url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS',
|
|
|
+ url: uni.getStorageSync('requestPath') +'/app/common/uploadOSS', // 仅为示例,非真实的接口地址
|
|
|
filePath: url,
|
|
|
name: 'file',
|
|
|
- formData: {
|
|
|
- user: 'test'
|
|
|
- },
|
|
|
success: (res) => {
|
|
|
- setTimeout(() => {
|
|
|
- console.log(JSON.parse(res.data).url)
|
|
|
- resolve(JSON.parse(res.data).url)
|
|
|
- }, 1000)
|
|
|
+ if(res.statusCode == 200&&JSON.parse(res.data).code == 200) {
|
|
|
+ resolve({
|
|
|
+ url:JSON.parse(res.data).url,
|
|
|
+ status: 'success'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ resolve({
|
|
|
+ url:url,
|
|
|
+ status: 'failed'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (res) => {
|
|
|
+ resolve({
|
|
|
+ url:url,
|
|
|
+ status: 'failed'
|
|
|
+ })
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
@@ -733,30 +794,39 @@ export default {
|
|
|
},
|
|
|
submit(){
|
|
|
var that=this;
|
|
|
- if(this.fileList1.length>0){
|
|
|
- this.form.logoUrl=this.fileList1[0].url
|
|
|
- }
|
|
|
- if(this.fileList2.length>0){
|
|
|
- this.form.businessLicense=this.fileList2[0].url
|
|
|
- }
|
|
|
- if(this.fileList3.length>0){
|
|
|
- this.form.drugLicense=this.fileList3[0].url
|
|
|
- }
|
|
|
- if(this.fileList4.length>0){
|
|
|
- this.form.medicalDevice2=this.fileList4[0].url
|
|
|
- }
|
|
|
- if(this.fileList5.length>0){
|
|
|
- this.form.medicalDevice1=this.fileList5[0].url
|
|
|
- }
|
|
|
- if(this.fileList6.length>0){
|
|
|
- this.form.medicalDevice3=this.fileList6[0].url
|
|
|
- }
|
|
|
- if(this.fileList7.length>0){
|
|
|
- this.form.foodLicense=this.fileList7[0].url
|
|
|
- }
|
|
|
- if(this.fileList8.length>0){
|
|
|
- this.form.medicalLicense=this.fileList8[0].url
|
|
|
- }
|
|
|
+
|
|
|
+ const logoUrl = this.getSuccessUrls(this.fileList1);
|
|
|
+ if (logoUrl === 'failed') return;
|
|
|
+ this.form.logoUrl = logoUrl;
|
|
|
+
|
|
|
+ const businessLicense = this.getSuccessUrls(this.fileList2);
|
|
|
+ if (businessLicense === 'failed') return;
|
|
|
+ this.form.businessLicense = businessLicense;
|
|
|
+
|
|
|
+ const drugLicense = this.getSuccessUrls(this.fileList3);
|
|
|
+ if (drugLicense === 'failed') return;
|
|
|
+ this.form.drugLicense = drugLicense;
|
|
|
+
|
|
|
+ const medicalDevice2 = this.getSuccessUrls(this.fileList4);
|
|
|
+ if (medicalDevice2 === 'failed') return;
|
|
|
+ this.form.medicalDevice2 = medicalDevice2;
|
|
|
+
|
|
|
+ const medicalDevice1 = this.getSuccessUrls(this.fileList5);
|
|
|
+ if (medicalDevice1 === 'failed') return;
|
|
|
+ this.form.medicalDevice1 = medicalDevice1;
|
|
|
+
|
|
|
+ const medicalDevice3 = this.getSuccessUrls(this.fileList6);
|
|
|
+ if (medicalDevice3 === 'failed') return;
|
|
|
+ this.form.medicalDevice3 = medicalDevice3;
|
|
|
+
|
|
|
+ const foodLicense = this.getSuccessUrls(this.fileList7);
|
|
|
+ if (foodLicense === 'failed') return;
|
|
|
+ this.form.foodLicense = foodLicense;
|
|
|
+
|
|
|
+ const medicalLicense = this.getSuccessUrls(this.fileList8);
|
|
|
+ if (medicalLicense === 'failed') return;
|
|
|
+ this.form.medicalLicense = medicalLicense;
|
|
|
+
|
|
|
console.log(this.form)
|
|
|
if(this.form.isBusinessLicensePermanent == 0&&!this.form.businessLicenseExpireStart) {
|
|
|
uni.showToast({
|
|
|
@@ -800,6 +870,56 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ if(this.form.isFoodLicenseExpiryPermanent == 0&&!this.form.foodLicenseExpiryStart) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择食品经营许可证/备案凭证有效期开始时间',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(this.form.isFoodLicenseExpiryPermanent == 0&&!this.form.foodLicenseExpiryEnd) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择食品经营许可证/备案凭证有效期结束时间',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const err = this.checkDateRanges([
|
|
|
+ {
|
|
|
+ start: this.form.businessLicenseExpireStart,
|
|
|
+ end: this.form.businessLicenseExpireEnd,
|
|
|
+ msg: '营业执照有效期' ,
|
|
|
+ require: this.form.isBusinessLicensePermanent == 0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ start: this.form.drugLicenseExpiryStart,
|
|
|
+ end: this.form.drugLicenseExpiryEnd,
|
|
|
+ msg: '药品经营许可证编号有效期' ,
|
|
|
+ require: this.form.isDrugLicensePermanent == 0,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ start: this.form.medicalDevice2ExpiryStart,
|
|
|
+ end: this.form.medicalDevice2ExpiryEnd,
|
|
|
+ msg: '2类器械经营备案有效期',
|
|
|
+ require: this.form.isMedicalDevice2ExpiryPermanent == 0,
|
|
|
+ },{
|
|
|
+ start: this.form.medicalDevice3ExpiryStart,
|
|
|
+ end: this.form.medicalDevice3ExpiryEnd,
|
|
|
+ msg: '3类器械经营许可证有效期' ,
|
|
|
+ require: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ start: this.form.foodLicenseExpiryStart,
|
|
|
+ end: this.form.foodLicenseExpiryEnd,
|
|
|
+ msg: '食品经营许可证/备案凭证有效期' ,
|
|
|
+ require: this.form.isFoodLicenseExpiryPermanent == 0,
|
|
|
+ }
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if (err) {
|
|
|
+ uni.showToast({ title: err, icon: 'none' });
|
|
|
+ return;
|
|
|
+ }
|
|
|
// if(this.form.isMedicalLicenseExpiryPermanent == 0&&!this.form.medicalLicenseExpiryStart) {
|
|
|
// uni.showToast({
|
|
|
// title: '请选择医疗机构执业许可证有效期开始时间',
|
|
|
@@ -821,6 +941,73 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ checkDateRanges(list = []) {
|
|
|
+ for (const { start, end, msg = '有效期', require = true, afterToday = true } of list) {
|
|
|
+ // 1. require=false 且任一为空 → 跳过
|
|
|
+ if (!require && (!start || !end)) continue;
|
|
|
+
|
|
|
+ // 2. require=true 时缺值 → 报错
|
|
|
+ if (!start || !end) return `${msg} 请选择完整时间`;
|
|
|
+
|
|
|
+ // 3. 常规区间校验
|
|
|
+ if (start > end) return `${msg} 开始时间不能大于结束时间`;
|
|
|
+
|
|
|
+ if (afterToday) {
|
|
|
+ // 今天 00:00:00.000
|
|
|
+ const todayZero = new Date();
|
|
|
+ todayZero.setHours(0, 0, 0, 0);
|
|
|
+
|
|
|
+ // 明天 00:00:00.000
|
|
|
+ const tomorrowZero = new Date(todayZero);
|
|
|
+ tomorrowZero.setDate(todayZero.getDate() + 1);
|
|
|
+
|
|
|
+ // 结束日期 00:00:00.000
|
|
|
+ const endZero = new Date(end);
|
|
|
+ endZero.setHours(0, 0, 0, 0);
|
|
|
+
|
|
|
+ // 结束日期 < 明天零点 → 不合法
|
|
|
+ if (endZero < tomorrowZero) return `${msg} 结束时间必须大于今天`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ },
|
|
|
+ businessLicenseCheck() {
|
|
|
+ businessLicenseCheck({imageUrl:this.form.businessLicense}).then(res=>{
|
|
|
+ if(res.code==200) {
|
|
|
+ if(res.data.flag) {
|
|
|
+ this.errMsg = ''
|
|
|
+ this.form.enterpriseAddress = res.data.address;
|
|
|
+ this.form.legalPersonName = res.data.person;
|
|
|
+ this.form.businessScope = res.data.businessStr;
|
|
|
+ this.form.businessCode = res.data.regNum;
|
|
|
+ } else {
|
|
|
+ this.fileList2 = ''
|
|
|
+ this.form.businessLicense = ''
|
|
|
+ this.errMsg = '请上传正确且清晰的营业执照'
|
|
|
+ uni.showToast({
|
|
|
+ title: '请上传正确且清晰的营业执照',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.errMsg = ''
|
|
|
+ this.fileList2 = ''
|
|
|
+ this.form.businessLicense = ''
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch((err)=>{
|
|
|
+ this.errMsg = ''
|
|
|
+ this.fileList2 = ''
|
|
|
+ this.form.businessLicense = ''
|
|
|
+ uni.showToast({
|
|
|
+ title: err,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|