|
@@ -54,7 +54,7 @@
|
|
|
<up-popup :show="show" @close="close" @open="open">
|
|
|
|
|
|
</up-popup>
|
|
|
- <up-popup v-model:show="show">
|
|
|
+ <up-popup v-model:show="show" @open="upPopupOpen">
|
|
|
<view>
|
|
|
<view class="Wrapper">
|
|
|
<image src="/static/img/Location.png" class="Wrapper-img" />
|
|
@@ -66,7 +66,7 @@
|
|
|
<up-divider></up-divider>
|
|
|
<view class="Wrap-content1">
|
|
|
<up-avatar :src="src"></up-avatar>
|
|
|
- <text style="margin-top: 15rpx;">¥300000</text>
|
|
|
+ <text style="margin-top: 15rpx;">¥{{onePrice}}</text>
|
|
|
</view>
|
|
|
<view class="Wrap-info">
|
|
|
<text style="margin-left: 10rpx;">服务类别:</text>
|
|
@@ -80,8 +80,12 @@
|
|
|
type="daterange"></uniDatetimePickerMy>
|
|
|
</view>
|
|
|
<view>
|
|
|
- <its-calendar :timeArr="doorToDoorTimeArr" :timeHostArr="timeHostArr"
|
|
|
- @getByDate=getByDate></its-calendar>
|
|
|
+ <its-calendar
|
|
|
+ :timeArr="doorToDoorTimeArr"
|
|
|
+ :timeHostArr="timeHostArr"
|
|
|
+ @getByDate="getByDate"
|
|
|
+ @getByTime="getByTime"
|
|
|
+ ></its-calendar>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -91,7 +95,9 @@
|
|
|
</view>
|
|
|
<view class="Wrap-detils-btn">
|
|
|
<up-button type="primary" shape="circle" :customStyle="wrapqx" @click="handlCancel">取消</up-button>
|
|
|
- <up-button type="error" shape="circle" :customStyle="wrapqx" @click="handleBuy">购买</up-button>
|
|
|
+ <up-button type="error" shape="circle" :customStyle="wrapqx" @click="handleBuy">
|
|
|
+ 购买¥{{ computeMoney }}
|
|
|
+ </up-button>
|
|
|
|
|
|
</view>
|
|
|
</up-popup>
|
|
@@ -101,7 +107,7 @@
|
|
|
<!-- 支付金额 -->
|
|
|
<view class="payment-header">
|
|
|
<text class="payment-title">现在支付</text>
|
|
|
- <text class="payment-amount">¥159.02</text>
|
|
|
+ <text class="payment-amount">¥{{ computeMoney }}</text>
|
|
|
</view>
|
|
|
|
|
|
<up-line></up-line>
|
|
@@ -144,7 +150,7 @@
|
|
|
|
|
|
<!-- 确认按钮 -->
|
|
|
<view class="confirm-button">
|
|
|
- <up-button type="primary" text="确认购买 · ¥159.20" @click="handlConfiRmpurchase"></up-button>
|
|
|
+ <up-button type="primary" :text="`确认购买 · ¥${computeMoney}`" @click="handlConfiRmpurchase"></up-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</up-popup>
|
|
@@ -153,6 +159,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+ // 点击当前时间,后面时间禁用
|
|
|
+ // workDate获取点击的精确时间
|
|
|
import {
|
|
|
onLoad
|
|
|
} from '@dcloudio/uni-app'
|
|
@@ -160,7 +168,8 @@
|
|
|
onMounted,
|
|
|
ref,
|
|
|
nextTick,
|
|
|
- reactive
|
|
|
+ reactive,
|
|
|
+ computed
|
|
|
} from "vue";
|
|
|
import {
|
|
|
getDetailsvolunteerId,
|
|
@@ -174,11 +183,15 @@
|
|
|
|
|
|
|
|
|
const src = ref('http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg')
|
|
|
+ const onePrice = ref(400)
|
|
|
const value = ref(''); //备注响应式
|
|
|
const volunteerId = ref(''); // 存储志愿者ID
|
|
|
const doorToDoorTimeArr = ref([]) // 完整时间范围
|
|
|
const doorToDoorTime = ref([]) // 只具备开始、结束 时间
|
|
|
const timeHostArr = ref([]) // 时间段数组
|
|
|
+ const currentDate = ref([]) // 点击过的年月日数组数据
|
|
|
+ const currentTime = ref('') // 最后一次点击时间的时间节点
|
|
|
+ const totalTimes = ref(0) // 时间点 点击的次数
|
|
|
const startDisabled = ref('')
|
|
|
const endDisabled = ref('')
|
|
|
const time = ref('')
|
|
@@ -186,6 +199,11 @@
|
|
|
const show = ref(false); //立即购买
|
|
|
const showSum = ref(false);
|
|
|
const showNotify = ref(false) //支付成功提示
|
|
|
+
|
|
|
+
|
|
|
+ const computeMoney = computed(() => {
|
|
|
+ return totalTimes.value * onePrice.value
|
|
|
+ })
|
|
|
|
|
|
|
|
|
// 定义方法
|
|
@@ -310,6 +328,7 @@
|
|
|
}
|
|
|
const res = await volunteerwork(params)
|
|
|
if (res.data) {
|
|
|
+ console.log(res.data, '>>>>>res.data333');
|
|
|
doorToDoorTimeArr.value = res.data
|
|
|
const newRes = [res.data[0], res.data[res.data.length - 1]]
|
|
|
doorToDoorTime.value = newRes
|
|
@@ -321,6 +340,7 @@
|
|
|
|
|
|
// 获取志愿者排班时间
|
|
|
const getByDate = async (date = doorToDoorTimeArr.value[0]) => {
|
|
|
+ currentDate.value.push(date)
|
|
|
console.log(date, '获取日期2')
|
|
|
if (!volunteerId.value) {
|
|
|
console.error('volunteerId 为空');
|
|
@@ -352,18 +372,30 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ // 点击具体时间触发
|
|
|
+ const getByTime = (timeObj) => {
|
|
|
+ currentTime.value = timeObj.hours
|
|
|
+ totalTimes.value += 1 // 记录点击次数
|
|
|
+ console.log(totalTimes.value, '>>>>>>>>>totalTimes.value');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 立即购买显示时执行
|
|
|
+ const upPopupOpen = () => { //显示时初始化预存储信息数据
|
|
|
+ totalTimes.value = 0
|
|
|
+ currentTime.value = ''
|
|
|
+ if (doorToDoorTimeArr.value.length) currentDate.value = [doorToDoorTimeArr.value[0]]
|
|
|
+ }
|
|
|
|
|
|
// 确认购买
|
|
|
const handlConfiRmpurchase = async () => {
|
|
|
// 定义要发送的数据
|
|
|
const orderData = {
|
|
|
orders: {
|
|
|
- serviceOnePrice: 400.00,
|
|
|
- serviceTotalPrice: 2000.00,
|
|
|
+ serviceOnePrice: onePrice.value,//需要传400死值返回给后端
|
|
|
+ serviceTotalPrice: computeMoney.value,//需要传获取到的总价
|
|
|
serviceCategory: 2,
|
|
|
- totalTimes: 1,
|
|
|
- serviceStartDate: "2025-05-22",
|
|
|
- serviceFinishDate: "2025-05-28",
|
|
|
+ totalTimes: totalTimes.value,//点击的次数
|
|
|
+
|
|
|
startTime: "8:00",
|
|
|
serviceDuration: 4,
|
|
|
paymentMethod: 1,
|
|
@@ -371,28 +403,22 @@
|
|
|
remark: "我是图图小淘气,面对世界很好奇!",
|
|
|
volunteerId: 104
|
|
|
},
|
|
|
- workDateList: [{
|
|
|
- workDate: "2025-05-23",
|
|
|
- workStartTime: "18:00",
|
|
|
- workEndTime: "20:00"
|
|
|
- },
|
|
|
- {
|
|
|
- workDate: "2025-05-24",
|
|
|
- workStartTime: "18:00",
|
|
|
- workEndTime: "20:00"
|
|
|
- },
|
|
|
- {
|
|
|
- workDate: "2025-05-25",
|
|
|
- workStartTime: "18:00",
|
|
|
- workEndTime: "20:00"
|
|
|
- },
|
|
|
- {
|
|
|
- workDate: "2025-05-26",
|
|
|
- workStartTime: "18:00",
|
|
|
- workEndTime: "20:00"
|
|
|
- }
|
|
|
+ workDateList: [
|
|
|
+ // {
|
|
|
+ // workDate: currentDate.value,//需要传获取到的时间,就是某个月份
|
|
|
+ // }
|
|
|
]
|
|
|
};
|
|
|
+
|
|
|
+ (new Set(currentDate.value)).forEach((item) => {
|
|
|
+ orderData.workDateList.push({
|
|
|
+ workDate: item,
|
|
|
+ workStartTime: currentTime.value,
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
try {
|
|
|
const res = await ordersCreateOrder(orderData);
|