Просмотр исходного кода

feat:预约改为可预约多天

zhanghui 2 лет назад
Родитель
Сommit
f275e852a9
1 измененных файлов с 42 добавлено и 7 удалено
  1. 42 7
      orderPages/bookService/index.vue

+ 42 - 7
orderPages/bookService/index.vue

@@ -1,7 +1,15 @@
 <template>
 	<view class="page">
-		<view class="periodDate">
-			<text>服务日期:{{periodDate.label}}</text>
+		<view class="flex-row periodDate">
+			<view class="flex-row">
+				<text>服务日期:</text>
+			</view>
+			<picker @change="bindPickerChange" mode='selector' range-key="label" :value="periodDateIndex" :range="periodDateList">
+				<view class="flex-row justify-between" :style="{width:'550rpx'}">
+					<text>{{periodDate.label || '请选择服务日期' }}</text>
+					<u-icon name="arrow-right" color="#666" size="18"></u-icon>
+				</view>
+			</picker>
 		</view>
 
 		<view class="flex-col group" v-if="serviceObjectList.length>1">
@@ -133,8 +141,12 @@
 				userInfo: {},
 				//服务门店
 				store: {},
-				//默认服务时间
-				periodDate: [],
+				//服务日期列表
+				periodDateList:[],
+				//当前选择的服务日期
+				periodDate: {},
+				//当前选择的日期下标
+				periodDateIndex:0,
 				//预约费用
 				price: '0',
 				//订单编号
@@ -180,6 +192,18 @@
 
 		},
 		methods: {
+			bindPickerChange(e){
+				console.log(e)
+				if (e.detail.value == this.periodDateIndex){
+					return
+				}
+				console.log('++++++++++++++')
+				this.periodDateIndex = e.detail.value
+				this.periodDate = this.periodDateList[e.detail.value]
+				//对所有子订单的服务人员及服务时段重新赋值
+				this.getServicePerson(this.periodDate.label,true)
+
+			},
 			//获取排班日期
 			selectDate() {
 				console.log(this.store)
@@ -187,13 +211,14 @@
 					organization: this.store.storeId
 				}).then(res => {
 					this.periodDate = res.data.data[0]
+					this.periodDateList = res.data.data
 					this.orderParam.serviceDate=this.periodDate.label
-					this.getServicePerson(this.periodDate.label)
+					this.getServicePerson(this.periodDate.label,false)
 				})
 			},
 
 			// 查询服务工作人员列表
-			getServicePerson(date) {
+			getServicePerson(date,bindPickerChange) {
 				this.$api.getServicePerson({
 					storeId:this.store.storeId,
 					date:date
@@ -201,7 +226,17 @@
 					this.serviceTeacherList = res.data.data;
 					this.serviceTeacherList[0].select = true
 					this.getServicePersonUrl(this.serviceTeacherList);
-					this.listServiceObject()
+					if (bindPickerChange){
+						this.serviceObjectList.forEach(i=>{
+							if (i.select){
+								this.orderParam.childService=[]
+								i.select = false
+								this.selectServiceObject(i)
+							}
+						})
+					}else {
+						this.listServiceObject()
+					}
 
 				})
 			},