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