完善预定页面

This commit is contained in:
wangxiaowei
2025-10-25 10:34:55 +08:00
parent b2f658f3c0
commit 68b075ce59
13 changed files with 407 additions and 61 deletions

View File

@ -1,5 +1,5 @@
import { http } from '@/http/alova'
import type { ITeaSpecialistDetailsResult } from '@/api/types/tea'
import type { ITeaSpecialistDetailsResult, ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
/**
* 获取茶艺师详情
@ -39,4 +39,36 @@ export function collectTeaSpecialist(data: ICollectTeaSpecialistParams) {
*/
export function getTeaSpecialistRewardAmounts() {
return http.Post('/api/Teamaster/teamasterTipAmount')
}
/**
* 获取门店地址
*/
export interface ITeaHouseListParams {
page: number
size: number
latitude: number
longitude: number
search: string
}
export function getTeaHouseList(data: ITeaHouseListParams) {
return http.Post('/api/Store/storeList',
data
)
}
/**
* 获取未来7天时间
*/
export function getNext7Days() {
return http.Post<ITeaSpecialistFuture7DaysResult>('/api/Common/get7Time')
}
/**
* 获取茶叶类型列表
*/
export function getTeaTypeList() {
return http.Post('/api/Teamaster/teaType')
}

View File

@ -37,3 +37,23 @@ export interface ITeaSpecialistRewardAmountsResult {
status: number
tip_price: number
}
/**
* 茶艺师门店列表
*/
export interface ITeaHouseListResult {
count: Number
list: Array<any>
more: Number
page: string
size: string
}
/**
* 获取未来7天时间列表
*/
export interface ITeaSpecialistFuture7DaysResult {
minimum_time: number
time: Array<any>
}

View File

@ -27,6 +27,7 @@ export function getUserAddress() {
* 用户添加地址
*/
export interface IAddUserAddressParams {
id: number
contact: string
telephone: string
province: string

View File

@ -7,24 +7,24 @@
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">选择时间</view>
<view class="">
<view class="booking-time ">
<wd-tabs v-model="selectedDay" color="#4C9F44">
<block v-for="item in days" :key="item">
<view class="booking-time">
<wd-tabs v-model="selectedDay" color="#4C9F44" @click="bookingTime.handleChangeTimeTab">
<block v-for="item in day.time" :key="item">
<scroll-view scroll-y>
<wd-tab :title="`${item}`" :name="item">
<wd-tab :title="`${item.display}`" :name="item.display">
<view class="">
<view class="!h-500rpx mt-30rpx">
<view class="grid grid-cols-4 gap-x-20rpx gap-y-20rpx mx-30rpx">
<view v-for="item in timeList" :key="item.time"
<view v-for="item2 in item.time_slots" :key="item2.start_time"
class="h-72rpx rounded-16rpx flex items-center justify-center text-28rpx leading-40rpx"
:class="[
item.disabled
item2.disabled == 0
? 'bg-[#F7F7F7] text-[#C9C9C9]' // 禁用高亮
: selectedTime.includes(item.time)
: selectedTime.includes(item2.start_time)
? 'bg-[#F1F8F0] text-[#4C9F44]' // 选中高亮
: 'bg-[#F7F7F7] text-[#303133]', // 可选高亮
]" @click="!item.disabled && bookingTime.handleSelectTime(item.time)">
{{ item.time }}
]" @click="item2.disabled == 1 && bookingTime.handleSelectTime(item2.start_time)">
{{ item2.start_time }}
</view>
</view>
</view>
@ -55,6 +55,8 @@
</template>
<script lang="ts" setup name="BookingTime">
import {toast} from '@/utils/toast'
const OSS = inject('OSS')
/**
@ -67,6 +69,10 @@
type: Boolean,
default: false
},
day: {
type: Object,
default: {}
},
// ...其它props
})
@ -105,6 +111,7 @@
result.push(`${month}/${date}${week}`)
}
days.value = result
console.log("🚀 ~ days.value:", days.value)
},
// 选择的时间高亮显示
@ -117,28 +124,48 @@
}
// 计算时长
countSelectedTime.value = selectedTime.value.length * 0.5
countSelectedTime.value = selectedTime.value.length * 1
},
// 确认选择的时间
handleConfirmSelectedTime: () => {
console.log('确认选择的时间:', selectedDay.value, selectedTime.value)
if (selectedTime.value.length === 0) {
toast.info('请选择时间')
return
}
if (selectedTime.value.length < props.day.minimum_time) {
toast.info(props.day.minimum_time + '小时起订')
return
}
const data = [
selectedDay.value,
selectedTime.value
]
emit('selectedTime', data)
showPopup.value = false
},
// 切换时间tab的时候把之前选中的时间重置
handleChangeTimeTab: () => {
selectedTime.value = []
countSelectedTime.value = 0
},
// 重置选择的时间
resetSelectedTime: () => {
selectedTime.value = []
},
}
const showPopup = computed({
get: () => props.modelValue,
set: (val: boolean) => emit('update:modelValue', val)
})
const emit = defineEmits(['update:modelValue'])
const emit = defineEmits(['update:modelValue', 'selectedTime'])
</script>
<script lang="ts">

View File

@ -27,7 +27,7 @@ export const getUrlCode = (): { [key: string]: string | undefined } => {
*/
export async function snsapiBaseAuthorize() {
// TODO 测试代码
wxSnsapiBaseLogin({code: '0617Y41007CraV1LKJ300cvi1P27Y41I'}).then((res: IUserInfoVo) => {
wxSnsapiBaseLogin({code: '001PFd1w3oKNQ53W681w3U6h8O0PFd13'}).then((res: IUserInfoVo) => {
console.log("登录成功 ~ snsapiBaseAuthorize ~ res:", res)
// 映射 IUserLogin 到 IUserInfoVo
useUserStore().setUserInfo(res)

View File

@ -106,11 +106,6 @@ const alovaInstance = createAlova({
return response
}
if (statusCode === ResultEnum.Unauthorized) {
useUserStore().removeUserInfo()
uni.navigateTo({ url: '/pages/login/mobile' })
}
// 处理 HTTP 状态码错误
// if (statusCode !== 200) {
// const errorMessage = ShowMessage(statusCode) || `HTTP请求错误[${statusCode}]`
@ -122,6 +117,8 @@ const alovaInstance = createAlova({
// 处理业务逻辑错误
const { code, msg, data } = rawData as IResponse
if (code === ResultEnum.Unauthorized) {
useUserStore().removeUserInfo()
if (config.meta?.toast !== false) {
toast.info(msg)
router.switchTab('/pages/my/my')
@ -131,7 +128,7 @@ const alovaInstance = createAlova({
if (code === ResultEnum.Success) {
if (config.meta?.toast !== false && msg) {
toast.info(msg)
if (msg !== '查询成功') toast.info(msg)
}
}

View File

@ -89,6 +89,14 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/address/store",
"type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/cashier/cashier",
"type": "page",

View File

@ -39,7 +39,7 @@
<view class="flex items-center mx-36rpx">
<view class="text-30rpx leading-42rpx text-#303133 mr-60rpx w-100rpx">省市区</view>
<view class="add-address">
<wd-col-picker v-model="address" :columns="area" :column-change="columnChange" @confirm="Add.handleConfirmAddress" placeholder="请选择省市区"></wd-col-picker>
<wd-col-picker v-model="address" :columns="area" :column-change="columnChange" auto-complete @confirm="Add.handleConfirmAddress" placeholder="请选择省市区"> </wd-col-picker>
</view>
</view>
<view class="h-2rpx bg-#F2F2F2"></view>
@ -74,7 +74,7 @@
<view class="flex items-center justify-between mx-30rpx" v-if="addressId > 0">
<view class="w-330rpx h-90rpx leading-90rpx text-center bg-[#F6F7F8] text-#303133 rounded-8rpx mr-30rpx" @click="Add.handleDeleteAddress">删除地址</view>
<view class="w-330rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] text-#FFFFFF rounded-8rpx">确定</view>
<view class="w-330rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] text-#FFFFFF rounded-8rpx" @click="Add.handleAddAddress">确定</view>
</view>
</view>
@ -85,7 +85,8 @@
<script lang="ts" setup>
import { useMessage } from 'wot-design-uni'
import { addUserAddress, IAddUserAddressParams, deleteUserAddress, userAddressDetails } from '@/api/user'
import { useColPickerData } from '@/hooks/useColPickerData'
import { addUserAddress, IAddUserAddressParams, deleteUserAddress, userAddressDetails, editUserAddress } from '@/api/user'
import { toast } from '@/utils/toast'
import { mobile } from '@/utils/test'
import { router } from '@/utils/tools'
@ -112,22 +113,18 @@
district: '',
district_id: 0,
address: '',
is_default: 0
is_default: 0,
id: 0
})
// 省市区数据
const { colPickerData, findChildrenByCode } = useColPickerData()
const address = ref<string[]>([])
const area = ref<any[]>([
colPickerData.map((item) => {
return {
value: item.value,
label: item.text
}
})
])
const columnChange = ({ selectedItem, resolve, finish }) => {
const areaData = findChildrenByCode(colPickerData, selectedItem.value)
const area = ref<any[]>([])
const columnChange = async ({ selectedItem, resolve, finish }) => {
await Add.handleSleep(0)
const areaData = findChildrenByCode(colPickerData, selectedItem.value)
if (areaData && areaData.length) {
resolve(
areaData.map((item) => {
@ -174,6 +171,7 @@
form.telephone = res.address_details.telephone
form.province = res.address_details.province
form.province_id = res.address_details.province_id
console.log("🚀 ~ form.province_id :", form.province_id )
form.city = res.address_details.city
form.city_id = res.address_details.city_id
form.district = res.address_details.district
@ -181,7 +179,12 @@
form.address = res.address_details.address
form.is_default = res.address_details.is_default
isDefaultAddress.value = res.address_details.is_default === 1 ? true : false
address.value = [res.address_details.province, res.address_details.city, res.address_details.district]
address.value = [
String(res.address_details.province_id),
String(res.address_details.city_id),
String(res.address_details.district_id)
]
console.log("🚀 ~ address.value:", address.value)
},
// 删除地址
@ -238,10 +241,24 @@
form.is_default = isDefaultAddress.value ? 1 : 0
await addUserAddress(form)
if (addressId.value > 0 ) {
// 编辑地址
form.id = addressId.value
await editUserAddress(form)
} else {
await addUserAddress(form)
}
uni.$emit('refreshAddressList')
router.navigateBack(500)
},
handleSleep: async (second: number = 1) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(true)
}, 1000 * second)
})
}
}
</script>

View File

@ -26,7 +26,7 @@
<!-- 地址列表 -->
<view class="mx-30rpx mt-20rpx" v-if="addressList.length > 0">
<view class="bg-#fff rounded-16rpx px-30rpx py-36rpx flex items-center mb-20rpx" v-for="(item, index) in addressList" :key="index">
<view>
<view @click="Address.handleChooseAddress(item)">
<view class="flex items-center">
<view class="mr-10rpx">
<wd-tag color="#4C9F44" bg-color="#F3F3F3" custom-class="!rounded-4rpx !px-10rpx" v-if="item.is_default">默认</wd-tag>
@ -56,10 +56,17 @@
const OSS = inject('OSS')
const from = ref<string>('')
// 地址列表
const addressList = ref<IUserAddressListResult[]>([])
onLoad(() => {
onLoad((args) => {
if (args.from) {
from.value = args.from as string
}
// 监听地址列表刷新
uni.$on('refreshAddressList', () => {
Address.handleInit()
})
@ -87,6 +94,14 @@
// 编辑地址
handleEditAddress: (id: number) => {
router.navigateTo(`/pages/address/add?id=${id}`)
},
// 选择地址
handleChooseAddress(item: IUserAddressListResult) {
if (from.value === 'reserve') {
uni.$emit('chooseAddress', item)
uni.navigateBack()
}
}
}
</script>

124
src/pages/address/store.vue Normal file
View File

@ -0,0 +1,124 @@
<route lang="jsonc" type="page">
{
"layout": "default",
"style": {
"navigationStyle": "custom"
}
}
</route>
<template>
<view class="">
<view>
<navbar title="门店列表" custom-class='!bg-[#fff]' :leftArrow="false"></navbar>
</view>
<view class="search-box relative">
<wd-search placeholder="门店名称" cancel-txt="搜索" placeholder-left hide-cancel custom-input-class="!h-72rpx" v-model="storeName" >
</wd-search>
<view
class="absolute top-1/2 -translate-y-1/2 right-34rpx w-142rpx h-64rpx leading-64rpx text-center rounded-32rpx bg-#4C9F44 text-#fff font-400 text-32rpx"
@click="Store.handleSearch">
搜索
</view>
</view>
<view class="mt-40rpx">
<mescroll-body @init="mescrollInit" @down="downCallback" @up="Store.upCallback" :up="upOption">
<view class="mx-56rpx" v-for="(item, index) in list" :key="index" @click="Store.handleChooseStore(item)">
<view class="flex items-center justify-between mb-66rpx">
<view class="mr-32rpx">
<wd-img width="80rpx" height='80rpx' :src="`${OSS}icon/icon_location3.png`"></wd-img>
</view>
<view class="flex-1">
<view>{{ item.name }}</view>
<view class="text-28rpx leading-40rpx text-[#909399] flex items-center mt-10rpx">
<view class="w-136rpx line-1">距您{{item.distance}}km</view>
<view>
<wd-divider vertical />
</view>
<view class="w-300rpx line-1">{{ item.address }}</view>
</view>
</view>
</view>
</view>
</mescroll-body>
</view>
</view>
</template>
<script lang="ts" setup>
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
import type { ITeaHouseListResult } from '@/api/types/tea'
import { router } from '@/utils/tools'
import { getTeaHouseList } from '@/api/tea'
const OSS = inject('OSS')
// 来自哪个页面
const from = ref<string>('')
// 门店列表
const list = ref<Array<any>>([]) // 茶艺师列表
// 分页相关
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
const storeName = ref<string>('') // 搜索的门店名称
const upOption = {
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
}
onLoad((args) => {
if (args.from) {
from.value = args.from as string
}
})
onUnload(() => {
uni.$off('refreshAddressList')
})
const Store = {
// 搜索
handleSearch: () => {
list.value = []
getMescroll().resetUpScroll()
},
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
upCallback: (mescroll) => {
const filter = {
page: mescroll.num,
size: mescroll.size,
latitude: uni.getStorageSync('latitude'),
longitude: uni.getStorageSync('longitude'),
search: storeName.value
}
getTeaHouseList(filter).then((res: ITeaHouseListResult) => {
const curPageData = res.list || [] // 当前页数据
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
list.value = list.value.concat(curPageData) //追加新数据
mescroll.endSuccess(curPageData.length, Boolean(res.more))
}).catch(() => {
mescroll.endErr() // 请求失败, 结束加载
})
},
// 选择门店
handleChooseStore: (item: ITeaHouseListResult) => {
if (from.value === 'reserve') {
uni.$emit('chooseTeaHouse', item)
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #fff;
}
</style>

View File

@ -167,6 +167,16 @@
</view>
<view class="h-20rpx bg-#F6F7F9 mt-42rpx mb-40rpx"></view>
<view class="content-tab">
<wd-tabs v-model="tab">
<block v-for="item in tabList" :key="item">
<wd-tab :title="item.name">
<view class="content">内容{{ item}}</view>
</wd-tab>
</block>
</wd-tabs>
</view>
<!-- 费用说明 -->
<view class="mx-30rpx mt-44rpx">
@ -285,6 +295,15 @@
const OSS = inject('OSS')
// tab
const tab = ref<number>(0)
const tabList = ref<Array<{type: number, name: string}>>([
{type: 1, name: '费用说明'},
{type: 2, name: '项目介绍'},
{type: 3, name: '禁忌说明'},
{type: 4, name: '下单须知'},
])
// 用户信息
const userInfo = ref<IUserInfoVo>(null)
@ -447,4 +466,20 @@
page {
background: $cz-page-background;
}
.content-tab {
:deep() {
.wd-tabs__line {
background-color: #006C2D !important;
}
.wd-tabs__nav-item {
color: #303133 !important;
}
.wd-tabs__nav-item.is-active {
color: #006C2D !important;
}
}
}
</style>

View File

@ -179,6 +179,10 @@
}
const latitude = ref<number>(import.meta.env.VITE_DEFAULT_LATITUDE) // 纬度
const longitude = ref<number>(import.meta.env.VITE_DEFAULT_LONGITUDE) // 经度
// 存储经纬度
uni.setStorageSync('latitude', latitude.value)
uni.setStorageSync('longitude', longitude.value)
const defaultCity = ref<string>(import.meta.env.VITE_DEFAULT_ADDRESS) // 默认城市
const list = ref<Array<any>>([]) // 茶艺师列表
const teaSpecialistName = ref<string>('') // 茶艺师名称
@ -186,10 +190,16 @@
const cityValue = ref<string>('')
onLoad(async () => {
// 授权获取地址
await wxGetLocation((res) => {
latitude.value = res.latitude
longitude.value = res.longitude
// 授权后存储经纬度
uni.setStorageSync('latitude', latitude.value)
uni.setStorageSync('longitude', longitude.value)
Index.handleSearch()
})

View File

@ -8,7 +8,7 @@
<template>
<view class="pb-180rpx">
<!-- 预定时间 -->
<wd-popup v-model="showReservePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
<!-- <wd-popup v-model="showReservePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
<view class="relative">
<view class="absolute top-18rpx right-30rpx" @click="showReservePopup = false">
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
@ -59,7 +59,7 @@
<view class='bg-[#4C9F44] text-[#fff] rounded-8rpx h-90rpx leading-90rpx w-[50%]' @click="TeaRoom.handleConfirmHour">确定({{ totalHour }}小时)</view>
</view>
</view>
</wd-popup>
</wd-popup> -->
<!-- 费用明细 -->
<wd-popup v-model="showCostPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" @close="showCostPopup = false" position="bottom">
@ -136,7 +136,7 @@
</wd-popup>
<!-- 选择门店 -->
<wd-popup v-model="showTeaHousePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
<!-- <wd-popup v-model="showTeaHousePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
<view class="relative">
<view class="absolute top-18rpx right-30rpx" @click="showTeaHousePopup = false">
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
@ -162,7 +162,7 @@
</view>
</scroll-view>
</view>
</wd-popup>
</wd-popup> -->
<!-- 茶艺服务 -->
<wd-popup v-model="showTeaServicePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
@ -213,7 +213,7 @@
<wd-radio-group v-model="teaUsageValue" shape="dot" checked-color="#4C9F44" inline>
<block v-for="(item, index) in teaUsageList" :key="index">
<wd-radio :value="item.type">
<view class="text-[#303133] text-26rpx leading-36rpx">{{item.name}}</view>
<view class="text-[#303133] text-26rpx leading-36rpx mt-2rpx">{{item.name}}</view>
</wd-radio>
</block>
</wd-radio-group>
@ -235,7 +235,7 @@
<view class="flex items-center">
<view class="w-178rpx h-70rpx leading-70rpx text-center bg-#F6F7F8 text-#303133 rounded-8rpx mr-20rpx">重置</view>
<view class="w-178rpx h-70rpx leading-70rpx text-center bg-#4C9F44 text-#fff rounded-8rpx">重置</view>
<view class="w-178rpx h-70rpx leading-70rpx text-center bg-#4C9F44 text-#fff rounded-8rpx">确定</view>
</view>
</view>
</view>
@ -243,6 +243,9 @@
</view>
</wd-popup>
<!-- 选择预定时间 -->
<booking-time v-model="showBookTimePopup" :day="sevenDay" @selectedTime="TeaRoom.handleChooseReserveTime"></booking-time>
<view>
<navbar title="预约茶茶艺师" :leftArrow="false"></navbar>
</view>
@ -275,7 +278,7 @@
<wd-radio-group v-model="serviceTypeValue" shape="dot" checked-color="#4C9F44" inline>
<block v-for="(item, index) in serviceType" :key="index">
<wd-radio :value="item.type">
<view class="text-[#303133] text-26rpx leading-36rpx">{{item.name}}</view>
<view class="text-[#303133] text-26rpx leading-36rpx mt-4rpx">{{item.name}}</view>
</wd-radio>
</block>
</wd-radio-group>
@ -283,7 +286,7 @@
</view>
<!-- 预定门店 -->
<view class="flex items-center justify-between mt-48rpx" v-if="serviceTypeValue == 1" @click="showTeaHousePopup = true">
<view class="flex items-center justify-between mt-48rpx" v-if="serviceTypeValue == 1" @click="TeaRoom.handleToSChooseStore">
<view class="text-28rpx leading-40rpx">预定店</view>
<view class="flex items-center">
<view class="text-28rpx leading-40rpx text-#303133">{{ teaHouse.name || '请选择茶馆' }}</view>
@ -297,22 +300,33 @@
<view class="flex items-center justify-between mt-48rpx" v-if="serviceTypeValue == 2" @click="TeaRoom.handleToAddress">
<view class="text-28rpx leading-40rpx">地址</view>
<view class="flex items-center">
<view class="text-28rpx leading-40rpx text-#303133">{{ teaHouse.name || '请选择地址' }}</view>
<view class="text-28rpx leading-40rpx text-#303133 w-430rpx line-1 text-right">
<template v-if="address && address.id > 0">
{{address.contact}} {{ address.telephone }} {{ address.province }}{{ address.city }}{{ address.district }}{{ address.address }}
</template>
<template v-else>
请选择地址
</template>
</view>
<view>
<wd-icon name="chevron-right" size="32rpx" color="#909399"></wd-icon>
</view>
</view>
</view>
</view>
<!-- 预定时间 -->
<view class="bg-white py-26rpx px-30rpx mt-20rpx" @click="showReservePopup = true">
<view class="bg-white py-26rpx px-30rpx mt-20rpx" @click="showBookTimePopup = true">
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">预定时间</view>
<view class="flex items-center justify-between">
<view class="text-[26rpx] text-[#606266] leading-36rpx">3小时起订</view>
<view class="text-[26rpx] text-[#606266] leading-36rpx">{{ sevenDay.minimum_time }}小时起订</view>
<view class="flex items-center">
<view class="text-[28rpx] text-[#909399] leading-40rpx">
{{ totalHour > 0 ? `${totalHour}小时` : '请选择' }}
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
<template v-if="reserveTime.length > 0">
{{ reserveTime[0] }} {{ reserveTime[1].join(',') }}
</template>
<template v-else>
请选择
</template>
</view>
<view>
<wd-icon name="chevron-right" size="32rpx" color="#909399"></wd-icon>
@ -397,9 +411,11 @@
import {ReserveServiceCategory} from '@/utils/order'
import { PayList, PayCategory, PayValue } from '@/utils/pay'
import Pay from '@/components/Pay.vue'
import { getTeaSpecialistDetails } from '@/api/tea'
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
import { getTeaSpecialistDetails, getNext7Days, getTeaTypeList } from '@/api/tea'
import type { ITeaSpecialistDetailsFields, ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
import { TeaSpecialistLevelValue } from '@/utils/teaSpecialist'
import type { IUserAddressListResult } from '@/api/types/user'
import BookingTime from '@/components/BookingTime.vue'
const OSS = inject('OSS')
@ -414,6 +430,28 @@
const teaHouse = ref<{id: number, name: string}>({id: 0, name: ''})
const showTeaHousePopup = ref<boolean>(false) // 显示门店列表弹窗
// 选择预定时间
const showBookTimePopup = ref<boolean>(false)
let sevenDay = reactive<ITeaSpecialistFuture7DaysResult>({
minimum_time: 0,
time: []
})
// 上门服务选择的地址
const address = ref<IUserAddressListResult>({
id: 0,
contact: '',
telephone: '',
province: '',
province_id: 0,
city: '',
city_id: 0,
district: '',
district_id: 0,
address: '',
is_default: 0,
})
// 茶艺服务
const teaService = ref<{id: number, name: string}>({id: 0, name: ''})
const showTeaServicePopup = ref<boolean>(false) // 显示门店列表弹窗
@ -495,6 +533,9 @@
})
const is90 = ref<boolean>(false)
// 提交的数据
const reserveTime = ref<Array<any>>([])
onLoad(async (args) => {
if (args.type == ReserveServiceCategory.GroupBuying) {
// TODO 如果是团购套餐则直接微信支付?
@ -518,17 +559,18 @@
})
}
}
// 获取未来7天时间段
const next7 = await getNext7Days()
Object.assign(sevenDay, next7)
})
const TeaRoom = {
startTimeTimestamp: 0, // 记录开始时间戳
endTimeTimestamp: 0, // 记录结束时间戳
// 选择茶馆
handleChooseTeaHouse: (item: any) => {
},
handleStartTimePicker: (e: {value: number}) => {
TeaRoom.startTimeTimestamp = e.value
startTimeLayout.value = TeaRoom.formatDate(e.value)
@ -565,7 +607,6 @@
console.log('Clicked item:', item)
},
// 重置预定时间
handleResetTime: () => {
startTimeValue.value = ''
@ -609,13 +650,32 @@
}
},
// 选择门店
handleToSChooseStore: () => {
uni.$on('chooseTeaHouse', params => {
uni.$off('chooseTeaHouse')
teaHouse.value = params
})
router.navigateTo('/pages/address/store?from=reserve')
},
// 选择地址
handleToAddress: () => {
uni.$on('chooseAddress', params => {
uni.$off('chooseAddress')
address.value = params
})
router.navigateTo('/pages/address/list?from=reserve')
},
// 选中预定时间
handleChooseReserveTime: (params: any) => {
console.log("🚀 ~ params:", params)
reserveTime.value = params
},
// 提交表单
handleSubmitOrder: () => {
// 提交订单
showPayPopup.value = true
uni.navigateTo({ url: '/pages/notice/reserve?type=teaSpecialist' })
},