Browse Source

更多设置提交

刘远航 4 years ago
parent
commit
0123f2186f
3 changed files with 222 additions and 84 deletions
  1. 1 1
      pages/login/doctorRenzheng.vue
  2. 182 80
      pages/service/more.vue
  3. 39 3
      pages/service/setservice.vue

+ 1 - 1
pages/login/doctorRenzheng.vue

xqd
@@ -705,7 +705,7 @@
 						let tempFilePaths = res.tempFilePaths;
 						// 图片上传案例
 						const uploadTask = wx.uploadFile({
-							url: 'http://182.92.112.142/api/v2/Common/uploadFile',
+							url: 'https://xiaoyunimg.top/api/v2/Common/uploadFile',
 							filePath: tempFilePaths[0],
 							name: 'file',
 							success: function(uploadFileRes) {

+ 182 - 80
pages/service/more.vue

xqd xqd xqd xqd xqd xqd
@@ -480,11 +480,7 @@
 				}, {
 					flag: true
 				}, ],
-				hospital: [{
-					name: '熊科医院'
-				}, {
-					name: '测试医院'
-				}],
+				hospital: [{'name':'医院1'},{'name':'医院2'}],
 				hospitals: [],
 				hospitalcurrent: 0,
 				list: [{
@@ -601,88 +597,109 @@
 							service_time: "",
 							relation_id: 0
 						}]
-					}
+					},
+					type:2
 				}
 
 			}
 		},
 		methods: {
 			/*    保存       */
-			bc(e) {
+			bc:async function(e) {
+				let that = this;
 				/**
 				 * 电话
 				 * */
-				for(let i in this.dh.timeList1){		//遍历选中 保存id
-					if(this.dh.timeList1[i].checked){this.form.is_phone.service_time = this.form.is_phone.service_time+","+this.dh.timeList1[i].id}
+				 
+				 that.form.is_phone.service_time='';
+				 that.form.is_chat.service_time='';
+				 that.form.is_appoint.hospitals[0].service_time='';
+				 that.form.is_appoint.hospitals[1].service_time='';
+				for(let i in that.dh.timeList1){		//遍历选中 保存id
+					if(that.dh.timeList1[i].checked){that.form.is_phone.service_time = that.form.is_phone.service_time+","+that.dh.timeList1[i].id}
 				}
-				for(let i in this.dh.timeList2){		//遍历选中 保存id
-					if(this.dh.timeList2[i].checked){this.form.is_phone.service_time = this.form.is_phone.service_time+","+this.dh.timeList2[i].id}
+				for(let i in that.dh.timeList2){		//遍历选中 保存id
+					if(that.dh.timeList2[i].checked){that.form.is_phone.service_time = that.form.is_phone.service_time+","+that.dh.timeList2[i].id}
 				}
-				for(let i in this.dh.timeList3){		//遍历选中 保存id
-					if(this.dh.timeList3[i].checked){this.form.is_phone.service_time = this.form.is_phone.service_time+","+this.dh.timeList3[i].id}
+				for(let i in that.dh.timeList3){		//遍历选中 保存id
+					if(that.dh.timeList3[i].checked){that.form.is_phone.service_time = that.form.is_phone.service_time+","+that.dh.timeList3[i].id}
 				}
 				//判断开头第一个是否为逗号,是就删除逗号
-				if(this.form.is_phone.service_time.startsWith(",")){
-					this.form.is_phone.service_time= this.form.is_phone.service_time.substr(1);
+				if(that.form.is_phone.service_time.startsWith(",")){
+					that.form.is_phone.service_time= that.form.is_phone.service_time.substr(1);
 				}
 				/**
 				 * 图文
 				 * */
-				for(let i in this.tw.timeList1){		//遍历选中 保存id
-					if(this.tw.timeList1[i].checked){this.form.is_chat.service_time = this.form.is_chat.service_time+","+this.tw.timeList1[i].id}
+				 
+				for(let i in that.tw.timeList1){		//遍历选中 保存id
+					if(that.tw.timeList1[i].checked){that.form.is_chat.service_time = that.form.is_chat.service_time+","+that.tw.timeList1[i].id}
 				}
-				for(let i in this.tw.timeList2){		//遍历选中 保存id
-					if(this.tw.timeList2[i].checked){this.form.is_chat.service_time = this.form.is_chat.service_time+","+this.tw.timeList2[i].id}
+				for(let i in that.tw.timeList2){		//遍历选中 保存id
+					if(that.tw.timeList2[i].checked){that.form.is_chat.service_time = that.form.is_chat.service_time+","+that.tw.timeList2[i].id}
 				}
-				for(let i in this.tw.timeList3){		//遍历选中 保存id
-					if(this.tw.timeList3[i].checked){this.form.is_chat.service_time = this.form.is_chat.service_time+","+this.tw.timeList3[i].id}
+				for(let i in that.tw.timeList3){		//遍历选中 保存id
+					if(that.tw.timeList3[i].checked){that.form.is_chat.service_time =thatthat.form.is_chat.service_time+","+that.tw.timeList3[i].id}
 				}
 				//判断开头第一个是否为逗号,是就删除逗号
-				if(this.form.is_chat.service_time.startsWith(",")){
-					this.form.is_chat.service_time= this.form.is_chat.service_time.substr(1);
+				if(that.form.is_chat.service_time.startsWith(",")){
+					
+					that.form.is_chat.service_time= that.form.is_chat.service_time.substr(1);
 				}
 				/**
 				 * 门诊
 				 * */
-				for(let i in this.mz1.timeList1){		//遍历选中 保存id
-					if(this.mz1.timeList1[i].checked){this.form.is_appoint.hospitals[0].service_time = this.form.is_appoint.hospitals[0].service_time+","+this.mz1.timeList1[i].id}
+				for(let i in that.mz1.timeList1){		//遍历选中 保存id
+					if(that.mz1.timeList1[i].checked){that.form.is_appoint.hospitals[0].service_time = that.form.is_appoint.hospitals[0].service_time+","+that.mz1.timeList1[i].id}
 				}
-				for(let i in this.mz1.timeList2){		//遍历选中 保存id
-					if(this.mz1.timeList2[i].checked){this.form.is_appoint.hospitals[0].service_time = this.form.is_appoint.hospitals[0].service_time+","+this.mz1.timeList2[i].id}
+				for(let i in that.mz1.timeList2){		//遍历选中 保存id
+					if(that.mz1.timeList2[i].checked){that.form.is_appoint.hospitals[0].service_time = that.form.is_appoint.hospitals[0].service_time+","+that.mz1.timeList2[i].id}
 				}
-				for(let i in this.mz1.timeList3){		//遍历选中 保存id
-					if(this.mz1.timeList3[i].checked){this.form.is_appoint.hospitals[0].service_time = this.form.is_appoint.hospitals[0].service_time+","+this.mz1.timeList3[i].id}
+				for(let i in that.mz1.timeList3){		//遍历选中 保存id
+					if(that.mz1.timeList3[i].checked){that.form.is_appoint.hospitals[0].service_time = that.form.is_appoint.hospitals[0].service_time+","+that.mz1.timeList3[i].id}
 				}
 				//判断开头第一个是否为逗号,是就删除逗号
-				if(this.form.is_appoint.hospitals[0].service_time.startsWith(",")){
-					this.form.is_appoint.hospitals[0].service_time= this.form.is_appoint.hospitals[0].service_time.substr(1);
+				if(that.form.is_appoint.hospitals[0].service_time.startsWith(",")){
+					
+					that.form.is_appoint.hospitals[0].service_time= that.form.is_appoint.hospitals[0].service_time.substr(1);
 				}
 				/**
 				 * 门诊
 				 * */
-				for(let i in this.mz2.timeList1){		//遍历选中 保存id
-					if(this.mz2.timeList1[i].checked){this.form.is_appoint.hospitals[1].service_time = this.form.is_appoint.hospitals[1].service_time+","+this.mz2.timeList1[i].id}
+				for(let i in that.mz2.timeList1){		//遍历选中 保存id
+					if(that.mz2.timeList1[i].checked){that.form.is_appoint.hospitals[1].service_time = that.form.is_appoint.hospitals[1].service_time+","+that.mz2.timeList1[i].id}
 				}
-				for(let i in this.mz2.timeList2){		//遍历选中 保存id
-					if(this.mz2.timeList2[i].checked){this.form.is_appoint.hospitals[1].service_time = this.form.is_appoint.hospitals[1].service_time+","+this.mz2.timeList2[i].id}
+				for(let i in that.mz2.timeList2){		//遍历选中 保存id
+					if(that.mz2.timeList2[i].checked){that.form.is_appoint.hospitals[1].service_time = that.form.is_appoint.hospitals[1].service_time+","+that.mz2.timeList2[i].id}
 				}
-				for(let i in this.mz2.timeList3){		//遍历选中 保存id
-					if(this.mz2.timeList3[i].checked){this.form.is_appoint.hospitals[1].service_time = this.form.is_appoint.hospitals[1].service_time+","+this.mz2.timeList3[i].id}
+				for(let i in that.mz2.timeList3){		//遍历选中 保存id
+					if(that.mz2.timeList3[i].checked){that.form.is_appoint.hospitals[1].service_time = that.form.is_appoint.hospitals[1].service_time+","+that.mz2.timeList3[i].id}
 				}
 				//判断开头第一个是否为逗号,是就删除逗号
-				if(this.form.is_appoint.hospitals[1].service_time.startsWith(",")){
-					this.form.is_appoint.hospitals[1].service_time= this.form.is_appoint.hospitals[1].service_time.substr(1);
+				if(that.form.is_appoint.hospitals[1].service_time.startsWith(",")){
+					that.form.is_appoint.hospitals[1].service_time= that.form.is_appoint.hospitals[1].service_time.substr(1);
 				}
 				
 				
-				
-				
-				
-				
-				console.log(this.form)
-				uni.navigateBack({
-					delta: 1
-				})
+			 
+				var forms = JSON.parse(JSON.stringify(that.form));
+				if(typeof forms!='string'){
+					forms = JSON.stringify(forms) 
+				}
+				 
+				 
+				console.log('我是form',that.form)
+				console.log('我是formzifuc',forms)
+				let res = await that.$request.post('doctor/saveSettingList',{data:forms,type:2});
+				if(res.status==0){
+					uni.showToast({
+						icon:'none',
+						duration:3000,
+						title:'操作成功',
+						
+					})
+				}
+				console.log('res对象:',res);
 			},
 			/**
 			 * @author Liu Yuanhang
@@ -695,11 +712,24 @@
 				if (res.status == 0) {
 
 					// 1.控制列表显示,2.渲染数据
-					// this.showList[0].flag = res.data.show.is_phone;
-					// this.showList[1].flag = res.data.show.is_chat;
-					// this.showList[2].flag = res.data.show.is_appoint;
+					this.showList[0].flag = res.data.show.is_phone;
+					this.showList[1].flag = res.data.show.is_chat;
+					this.showList[2].flag = res.data.show.is_appoint;
+
+					// 获取医院
+					if (res.data.org != null) {
+						this.hospital=[];
+						// this.hospital = res.data.org;
+						this.hospitals = res.data.orgs;
+						
+					}
+
 
 					// 渲染显示的基础价格设置
+					this.form.is_phone.person = '';
+					this.form.is_chat.person ='';
+					this.form.is_appoint.person='';
+					
 					if (res.data.list.phone != null) {
 						// 渲染电话的基础数据
 						this.form.is_phone.base_price = res.data.list.phone.base_price;
@@ -721,13 +751,7 @@
 						this.form.is_appoint.person = res.data.list.men.person;
 					}
 
-					// 获取医院
-					if (res.data.org != null) {
-						console.log('获取医院', res.data.org)
-						this.hospital = res.data.org;
-						this.hospitals = res.data.orgs;
-						
-					}
+					
 
 					/* 渲染时间 */
 					//电话的时间
@@ -773,8 +797,13 @@
 					dh1 = this.dh.timeList1;
 					dh2 = this.dh.timeList2;
 					dh3 = this.dh.timeList3;
-					let phones = e.list.phone.service_time;
+					let phone = e.list.phone.service_time.split(',');
+					var phones=[];//保存转换后的整型字符串
+					 phone.forEach(function(data,index,arr){  
+					        phones.push(+data);  
+					 });  
 					console.log('我是电话', phones)
+		 
 					for (let i = 0; i < dh1.length; i++) {
 						if (phones.indexOf(dh1[i].id) != -1) {
 							dh1[i].checked = true
@@ -795,28 +824,101 @@
 				}
 
 				// 图文资讯渲染
-				// if(e.list.chat!=null){
-				// tw1=this.tw.timeList1;
-				// tw2=this.tw.timeList2;
-				// tw3=this.tw.timeList3;
-				//  let chat = e.list.chat.service_time;
-				//  console.log('我是图文',chat)
-				//  for(let i=0;i<tw1.length;i++){
-				// 	if(chat.indexOf(tw1[i].id)!=-1){
-				// 		tw1[i].checked = true
-				// 	}
-				//  }
-				//  for(let i=0;i<tw2.length;i++){
-				// 	if(chat.indexOf(tw2[i].id)!=-1){
-				// 		tw2[i].checked = true
-				// 	}
-				//  }
-				//  for(let i=0;i<tw3.length;i++){
-				// 	if(chat.indexOf(tw3[i].id)!=-1){
-				// 		tw3[i].checked = true
-				// 	}
-				//  }
-				// }
+				if(e.list.chat!=null){
+					tw1=this.tw.timeList1;
+					tw2=this.tw.timeList2;
+					tw3=this.tw.timeList3;
+					 let chats = e.list.chat.service_time.split(',');
+					 var chat=[];//保存转换后的整型字符串
+					  chats.forEach(function(data,index,arr){  
+					         chat.push(+data);  
+					  });  
+					 console.log('我是图文',chat)
+					 for(let i=0;i<tw1.length;i++){
+						if(chat.indexOf(tw1[i].id)!=-1){
+							tw1[i].checked = true
+						}
+					 }
+					 for(let i=0;i<tw2.length;i++){
+						if(chat.indexOf(tw2[i].id)!=-1){
+							tw2[i].checked = true
+						}
+					 }
+					 for(let i=0;i<tw3.length;i++){
+						if(chat.indexOf(tw3[i].id)!=-1){
+							tw3[i].checked = true
+						}
+					 }
+				}
+			 
+				let mzCont = e.list.men.length;
+				if(mzCont>0){
+					 
+					let men = e.list.men;
+					let men1 =  e.list.men[0].service_time.split(',');
+					let men2 =  e.list.men[1].service_time.split(',');
+					var men1s=[];//保存转换后的整型字符串
+					var men2s=[];//保存转换后的整型字符串
+					 men1.forEach(function(data,index,arr){  
+					        men1s.push(+data);  
+					 });  
+					 men2.forEach(function(data,index,arr){
+					        men2s.push(+data);  
+					 }); 
+					 
+					let p =0;
+					var names = '';
+					  if(mzCont==1){
+						  for(let k=0;k<this.mz1.timeList1.length;k++){
+						  	if(men1s.indexOf(this.mz1.timeList1[k].id)!=-1){
+						  		this.mz1.timeList1[k].checked = true
+						  	}
+						  }
+						  for(let k=0;k<this.mz1.timeList2.length;k++){
+						  	if(men1s.indexOf(this.mz1.timeList2[k].id)!=-1){
+						  		this.mz1.timeList2[k].checked = true
+						  	}
+						  }						  					 
+						  for(let k=0;k<this.mz1.timeList3.length;k++){
+						  	if(men1s.indexOf(this.mz1.timeList3[k].id)!=-1){
+						  		this.mz1.timeList3[k].checked = true
+						  	}
+						  }
+					  }else if(mzCont==2){
+						  for(let k=0;k<this.mz1.timeList1.length;k++){
+						  	if(men1s.indexOf(this.mz1.timeList1[k].id)!=-1){
+						  		this.mz1.timeList1[k].checked = true
+						  	}
+						  }
+						  for(let k=0;k<this.mz1.timeList2.length;k++){
+						  	if(men1s.indexOf(this.mz1.timeList2[k].id)!=-1){
+						  		this.mz1.timeList2[k].checked = true
+						  	}
+						  }						  					 
+						  for(let k=0;k<this.mz1.timeList3.length;k++){
+						  	if(men1s.indexOf(this.mz1.timeList3[k].id)!=-1){
+						  		this.mz1.timeList3[k].checked = true
+						  	}
+						  }
+						  
+						  for(let k=0;k<this.mz2.timeList1.length;k++){
+						  	if(men2s.indexOf(this.mz2.timeList1[k].id)!=-1){
+						  		this.mz2.timeList1[k].checked = true
+						  	}
+						  }
+						  for(let k=0;k<this.mz2.timeList2.length;k++){
+						  	if(men2s.indexOf(this.mz2.timeList2[k].id)!=-1){
+						  		this.mz2.timeList2[k].checked = true
+						  	}
+						  }						  					 
+						  for(let k=0;k<this.mz2.timeList3.length;k++){
+						  	if(men2s.indexOf(this.mz2.timeList3[k].id)!=-1){
+						  		this.mz2.timeList3[k].checked = true
+						  	}
+						  }
+					  }
+				}
+				console.log(e.list);
 				uni.hideLoading();
 			},
 			dhchange(index) {

+ 39 - 3
pages/service/setservice.vue

xqd xqd xqd xqd xqd
@@ -25,7 +25,7 @@
 			</view>
 			<!-- 控制器 -->
 			<view style="width: 15%;">
-			<u-switch v-model="item.state" active-color="#84bb43" inactive-color="#eee" :disabled="item.Opening"></u-switch>
+			<u-switch v-model="item.state" :data-index="item.state" active-color="#84bb43" inactive-color="#eee" @change="openSave" :disabled="item.Opening"></u-switch>
 			</view>
 			
 		</view>
@@ -38,6 +38,7 @@
 
 		},
 		onLoad() {
+			this.getStatus();
 
 		},
 		mounted() {
@@ -59,7 +60,7 @@
 				}, {
 					zhonglei: '图文咨询',
 					state: false,
-					Opening: 1
+					Opening: 0
 				}, {
 					zhonglei: '门诊预约',
 					state: false,
@@ -68,6 +69,41 @@
 			}
 		},
 		methods: {
+			/**
+			 * @author Liu Yuanhang
+			 * 查询开启状态(未完成暂时没有审核表)
+			 */
+			getStatus:async function(){
+				let res = await this.$request.post('doctor/getSettingList',{'type':1});
+				if(res.status==0){
+					this.serbicelist[0].state = res.data.is_phone;
+					this.serbicelist[1].state = res.data.is_chat;
+					this.serbicelist[2].state = res.data.is_appoint
+				}
+			},
+			
+			/**
+			 * @author Liu Yuanhang
+			 * 修改状态
+			 * @param {Object} e
+			 */
+			openSave:async function(e){
+				let list = this.serbicelist;
+			
+				let data =  {"is_chat":list[1]['state'],"is_phone":list[0]['state'],"is_appoint":list[2]['state']}
+				if(typeof data != 'string'){
+					data = JSON.stringify(data);
+				}
+				let res = await this.$request.post('doctor/saveSettingList',{'type':1,'data':data});
+				console.log(res);
+				if(res.status==0){
+					uni.showToast({
+						title:'操作成功',
+						duration:2000,
+						icon:'none'
+					})
+				}
+			},
 			// 下一页
 			next(){
 				uni.navigateTo({
@@ -95,4 +131,4 @@
 		background-color: #FFFFFF;
 		border-bottom:1rpx solid #f6f6f6;
 	}
-</style>
+</style>