yanjie 4 роки тому
батько
коміт
4e80ad5f8d
1 змінених файлів з 244 додано та 103 видалено
  1. 244 103
      pages/login/doctorRenzheng.vue

+ 244 - 103
pages/login/doctorRenzheng.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -14,19 +14,22 @@
 			<view class="flex align-center justify-between" style="margin: 20rpx 0;">
 				<view style="width: 30%;font-weight: bold;" class="felx align-center">医生姓名</view>
 				<text v-if="allupload">{{form.name}}</text>
-				<u-input v-model="form.name" type="text" :border="false" placeholder="请填写真实姓名" input-align="right" maxlength="6" v-else/>
+				<u-input v-model="form.name" type="text" :border="false" placeholder="请填写真实姓名" input-align="right" maxlength="6"
+				 v-else />
 			</view>
 			<u-line color="#f0f2f5" />
 			<view class="flex align-center justify-between" style="margin: 20rpx 0;">
 				<view style="width: 30%;font-weight: bold;" class="felx align-center">性别</view>
 				<text v-if="allupload">{{form.sex}}</text>
-				<u-icon name="arrow-down" color="#dddfe1" @click="sexshow = true" :label="form.sex==''?'请选择性别':form.sex" label-pos="left" :label-color="form.sex==''?'#c7c9ca':'#000000'" v-else></u-icon>
+				<u-icon name="arrow-down" color="#dddfe1" @click="sexshow = true" :label="form.sex==''?'请选择性别':form.sex" label-pos="left"
+				 :label-color="form.sex==''?'#c7c9ca':'#000000'" v-else></u-icon>
 			</view>
 			<u-line color="#f0f2f5" />
 			<view class="flex align-center justify-between" style="margin: 20rpx 0;">
 				<view style="width: 30%;font-weight: bold;" class="felx align-center">身份证</view>
 				<text v-if="allupload">{{form.ID}}</text>
-				<u-input v-model="form.ID" type="idcard" :border="false" placeholder="请填写身份证号" input-align="right" maxlength="18" v-else/>
+				<u-input v-model="form.ID" type="idcard" :border="false" placeholder="请填写身份证号" input-align="right" maxlength="18"
+				 v-else />
 			</view>
 		</view>
 
@@ -39,7 +42,21 @@
 			</view>
 			<!-- 上传 -->
 			<view>
-				<u-upload :action="action" :file-list="form.certificate" max-count="2" ref="Upractice" :auto-upload="true" :deletable="!allupload"></u-upload>
+				<!-- <u-upload :action="action" :file-list="form.certificate" max-count="2" ref="Upractice" :auto-upload="true"
+				 :deletable="!allupload"></u-upload> -->
+				<view class="cu-form-group">
+					<view class="grid col-4 grid-square flex-sub">
+						<view class="bg-img" v-for="(item,index) in form.certificate" :key="index" :data-url="form.certificate[index]">
+							<image :src="'https://xiaoyunimg.top/'+form.certificate[index]" mode='aspectFill'></image>
+							<view class="cu-tag bg-red" v-if="iscertificate" @click="certificateDelImg" :data-index="index">
+								<text class="cuIcon-close"></text>
+							</view>
+						</view>
+						<view class="solids" @click="certificateChooseImage" v-if="form.certificate.length<2">
+							<text class="cuIcon-cameraadd"></text>
+						</view>
+					</view>
+				</view>
 			</view>
 		</view>
 		<view style="border-bottom: 0.5rpx solid #EFEFEF;padding: 10rpx 25rpx;">
@@ -49,7 +66,21 @@
 			</view>
 			<!-- 上传 -->
 			<view>
-				<u-upload :action="action" :file-list="form.idPhoto" max-count="2" ref="Ucard_photo" :auto-upload="true" :deletable="!allupload"></u-upload>
+
+				<!-- <u-upload :action="action" :file-list="form.idPhoto" max-count="2" ref="Ucard_photo" :auto-upload="true" :deletable="!allupload"></u-upload> -->
+				<view class="cu-form-group">
+					<view class="grid col-4 grid-square flex-sub">
+						<view class="bg-img" v-for="(item,index) in form.idPhoto" :key="index" :data-url="form.idPhoto[index]">
+							<image :src="'https://xiaoyunimg.top/'+form.idPhoto[index]" mode='aspectFill'></image>
+							<view class="cu-tag bg-red" v-if="isidPhoto" @click="idPhotoDelImg" :data-index="index">
+								<text class="cuIcon-close"></text>
+							</view>
+						</view>
+						<view class="solids" @click="idPhotoChooseImage" v-if="form.idPhoto.length<2">
+							<text class="cuIcon-cameraadd"></text>
+						</view>
+					</view>
+				</view>
 			</view>
 
 		</view>
