|
@@ -74,7 +74,8 @@
|
|
|
type="daterange"></uniDatetimePickerMy>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <its-calendar v-if="show" :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>
|
|
@@ -99,7 +100,6 @@
|
|
|
<up-cell-group>
|
|
|
<view @click="jumpToAddressSelect" style="display: flex; align-items: center; padding: 10px;">
|
|
|
<up-icon name="more-dot-fill" size="16" />
|
|
|
-
|
|
|
<view v-if="selectedAddress" style="margin-left: 8px; flex: 1;">
|
|
|
<view class="address-display">
|
|
|
<text class="address-line">
|
|
@@ -113,20 +113,19 @@
|
|
|
</view>
|
|
|
<text v-else style="margin-left: 8px; font-size: 14px;">请选择服务地址</text>
|
|
|
</view>
|
|
|
- <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">
|
|
|
- 时间:{{ item.time }}
|
|
|
- <!-- <span v-for="(i,ind) in item.timeArr" :key="ind">
|
|
|
- {{i}}
|
|
|
- </span> -->
|
|
|
+ <scroll-view scroll-y style="height: 460rpx;">
|
|
|
+ <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">
|
|
|
+ <view class="info-item">服务项目:{{listData.projectName}}</view>
|
|
|
+ <view class="Telephone">服务时长:{{listData.businessDuration}}</view>
|
|
|
+ <view class="date">日期:{{item.date}}</view>
|
|
|
+ <view class="time">
|
|
|
+ 时间:{{ item.time }}
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </scroll-view>
|
|
|
</up-cell-group>
|
|
|
</view>
|
|
|
|
|
@@ -142,7 +141,7 @@
|
|
|
<!-- 钱包支付选项 -->
|
|
|
<view class="payment-option">
|
|
|
<view class="option-left">
|
|
|
- <image src="/static/my/钱包.png" class="payment-icon"></image>
|
|
|
+ <image src="/static/钱包.png" class="payment-icon"></image>
|
|
|
<text class="option-text">钱包</text>
|
|
|
</view>
|
|
|
<up-radio-group v-model="radiovalue1" placement="column">
|
|
@@ -218,7 +217,7 @@
|
|
|
|
|
|
const src = ref('http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg')
|
|
|
const businessPrice = ref() //价格
|
|
|
- const addressId = ref('')//用户下单地址
|
|
|
+ const addressId = ref('') //用户下单地址
|
|
|
const volunteerId = ref(''); // 存储志愿者ID
|
|
|
const serviceCategory = ref('') //存储大类别
|
|
|
const businessManagementId = ref('') //具体分类id
|
|
@@ -332,7 +331,7 @@
|
|
|
|
|
|
// 获取传递的参数
|
|
|
onLoad(async (options) => {
|
|
|
- const option = JSON.parse(decodeURIComponent(options.params));
|
|
|
+ const option = JSON.parse(decodeURIComponent(options.params));
|
|
|
const {
|
|
|
volunteerId: id,
|
|
|
serviceCategory: categoy,
|
|
@@ -371,7 +370,7 @@
|
|
|
console.error('接口返回的日期范围为空');
|
|
|
doorToDoorTimeArr.value = [];
|
|
|
timeHostArr.value = []; // 清空时间段
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -396,20 +395,20 @@
|
|
|
try {
|
|
|
const res = await volunteergetTimesByDate(params);
|
|
|
const TArr = res.data.map((item) => {
|
|
|
-
|
|
|
+
|
|
|
// 初始化disabled变量
|
|
|
let disabled = false
|
|
|
- if (item.hasReservation === 1) (disabled = true)
|
|
|
-
|
|
|
+ if (item.hasReservation === 1)(disabled = true)
|
|
|
+
|
|
|
let itemTime = item.timeStamp > 9999999999 ? item.timeStamp : item.timeStamp * 1000;
|
|
|
-
|
|
|
- if (new Date().getTime() > itemTime) (disabled = true)
|
|
|
-
|
|
|
+
|
|
|
+ if (new Date().getTime() > itemTime)(disabled = true)
|
|
|
+
|
|
|
return {
|
|
|
...item,
|
|
|
hours: item.reservationTime,
|
|
|
timeStamp: new Date(`${date} ${item.reservationTime}`).getTime() / 1000,
|
|
|
- date:date,
|
|
|
+ date: date,
|
|
|
checked: false,
|
|
|
disabled
|
|
|
}
|
|
@@ -422,7 +421,7 @@
|
|
|
}
|
|
|
|
|
|
// 填充时间段数组
|
|
|
- timeHostArr.value = Array(doorToDoorTimeArr.value.length).fill(TArr);
|
|
|
+ timeHostArr.value = Array(doorToDoorTimeArr.value.length).fill(TArr);
|
|
|
} catch (error) {
|
|
|
console.error('获取排班时间失败:', error);
|
|
|
}
|
|
@@ -432,7 +431,7 @@
|
|
|
if (timeObj.clicked) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (timeObj.checked) { // 选中 添加到已选时间数组
|
|
|
selectedTimes.value.push({
|
|
|
date: timeObj.date,
|
|
@@ -489,74 +488,74 @@
|
|
|
}
|
|
|
return []
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 确认购买
|
|
|
const handlConfiRmpurchase = () => {
|
|
|
if (!selectedAddress.value) {
|
|
|
- uni.showToast({
|
|
|
- title: '请先选择收货地址',
|
|
|
- icon: 'none',
|
|
|
- duration: 2000,
|
|
|
- });
|
|
|
- return; // 阻止购买
|
|
|
- }
|
|
|
-
|
|
|
- // 如果有地址,执行购买逻辑
|
|
|
- proceedToPayment();
|
|
|
+ uni.showToast({
|
|
|
+ title: '请先选择收货地址',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ return; // 阻止购买
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果有地址,执行购买逻辑
|
|
|
+ proceedToPayment();
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
const proceedToPayment = async () => {
|
|
|
- // 定义要发送的数据
|
|
|
- const orderData = {
|
|
|
- orders: {
|
|
|
- serviceOnePrice: businessPrice.value,
|
|
|
- serviceTotalPrice: computeMoney.value, //需要传获取到的总价
|
|
|
- serviceCategory: serviceCategory.value, //大类别参数
|
|
|
- totalTimes: totalTimes.value, //点击的次数
|
|
|
- serviceStartDate: "2025-04-18",
|
|
|
- startTime: "8:00",
|
|
|
- serviceDuration: 4,
|
|
|
- paymentMethod: 1,
|
|
|
- volunteerId: volunteerId.value,
|
|
|
- remark: remark.value,
|
|
|
- businessManagementId: businessManagementId.value,
|
|
|
- volunteerInfoId: listData.value.volunteerInfoId,
|
|
|
- addressId:selectedAddress.value.addressId,
|
|
|
- },
|
|
|
- workDateList: []
|
|
|
- };
|
|
|
- // 转换所有选择的时间
|
|
|
- selectedTimes.value.forEach(item => {
|
|
|
- orderData.workDateList.push({
|
|
|
- workDate: item.date,
|
|
|
- workStartTime: item.time
|
|
|
- });
|
|
|
- });
|
|
|
- try {
|
|
|
- const res = await ordersCreateOrder(orderData);
|
|
|
- if (res.code == 200) {
|
|
|
- uni.showToast({
|
|
|
- title: '支付成功',
|
|
|
- icon: 'success', // 或者 'none'
|
|
|
- duration: 1500, // 显示时间,单位毫秒,默认1500
|
|
|
- mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- uni.reLaunch({
|
|
|
- url: '/pages/index'
|
|
|
- });
|
|
|
- }, 1500)
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- uni.showToast({
|
|
|
- title: '支付失败',
|
|
|
- icon: 'error', // 或者 'none'
|
|
|
- duration: 1500, // 显示时间,单位毫秒,默认1500
|
|
|
- mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
|
|
|
- });
|
|
|
- }
|
|
|
+ // 定义要发送的数据
|
|
|
+ const orderData = {
|
|
|
+ orders: {
|
|
|
+ serviceOnePrice: businessPrice.value,
|
|
|
+ serviceTotalPrice: computeMoney.value, //需要传获取到的总价
|
|
|
+ serviceCategory: serviceCategory.value, //大类别参数
|
|
|
+ totalTimes: totalTimes.value, //点击的次数
|
|
|
+ serviceStartDate: "2025-04-18",
|
|
|
+ startTime: "8:00",
|
|
|
+ serviceDuration: 4,
|
|
|
+ paymentMethod: 1,
|
|
|
+ volunteerId: volunteerId.value,
|
|
|
+ remark: remark.value,
|
|
|
+ businessManagementId: businessManagementId.value,
|
|
|
+ volunteerInfoId: listData.value.volunteerInfoId,
|
|
|
+ addressId: selectedAddress.value.addressId,
|
|
|
+ },
|
|
|
+ workDateList: []
|
|
|
+ };
|
|
|
+ // 转换所有选择的时间
|
|
|
+ selectedTimes.value.forEach(item => {
|
|
|
+ orderData.workDateList.push({
|
|
|
+ workDate: item.date,
|
|
|
+ workStartTime: item.time
|
|
|
+ });
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ const res = await ordersCreateOrder(orderData);
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功',
|
|
|
+ icon: 'success', // 或者 'none'
|
|
|
+ duration: 1500, // 显示时间,单位毫秒,默认1500
|
|
|
+ mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/index'
|
|
|
+ });
|
|
|
+ }, 1500)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付失败',
|
|
|
+ icon: 'error', // 或者 'none'
|
|
|
+ duration: 1500, // 显示时间,单位毫秒,默认1500
|
|
|
+ mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
|
|
@@ -566,6 +565,38 @@
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
+ /* 添加卡片样式 */
|
|
|
+ .card-container {
|
|
|
+ display: flex;
|
|
|
+ padding: 20rpx;
|
|
|
+ margin: 10rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
|
|
|
+ }
|
|
|
+
|
|
|
+ .card-image {
|
|
|
+ width: 120rpx;
|
|
|
+ height: 120rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ margin-right: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card-content {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
+
|
|
|
+ .info-item,
|
|
|
+ .Telephone,
|
|
|
+ .date,
|
|
|
+ .time {
|
|
|
+ font-size: 26rpx;
|
|
|
+ margin-bottom: 8rpx;
|
|
|
+ }
|
|
|
+
|
|
|
.box {
|
|
|
height: 100vh;
|
|
|
width: 100vw;
|