修改代码
This commit is contained in:
2
env/.env.development
vendored
2
env/.env.development
vendored
@ -14,4 +14,4 @@ VITE_UPLOAD_BASEURL = 'https://76458.com/upload'
|
||||
|
||||
# 上传图片请求地址
|
||||
VITE_UPLOAD_BASEURL = 'https://76458.com/api/upload/image'
|
||||
VITE_UPLOAD_IMAGE_URL = 'https://76458.com/'
|
||||
VITE_UPLOAD_IMAGE_URL = 'https://chaz.oss-cn-shanghai.aliyuncs.com/'
|
||||
2
env/.env.production
vendored
2
env/.env.production
vendored
@ -14,4 +14,4 @@ VITE_UPLOAD_BASEURL = 'https://76458.com/upload'
|
||||
|
||||
# 上传图片请求地址
|
||||
VITE_UPLOAD_BASEURL = 'https://76458.com/api/upload/image'
|
||||
VITE_UPLOAD_IMAGE_URL = 'https://76458.com/'
|
||||
VITE_UPLOAD_IMAGE_URL = 'https://chaz.oss-cn-shanghai.aliyuncs.com/'
|
||||
@ -99,7 +99,9 @@ export interface IRoomDetailParams {
|
||||
}
|
||||
|
||||
export function getTeaRoomDetail(data: IRoomDetailParams) {
|
||||
return http.Post<ITeaRoomDetailResult>('/api/teaStore/teaStoreDetails', data)
|
||||
return http.Post<ITeaRoomDetailResult>('/api/teaStore/teaStoreDetails', data, {
|
||||
meta: { ignoreAuth: true }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,7 +142,9 @@ export interface IStoreTeaRoomListParams {
|
||||
}
|
||||
|
||||
export function getStoreTeaRoomList(data: IStoreTeaRoomListParams) {
|
||||
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreRoomLists', data)
|
||||
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreRoomLists', data, {
|
||||
meta: { ignoreAuth: true }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,7 +267,9 @@ export interface ITeaRoomPackageParams {
|
||||
}
|
||||
|
||||
export function getTeaRoomPackage(data: ITeaRoomPackageParams) {
|
||||
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreGroupLists', data)
|
||||
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreGroupLists', data, {
|
||||
meta: { ignoreAuth: true }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@ -365,3 +371,17 @@ export function teaRoomRecharge(money: number) {
|
||||
export function getRechargeActivity(data: {store_id: number}) {
|
||||
return http.Post<any>('/api/TeaStore/rechargeLists', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取茶室支付订单金额
|
||||
*/
|
||||
export function getTeaRoomPayOrderAmount(data: {id: number, pay_way: number}) {
|
||||
return http.Post<any>('/api/order/getOrderAmount', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取续订茶室支付订单金额
|
||||
*/
|
||||
export function getRenewTeaRoomPayOrderAmount(data: {id: number, pay_way: number}) {
|
||||
return http.Post<any>('/api/order/getOrderRenewAmount', data)
|
||||
}
|
||||
@ -38,23 +38,25 @@
|
||||
</view>
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">费用明细</view>
|
||||
<view class="collapse">
|
||||
<!-- 茶室费 -->
|
||||
<view class="px-30rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133]">茶室费</view>
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] flex items-center">
|
||||
¥640.00
|
||||
¥{{ order.room_all_price }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="rounded-16rpx py-20rpx">
|
||||
<view class="mb-26rpx">
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133] flex items-center justify-between mb-16rpx">
|
||||
<view>茶室费(¥160元/小时)</view>
|
||||
<view>x4</view>
|
||||
<view>茶室费(¥{{ order.room_price }}元/小时)</view>
|
||||
<view>x{{ order.hours }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 优惠 -->
|
||||
<view class="px-30rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133]">优惠</view>
|
||||
@ -69,7 +71,7 @@
|
||||
</view>
|
||||
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133] flex items-center justify-between mb-16rpx">
|
||||
<view>会员八折</view>
|
||||
<view>会员折扣</view>
|
||||
<view>-¥20</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -79,8 +81,8 @@
|
||||
<wd-gap height="2rpx" bg-color="#F6F7F9"></wd-gap>
|
||||
</view>
|
||||
<view class="mx-60rpx text-30rpx text-[#303133] leading-42rpx flex items-center justify-between mt-30rpx" >
|
||||
<view>实际退款</view>
|
||||
<view>¥698.90</view>
|
||||
<view>实付金额</view>
|
||||
<view>¥{{ order.order_amount }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
@ -267,19 +269,19 @@
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx" v-if="orderStatus !== TeaRoomOrderStatus.Refunded && orderStatus !== TeaRoomOrderStatus.Pending">
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx" v-if="orderStatus !== TeaRoomOrderStatus.Refunded">
|
||||
<!-- 已预约 -->
|
||||
<view class="flex items-center justify-center text-32rpx leading-44rpx leading-90rpx text-center !mt-34rpx" v-if="orderStatus == TeaRoomOrderStatus.Pay">
|
||||
<wd-button custom-class="!text-32rpx !w-630rpx !h-90rpx !bg-[#4C9F44] !rounded-8rpx !text-[#fff]" open-type="share">分享房间给朋友</wd-button>
|
||||
</view>
|
||||
|
||||
<!-- 待付款 -->
|
||||
<!-- <view class="flex items-center justify-between mx-58rpx mt-34rpx" v-if="orderStatus == TeaRoomOrderStatus.Pending">
|
||||
<view class="flex items-center justify-between mx-58rpx mt-34rpx" v-if="orderStatus == TeaRoomOrderStatus.Pending">
|
||||
<view class="flex items-center">
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] mr-16rpx" @click="OrderDetail.handleCancelOrder">取消订单</view>
|
||||
</view>
|
||||
<view class="w-360rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleToPay">立即支付¥{{ order.order_amount }}</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 消费中 -->
|
||||
<view class="flex items-center justify-between mx-58rpx mt-34rpx" v-if="orderStatus == TeaRoomOrderStatus.Consumption">
|
||||
|
||||
@ -325,10 +325,20 @@
|
||||
<view class="text-[#303133]">{{ order.leaf_name }}</view>
|
||||
</view>
|
||||
|
||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||
<view class="text-[#606266] mr-54rpx w-120rpx whitespace-nowrap">茶叶费</view>
|
||||
<view class="text-[#303133]">{{ order.tea_price }}</view>
|
||||
</view>
|
||||
|
||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||
<view class="text-[#606266] mr-54rpx w-120rpx whitespace-nowrap">茶具使用</view>
|
||||
<view class="text-[#303133]">{{ order.is_teacup == 1 ? '茶艺师提供' : '客户自备' }}</view>
|
||||
</view>
|
||||
|
||||
<view class="text-28rpx leading-40rpx flex items-center mt-22rpx">
|
||||
<view class="text-[#606266] mr-54rpx w-120rpx whitespace-nowrap">茶具费</view>
|
||||
<view class="text-[#303133]">{{ order.teacup_price }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-32rpx" v-if="order.is_renewal">
|
||||
<view class="renew-border"></view>
|
||||
@ -580,6 +590,8 @@
|
||||
renew_hour: 0, // 续订小时
|
||||
renew_price: 0, // 续订金额
|
||||
renew_tea_price: 0, // 续订茶叶金额
|
||||
tea_price: 0, // 茶叶费
|
||||
teacup_price: 0, // 茶具费
|
||||
})
|
||||
|
||||
onLoad(async (args) => {
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
</wd-popup>
|
||||
|
||||
<!-- 选择预定时间 -->
|
||||
<booking-time v-model="showBookTimePopup" :day="sevenDay" @selectedTime="Detail.handleChooseReserveTime"></booking-time>
|
||||
<booking-time v-model="showBookTimePopup" :day="sevenDay" :auto-reserve-time="teaRoom?.room?.hours" @selectedTime="Detail.handleChooseReserveTime"></booking-time>
|
||||
|
||||
<view>
|
||||
<navbar :title="isGroupBuying ? '团购套餐' : '预定'" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
@ -90,10 +90,10 @@
|
||||
<view class="text-[#303133] text-26rpx leading-48rpx font-500" v-if="isGroupBuying">{{ teaRoomPackage.description }}</view>
|
||||
<view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售
|
||||
<template v-if="isGroupBuying">
|
||||
{{ teaRoomPackage.sold + '+' }}
|
||||
{{ teaRoomPackage.sold > 100 ? '100+' : teaRoomPackage.sold }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ teaRoom.room?.sold > 10 ? '10+' : teaRoom.room?.sold }}
|
||||
{{ teaRoom.room?.sold > 100 ? '100+' : teaRoom.room?.sold }}
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
@ -545,7 +545,7 @@
|
||||
toast.info('请选择预定时间')
|
||||
return
|
||||
}
|
||||
return false
|
||||
|
||||
isSubmitting.value = true
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
@ -597,9 +597,10 @@ return false
|
||||
|
||||
setTimeout(() => {
|
||||
const name = isGroupBuying.value ? teaRoomPackage.value.title : teaRoom.value.name
|
||||
const money = isGroupBuying.value ? res.order_amount : 0 // 团购套餐支付金额会在创建订单的时候返回
|
||||
|
||||
router.navigateTo(
|
||||
`/pages/cashier/cashier?from=${OrderType.TeaRoomOrder}&orderId=${res.id}&name=${name}&storeId=${storeId.value}&isGroupBuying=${isGroupBuying.value ? 1 : 0}&cmoboId=${id.value || 0}`
|
||||
`/pages/cashier/cashier?from=${OrderType.TeaRoomOrder}&orderId=${res.id}&name=${name}&storeId=${storeId.value}&isGroupBuying=${isGroupBuying.value ? 1 : 0}&cmoboId=${id.value || 0}&money=${money}`
|
||||
)
|
||||
}, 500)
|
||||
} catch (error) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
|
||||
<route lang="jsonc" type="page">{
|
||||
"needLogin": true,
|
||||
//"needLogin": true,
|
||||
"layout": "tabbar",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
|
||||
@ -11,11 +11,11 @@
|
||||
<template>
|
||||
<view class="bg">
|
||||
<view>
|
||||
<navbar title="门店充值" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
<navbar title="平台充值" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
</view>
|
||||
|
||||
<view class="mt-24rpx text-center font-400 text-30rpx leading-42rpx text-[#303133]" v-if="rechargeList.length == 0">
|
||||
当前门店暂无充值活动
|
||||
当前平台暂无充值活动
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
@ -38,27 +38,6 @@
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="mx-30rpx">
|
||||
<view class="mx30rpx">
|
||||
<text class="text-[#303133] font-bold text-30rpx leading-42rpx">不可用优惠券</text>
|
||||
<text class="text-[#606266] font-400 text-28rpx leading-40rpx ml-24rpx">{{ couponList.no_use.length }}张</text>
|
||||
</view>
|
||||
<view class="mt-28rpx radio">
|
||||
<wd-radio-group v-model="checkedId" size="large" checked-color="#4C9F44">
|
||||
<coupon
|
||||
v-for="(item, index) in couponList.no_use"
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
:canUse="false"
|
||||
showChecked
|
||||
couponType="coupon"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="Coupons.handleCheck"
|
||||
:class="index !== couponList.no_use.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -127,7 +106,13 @@
|
||||
* @param id 优惠券ID
|
||||
*/
|
||||
handleCheck: (id: number) => {
|
||||
console.log("🚀 ~ id:", id)
|
||||
// 如果是优惠券的话则是可以取消选择
|
||||
if (checkedId.value === id) {
|
||||
checkedId.value = 0 // 再次点击已选中时取消选择
|
||||
} else {
|
||||
checkedId.value = id
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
{{ item.state == 0 ? '可约' : '工作中' }}
|
||||
</view>
|
||||
<view class="mr-28rpx relative z-2">
|
||||
<wd-img width="200rpx" height="200rpx" :src="item.image"></wd-img>
|
||||
<wd-img width="200rpx" height="200rpx" :src="item.image" mode="aspectFill"></wd-img>
|
||||
</view>
|
||||
<view class="flex-1">
|
||||
<view class="flex items-center">
|
||||
|
||||
@ -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')
|
||||
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}) => {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
</view>
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">选择时间</view>
|
||||
|
||||
<view class="">
|
||||
<view>
|
||||
<view class="booking-time">
|
||||
<wd-tabs v-model="selectedDay" color="#4C9F44" @click="BookingTime.handleChangeTimeTab" :slidable-num="4">
|
||||
<scroll-view scroll-y class="!h-500rpx pb-100rpx">
|
||||
@ -33,11 +33,11 @@
|
||||
</block>
|
||||
</scroll-view>
|
||||
</wd-tabs>
|
||||
<view class="">
|
||||
<view>
|
||||
<view>
|
||||
<wd-gap height="2rpx" bg-color="#E5E5E5"></wd-gap>
|
||||
</view>
|
||||
<view class="">
|
||||
<view>
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center">
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] mr-30rpx" @click="BookingTime.handleResetSelectedTime">重置</view>
|
||||
<view class="w-330rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="BookingTime.handleConfirmSelectedTime">
|
||||
@ -73,6 +73,11 @@
|
||||
type: Object,
|
||||
default: {}
|
||||
},
|
||||
|
||||
autoReserveTime: {
|
||||
type: Number,
|
||||
default: 0 // 最少预定时间,单位小时
|
||||
}
|
||||
})
|
||||
|
||||
// 初始化时间
|
||||
@ -88,6 +93,8 @@
|
||||
const selectedTime = ref<Array<{ date: string, time: string, timestamp: number }>>([])
|
||||
const countSelectedTime = ref<number>(0)
|
||||
const selectTimeIndex = ref<number>(0) // 选择的时间tab索引
|
||||
// 记录第一次点击的锚点,用于后续范围选择
|
||||
const firstAnchor = ref<{ date: string, time: string, timestamp: number } | null>(null)
|
||||
|
||||
const BookingTime = {
|
||||
/**
|
||||
@ -99,38 +106,57 @@
|
||||
* @param display 当前选择的日期展示 "12/20周六"
|
||||
*/
|
||||
handleSelectTime: (time: string, timestamp: number, timeSlots: any[], date: string, display: string) => {
|
||||
// 获取当前tab的日期
|
||||
const currentDate = props.day.time[selectTimeIndex.value].date
|
||||
const idx = selectedTime.value.findIndex(t => t.date === currentDate && t.time === time)
|
||||
if (selectedTime.value.length === 0 || selectedTime.value.length > 1) {
|
||||
// 第一次点击或已选2个及以上,重置为只选当前
|
||||
selectedTime.value = [{ date: currentDate, time, timestamp }]
|
||||
} else if (selectedTime.value.length === 1) {
|
||||
// 第二次点击,做范围选择
|
||||
const first = selectedTime.value[0]
|
||||
const second = { date: currentDate, time, timestamp }
|
||||
// 获取所有可选时间段(含跨天)
|
||||
let allSlots = []
|
||||
props.day.time.forEach(dayItem => {
|
||||
dayItem.time_slots.forEach(slot => {
|
||||
// 汇总所有可选时间段(含跨天),只包含未禁用的slot
|
||||
const allSlots: Array<{ date: string, time: string, timestamp: number }> = []
|
||||
props.day.time.forEach((dayItem: any) => {
|
||||
dayItem.time_slots.forEach((slot: any) => {
|
||||
if (slot.disabled == 0) {
|
||||
allSlots.push({ date: dayItem.date, time: slot.start_time, timestamp: slot.timestamp })
|
||||
}
|
||||
})
|
||||
})
|
||||
// 按 timestamp 排序
|
||||
allSlots = allSlots.sort((a, b) => a.timestamp - b.timestamp)
|
||||
// 找到 first 和 second 的索引
|
||||
allSlots.sort((a, b) => a.timestamp - b.timestamp)
|
||||
|
||||
const currentSlot = { date: currentDate, time, timestamp }
|
||||
|
||||
// 没有锚点:第一次点击 => 自动补全 autoReserveTime 小时的连续时间段
|
||||
if (!firstAnchor.value) {
|
||||
firstAnchor.value = currentSlot
|
||||
const startIdx = allSlots.findIndex(t => t.date === currentSlot.date && t.time === currentSlot.time)
|
||||
// 首个时间点本身不计入小时数,所以需要补足的 slot 数 = autoReserveTime*2(每半小时一个)
|
||||
// 再加上第一个时间点,共 autoReserveTime*2 + 1 个时间块
|
||||
const totalSlots = Math.max(1, (props.autoReserveTime ?? 2) * 2 + 1)
|
||||
const autoSelected: Array<{ date: string, time: string, timestamp: number }> = []
|
||||
if (startIdx > -1) {
|
||||
autoSelected.push(allSlots[startIdx])
|
||||
for (let i = 1; i < totalSlots && startIdx + i < allSlots.length; i++) {
|
||||
// 必须连续(30分钟一格)
|
||||
if (allSlots[startIdx + i].timestamp - allSlots[startIdx + i - 1].timestamp === 1800) {
|
||||
autoSelected.push(allSlots[startIdx + i])
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedTime.value = autoSelected.length ? autoSelected : [currentSlot]
|
||||
} else {
|
||||
// 已有锚点:第二次点击 => 以锚点和当前点击为范围,支持继续延申小时数量
|
||||
const first = firstAnchor.value
|
||||
const second = currentSlot
|
||||
const idx1 = allSlots.findIndex(t => t.date === first.date && t.time === first.time)
|
||||
const idx2 = allSlots.findIndex(t => t.date === second.date && t.time === second.time)
|
||||
if (idx1 > -1 && idx2 > -1) {
|
||||
const [start, end] = idx1 < idx2 ? [idx1, idx2] : [idx2, idx1]
|
||||
selectedTime.value = allSlots.slice(start, end + 1)
|
||||
} else {
|
||||
// 找不到则只选当前
|
||||
selectedTime.value = [second]
|
||||
// 找不到其一,退化为只选当前
|
||||
selectedTime.value = [currentSlot]
|
||||
}
|
||||
// 完成一次范围选择后,清除锚点,下一次点击重新开始逻辑
|
||||
firstAnchor.value = null
|
||||
}
|
||||
|
||||
countSelectedTime.value = BookingTime.handleCalcContinuousHours(selectedTime.value.map(t => t.timestamp))
|
||||
},
|
||||
|
||||
@ -210,6 +236,7 @@
|
||||
handleResetSelectedTime: () => {
|
||||
selectedTime.value = []
|
||||
countSelectedTime.value = 0
|
||||
firstAnchor.value = null
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -147,8 +147,8 @@
|
||||
|
||||
<template v-if="order.order_status === TeaRoomOrderStatus.Pending">
|
||||
<view class="text-center flex items-center text-28rpx mt-28rpx justify-end">
|
||||
<!-- <view class="w-178rpx h-70rpx rounded-8rpx border-[2rpx] border-[#9CA3AF] text-[#303133] mr-28rpx flex items-center justify-center"
|
||||
@click="ComboCard.handleCancelOrder(OrderSource.TeaRoom)">取消订单</view> -->
|
||||
<view class="w-178rpx h-70rpx rounded-8rpx border-[2rpx] border-[#9CA3AF] text-[#303133] mr-28rpx flex items-center justify-center"
|
||||
@click="ComboCard.handleCancelOrder(OrderSource.TeaRoom)">取消订单</view>
|
||||
<view class="w-178rpx h-70rpx rounded-8rpx border-[2rpx] border-[#4C9F44] text-[#4C9F44] flex items-center justify-center"
|
||||
@click="ComboCard.handleToPayOrder(OrderSource.TeaRoom)">去支付</view>
|
||||
</view>
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
<price-format color="#FF5951" :first-size="34" :second-size="26" :subscript-size="26" :price="item.price" weight="500"></price-format>
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx mt-8rpx">/小时</view>
|
||||
</view>
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx mt-8rpx">已售 {{ item.sold > 10 ? '10+' : item.sold }}</view>
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx mt-8rpx">已售 {{ item.sold > 100 ? '100+' : item.sold }}</view>
|
||||
</view>
|
||||
|
||||
<view class="absolute top-50rpx right-0" v-if="isUseCoupon">
|
||||
@ -84,7 +84,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="absolute bottom-0 right-0">
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx">已售 {{ item.sold + '+' }}</view>
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx">已售 {{ item.sold > 100 ? '100+' : item.sold }}</view>
|
||||
<view class="w-104rpx h-52rpx mt-16rpx text-26rpx font-400 text-[#4C9F44] leading-52rpx text-center border-[2rpx] border-[#4C9F44] rounded-10rpx">
|
||||
抢购
|
||||
</view>
|
||||
|
||||
@ -21,7 +21,7 @@ export function createApp() {
|
||||
app.use(requestInterceptor)
|
||||
|
||||
app.use(VueQueryPlugin)
|
||||
app.provide('OSS', 'https://shchazhi.oss-cn-hangzhou.aliyuncs.com/fronted/')
|
||||
app.provide('OSS', 'https://chaz.oss-cn-shanghai.aliyuncs.com/fronted/')
|
||||
app.provide('navbarHeight', getNavBarHeight())
|
||||
app.provide('capsuleOffset', getCapsuleOffset())
|
||||
|
||||
|
||||
@ -172,7 +172,6 @@
|
||||
{
|
||||
"path": "pages/webview/webview",
|
||||
"type": "page",
|
||||
"layout": "tabbar",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
@ -309,7 +308,6 @@
|
||||
{
|
||||
"path": "tea-room/room",
|
||||
"type": "page",
|
||||
"needLogin": true,
|
||||
"layout": "tabbar",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
|
||||
@ -17,12 +17,7 @@
|
||||
<view class="mt-56rpx text-center">
|
||||
<view class="text-28rpx leading-40rpx text-#606266">{{ title }}</view>
|
||||
<view class="mt-24rpx">
|
||||
<!-- 是否是一键续订 -->
|
||||
<template v-if="renew">
|
||||
<price-format color="#303133" :first-size="44" :second-size="44" :subscript-size="28" :price="renewPrice"></price-format>
|
||||
</template>
|
||||
<!-- 正常订单金额 -->
|
||||
<template v-if="!renew">
|
||||
<template>
|
||||
<price-format color="#303133" :first-size="44" :second-size="44" :subscript-size="28" :price="money"></price-format>
|
||||
</template>
|
||||
</view>
|
||||
@ -52,7 +47,7 @@
|
||||
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
|
||||
import { prePay, balancePay, newPrePay } from '@/api/pay'
|
||||
import type {IUserInfoVo } from '@/api/types/login'
|
||||
import { getTeaRoomBalance, getTeaRoomOrderDetail, getTeaRoomPackageOrderDetail, getTeaRoomPackageDetail } from '@/api/tea-room'
|
||||
import { getTeaRoomBalance, getTeaRoomOrderDetail, getTeaRoomPackageOrderDetail, getTeaRoomPackageDetail, getTeaRoomPayOrderAmount, getRenewTeaRoomPayOrderAmount } from '@/api/tea-room'
|
||||
import Pay from '@/components/Pay.vue'
|
||||
import { PayValue, PayValueMap, PayOrderType, PayOrderSource } from '@/utils/pay'
|
||||
import { toast } from '@/utils/toast'
|
||||
@ -114,9 +109,6 @@
|
||||
|
||||
// 一键续订支付
|
||||
const renew = ref<string>('')
|
||||
const renewPrice = ref<number>(0)
|
||||
|
||||
|
||||
|
||||
// 购买套餐支付
|
||||
const isGroupBuying = ref<number>(0)
|
||||
@ -143,7 +135,6 @@
|
||||
|
||||
// 一键续订
|
||||
renew.value = args?.renew || ''
|
||||
renewPrice.value = Number(args?.renewPrice) || 0
|
||||
|
||||
// 获取门店余额
|
||||
if (args.storeId) {
|
||||
@ -185,10 +176,13 @@
|
||||
// 获取订单详情
|
||||
if (isGroupBuying.value == 0) {
|
||||
// 茶室预约订单走这个接口,续订的不需要
|
||||
if (renew.value) return
|
||||
Cashier.handleGetOrderDetails()
|
||||
if (renew.value) {
|
||||
Cashier.handleGetRenewOrderDetails()
|
||||
} else {
|
||||
Cashier.handleGetRoomPackageDetails()
|
||||
Cashier.handleGetOrderDetails()
|
||||
}
|
||||
} else {
|
||||
Cashier.handleGetRoomPackageDetails(args.money)
|
||||
}
|
||||
} else if (args.from == OrderType.TeaSpecialist && args.orderId) {
|
||||
// 获取预定茶艺师订单详情
|
||||
@ -207,7 +201,6 @@
|
||||
})
|
||||
|
||||
const Cashier = {
|
||||
|
||||
/**获取茶艺师订单详情
|
||||
*
|
||||
* @param id
|
||||
@ -230,24 +223,42 @@
|
||||
*/
|
||||
handleGetOrderDetails: async () => {
|
||||
// 获取订单详情接口
|
||||
const res = await getTeaRoomOrderDetail({
|
||||
// const res = await getTeaRoomOrderDetail({
|
||||
// id: orderId.value,
|
||||
// latitude: uni.getStorageSync('latitude') || import.meta.env.VITE_DEFAULT_LATITUDE,
|
||||
// longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE,
|
||||
// })
|
||||
const res = await getTeaRoomPayOrderAmount({
|
||||
id: orderId.value,
|
||||
latitude: uni.getStorageSync('latitude') || import.meta.env.VITE_DEFAULT_LATITUDE,
|
||||
longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE,
|
||||
pay_way: pay.value || PayValue.PlatformBalance
|
||||
})
|
||||
console.log("🚀 ~ getTeaRoomPayOrderAmount res:", res)
|
||||
order.value = res
|
||||
money.value = Number(res.details.order_amount)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取茶室套餐订单详情
|
||||
* 获取茶室续订订单详情
|
||||
*/
|
||||
handleGetRenewOrderDetails: async () => {
|
||||
const res = await getRenewTeaRoomPayOrderAmount({
|
||||
id: orderId.value,
|
||||
pay_way: pay.value || PayValue.PlatformBalance
|
||||
})
|
||||
console.log("🚀 ~ getRenewTeaRoomPayOrderAmount res:", res)
|
||||
order.value = res
|
||||
money.value = Number(res.details.order_amount)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取茶室套餐订单详情(改为args传过来金额)
|
||||
* @param value
|
||||
*/
|
||||
handleGetRoomPackageDetails: async () => {
|
||||
const res = await getTeaRoomPackageDetail({
|
||||
id: comboId.value
|
||||
})
|
||||
money.value = Number(res.details.discount_price)
|
||||
handleGetRoomPackageDetails: async (m: number) => {
|
||||
// const res = await getTeaRoomPackageDetail({
|
||||
// id: comboId.value
|
||||
// })
|
||||
money.value = m
|
||||
},
|
||||
|
||||
/**
|
||||
@ -256,6 +267,17 @@
|
||||
*/
|
||||
handleGetPayValue: (value: number) => {
|
||||
pay.value = value
|
||||
|
||||
// 茶室订单:为了获取不同支付方式下的订单金额
|
||||
if (from.value == OrderType.TeaRoomOrder && orderId.value && isGroupBuying.value == 0) {
|
||||
if (renew.value) {
|
||||
// 续订订单
|
||||
Cashier.handleGetRenewOrderDetails()
|
||||
} else {
|
||||
// 正常茶室订单
|
||||
Cashier.handleGetOrderDetails()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<view class="mt-52rpx mx-30rpx">
|
||||
<view class="text-[#333] leading-42rpx text-30rpx font-bold">当前定位</view>
|
||||
<view class="mt-40rpx">
|
||||
<view class="bg-[#F8F9FA] rounded-28rpx w-162rpx h-56rpx text-[#606266] flex items-center justify-center" @click="City.handleSetCurretCity">
|
||||
<view class="bg-[#F8F9FA] rounded-28rpx w-162rpx h-56rpx text-[#606266] flex items-center justify-center">
|
||||
<wd-img width="28rpx" height="28rpx" :src="`${OSS}icon/icon_location2.png`"></wd-img>
|
||||
<view class="text-26rpx text-[#606266] leading-36rpx">{{ city || LOCATION_DEFAULT_CITY }}</view>
|
||||
</view>
|
||||
@ -82,15 +82,6 @@
|
||||
openCityList.value = res.list
|
||||
},
|
||||
|
||||
/**
|
||||
* 将缓存设置为当前定位城市
|
||||
* @param item
|
||||
*/
|
||||
handleSetCurretCity: () => {
|
||||
const params = uni.getStorageSync(LOCATION_CURRENT)
|
||||
City.handleChooseCity(params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择城市
|
||||
*/
|
||||
|
||||
@ -363,6 +363,7 @@
|
||||
handleToGetCoupon: async () => {
|
||||
await claimIndexCoupon()
|
||||
showCoupon.value = false
|
||||
router.navigateTo('/bundle_b/pages/tea-specialist/list')
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -78,7 +78,10 @@
|
||||
})
|
||||
|
||||
const Login = {
|
||||
// 获取手机号
|
||||
/**
|
||||
* 登录
|
||||
* @param e
|
||||
*/
|
||||
handleLogin: async (e: object) => {
|
||||
if (!agree.value) {
|
||||
toast.info('请同意服务协议和隐私政策')
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
|
||||
<route lang="jsonc" type="page">{
|
||||
"layout": "tabbar",
|
||||
"style": {
|
||||
// 'custom' 表示开启自定义导航栏,默认 'default'
|
||||
"navigationStyle": "custom"
|
||||
|
||||
@ -11,7 +11,9 @@ import {
|
||||
} from '@/api/login'
|
||||
import { toast } from '@/utils/toast'
|
||||
|
||||
const defaultAvatar = 'https://shchazhi.oss-cn-hangzhou.aliyuncs.com/fronted/icon/icon_avatar.png'
|
||||
const OSS = inject('OSS')
|
||||
|
||||
const defaultAvatar = `${OSS}icon/icon_avatar.png`
|
||||
|
||||
// 初始化状态
|
||||
const userInfoState: IUserInfoVo = {
|
||||
|
||||
@ -79,4 +79,4 @@ $uni-font-size-paragraph: 15px;
|
||||
/* chazhi 自定义 */
|
||||
$cz-page-background: #F6F7F9; // 页面背景色
|
||||
$cz-theme-color: #4C9F44; // 页面背景色
|
||||
$OSS: 'https://shchazhi.oss-cn-hangzhou.aliyuncs.com/fronted/';
|
||||
$OSS: 'https://chaz.oss-cn-shanghai.aliyuncs.com/fronted/';
|
||||
|
||||
Reference in New Issue
Block a user