@@ -60,7 +91,21 @@
 			</view>
 			<!-- 上传 -->
 			<view>
-				<u-upload :action="action" :file-list="form.doctorQualification" max-count="2" ref="Uis_quali" :auto-upload="true" :deletable="!allupload"></u-upload>
+				<!-- <u-upload :action="action" :file-list="form.doctorQualification" max-count="2" ref="Uis_quali" :auto-upload="true"
+				 :deletable="!allupload"></u-upload> -->
+				<view class="cu-form-group">
+					<view class="grid col-4 grid-square flex-sub">
+						<view class="bg-img" v-for="(item,index) in form.doctorQualification" :key="index" :data-url="form.doctorQualification[index]">
+							<image :src="'https://xiaoyunimg.top/'+form.doctorQualification[index]" mode='aspectFill'></image>
+							<view class="cu-tag bg-red" v-if="isdoctorQualification" @click="doctorQualificationDelImg" :data-index="index">
+								<text class="cuIcon-close"></text>
+							</view>
+						</view>
+						<view class="solids" @click="doctorQualificationChooseImage" v-if="form.doctorQualification.length<2">
+							<text class="cuIcon-cameraadd"></text>
+						</view>
+					</view>
+				</view>
 			</view>
 		</view>
 
@@ -78,7 +123,8 @@
 				<u-icon name="close" size="30" @click="closemechanism" style="margin-right:20rpx;" v-if="index != 0&&item.Submit==0"></u-icon>
 				<!-- 状态  1审核中 2审核通过 3审核不通过    -->
 				<view v-else-if="item.Submit==0" style="color:#EA970E;font-size: 28rpx;">状态:审核中</view>
-				<view v-else-if="item.Submit==1" style="color:#4CAD84;font-size: 28rpx;">状态:已审核</view>
+				<view v-else-if="item.Submit==1" style="color:#4CAD84;font-size: 28rpx;">状态:审核通过</view>
+				<view v-else="item.Submit==2" style="color:#4CAD84;font-size: 28rpx;">状态:审核拒绝</view>
 			</view>
 			<!-- 地区 -->
 			<view style="padding: 25rpx 10rpx;" class="flex align-center justify-around" @click="regionClick(index)">
@@ -110,7 +156,7 @@
 		</view>
 
 		<u-gap height="200" bg-color="#f0f2f5"></u-gap>
-		<view class="bottomButton" @click="bc" >提交</view>
+		<view class="bottomButton" @click="bc">提交</view>
 		<!-- <view class="bottomButton" @click="jxrz" style="background-color: #FFF;color: #0000FF;">继续认证</view> -->
 	</view>
 
@@ -123,7 +169,7 @@
 			this.provinceconfirm()
 			this.addmechanism()
 			this.docterInfos();
