yanjie 4 年 前
コミット
2fba6c85df
2 ファイル変更65 行追加28 行削除
  1. 5 23
      pages/doctor_related/doctor_info.vue
  2. 60 5
      pages/doctor_related/select_doctor.vue

+ 5 - 23
pages/doctor_related/doctor_info.vue

xqd xqd xqd xqd xqd
@@ -62,10 +62,10 @@
 				<view v-if="!isjigou" class="text-lg text-center margin-top-sm" style="color: rgb(238, 170, 63);">
 					平均回复低至1分钟
 				</view>
-				<view v-else class="text-lg margin-top-sm" style="color: rgb(238, 170, 63);border-bottom: 3rpx solid rgb(238, 170, 63);"
+				<view v-else class="text-lg margin-top-sm" style="color: rgb(238, 170, 63);border-bottom: 3rpx solid rgb(238, 170, 63); width: 375rpx;"
 				 @click="xuantime">
-					已选时间{{daytime}}
-					<u-picker mode="multiSelector" v-model="show" @confirm="test" safe-area-inset-bottom :params="params"></u-picker>
+					已选时间{{daytime}}
+					<!-- <u-picker mode="multiSelector" v-model="show" @confirm="test" safe-area-inset-bottom :params="params"></u-picker> -->
 				</view>
 			</view>
 			<view v-if="isjigou" bindtap="goAdrPostion" class="pr pt10 pb10 margin-lr-sm margin-top-sm m-bg-white" style="border-radius: 16rpx;box-shadow: 0 0 50rpx 0 rgba(0, 0, 0, 0.1);">
@@ -129,11 +129,11 @@
 	export default {
 		onLoad(options) {
 			this.doctorid = options.id
-			console.log(this.doctorid)
+			this.daytime = options.time
+			console.log(options)
 		},
 		mounted() {
 			this.getdoctorInfo()
-			this.gettime()
 		},
 		data() {
 			return {
@@ -148,15 +148,6 @@
 				},
 				isjigou: false,
 				barindex: 1, //显示按钮
-				params: {
-					year: false,
-					month: true,
-					day: true,
-					hour: true,
-					minute: true,
-					second: false
-				},
-				show: false,
 				daytime: ""
 			}
 		},
@@ -191,12 +182,6 @@
 					}
 				}
 			},
-			gettime: async function() {
-				let res = await this.$request.post("/api/v1/docter/schedulePeriodList", {
-					docter_id: this.doctorid,
-				})
-				console.log(res)
-			},
 			gotoxuanze(e) {
 				this.barindex = e.currentTarget.dataset.index
 				if (e.currentTarget.dataset.index == 3) {
@@ -208,9 +193,6 @@
 			xuantime() {
 				this.show = !this.show
 			},
-			test(arr) {
-
-			}
 		}
 	};
 </script>

+ 60 - 5
pages/doctor_related/select_doctor.vue

xqd xqd xqd xqd xqd xqd
@@ -8,6 +8,11 @@
 			</u-dropdown>
 			<view class="main">
 				<u-search :clearabled="false" shape="round" :show-action="false" placeholder="搜索医生姓名、医院名" v-model="keyword"></u-search>
+				<view class="margin-top-sm text-df text-bold" @click="xuanzetime" v-if="istime">
+					选择时间:{{showtime}}
+					<u-picker mode="multiSelector" @confirm="callbacktime" v-model="show" :default-selector='[0, 1]' range-key="start_time_period"
+					 :range="multiSelector"></u-picker>
+				</view>
 				<view style="width: 100%;">
 					<view class="recommendstyle margin-top-sm" v-for="(item,index) in doctorList" :key="index">
 						<view class="base_item" @click="gotoinfo" :data-id="item.id">
@@ -97,13 +102,20 @@
 		onLoad(options) {
 			if (options.index) {
 				this.value1 = options.index
-
+				if (this.value1 == 3) {
+					this.istime = true
+				} else {
+					this.istime = false
+				}
 			}
 		},
 		onShow() {
 			this.getDoctorList()
+
+		},
+		mounted() {
+			this.gettime()
 		},
-		mounted() {},
 		data() {
 			return {
 				scrollTop: 0,
@@ -156,7 +168,21 @@
 						value: 3,
 					},
 				],
-				doctorList: []
+				doctorList: [],
+				timeday: "", //年月日
+				timehour: "", //时分
+				multiSelector: [],
+				params: {
+					year: false,
+					month: true,
+					day: true,
+					hour: true,
+					minute: true,
+					second: false
+				},
+				show: false,
+				istime: false,
+				showtime: ""
 			}
 		},
 		watch: {
@@ -184,6 +210,11 @@
 			},
 			allserive(value) {
 				this.value1 = value
+				if (this.value1 == 3) {
+					this.istime = true
+				} else {
+					this.istime = false
+				}
 				this.getDoctorList()
 			},
 			city(value) {
@@ -195,7 +226,7 @@
 			},
 			gotoinfo(e) {
 				uni.navigateTo({
-					url: "./doctor_info?id=" + e.currentTarget.dataset.id
+					url: "./doctor_info?id=" + e.currentTarget.dataset.id + "&time=" + this.showtime
 				})
 			},
 			submitCollect: async function(e) {
@@ -226,15 +257,39 @@
 					name: this.keyword,
 					sort_type: this.value3,
 					latitude: uni.getStorageSync("latitude"),
-					longitude: uni.getStorageSync("longitude")
+					longitude: uni.getStorageSync("longitude"),
+					schedule_date: this.timeday,
+					time_period_id: this.timehour
 				}, )
 				if (res.status == 0) {
 					this.doctorList = res.data.data
 					console.log(res)
 				}
 			},
+			gettime: async function() {
+				let res = await this.$request.post("/api/v1/docter/timePeriodList")
+				console.log(res)
+				if (res.status == 0) {
+					res.data.list.forEach(item => {
+						item.start_time_period = item.start_time_period + '-' + item.end_time_period
+					})
+					this.multiSelector.push(res.data.dates)
+					this.multiSelector.push(res.data.list)
+					this.showtime = res.data.dates[0] + ' ' + res.data.list[0].start_time_period
+				}
+			},
 			changeStr() {
 				this.getDoctorList()
+			},
+			xuanzetime() {
+				this.show = !this.show
+			},
+			//返回时间
+			callbacktime(arr) {
+				this.timeday = this.multiSelector[0][arr[0]]
+				this.timehour = this.multiSelector[1][arr[1]].id
+				this.showtime = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
+				this.getDoctorList()
 			}
 		}
 	};