Преглед на файлове

fix:修改志愿者获取日期

贾宇博 преди 5 месеца
родител
ревизия
ff78574746
променени са 3 файла, в които са добавени 36 реда и са изтрити 39 реда
  1. 0 10
      api/volunteerDetailsApi/details.js
  2. 15 12
      pages/Client/new_file.vue
  3. 21 17
      pages/goodsDetails/goodsDetails.vue

+ 0 - 10
api/volunteerDetailsApi/details.js

@@ -72,16 +72,6 @@ export function volunteerwork(params) {
 
 
 
-// 获取志愿者所有排班时间
-export function volunteergetTimesByDate(params) {
-  return request({
-    url: '/core/volunteer/work-date/getTimesByDate',  
-    method: 'get',
-	  params:params,
-  });
-}
-
-
 // 确认支付
 export function ordersCreateOrder(data) {
   return request({

+ 15 - 12
pages/Client/new_file.vue

@@ -247,20 +247,23 @@
 	}
 
 	const init = () => {
-		getDataTime().then(res => {
-			console.log('res', res);
-			selected.value = res.data.map(item => {
-				return {
-					date: item.workDate,
-					info: `${item.workStartTime}~${item.workEndTime}`,
-					time: {
-						startTime: item.workStartTime,
-						endTime: item.workEndTime
+		if(userType === "2"){
+			getDataTime().then(res => {
+				console.log('res', res);
+				selected.value = res.data.map(item => {
+					return {
+						date: item.workDate,
+						info: `${item.workStartTime}~${item.workEndTime}`,
+						time: {
+							startTime: item.workStartTime,
+							endTime: item.workEndTime
+						}
 					}
-				}
+				})
+			
 			})
-
-		})
+			return
+		}
 	}
 
 

+ 21 - 17
pages/goodsDetails/goodsDetails.vue

@@ -283,13 +283,15 @@
 		// 解析传递过来的参数对象
 		const params = JSON.parse(options.params);
 		const {
-			volunteerId,
+			volunteerId: id, // 重命名以避免命名冲突
 			serviceCategory
-		} = params; // 解构出 volunteerId 和 serviceCategory
+		} = params;
 
+		// 将volunteerId赋值给响应式变量
+		volunteerId.value = id;
 		// 使用传递的参数调用 API
 		const res = await getDetailsvolunteerId({
-			volunteerId,
+			volunteerId: id,
 			serviceCategory
 		});
 
@@ -298,6 +300,22 @@
 	});
 
 
+	// 选择日期
+	const getListTime = async () => {
+		const params = {
+			volunteerId: Number(volunteerId.value),
+		}
+		console.log(params, 'params>>>>>>>>>>>params')
+		const res = await volunteerwork(params)
+		if (res.data) {
+			doorToDoorTimeArr.value = res.data
+			const newRes = [res.data[0], res.data[res.data.length - 1]]
+			doorToDoorTime.value = newRes
+			startDisabled.value = doorToDoorTime.value[0]
+			endDisabled.value = doorToDoorTime.value[1]
+		}
+	}
+
 
 	// 获取志愿者排班时间
 	const getByDate = async (date = doorToDoorTimeArr.value[0]) => {
@@ -332,20 +350,6 @@
 		}
 	};
 
-	// 选择日期
-	const getListTime = async () => {
-		const params = {
-			volunteerId: volunteerId.value,
-		}
-		const res = await volunteerwork(params)
-		if (res.data) {
-			doorToDoorTimeArr.value = res.data
-			const newRes = [res.data[0], res.data[res.data.length - 1]]
-			doorToDoorTime.value = newRes
-			startDisabled.value = doorToDoorTime.value[0]
-			endDisabled.value = doorToDoorTime.value[1]
-		}
-	}
 
 	// 确认购买
 	const handlConfiRmpurchase = async () => {