-		
+
 		},
 		mounted() {},
 		data() {
@@ -155,61 +201,75 @@
 
 				//省市区选择器
 				regionShow: false,
-				regionlist: [
-				],
+				regionlist: [],
 				regindex: 0, //记录点击的地方
 				//机构科室资质选择器
 				hospitalShow: false,
 				hospitallist: [],
 				hosindex: 0, //记录点击的地方
 				//提交之后不能修改姓名 身份证 性别 证书
-				allupload: false //是否已经提交过并且审核通过
+				allupload: false, //是否已经提交过并且审核通过
+				iscertificate: true,
+				isidPhoto: true,
+				isdoctorQualification: true
+
 			}
 		},
 		methods: {
 			/*****************view点击**********************/
 			//省市区选择器打开
-			
-			docterInfos:async function(){
+
+			docterInfos: async function() {
 				let res = await this.$request.post("doctor/getRenInfo");
-				if(res.status==0){
-					if(res.data!=undefined || res.data!="undefined"){
-						if(res.data.info.length!=undefined || res.data.info.length!='undefined'){
+				if (res.status == 0) {
+					if (res.data != undefined || res.data != "undefined") {
+						if (res.data.oqf.length != 0 || res.data.orgList.length != 0) {
 							this.allupload = true;
 							this.form.name = res.data.info.name;
-							this.form.sex = res.data.info.sex==1?'男':'女';
-							this.form.ID = res.data.info.card_id; 
-							this.form.certificate = res.data.info.practice.split(',');
-							this.form.idPhoto = res.data.info.card_photo.split(',');
-							this.form.doctorQualification = res.data.info.is_quail.split(',');
+							this.form.sex = res.data.info.sex == 1 ? '男' : '女';
+							this.form.ID = res.data.info.card_id;
+							if (res.data.info.practice != '0') {
+								this.form.certificate = res.data.info.practice.split(',');
+								this.iscertificate = false
+							}
+							if (res.data.info.card_photo != '0') {
+								this.form.idPhoto = res.data.info.card_photo.split(',');
+								this.isidPhoto = false
+							}
+							if (res.data.info.is_quail != '0') {
+								this.form.doctorQualification = res.data.info.is_quail.split(',');
+								this.isdoctorQualification = false
+							}
+
+
 						}
-						
-						if(res.data.orgList.length!=0){
+						console.log(this.form.certificate)
+						if (res.data.orgList.length != 0 && res.data.oqf.length != 0) {
 							let orglist = res.data.orgList;
 							let oqflist = res.data.oqf;
-							this.mechanismList.length=0;
-							this.form.works.length=0;
-							for(let i=0;i<orglist.length;i++){
+							this.mechanismList.length = 0;
+							this.form.works.length = 0;
+							for (let i = 0; i < orglist.length; i++) {
 								// 获取到修改中数据
 								this.form.works.push({
 									hospital: orglist[i].organization.id, //医院id
 									department: oqflist[i].office.id, //科室id
 									qualifications: oqflist[i].qualification.id, //资质id
-									state:orglist[i].state,
+									state: orglist[i].state,
 								})
-								
+
 								// 渲染页面数据
 								this.mechanismList.push({
 									title: '工作机构' + this.convertToChinese(this.mechanismList.length + 1), //工作机构名称
-									regionText: orglist[i].province +'-' + orglist[i].city +'-'+orglist[i].area, //地区信息文字
-									hospitalText: orglist[i].name +'-'+oqflist[i].office.name+'-'+oqflist[i].qualification.name, //机构信息文字
+									regionText: orglist[i].province + '-' + orglist[i].city + '-' + orglist[i].area, //地区信息文字
+									hospitalText: orglist[i].name + '-' + oqflist[i].office.name + '-' + oqflist[i].qualification.name, //机构信息文字
 									preservation: true, //是否已经保存
 									Submit: orglist[i].state, // 0=审核中,1=审核通过,2=审核拒绝 信息状态 0未提交 1审核中 2审核通过 3审核不通过
 								})
 							}
 						}
-						
-						
+
+
 					}
 				}
 			},
@@ -227,11 +287,11 @@
 			//机构选择器打开
 			hospitalClick(index) {
 				console.log(index);
-				if(this.mechanismList.length - 1 == index){
-					if (this.mechanismList[index].regionText!='') {
-					this.hospitalShow = true
-					this.hosindex = index //保存点击的地方
-					}else{
+				if (this.mechanismList.length - 1 == index) {
+					if (this.mechanismList[index].regionText != '') {
+						this.hospitalShow = true
+						this.hosindex = index //保存点击的地方
+					} else {
 						uni.showToast({
 							title: '请先填写地区数据',
 							icon: 'none'
@@ -247,26 +307,26 @@
 			//省市区选择器确认
 			regionChoice(e) {
 				this.mechanismList[this.hosindex].hospitalText = '';
-				this.hospitalconfirm(e[0].value,e[1].value,e[2].value);
+				this.hospitalconfirm(e[0].value, e[1].value, e[2].value);
 				this.mechanismList[this.regindex].regionText = e[0].label + '-' + e[1].label + '-' + e[2].label //利用保存的地方赋值
 			},
 			//机构选择
 			hospitalChoice(e) {
-				if(typeof this.form.works[this.hosindex]==undefined || typeof this.form.works[this.hosindex]=='undefined'){
+				if (typeof this.form.works[this.hosindex] == undefined || typeof this.form.works[this.hosindex] == 'undefined') {
 					this.form.works.push({
 						hospital: e[0].value, //医院id
 						department: e[1].value, //科室id
 						qualifications: e[2].value, //资质id
-						state:0,
+						state: 0,
 					})
-				}else{
+				} else {
 					this.form.works[this.hosindex].hospital = e[0].value;
 					this.form.works[this.hosindex].department = e[1].value;
 					this.form.works[this.hosindex].qualifications = e[2].value;
 					this.form.works[this.hosindex].state = 0;
 				}
-				
-				
+
+
 				this.mechanismList[this.hosindex].hospitalText = e[0].label + '-' + e[1].label + '-' + e[2].label
 			},
 			//数字转文字
@@ -329,7 +389,7 @@
 				// console.log('省', res.data)
 				// this.provincelist = this.provincelist2 = res.data
 				this.regionlist = res.data
-				
+
 			},
 			//市
 			cityconfirm: async function(e) {
@@ -373,7 +433,7 @@
 				console.log('提交的数据', c)
 				console.log('提交的数据', a)
 				console.log('医院', res.data)
-				if(res.status==0){
+				if (res.status == 0) {
 					this.hospitallist = res.data
 				}
 			},
@@ -403,21 +463,21 @@
 			},
 			// 保存
 			bc: async function() {
-				
-				if(this.mechanismList[this.mechanismList.length - 1].preservation == false){
+
+				if (this.mechanismList[this.mechanismList.length - 1].preservation == false) {
 					uni.showModal({
-						'title':'请先保存机构!'
+						'title': '请先保存机构!'
 					})
 					return false;
 				}
 				//保存之后改变机构信息状态
-			/* 	this.mechanismList.map(val => {
-					//判断是不是新增的数据    状态为0
-					if(val.Submit==0){
-						val.Submit = 1;
-					}
-				}) */
-				
+				/* 	this.mechanismList.map(val => {
+						//判断是不是新增的数据    状态为0
+						if(val.Submit==0){
+							val.Submit = 1;
+						}
+					}) */
+
 				//照片
 				let practice = [] //证书
 				let card_photo = [] //身份证
@@ -432,43 +492,43 @@
 				// is_quail = this.$refs.uUpload.lists.filter(val => {
 				// 	return val.progress == 100;
 				// })
-				
+
 				// 如果您不需要进行太多的处理,直接如下即可
-	/* 			practice = this.$refs.Upractice.lists; //证书
-				card_photo = this.$refs.Ucard_photo.lists; //身份证
-				is_quali = this.$refs.Uis_quali.lists; //资格
+				/* 			practice = this.$refs.Upractice.lists; //证书
+							card_photo = this.$refs.Ucard_photo.lists; //身份证
+							is_quali = this.$refs.Uis_quali.lists; //资格
 
-				if (typeof practice[0] == 'undefined' || typeof practice[1] == 'undefined') {
-					uni.showToast({
-						'title': '医师职业证书必填',
-						icon: "none"
-					})
-					return false;
-				}
+							if (typeof practice[0] == 'undefined' || typeof practice[1] == 'undefined') {
+								uni.showToast({
+									'title': '医师职业证书必填',
+									icon: "none"
+								})
+								return false;
+							}
 
-				if (typeof card_photo[0] == 'undefined' || typeof card_photo[1] == 'undefined') {
-					uni.showToast({
-						'title': '身份证必填',
-						icon: "none"
-					})
-					return false;
-				}
-				if (typeof is_quali[0] == 'undefined' || typeof is_quali[1] == 'undefined') {
-					uni.showToast({
-						'title': '资格证必填',
-						icon: "none"
-					})
-					return false;
-				}
-				this.form.certificate = [practice[0].response.data.url, practice[1].response.data.url]
-				this.form.idPhoto = [card_photo[0].response.data.url, card_photo[1].response.data.url]
-				this.form.doctorQualification = [is_quali[0].response.data.url, is_quali[1].response.data.url] */
+							if (typeof card_photo[0] == 'undefined' || typeof card_photo[1] == 'undefined') {
+								uni.showToast({
+									'title': '身份证必填',
+									icon: "none"
+								})
+								return false;
+							}
+							if (typeof is_quali[0] == 'undefined' || typeof is_quali[1] == 'undefined') {
+								uni.showToast({
+									'title': '资格证必填',
+									icon: "none"
+								})
+								return false;
+							}
+							this.form.certificate = [practice[0].response.data.url, practice[1].response.data.url]
+							this.form.idPhoto = [card_photo[0].response.data.url, card_photo[1].response.data.url]
+							this.form.doctorQualification = [is_quali[0].response.data.url, is_quali[1].response.data.url] */
 
 
 				if (typeof this.form.works != 'string') {
 					this.form.works = JSON.stringify(this.form.works);
 				}
-				console.log('提交表单!',this.form);
+				console.log('提交表单!', this.form);
 
 				// 注意要 {'doctor_name':'ddd',doctor_sex:1....}分开传值因为我方便拦截垃圾数据
 				let res = await this.$request.post('doctor/addthen', this.form);
@@ -480,30 +540,111 @@
 				}
 
 			},
-			ChooseImage() {
-				let that = this;
+			certificateChooseImage() {
+				let arr = []
 				uni.chooseImage({
-					count: 1, //默认9
-					sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
+					count: 2, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
 					sourceType: ['album', 'camera'], //从相册选择
 					success: (res) => {
-						let tempFilePaths = res.tempFilePaths;
-						// 图片上传案例
-						const uploadTask = wx.uploadFile({
-							url: 'http://182.92.112.142/api/v2/Common/uploadFile',
-							filePath: tempFilePaths[0],
-							name: 'file',
-							success: function(uploadFileRes) {
-								let arr = [];
-								arr.push(imglocal + JSON.parse(uploadFileRes.data).data.url);
-								that.imgList = arr
-								that.src = JSON.parse(uploadFileRes.data).data.url
-							}
-						})
-
+						if (arr.length != 0) {
+							arr = arr.concat(res.tempFilePaths)
+							this.$request.upload("Common/uploadFile", arr[arr.length - 1], {}).then(data => {
+								this.form.certificate.push(JSON.parse(data).data.url)
+							})
+						} else {
+							arr = res.tempFilePaths
+							this.$request.upload("Common/uploadFile", arr[0], {}).then(data => {
+								this.form.certificate.push(JSON.parse(data).data.url)
+							})
+						}
+					}
+				});
+			},
+			idPhotoChooseImage() {
+				let arr = []
+				uni.chooseImage({
+					count: 2, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['album', 'camera'], //从相册选择
+					success: (res) => {
+						if (arr.length != 0) {
+							arr = arr.concat(res.tempFilePaths)
+							this.$request.upload("Common/uploadFile", arr[arr.length - 1], {}).then(data => {
+								this.form.idPhoto.push(JSON.parse(data).data.url)
+							})
+						} else {
+							arr = res.tempFilePaths
+							this.$request.upload("Common/uploadFile", arr[0], {}).then(data => {
+								this.form.idPhoto.push(JSON.parse(data).data.url)
+							})
+						}
 					}
 				});
 			},
+			doctorQualificationChooseImage() {
+				let arr = []
+				uni.chooseImage({
+					count: 2, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['album', 'camera'], //从相册选择
+					success: (res) => {
+						if (arr.length != 0) {
+							arr = arr.concat(res.tempFilePaths)
+							this.$request.upload("Common/uploadFile", arr[arr.length - 1], {}).then(data => {
+								this.form.doctorQualification.push(JSON.parse(data).data.url)
+							})
+						} else {
+							arr = res.tempFilePaths
+							this.$request.upload("Common/uploadFile", arr[0], {}).then(data => {
+								this.form.doctorQualification.push(JSON.parse(data).data.url)
+							})
+						}
+					}
+				});
+			},
+			certificateDelImg(e) {
+				uni.showModal({
+					title: '提示',
+					content: '确定要删除吗?',
+					cancelText: '再想想',
+					confirmText: '删除',
+					success: res => {
+						if (res.confirm) {
+							this.form.certificate.splice(e.currentTarget.dataset.index, 1);
+							this.form.certificate = this.form.certificate
+						}
+					}
+				})
+			},
+			idPhotoDelImg(e) {
+				uni.showModal({
+					title: '提示',
+					content: '确定要删除吗?',
+					cancelText: '再想想',
+					confirmText: '删除',
+					success: res => {
+						if (res.confirm) {
+							this.form.idPhoto.splice(e.currentTarget.dataset.index, 1);
+							this.form.idPhoto = this.form.idPhoto
+						}
+					}
+				})
+			},
+			doctorQualificationDelImg(e) {
+				uni.showModal({
+					title: '提示',
+					content: '确定要删除吗?',
+					cancelText: '再想想',
+					confirmText: '删除',
+					success: res => {
+						if (res.confirm) {
+							this.form.doctorQualification.splice(e.currentTarget.dataset.index, 1);
+							this.form.doctorQualification = this.form.doctorQualification
+						}
+					}
+				})
+			},
 		}
 	};
 </script>