Browse Source

订单日期修改/bug修复

贾宇博 3 weeks ago
parent
commit
94208a7897

+ 9 - 0
api/userList.js

@@ -39,4 +39,13 @@ export function usersUserFinishOrder(data) {
 		method: 'post',
 		data:data
 	})
+}
+
+// 用户详情小订单
+export function userdictDataList(params) {
+	return request({
+		url: `/system/dict/data/list`,
+		method: 'get',
+		params: params
+	})
 }

+ 12 - 8
components/Client/new_file.vue

@@ -5,8 +5,8 @@
 				<view class="serve-title client-title" v-if="userType == 2">注册专区</view>
 				<!-- <swiper :indicator-dots="true" class="swiper" v-if="serveiceList && serveiceList.length > 0"> -->
 				<!-- <swiper-item> -->
-				<up-grid :border="false" col="5">
-					<up-grid-item v-for="(item, index) in serveiceList.slice(0,10)" :key="index"
+				<up-grid :border="false" col="4">
+					<up-grid-item v-for="(item, index) in serveiceList.slice(0,12)" :key="index"
 						:custom-style="custmoStyle" @click="handleGridClick(item)">
 						<view class="grid-box">
 							<view class="grid-icon">
@@ -18,8 +18,8 @@
 				</up-grid>
 				<!-- </swiper-item> -->
 				<!-- <swiper-item> -->
-				<up-grid :border="false" col="5">
-					<up-grid-item v-for="(item, index) in serveiceList.slice(10,serveiceList.length)" :key="index"
+				<up-grid :border="false" col="4">
+					<up-grid-item v-for="(item, index) in serveiceList.slice(12,serveiceList.length)" :key="index"
 						:custom-style="custmoStyle" @click="handleGridClick(item)">
 						<view class="grid-box">
 							<view class="grid-icon">
@@ -259,11 +259,15 @@
 					})
 					return
 				}
