|
@@ -26,6 +26,9 @@
|
|
|
<view class="Telephone"
|
|
|
>服务时长:{{ listData.businessDuration }}</view
|
|
|
>
|
|
|
+ <view class="Telephone"
|
|
|
+ >次/件:{{ listData.minQuantity + listData.businessUnit }}</view
|
|
|
+ >
|
|
|
<view class="Telephone">电话:{{ listData.phonenumber }}</view>
|
|
|
</view>
|
|
|
|
|
@@ -34,6 +37,17 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
</up-card>
|
|
|
+
|
|
|
+ <up-card
|
|
|
+ title="服务描述"
|
|
|
+ :thumb="thumb"
|
|
|
+ :head-style="{ height: '80rpx', padding: '20rpx' }"
|
|
|
+ >
|
|
|
+ <template #body>
|
|
|
+ {{ listData.businessDescribe }}
|
|
|
+ </template>
|
|
|
+ </up-card>
|
|
|
+
|
|
|
<up-card
|
|
|
title="技能介绍"
|
|
|
:thumb="thumb"
|
|
@@ -88,13 +102,21 @@
|
|
|
<up-divider></up-divider>
|
|
|
<view class="Wrap-content1">
|
|
|
<up-avatar :src="src"></up-avatar>
|
|
|
- <text style="margin-top: 15rpx">¥{{ listData.businessPrice }}</text>
|
|
|
+ <text style="margin-top: 15rpx">¥{{ businessPrice }}</text>
|
|
|
</view>
|
|
|
<view class="Wrap-info">
|
|
|
<text style="margin-left: 10rpx">服务类别:</text>
|
|
|
<up-text type="info" text="家庭教育"></up-text>
|
|
|
</view>
|
|
|
+ <view class="Wrap-info">
|
|
|
+ <text style="margin-left: 10rpx">服务次数:</text>
|
|
|
+ <up-number-box :modelValue="singleQuantity" :min="listData.minQuantity" @change="valChange"></up-number-box>
|
|
|
+ </view>
|
|
|
|
|
|
+ <view class="Wrap-info">
|
|
|
+ <text style="margin-left: 10rpx">购买规格:</text>
|
|
|
+ <view>{{ listData.projectTypeName + listData.minQuantity }}</view>
|
|
|
+ </view>
|
|
|
<view class="Wrap-content3">
|
|
|
<text style="margin-left: 15rpx">服务周期:</text>
|
|
|
<view style="margin-top: 25rpx">
|
|
@@ -108,7 +130,9 @@
|
|
|
<view>
|
|
|
<its-calendar
|
|
|
v-if="show"
|
|
|
+ ref="itsCalendarRef"
|
|
|
:businessDuration="listData.businessDuration"
|
|
|
+ :minQuantity="singleQuantity"
|
|
|
:timeArr="doorToDoorTimeArr"
|
|
|
:timeHostArr="timeHostArr"
|
|
|
@getByDate="getByDate"
|
|
@@ -293,7 +317,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
-import { onMounted, ref, reactive, computed } from 'vue'
|
|
|
+import { onMounted, ref, reactive, computed, nextTick } from 'vue'
|
|
|
import {
|
|
|
getDetailsvolunteerId,
|
|
|
volunteerwork,
|
|
@@ -309,8 +333,9 @@ import addressComponent from '@/pages_home/components/volunteerData/adresss.vue'
|
|
|
const src = ref(
|
|
|
'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg'
|
|
|
)
|
|
|
+const itsCalendarRef = ref(null)
|
|
|
const businessPrice = ref() //价格
|
|
|
-const addressId = ref('') //用户下单地址
|
|
|
+const singleQuantity = ref(1) // 购买次数,默认为1,不可为0
|
|
|
const volunteerId = ref('') // 存储志愿者ID
|
|
|
const serviceCategory = ref('') //存储大类别
|
|
|
const businessManagementId = ref('') //具体分类id
|
|
@@ -323,19 +348,17 @@ const selectedTimes = ref([]) // 存储所有选择的时间对象
|
|
|
const totalTimes = ref(0) // 时间点 点击的次数
|
|
|
const startDisabled = ref('')
|
|
|
const endDisabled = ref('')
|
|
|
-const time = ref('')
|
|
|
const listData = ref({})
|
|
|
const show = ref(false) //第一层弹框
|
|
|
const showSecond = ref(false) //第二层弹框
|
|
|
-const showThird = ref(false) //第二层弹框
|
|
|
-const showSum = ref(false)
|
|
|
const remark = ref('') //备注
|
|
|
-const radiovalue1 = ref('苹果')
|
|
|
+const radiovalue1 = ref(null)
|
|
|
const selectedAddress = ref(null)
|
|
|
const addressFlag = ref(false)
|
|
|
const paymentMethod = ref(null) // Add payment method ref with default value 1 (wallet)
|
|
|
|
|
|
-const addressInfo = ref(null)
|
|
|
+const addressInfo = ref(null)
|
|
|
+const value = ref(1); // 将在onLoad中更新为listData.minQuantity
|
|
|
// Radio 单选框数据
|
|
|
const radiolist1 = reactive([
|
|
|
{
|
|
@@ -451,9 +474,47 @@ onLoad(async (options) => {
|
|
|
})
|
|
|
|
|
|
listData.value = res.data || {}
|
|
|
+
|
|
|
+ // 更新步进器的初始值为listData中的minQuantity
|
|
|
+ value.value = listData.value.minQuantity || 1
|
|
|
businessPrice.value = listData.value.businessPrice || 0
|
|
|
+ singleQuantity.value = listData.value.minQuantity || 1
|
|
|
})
|
|
|
|
|
|
+// 添加步进器值变化处理函数
|
|
|
+const valChange = (obj) => {
|
|
|
+ const durationMs = listData.value.businessDuration * obj.value * 60;
|
|
|
+
|
|
|
+ const a = itsCalendarRef.value.upItem
|
|
|
+ const b = itsCalendarRef.value.timeHostArr
|
|
|
+ const c = itsCalendarRef.value.day_index
|
|
|
+
|
|
|
+ const seconds = listData.value.businessDuration * obj.value * 60;
|
|
|
+ const endTimestamp = (a.timeStamp + durationMs);
|
|
|
+
|
|
|
+ // 根据当前时间分割出后续应选数据数组
|
|
|
+ const filteredSlots = b[c].filter(i => {
|
|
|
+ return (i.timeStamp > a.timeStamp &&
|
|
|
+ i.timeStamp <= endTimestamp)
|
|
|
+ });
|
|
|
+
|
|
|
+ const timestampDifferenceValue = filteredSlots.length ? (filteredSlots[filteredSlots.length - 1].timeStamp - a.timeStamp) : 0
|
|
|
+
|
|
|
+ console.log(filteredSlots, '>>>>>filteredSlots');
|
|
|
+
|
|
|
+
|
|
|
+ if (timestampDifferenceValue < durationMs) { // 所选时间差值 小于 服务时间值 结束执行
|
|
|
+ uni.showToast({ title: '所选时间的服务时间不充足!', icon: 'none' });
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ singleQuantity.value = obj.value || 1;
|
|
|
+
|
|
|
+ nextTick(() => {
|
|
|
+ itsCalendarRef.value.handleTimeClick2()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// 选择日期
|
|
|
const getListTime = async () => {
|
|
|
const params = {
|
|
@@ -565,7 +626,8 @@ const upPopupOpen = () => {
|
|
|
}
|
|
|
|
|
|
const computeMoney = computed(() => {
|
|
|
- return totalTimes.value * businessPrice.value
|
|
|
+ console.log(totalTimes.value , businessPrice.value , singleQuantity.value, '>>>>>> console.log(totalTimes.value * businessPrice.value * minQuantity.value);');
|
|
|
+ return totalTimes.value * businessPrice.value * singleQuantity.value
|
|
|
})
|
|
|
|
|
|
const certificationPictures = computed(() => {
|
|
@@ -611,6 +673,7 @@ const proceedToPayment = async () => {
|
|
|
businessManagementId: businessManagementId.value,
|
|
|
volunteerInfoId: listData.value.volunteerInfoId,
|
|
|
addressId: selectedAddress.value.addressId,
|
|
|
+ singleQuantity: singleQuantity.value,
|
|
|
},
|
|
|
workDateList: [],
|
|
|
}
|
|
@@ -688,7 +751,7 @@ const proceedToPayment = async () => {
|
|
|
})
|
|
|
reject(error)
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -702,7 +765,7 @@ const proceedToPayment = async () => {
|
|
|
})
|
|
|
setTimeout(() => {
|
|
|
uni.reLaunch({
|
|
|
- url: '/pages/classify'
|
|
|
+ url: '/pages/classify',
|
|
|
})
|
|
|
}, 1500)
|
|
|
}
|
|
@@ -786,7 +849,7 @@ onMounted(async () => {
|
|
|
/* 左侧图片 */
|
|
|
.card-image {
|
|
|
width: 240rpx;
|
|
|
- height: 340rpx;
|
|
|
+ height: 380rpx;
|
|
|
border-radius: 12rpx;
|
|
|
margin-right: 30rpx;
|
|
|
flex-shrink: 0;
|