修改代码

This commit is contained in:
wangxiaowei
2026-01-24 23:59:41 +08:00
parent 1e09782256
commit 5e5cd66f21
23 changed files with 228 additions and 127 deletions

View File

@ -221,7 +221,7 @@
</wd-popup>
<!-- 选择预定时间 -->
<booking-time v-model="showBookTimePopup" :day="sevenDay" @selectedTime="Reserve.handleChooseReserveTime"></booking-time>
<booking-time v-model="showBookTimePopup" :day="sevenDay" :auto-reserve-time="sevenDay.minimum_time" @selectedTime="Reserve.handleChooseReserveTime"></booking-time>
<view>
<navbar title="预约茶艺师" :leftArrow="false"></navbar>
@ -252,8 +252,18 @@
<view class="flex items-center justify-between">
<view class="font-bold text-32rpx leading-44rpx">服务方式</view>
<view class="bg-[#F0F6EF] h-60rpx rounded-20rpx flex items-center justify-between py-14rpx px-30rpx relative w-304rpx font-400 text-26rpx text-[#333]">
<view class="absolute left-30rpx top-1/2 -translate-y-1/2 z-2" :class="serviceTypeValue == 1 ? 'text-[#fff]' : ''" @click="Reserve.handleChooseService(1)">到店服务</view>
<view class="absolute right-30rpx top-1/2 -translate-y-1/2 z-2" :class="serviceTypeValue == 2 ? 'text-[#fff]' : ''" @click="Reserve.handleChooseService(2)">上门服务</view>
<view
class="absolute left-30rpx top-1/2 -translate-y-1/2 z-2"
:class="serviceTypeValue == 1 ? 'text-[#fff]' : ''"
@click="Reserve.handleChooseService(1)">
到店服务
</view>
<view
class="absolute right-30rpx top-1/2 -translate-y-1/2 z-2"
:class="serviceTypeValue == 2 ? 'text-[#fff]' : ''"
@click="Reserve.handleChooseService(2)">
上门服务
</view>
<view class="swiper-service" :style="{ transform: serviceTypeValue == 1 ? 'translateY(-50%) translateX(0)' : 'translateY(-50%) translateX(76px)' }"></view>
</view>
</view>
@ -509,6 +519,7 @@
price: 0, // 服务费
mileage_price: 0, // 车马费
state: 0, // 茶艺师状态哦
server_type: 0, // 服务类型 1到店 2上门 3两者皆有
})
// 选择的优惠券
@ -577,6 +588,13 @@
longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE,
})
info.value = res.teamaster
// 根据茶艺师支持的服务类型初始化服务方式
if (info.value.server_type === 1 || info.value.server_type === 3) {
serviceTypeValue.value = 1
} else if (info.value.server_type === 2 || info.value.server_type === 3) {
serviceTypeValue.value = 2
}
}
// 初始化数据
@ -597,6 +615,16 @@
* @param type 服务类型 1到店服务 2上门服务
*/
handleChooseService: (type: number) => {
if (type === 1 && (info.value.server_type === 2)) {
toast.show('该茶艺师仅支持上门服务')
return
}
if (type === 2 && (info.value.server_type === 1)) {
toast.show('该茶艺师仅支持到店服务')
return
}
serviceTypeValue.value = type
if (type === 1) {
@ -684,7 +712,7 @@
// 计算费用明细
costParams.value.longitude = params.longitude
costParams.value.latitude = params.latitude
// Reserve.handleCost()
Reserve.handleCost()
})
router.navigateTo('/bundle_b/pages/tea-specialist/store?from=reserve')
},
@ -700,7 +728,7 @@
costParams.value.longitude = params.longitude
costParams.value.latitude = params.latitude
// Reserve.handleCost()
Reserve.handleCost()
})
router.navigateTo('/bundle_b/pages/tea-specialist/address/list?from=reserve')
},
@ -762,12 +790,19 @@
uni.$off('chooseCoupon');
uni.$on('chooseCoupon', params => {
uni.$off('chooseCoupon')
selectedCoupon.value = {id: params.coupon.id, name: params.coupon.name}
bill.value.coupon = params.coupon.coupon_price
selectCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID保存下来是为了回显列表的,没有其他作用
if (params.coupon) {
selectedCoupon.value = {id: params.coupon.id, name: params.coupon.name}
bill.value.coupon = params.coupon.coupon_price
selectCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID保存下来是为了回显列表的,没有其他作用
costParams.value.user_coupon_id = params.coupon.id
} else {
selectedCoupon.value = {id: 0, name: '' }
bill.value.coupon = 0
selectCouponId.value = 0
costParams.value.user_coupon_id = 0
}
// 计算费用明细
costParams.value.user_coupon_id = params.coupon.id
Reserve.handleCost()
})
@ -911,6 +946,9 @@
Door.endTimeTimestamp = Number(e.value) + Number(2 * 60 * 60 * 1000) // 初始化结束时间是未来2个小时
endTimeValue.value = String(Door.endTimeTimestamp)
Door.handleTotalTimestamp()
costParams.value.hours = totalHour.value
Reserve.handleCost()
},
handleEndTimePicker: (e: {value: number}) => {