-				[1, 2].includes(service.key) ? uni.navigateTo({
+				// [1, 2].includes(service.key) ? uni.navigateTo({
+				// 	url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(service))}`
+				// }) : uni.showToast({
+				// 	title: '敬请期待',
+				// 	icon: 'none'
+				// })
+
+				uni.navigateTo({
 					url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(service))}`
-				}) : uni.showToast({
-					title: '敬请期待',
-					icon: 'none'
 				})
 				return;
 			}

+ 3 - 2
components/Services/services.vue

@@ -62,9 +62,10 @@
 			serviceCategory: item.serviceCategory, // 获取 serviceCategory
 			businessManagementId: item.businessManagementId, //获取 businessManagementId
 		};
-
+		const data = encodeURIComponent(JSON.stringify(params))
+		console.log(data, '>>>>>data');
 		uni.navigateTo({
-			url: `/pages_home/pages/Volunteerside/goodsDetails?params=${JSON.stringify(params)}`
+			url: `/pages_home/pages/Volunteerside/goodsDetails?params=${data}`
 		});
 	}
 </script>

+ 269 - 0
components/its-calendar/its-calendar - 副本.vue

@@ -0,0 +1,269 @@
+<template>
+	<view>
+		<view class="calendar">
+			<view class="calendar_day">
+				<view class="day_x" :style="{'color': (day_index == index ? '#FE3B3C' : '')}"
+					v-for="(item, index) in dayArr" :key="index" @click.stop="dayList(item,index)">
+					<view class="day_x_a">{{item.weeks}}</view>
+					<view class="day_x_b">{{item.days}}</view>
+				</view>
+			</view>
+			<view class="calendar_time">
+				<view class="time_x" 
+				  :class="{
+				    'time_x_sty': host_index == item?.timeStamp, 
+				    'disabled-time': shouldDisable(item) 
+				  }" 
+				  v-for="(item, index) in timeHostArr[day_index]" 
+				  :key="index"
+				  @click="handleTimeClick(item)">
+				  <text>{{item?.hours}}</text>
+				  <text v-if="item.hasReservation === 1" class="hasRe-text">已预约</text>
+				</view>
+			</view>
+		</view>
+		<!-- <view class="sub" @click="sub()">
+			立即预约
+		</view> -->
+	</view>
+</template>
+<script>
+	export default {
+		props: {
+			timeArr: {
+				type: Array,
+				default: () => []
+			},
+
+			timeHostArr: {
+				type: Array,
+				default: () => []
+			},
+			businessDuration: {
+				type: Number,
+				default: 0
+			} // 从父组件接收的服务时长(分钟)
+		},
+		data() {
+			return {
+				dayArr: [],
+				day_index: 0,
+				host_index: '',
+				nowTimes: new Date().getTime(), // 只保留一个定义
+				disableAfterTime: null,
+				selectedTime: null,
+				selectedDay: null // 新增:记录选择的日期
+			}
+		},
+		watch: {
+			timeArr: {
+				handler(newVal) {
+
+					let dateArr = newVal.map(item => {
+						let day = new Date(item)
+						const daysOfWeek = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
+						return {
+							weeks: daysOfWeek[day.getDay()],
+							days: item.slice(5)
+						}
+					})
+					this.dayArr = dateArr
+				},
+				immediate: true
+			}
+		},
+		mounted() {},
+		methods: {
+			handleTimeClick(item) {
+				if (!this.shouldDisable(item)) {
+					this.hosts(item);
+				}
+			},
+			// 点击日期
+			dayList(e, index) {
+				this.day_index = index
+				this.$emit('getByDate', this.timeArr[index])
+			},
+			// 转换时间戳为毫秒
+			ensureMillisecond(timestamp) {
+				return timestamp > 9999999999 ? timestamp : timestamp * 1000;
+			},
+
+			shouldDisable(item) {
+				if (!item) return true;
+
+				const itemTime = this.ensureMillisecond(item.timeStamp);
+
+				// 已预约
+				if (item.hasReservation === 1) return true;
+
+				// 过去时间
+				if (this.nowTimes > itemTime) return true;
+
+				// 选择后的时间段
+				if (this.selectedTime) {
+					return itemTime > this.selectedTime &&
+						itemTime <= this.disableAfterTime;
+				}
+
+				return false;
+			},
+			hosts(item) {
+				const itemTime = this.ensureMillisecond(item.timeStamp);
+
+				this.host_index = item.timeStamp; // 显示用原始值
+				this.selectedTime = itemTime;
+				this.disableAfterTime = itemTime + (this.businessDuration * 60 * 1000);
+				this.$emit('getByTime', {
+					...item,
+					timeStamp: itemTime // 传递转换后的值
+				});
+			},
+
+			// 点击立即预约
+			sub() {
+				if (this.host_index == '') {
+					this.$tool.toast('请选择时间');
+				} else {
+					let day = this.dayArr[this.day_index];
+					let time = this.times(this.host_index);
+					let comTime = {
+						days: day.days,
+						weeks: day.weeks,
+						hours: this.host_All.hours,
+						timeStamp: this.host_All.timeStamp,
+						time: time
+					};
+					this.$emit('getTime', comTime);
+				}
+			},
+
+			// 格式化时间
+			times(data) {
+				let date = new Date(data * 1000);
+				let h = date.getHours();
+				h = h < 10 ? ('0' + h) : h; // 小时补0
+				let m = date.getMinutes();
+				m = m < 10 ? ('0' + m) : m; // 分钟补0
+				return h + ':' + m;
+			},
+			time(data, type) {
+				let date = new Date(data * 1000);
+				let y = date.getFullYear();
+				let MM = date.getMonth() + 1;
+				MM = MM < 10 ? ('0' + MM) : MM; // 月补0
+				let d = date.getDate();
+				d = d < 10 ? ('0' + d) : d; // 天补0
+				let h = date.getHours();
+				h = h < 10 ? ('0' + h) : h; // 小时补0
+				let m = date.getMinutes();
+				m = m < 10 ? ('0' + m) : m; // 分钟补0
+				let s = date.getSeconds();
+				s = s < 10 ? ('0' + s) : s; // 秒补0
+				if (type == 'yymmdd') {
+					return y + '-' + MM + '-' + d;
+				} else if (type == 'hhmmss') {
+					return h + ':' + m + ':' + s;
+				} else {
+					return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #F4F4F4;
+	}
+
+	.calendar {
+		width: 710rpx;
+		height: 460rpx;
+		background-color: #FFFFFF;
+		margin: 20rpx auto 10rpx;
+		border-radius: 8rpx;
+	}
+
+	.calendar_day {
+		display: flex;
+		width: 100%;
+		height: 120rpx;
+
+		.day_x {
+			display: flex;
+			flex-flow: column nowrap;
+			justify-content: center;
+			align-items: center;
+			width: 20%;
+			height: 100%;
+			font-size: 30rpx;
+			color: #333333;
+		}
+	}
+
+	.calendar_time {
+		display: flex;
+		width: 100%;
+		height: 448rpx;
+		flex-flow: row wrap;
+		align-content: flex-start;
+		margin: 20rpx 0;
+		overflow-y: auto;
+
+		.time_x {
+			display: flex;
+			flex-flow: row;
+			justify-content: center;
+			align-items: center;
+			width: 20%;
+			height: 54rpx;
+			border-radius: 26rpx;
+			margin: 10rpx 0;
+			font-size: 30rpx;
+			color: #333333;
+
+			display: flex;
+			flex-direction: column;
+
+			.hasRe-text {
+				font-size: 20rpx;
+				color: #999999;
+			}
+		}
+
+		.time_x_sty {
+			background-color: #FFE97B;
+			color: #000000 !important;
+		}
+	}
+
+	.sub {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		width: 710rpx;
+		height: 100rpx;
+		border-radius: 50rpx;
+		margin: 30rpx auto;
+		color: #FFFFFF;
+		font-size: 36rpx;
+		background-color: #FE3B3C;
+	}
+
+
+
+	.time_x {
+	  /* 正常状态样式 */
+	  &.disabled-time {
+	    background-color: #f2f2f2;
+	    color: #999999;
+	    pointer-events: none;
+	  }
+	  
+	  &.time_x_sty {
+	    background-color: #FFE97B;
+	    color: #000000;
+	  }
+	}
+</style>

+ 69 - 15
components/its-calendar/its-calendar.vue

@@ -11,8 +11,8 @@
 			<view class="calendar_time">
 				<view class="time_x" 
 				  :class="{
-				    'time_x_sty': host_index == item?.timeStamp, 
-				    'disabled-time': shouldDisable(item) 
+				    'time_x_sty': item?.checked, 
+				    'disabled-time': item?.disabled
 				  }" 
 				  v-for="(item, index) in timeHostArr[day_index]" 
 				  :key="index"
@@ -52,13 +52,12 @@
 				nowTimes: new Date().getTime(), // 只保留一个定义
 				disableAfterTime: null,
 				selectedTime: null,
-				selectedDay: null // 新增:记录选择的日期
+				selectedDay: null ,// 新增:记录选择的日期
 			}
 		},
 		watch: {
 			timeArr: {
 				handler(newVal) {
-
 					let dateArr = newVal.map(item => {
 						let day = new Date(item)
 						const daysOfWeek = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
@@ -72,12 +71,48 @@
 				immediate: true
 			}
 		},
-		mounted() {},
+		mounted() {
+		},
 		methods: {
 			handleTimeClick(item) {
-				if (!this.shouldDisable(item)) {
-					this.hosts(item);
+				console.log(this.businessDuration, '>>>>>>businessDuration');
+				// 禁用点击,取消点击触发
+				if (item.disabled) return false
+				
+				// if (!this.shouldDisable(item)) {
+				// 	item.checked = !item.checked
+				// 	this.hosts(item);
+				// }
+				
+				// 计算服务时间秒
+				const seconds = this.businessDuration * 60
+				// 计算最终服务时间
+				const endTimestamp = (item.timeStamp + seconds)
+				
+				// 禁用区域/释放区域数据
+				const filteredSlots = this.timeHostArr[this.day_index].filter(i => {
+				   return (i.timeStamp > item.timeStamp && 
+				          i.timeStamp <= endTimestamp)
+				 })
+				 
+				 console.log(filteredSlots, '>>>>>filteredSlots');
+				if (!item.checked) {
+					// 计算禁用时间区域
+					 filteredSlots.forEach(v => {
+						v.disabled = true
+					 })
+					 item.checked = true
+				} else {
+					// 释放禁用区域
+					filteredSlots.forEach(v => {
+						if (v.hasReservation !== 1) v.disabled = false
+					})
+					item.checked = false
 				}
+				
+				
+				
+				this.hosts(item);
 			},
 			// 点击日期
 			dayList(e, index) {
@@ -91,20 +126,39 @@
 
 			shouldDisable(item) {
 				if (!item) return true;
+				
+				// 已预约
+				if (item.hasReservation === 1) return true;
 
 				const itemTime = this.ensureMillisecond(item.timeStamp);
 
-				// 已预约
-				if (item.hasReservation === 1) return true;
+				
 
-				// 过去时间
+				// // 过去时间
 				if (this.nowTimes > itemTime) return true;
 
-				// 选择后的时间段
-				if (this.selectedTime) {
-					return itemTime > this.selectedTime &&
-						itemTime <= this.disableAfterTime;
-				}
+				// // // 选择后的时间段
+				// if (this.selectedTime) {
+				// 	return itemTime > this.selectedTime &&
+				// 		itemTime <= this.disableAfterTime;
+				// }
+				
+				// let flat = false
+				
+				// this.timeHostArr[this.day_index].forEach(i => {
+				// 	if (i.checked) {
+				// 		const itemTime2 = this.ensureMillisecond(item.timeStamp);
+				// 		flat = itemTime2 > this.selectedTime &&
+				// 		itemTime2 <= this.disableAfterTime;
+				// 	}
+				// })
+				
+				
+				// if (!item.checked) {
+				// 	return itemTime > this.selectedTime &&
+				// 		itemTime <= this.disableAfterTime;
+				// }
+				
 
 				return false;
 			},

+ 5 - 4
manifest.json

@@ -64,12 +64,13 @@
         "requiredPrivateInfos": [
             "getLocation",
             "chooseLocation"
-          ],
-         "permission": {
+        ],
+        "permission": {
             "scope.userLocation": {
-              "desc": "你的位置信息将用于警情上报"
+                "desc": "你的位置信息将用于警情上报"
             }
-          }
+        },
+        "mergeVirtualHostAttributes": true
     },
     "mp-alipay": {
         "usingComponents": true

+ 7 - 3
pages/common/orderList/listItem.vue

@@ -1,7 +1,8 @@
 <template>
     <view class="item">
         <view class="item-img">
-            <img :src="baseUrl + data.avatar" alt="" style="width: 112rpx; height: 112rpx;">
+            <!-- <img :src="data.avatar" alt="" style="width: 112rpx; height: 112rpx;"> -->
+            <up-image :show-loading="true" :src="data.avatar" width="112rpx" height="112rpx"></up-image>
         </view>
         <view class="item-info">
             <view class="item-title-box">
@@ -21,7 +22,7 @@
                     {{ data.address }}
                 </view>
                 <view class="item-time">
-                    {{ data.createTime }}
+                    服务时间:{{ data.workStartTime }}(<text class="item-time-text">{{ data.serviceDuration }}分钟</text>)
                 </view>
                 <view class="item-price"><span class="item-price-yuan">¥</span> {{ data.serviceOnePrice || 0 }}</view>
             </view>
@@ -125,7 +126,7 @@ function onClick(type) {
             letter-spacing: 0rpx;
             line-height: 39rpx;
             color: rgba(153, 153, 153, 1);
-            margin-bottom: 40rpx;
+            margin-bottom: 20rpx;
         }
 
         .item-price {
@@ -180,4 +181,7 @@ function onClick(type) {
         }
     }
 }
+.item-time-text {
+    color: #dd5e45;
+}
 </style>

+ 4 - 6
pages/index.vue

@@ -114,7 +114,6 @@
 	})
 	
 const cityClick = () => {
-	console.log('cityClick', data.address);
 	citySelectorNavigateTo(data.address)
 }
 
@@ -148,8 +147,6 @@ const cityClick = () => {
 			    serviceCategory: pages.value.serviceCategory || '',
 				// appStatus:pages.value.appStatus,
 			  };
-			  console.log('请求参数:', params); // 调试输出
-			
 			  const res = await volunteerinfolist(params);
 
 			if (!res || !res.rows) {
@@ -212,7 +209,6 @@ const cityClick = () => {
 	}
 
 	onShow(() => {
-	getList()
 	getBanners();
 
 	// 在 App.vue  中初始化 
@@ -221,19 +217,21 @@ const cityClick = () => {
 			const statusBarHeight = res.statusBarHeight;
 			const navBarHeight = res.platform === 'android' ? 48 : 44 + res.statusBarHeight;
 			globalData.value = { statusBarHeight, navBarHeight };
-			console.log('statusBarHeight', statusBarHeight, navBarHeight);
 
 		}
 	});
 
 	if (citySelector) {
 		const selectedCity = citySelector.getCity(); // 如果点击确认选点按钮,则返回选点结果对象,否则返回null
-		console.log('citySelector', selectedCity,selectedCity.name)
 		data.address = selectedCity.name;
 	}
 
 })
 
+onMounted(() => {
+	getList()
+})
+
 onUnload(() => {
 	if (citySelector) {
 		// 页面卸载时设置插件选点数据为null,防止再次进入页面,geLocation返回的是上次选点结果

+ 3 - 3
pages/login.vue

@@ -10,7 +10,7 @@
 				<up-avatar :src="src" class="avatar"></up-avatar>
 
 				<!-- 下方按钮 -->
-				<up-button type="error" shape="circle" class="button" @click="handleLogin">获取微信授权登录</up-button>
+				<up-button type="error" shape="circle" class="button"  @click="handleLogin">获取微信授权登录</up-button>
 			</view>
 			<view class="xieyi text-center">
 				<text class="text-grey1">登录即代表同意</text>
@@ -263,8 +263,8 @@
 		align-items: center;
 		/* 水平居中 */
 		padding: 30rpx;
-		gap: 30rpx;
 		/* 元素间距 */
+		gap: 30rpx;
 	}
 
 	/* 头像样式 */
@@ -275,7 +275,7 @@
 
 	/* 按钮样式 */
 	.button {
-		width: 170rpx !important;
+		// width: 170rpx !important;
 		/* 覆盖默认宽度 */
 		margin-left: 0 !important;
 		/* 清除原代码中的 margin-left */

+ 20 - 15
pages/mallMenu.vue

@@ -12,19 +12,17 @@
                 @scroll="rightScroll">
                 <view class="page-view">
                     <view class="class-item" :id="'item' + index" v-for="(item, index) in tabbar" :key="index">
-                        <view v-for="(classItem, index) in item.children" :key="index + 'title'">
-                            <view class="item-title">
-                                <text>{{ classItem.businessName }}</text>
-                            </view>
-                            <view class="item-container">
+                        <view class="item-title">
+							<text>{{ item.businessName }}</text>
+						</view>
+                        <view class="item-container">
                                 <view class="thumb-box"
-                                    v-for="(item1, index1) in (classItem.children ? classItem.children : [classItem])"
-                                    :key="index1" @click="clickMenu(item1, classItem.parentId)">
-                                    <!-- <image class="item-menu-image" src="https://cdn.uviewui.com/uview/common/classify/1/1.jpg" mode=""></image> -->
+                                    v-for="(item1, index1) in  (item.children?item.children:[item])"
+                                    :key="index1" @click="clickMenu(item,item1)">
+                                    <image class="item-menu-image" :src="item1.businessIcon"></image>
                                     <view class="item-menu-name">{{ item1.businessName }}</view>
                                 </view>
                             </view>
-                        </view>
                     </view>
                 </view>
             </scroll-view>
@@ -54,6 +52,9 @@ export default {
         }
     },
     onReady() {
+ 
+    },
+    onShow() {
         this.getData();
         this.getMenuItemTop()
     },
@@ -167,22 +168,25 @@ export default {
                 }
             }, 10)
         },
-        async clickMenu(service, key) {
-            console.log(service, key);
-
+        async clickMenu(service,record) {
+            console.log(service,record);
+            const { id } = service;
+            const key = id;
             if (this.userType == '2') {
                 const res = await getVolunteerInfo({
                     serviceCategory: key
                 });
+                const parmas = { ...service, key,name:service.businessName,record };
+                
                 if (res.code === 200 && res.data) {
                     //已有注册,跳转详情页面
                     uni.navigateTo({
-                        url: `/pages_home/pages/details/index?data=${encodeURIComponent(JSON.stringify({ ...service, key }))}`
+                        url: `/pages_home/pages/details/index?data=${encodeURIComponent(JSON.stringify(parmas))}`
                     })
                     return
                 }
                 [1, 2] ? uni.navigateTo({
-                    url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify({ ...service, key }))}`
+                    url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(parmas))}`
                 }) : uni.showToast({
                     title: '敬请期待',
                     icon: 'none'
@@ -344,12 +348,13 @@ export default {
     flex-direction: column;
     // margin-top: 20rpx;
 
-    background: #f5f5f5;
+    // background: #f5f5f5;
     padding: 12rpx 0;
 }
 
 .item-menu-image {
     width: 120rpx;
     height: 120rpx;
+    margin-bottom: 12rpx;
 }
 </style>

+ 2 - 2
pages_classify/pages/order/index.vue

@@ -36,7 +36,7 @@
 				</view>
 				<view class="upload-box-see">
 					<view class="upload-img-item" v-for="(item) in volunteerPicture" :key="item.url">
-						<img class="upload-img-see" :src="item.url" :alt="item.fileName" srcset="">
+						<up-image class="upload-img-see" :show-loading="true" :src="item.url" :alt="item.fileName"></up-image>
 					</view>
 				</view>
 			</view>
@@ -50,7 +50,7 @@
 				</view>
 				<view class="upload-box-see">
 					<view class="upload-img-item" v-for="(item) in userPicture" :key="item.url">
-						<img class="upload-img-see" :src="item.url" :alt="item.fileName" srcset="">
+						<up-image class="upload-img-see" :show-loading="true" :src="item.url" :alt="item.fileName"></up-image>
 					</view>
 				</view>
 			</view>

+ 11 - 0
pages_classify/pages/orderItem/orderdetails.vue

@@ -73,6 +73,9 @@
 							</view>
 							<text>开始日期:{{item.workDate}}</text>
 							<text>开始时间: {{item.workStartTime}}</text>
+							
+							
+							{{dictSortMap[item.orderStatus]}}
 						</view>
 						<view class="status-tags">
 							{{dataList.dictLabel}}
@@ -117,6 +120,14 @@
 		}
 		return []
 	})
+	
+	const dictSortMap = computed(() => {
+		let mapObj = {}
+		dataList.value.forEach((item => {
+			mapObj[item.dictValue] = item.dictLabel
+		}))
+		return mapObj
+	})
 
 	//获取用户订单列表状态
 	async function getData() {

+ 64 - 53
pages_home/pages/Volunteerside/goodsDetails.vue

@@ -75,7 +75,7 @@
 							type="daterange"></uniDatetimePickerMy>
 					</view>
 					<view>
-						<its-calendar :businessDuration="listData.businessDuration" :timeArr="doorToDoorTimeArr" :timeHostArr="timeHostArr" @getByDate="getByDate"
+						<its-calendar v-if="show" :businessDuration="listData.businessDuration" :timeArr="doorToDoorTimeArr" :timeHostArr="timeHostArr" @getByDate="getByDate"
 							@getByTime="getByTime"></its-calendar>
 					</view>
 				</view>
@@ -114,17 +114,17 @@
 						</view>
 						<text v-else style="margin-left: 8px; font-size: 14px;">请选择服务地址</text>
 					</view>
-					<view class="card-container" v-for="(item, index) in computeClickTime" :key="index">
+					<view class="card-container" v-for="(item, index) in selectedTimes" :key="index">
 						<image class="card-image" :src="listData.volunteerPicture" mode="aspectFill"></image>
 						<view class="card-content"> <!-- Content container -->
 							<view class="info-item">服务项目:{{listData.projectName}}</view>
 							<view class="Telephone">服务时长:{{listData.businessDuration}}</view>
 							<view class="date">日期:{{item.date}}</view>
 							<view class="time">
-								时间:
-								<span v-for="(i,ind) in item.timeArr" :key="ind">
-									{{i}} &nbsp;&nbsp;&nbsp;
-								</span>
+								时间:{{ item.time }}
+								<!-- <span v-for="(i,ind) in item.timeArr" :key="ind">
+									{{i}} 
+								</span> -->
 							</view>
 						</view>
 					</view>
@@ -293,7 +293,6 @@
 
 	// 新增:处理子组件传回的地址数据
 	const handleAddressUpdate = (newAddress) => {
-		console.log(newAddress,'接受到的数据')
 		selectedAddress.value = newAddress;
 		addressFlag.value = false; // 关闭选择器
 	};
@@ -335,12 +334,12 @@
 
 	// 获取传递的参数
 	onLoad(async (options) => {
-		const params = JSON.parse(options.params);
+		const option = JSON.parse(decodeURIComponent(options.params));		
 		const {
 			volunteerId: id,
 			serviceCategory: categoy,
 			businessManagementId: manage
-		} = params
+		} = option
 		volunteerId.value = id;
 		serviceCategory.value = categoy;
 		businessManagementId.value = manage;
@@ -374,6 +373,7 @@
 			console.error('接口返回的日期范围为空');
 			doorToDoorTimeArr.value = [];
 			timeHostArr.value = []; // 清空时间段
+			
 		}
 	};
 
@@ -381,7 +381,7 @@
 	const getByDate = async (date = doorToDoorTimeArr.value[0]) => {
 		// 检查日期是否为空
 		if (!date) {
-			console.error('日期为空,跳过获取排班时间');
+			coannsole.error('日期为空,跳过获取排班时间');
 			return;
 		}
 
@@ -397,11 +397,25 @@
 
 		try {
 			const res = await volunteergetTimesByDate(params);
-			const TArr = res.data.map((item) => ({
-				...item,
-				hours: item.reservationTime,
-				timeStamp: new Date(`${date} ${item.reservationTime}`).getTime() / 1000,
-			}));
+			const TArr = res.data.map((item) => {
+				
+				// 初始化disabled变量
+				let disabled = false
+				if (item.hasReservation === 1) (disabled = true)
+				
+				let itemTime = item.timeStamp > 9999999999 ? item.timeStamp : item.timeStamp * 1000;
+				
+				if (new Date().getTime() > itemTime) (disabled = true)
+				
+				return {
+					...item,
+					hours: item.reservationTime,
+					timeStamp: new Date(`${date} ${item.reservationTime}`).getTime() / 1000,
+					date:date,
+					checked: false,
+					disabled
+				}
+			});
 
 			// 如果 doorToDoorTimeArr.value 为空,直接返回
 			if (!doorToDoorTimeArr.value.length) {
@@ -410,7 +424,7 @@
 			}
 
 			// 填充时间段数组
-			timeHostArr.value = Array(doorToDoorTimeArr.value.length).fill(TArr);
+			timeHostArr.value = Array(doorToDoorTimeArr.value.length).fill(TArr);			
 		} catch (error) {
 			console.error('获取排班时间失败:', error);
 		}
@@ -418,24 +432,23 @@
 
 	const getByTime = (timeObj) => {
 		if (timeObj.clicked) {
-			console.log('>>>>>> 已经点击过此时间');
 			return;
 		}
-
-		// 标记为已点击
-		timeObj.clicked = true;
-
-		// 添加到已选时间数组
-		selectedTimes.value.push({
-			date: timeObj.yearToDate,
-			time: timeObj.hours,
-			timestamp: timeObj.timeStamp
-		});
+		
+		if (timeObj.checked) { // 选中 添加到已选时间数组
+			selectedTimes.value.push({
+				date: timeObj.date,
+				time: timeObj.hours,
+				timestamp: timeObj.timeStamp
+			});
+		} else { // 取消选中
+			const index = selectedTimes.value.findIndex(
+				item => item.timestamp === timeObj.timeStamp
+			)
+			selectedTimes.value.splice(index, 1)
+		}
 
 		totalTimes.value = selectedTimes.value.length; // 更新点击次数
-
-
-		console.log(selectedTimes.value, '>>>>>selectedTimes.value');
 	}
 
 	// 立即购买显示时执行
@@ -444,32 +457,33 @@
 		totalTimes.value = 0;
 		currentTime.value = '';
 		currentDate.value = [];
+		// 初始化disabled/checked 数据状态
+		getByDate()
 	}
 
 
 	const computeMoney = computed(() => {
 		return totalTimes.value * businessPrice.value
 	})
-	const computeClickTime = computed(() => {
-		let timeArr = []
-		let nyr = selectedTimes.value.map(item => {
-			return item.date
-		})
-
-		let nyrSet = Array.from(new Set(nyr)).map(item => {
-			return {
-				date: item,
-				timeArr: []
-			}
-		})
-		selectedTimes.value.forEach(item => {
-			nyrSet.forEach(i => {
-				if (item.date == i.date) i.timeArr.push(item.time)
-			})
-		})
-		console.log(nyrSet, '>>>>>nyrSet');
-		return nyrSet
-	})
+	// const computeClickTime = computed(() => {
+	// 	let timeArr = []
+	// 	let nyr = selectedTimes.value.map(item => {
+	// 		return item.date
+	// 	})
+
+	// 	let nyrSet = Array.from(new Set(nyr)).map(item => {
+	// 		return {
+	// 			date: item,
+	// 			timeArr: []
+	// 		}
+	// 	})
+	// 	selectedTimes.value.forEach(item => {
+	// 		nyrSet.forEach(i => {
+	// 			if (item.date == i.date) i.timeArr.push(item.time)
+	// 		})
+	// 	})
+	// 	return nyrSet
+	// })
 
 	const certificationPictures = computed(() => {
 		if (listData.value.certificationPicture) {
@@ -493,9 +507,6 @@
 		
 		  // 如果有地址,执行购买逻辑
 		  proceedToPayment();
-		
-
-	
 	};
 	
 	const proceedToPayment = async () => {

+ 2 - 117
pages_home/pages/register/data.js

@@ -96,77 +96,8 @@ const rules = {
     ]
 }
 
-//陪伴陪聊注册 1
-const chatting = [
-    {
-        label: "姓名",
-        key: "name",
-        type: "input",
-        rules: rules.name,
-        required:true
-    },
-    {
-        label: "性别",
-        key: "sex",
-        type: "select",
-        option: sex_option,
-        rules: rules.sex,
-        required:true
-    },
-    {
-        label: "年龄",
-        key: "age",
-        type: "input",
-        rules: rules.age,
-        required:true
-    },
-    {
-        label: "手机号",
-        key: "phonenumber",
-        type: "phone-code",
-    },
-    // {
-    //     label: "服务项目",
-    //     key: "businessManagementId",
-    //     type: "cascader",
-    //     cascaderKey:'0',
-    //     rules: rules.businessManagementId,
-    //     required:true,
-    //     apifun: ()=>{
-    //         return new Promise((resolve, reject) => {
-    //             getTreeList({ parentId: "1" }).then(res => {
-    //                 resolve(res.data)
-    //             })
-    //         })
-    //     },
-    //     optionKey:'businessManagementOption'
-    // },
-    {
-        label: "地区",
-        key: "city",
-        type: "city",
-        option: city_option,
-        rules: rules.city,
-        required:true
-    },
-    {
-        label: "详细地址",
-        key: "address",
-        type: "input",
-        rules: rules.address,
-        required:true
-    },
-    {
-        label: "技能简介",
-        key: "skillDescribe",
-        type: "textarea",
-        rules: rules.skillDescribe,
-        required:true
-    },
-]
 
-//孩子陪护(教育)2
-const education = [
+const column = [
     {
         label: "姓名",
         key: "name",
@@ -194,29 +125,6 @@ const education = [
         key: "phonenumber",
         type: "phone-code",
     },
-    // {
-    //     label: "服务项目",
-    //     key: "businessManagementId",
-    //     type: "cascader",
-    //     cascaderKey:'0',
-    //     rules: rules.businessManagementId,
-    //     required:true,
-    //     apifun: ()=>{
-    //         return new Promise((resolve, reject) => {
-    //             getTreeList({ parentId: "2" }).then(res => {
-    //                 resolve(res.data)
-    //             })
-    //         })
-    //     },
-    //     optionKey:'businessManagementOption'
-    // },
-    // {
-    //     label: "证件号",
-    //     key: "idCard",
-    //     type: "input",
-    //     rules: rules.idCard,
-    //     required:true
-    // },
     {
         label: "地区",
         key: "city",
@@ -224,7 +132,6 @@ const education = [
         option: city_option,
         rules: rules.city,
         required:true
-
     },
     {
         label: "详细地址",
@@ -241,26 +148,4 @@ const education = [
         required:true
     },
 ]
-
-// 健康管理
-const health  = [
-    {
-        label: "地区",
-        key: "city",
-        type: "city",
-        option: city_option,
-        rules: rules.city,
-        required:true
-    },
-    {
-        label: "详细地址",
-        key: "address",
-        type: "input",
-        rules: rules.address,
-        required:true
-    },
-]
-
-
-
-export { chatting, education,health}
+export {  column}

+ 55 - 67
pages_home/pages/register/index.vue

@@ -58,7 +58,7 @@
 
 		<view v-for="item in updata_list" :key="item.key" class="updata-imgs">
 			<UpdataImgs :fileList="file_url[item.key]" :data="item" ref="zsImg"
-				v-if="item.permission.includes(data.key)" @onSubmit="onChange" />
+				 @onSubmit="onChange" />
 		</view>
 
 
@@ -75,7 +75,7 @@ import { onLoad } from '@dcloudio/uni-app';
 import FontTitle from "@/pages_home/components/font-title/index.vue";
 import CustForm from "@/pages_home/components/cust-form/index";
 import UpdataImgs from "@/pages_home/components/updata-imgs/index.vue";
-import { chatting, education, health } from "./data";
+import { column } from "./data";
 import { add, getVolunteerInfo } from "@/api/volunteer";
 import { computed } from 'vue';
 import { getTreeList } from '@/api/volunteer'
@@ -91,7 +91,7 @@ const updata_list = [
 		img: '/static/img/updata-user-img.png',
 		key: 'volunteerPicture',
 		ref: userImg,
-		permission: [1, 2],
+		// permission: [1, 2],
 		required: true
 	},
 	{
@@ -100,7 +100,7 @@ const updata_list = [
 		img: '/static/img/updata-user-img.png',
 		key: 'idCardPicture',
 		ref: zsImg,
-		permission: [1, 2],
+		// permission: [1, 2],
 		required: true
 	},
 	{
@@ -109,7 +109,7 @@ const updata_list = [
 		img: '/static/img/updata-user-img.png',
 		key: 'certificationPicture',
 		ref: zsImg,
-		permission: [1, 2],
+		// permission: [1, 2],
 		required: false
 	}
 ]
@@ -131,8 +131,8 @@ const serviceKeys = reactive({
 	classKeyname: '',
 	itemKey: '',//服务项目
 	itemKeyname: '',
-	time:'',//时间
-	price:'',//价格
+	time: '',//时间
+	price: '',//价格
 })
 
 const timeList = [
@@ -154,16 +154,10 @@ const sex_status = {
 	'男': 0,
 	'女': 1
 }
-const register_column = {
-	1: chatting,
-	2: education,
-	3: health
-
-}
 
 //根据类型获取表单item 值
 const com_column = computed(() => {
-	let column_list = data.value ? register_column[data.value.key] : [];
+	let column_list = data.value ?column : [];
 	return column_list
 })
 
@@ -173,16 +167,13 @@ function onSubmit() {
 		// return;
 		// 校验表单并获取数据
 		cust_form_ref.value.onSubmit().then(async (res) => {
-			console.log('===res===>', res, file_url);
 
 			//文件必传校验
 			for (let i = 0; i < updata_list.length; i++) {
 				const element = updata_list[i];
-				console.log(element.required, element.permission.includes(data.value.key), file_url[element.key]);
 
 
-				const type = element.required && element.permission.includes(data.value.key) && !file_url[element.key];
-				console.log('element', element, type);
+				const type = element.required&& !file_url[element.key];
 
 				if (type) {
 					uni.showToast({
@@ -192,33 +183,33 @@ function onSubmit() {
 					return;
 				}
 			}
-		
-			if(!(serviceKeys.itemKeyname || serviceKeys.classKeyname)){
+
+			if (!(serviceKeys.itemKeyname || serviceKeys.classKeyname)) {
 				uni.showToast({
-						title: '请选择服务',
-						icon: 'none'
-					})
+					title: '请选择服务',
+					icon: 'none'
+				})
 				return
 			}
-			if(!serviceKeys.time){
+			if (!serviceKeys.time) {
 				uni.showToast({
-						title: '请选择服务时长',
-						icon: 'none'
-					})
+					title: '请选择服务时长',
+					icon: 'none'
+				})
 				return
 			}
-			if(!serviceKeys.price){
+			if (!serviceKeys.price) {
 				uni.showToast({
-						title: '请输入服务价格',
-						icon: 'none'
-					})
+					title: '请输入服务价格',
+					icon: 'none'
+				})
 				return
 			}
 
 			const parmas = {
 				serviceCategory: data.value.key,
 				...file_url,
-				businessManagementId:serviceKeys.itemKey || serviceKeys.classKey,
+				businessManagementId: serviceKeys.itemKey || serviceKeys.classKey,
 				businessPrice: serviceKeys.price,
 				businessDuration: serviceKeys.time
 			};
@@ -251,7 +242,6 @@ function onSubmit() {
 				title: res.msg,
 				icon: 'none'
 			})
-			console.log('==submit_res====>', submit_res);
 		})
 
 
@@ -265,7 +255,6 @@ function onSubmit() {
 }
 
 function onChange({ key, url }) {
-	console.log('onChange', key, url);
 	Object.assign(file_url, {
 		[key]: url
 	})
@@ -273,37 +262,36 @@ function onChange({ key, url }) {
 
 function idToIndexs(array, targetId, path = []) {
 
-    for (let i = 0; i < array.length; i++) {
-        const item = array[i];
-        const currentPath = path.concat(i);
+	for (let i = 0; i < array.length; i++) {
+		const item = array[i];
+		const currentPath = path.concat(i);
 
-        if (item.id === targetId) {
-			console.log('indexs',item);
-            return item
-        }
+		if (item.id === targetId) {
+			return item
+		}
 
-        if (item.children) {
-            const result = idToIndexs(item.children, targetId, currentPath);
-            if (result) {
-                return result;
-            }
-        }
-    }
+		if (item.children) {
+			const result = idToIndexs(item.children, targetId, currentPath);
+			if (result) {
+				return result;
+			}
+		}
+	}
 
-    return null; // 如果没有找到对应的项,返回 null
+	return null; // 如果没有找到对应的项,返回 null
 }
 //重新提交的服务信息回显
-function servesInit(){
-	const indexs =  idToIndexs(serviceOptions.value,details.value.businessManagementId +'')
+function servesInit() {
+	const indexs = idToIndexs(serviceOptions.value, details.value.businessManagementId + '')
 	const names = indexs.businessTierName.split('-');
 	Object.assign(serviceKeys, {
-					classKey: String(indexs.parentId)===String(data.value.key)? indexs.id :indexs.parentId,//服务类别
-					classKeyname:names[1],
-					itemKey: indexs.id,//服务项目
-					itemKeyname: indexs.businessName,
-					time:details.value.businessDuration,//时间
-					price:details.value.businessPrice,//价格
-				})
+		classKey: String(indexs.parentId) === String(data.value.key) ? indexs.id : indexs.parentId,//服务类别
+		classKeyname: names[1],
+		itemKey: indexs.id,//服务项目
+		itemKeyname: indexs.businessName,
+		time: details.value.businessDuration,//时间
+		price: details.value.businessPrice,//价格
+	})
 }
 async function getRegister() {
 
@@ -320,12 +308,15 @@ async function getRegister() {
 				idCardPicture: res.data.idCardPicture,
 				certificationPicture: res.data.certificationPicture
 			})
-
-			 servesInit(data)
-
-		
+			servesInit(data)
 			isAdd.value = false;
-			
+		}
+
+		if (data.value.record) {
+			Object.assign(serviceKeys, {
+				classKey: data.value.record.id,//服务类别
+				classKeyname: data.value.record.businessName,
+			})
 		}
 	} catch (error) {
 		console.log('error', error);
@@ -341,7 +332,6 @@ async function getRegister() {
 
 
 const serviceChange = (item, key) => {
-	console.log('----', item);
 	if (key === 'classKey') {
 		serviceItems.value = item.children;
 		serviceKeys['itemKey'] = '';
@@ -354,7 +344,6 @@ const serviceChange = (item, key) => {
 }
 const getTreeListInit = () => {
 	getTreeList({ parentId: data.value.key }).then(res => {
-		console.log('----', res.data);
 		serviceOptions.value = res.data;
 	})
 }
@@ -365,7 +354,7 @@ onMounted(() => {
 onLoad((options) => {
 	const option = JSON.parse(decodeURIComponent(options.data));
 	data.value = option;
-	console.log("option", option);
+	console.log("option", data.value);
 
 	uni.setNavigationBarTitle({
 		title: option.name  // 根据业务逻辑调整 
@@ -373,7 +362,6 @@ onLoad((options) => {
 
 	setTimeout(() => {
 		getRegister();
-
 	}, 500);
 
 })