调试接口
This commit is contained in:
6
env/.env
vendored
6
env/.env
vendored
@ -19,4 +19,8 @@ VITE_APP_PROXY=false
|
|||||||
VITE_APP_PROXY_PREFIX = '/api'
|
VITE_APP_PROXY_PREFIX = '/api'
|
||||||
|
|
||||||
# 第二个请求地址 (目前alova中可以使用)
|
# 第二个请求地址 (目前alova中可以使用)
|
||||||
VITE_SERVER_BASEURL = 'https://cz.stnav.com'
|
VITE_SERVER_BASEURL = 'https://cz.stnav.com'
|
||||||
|
|
||||||
|
# 默认上海经纬度
|
||||||
|
VITE_DEFAULT_LONGITUDE = 121.4737
|
||||||
|
VITE_DEFAULT_LATITUDE = 31.2304
|
||||||
@ -58,4 +58,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.booking-time {
|
||||||
|
:deep() {
|
||||||
|
.wd-tabs__line--inner,
|
||||||
|
.wd-tabs__line {
|
||||||
|
background-color: #4C9F44 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export interface IPrePayParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function prePay(data: IPrePayParams) {
|
export function prePay(data: IPrePayParams) {
|
||||||
return http.Post<{ pay_id: number }>('/api/pay/prepay', data)
|
return http.Post<any>('/api/pay/prepay', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,5 +23,5 @@ export interface ITeaSpecialistPayParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function balancePay(data: ITeaSpecialistPayParams) {
|
export function balancePay(data: ITeaSpecialistPayParams) {
|
||||||
return http.Post('/api/pay/yuePay', data)
|
return http.Post<any>('/api/pay/yuePay', data)
|
||||||
}
|
}
|
||||||
@ -94,6 +94,7 @@ export interface IRoomDetailParams {
|
|||||||
latitude: number
|
latitude: number
|
||||||
longitude: number
|
longitude: number
|
||||||
user_id: number
|
user_id: number
|
||||||
|
room_id?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTeaRoomDetail(data: IRoomDetailParams) {
|
export function getTeaRoomDetail(data: IRoomDetailParams) {
|
||||||
@ -151,8 +152,8 @@ export function getStoreTeaRoomList(data: IStoreTeaRoomListParams) {
|
|||||||
/**
|
/**
|
||||||
* 获取未来7天时间
|
* 获取未来7天时间
|
||||||
*/
|
*/
|
||||||
export function getNext7Days() {
|
export function getNext7Days(room_id: number, date: string) {
|
||||||
return http.Post<ITeaSpecialistFuture7DaysResult>('/api/Common/get7Time')
|
return http.Post<any>('/api/Common/get7Time', {room_id, date})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,12 +173,14 @@ export function getTeaRoomBalance(data: ITeaRoomBalanceParams) {
|
|||||||
export interface ICreateTeaRoomOrderParams {
|
export interface ICreateTeaRoomOrderParams {
|
||||||
store_id: number
|
store_id: number
|
||||||
room_id: number
|
room_id: number
|
||||||
|
day_title: string
|
||||||
day_time: string
|
day_time: string
|
||||||
start_time: string
|
start_time: string
|
||||||
end_time: string
|
end_time: string
|
||||||
hours: number
|
hours: number
|
||||||
user_coupon_id: number
|
user_coupon_id: number
|
||||||
group_coupon_id: number
|
group_coupon_id: number
|
||||||
|
timeslot: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTeaRoomOrder(data: ICreateTeaRoomOrderParams) {
|
export function createTeaRoomOrder(data: ICreateTeaRoomOrderParams) {
|
||||||
@ -287,6 +290,7 @@ export function getTeaRoomPackageDetail(data: ITeaRoomPackageDetailParams) {
|
|||||||
*/
|
*/
|
||||||
export interface ICreateTeaRoomPackageOrderParams {
|
export interface ICreateTeaRoomPackageOrderParams {
|
||||||
group_id: number
|
group_id: number
|
||||||
|
room_id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTeaRoomPackageOrder(data: ICreateTeaRoomPackageOrderParams) {
|
export function createTeaRoomPackageOrder(data: ICreateTeaRoomPackageOrderParams) {
|
||||||
@ -352,4 +356,11 @@ export interface ITeaRoomGroupCouponListParams {
|
|||||||
|
|
||||||
export function getTeaRoomGroupCouponList(data: ITeaRoomGroupCouponListParams) {
|
export function getTeaRoomGroupCouponList(data: ITeaRoomGroupCouponListParams) {
|
||||||
return http.Post<{list: {}}>('/api/order/teaStoreGroupUseLists', data)
|
return http.Post<{list: {}}>('/api/order/teaStoreGroupUseLists', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值接口
|
||||||
|
*/
|
||||||
|
export function teaRoomRecharge(money: number) {
|
||||||
|
return http.Post<{id: number}>('/api/recharge/recharge', {money})
|
||||||
}
|
}
|
||||||
@ -69,4 +69,5 @@ export interface IUserResult {
|
|||||||
mobile: string
|
mobile: string
|
||||||
user_money: string
|
user_money: string
|
||||||
version: string
|
version: string
|
||||||
|
last_month?: number
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ export interface IGetUserMoneyLogParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getUserMoneyLog(data: IGetUserMoneyLogParams) {
|
export function getUserMoneyLog(data: IGetUserMoneyLogParams) {
|
||||||
return http.Post<IOrderListResult>('/api/user/moneyLogList', data)
|
return http.Post<any>('/api/user/moneyLogList', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,3 +144,23 @@ export interface IUpdateUserInfoParams {
|
|||||||
export function updateUserInfo(data: IUpdateUserInfoParams) {
|
export function updateUserInfo(data: IUpdateUserInfoParams) {
|
||||||
return http.Post('/api/user/setInfo', data)
|
return http.Post('/api/user/setInfo', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抖音验券
|
||||||
|
*/
|
||||||
|
export interface ICheckDouyinCouponParams {
|
||||||
|
store_id: number,
|
||||||
|
code: string,
|
||||||
|
type: number // 1是手动输入 2是扫码
|
||||||
|
}
|
||||||
|
|
||||||
|
export function checkDouyinCoupon(data: ICheckDouyinCouponParams) {
|
||||||
|
return http.Post('/api/DouyinAfterVerifi/setDouy', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员记录
|
||||||
|
*/
|
||||||
|
export function getUserMember() {
|
||||||
|
return http.Post<any>('/api/user/UserMember')
|
||||||
|
}
|
||||||
@ -171,7 +171,7 @@
|
|||||||
.wd-tabs,
|
.wd-tabs,
|
||||||
.wd-tabs__nav,
|
.wd-tabs__nav,
|
||||||
.wd-tabs__line {
|
.wd-tabs__line {
|
||||||
background-color: transparent;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wd-tabs__nav-item.is-active {
|
.wd-tabs__nav-item.is-active {
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx"
|
custom-class="!bg-[#F6F7F8] !rounded-16rpx"
|
||||||
custom-input-class="!h-104rpx">
|
custom-input-class="!h-104rpx">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<view class="ml-38rpx flex items-center" @click="excharge.handleScan">
|
<view class="ml-38rpx flex items-center" @click="Excharge.handleScan">
|
||||||
<view class="w-36rpx h-36rpx">
|
<view class="w-36rpx h-36rpx">
|
||||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_scan.png`"></wd-img>
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_scan.png`"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</wd-input>
|
</wd-input>
|
||||||
</view>
|
</view>
|
||||||
<view class="bg-[#4C9F44] text-[#fff] mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx mt-80rpx" @click="excharge.handleConfirm">确定</view>
|
<view class="bg-[#4C9F44] text-[#fff] mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx mt-80rpx" @click="Excharge.handleConfirm">确定</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 间隔线 -->
|
<!-- 间隔线 -->
|
||||||
@ -69,18 +69,47 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useMessage } from 'wot-design-uni'
|
import { useMessage } from 'wot-design-uni'
|
||||||
import {toast} from '@/utils/toast'
|
import {toast} from '@/utils/toast'
|
||||||
|
import { checkDouyinCoupon } from '@/api/user'
|
||||||
|
import { router } from '@/utils/tools'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
const code = ref<string>('')
|
const code = ref<string>('')
|
||||||
const message = useMessage('wd-message-box-slot')
|
const message = useMessage('wd-message-box-slot')
|
||||||
|
|
||||||
const excharge = {
|
// 茶室ID
|
||||||
// 扫码
|
const storeId = ref<number>(0)
|
||||||
|
|
||||||
|
onLoad((args) => {
|
||||||
|
storeId.value = Number(args.storeId)
|
||||||
|
})
|
||||||
|
|
||||||
|
const Excharge = {
|
||||||
|
/**
|
||||||
|
* 扫码
|
||||||
|
*/
|
||||||
handleScan: () => {
|
handleScan: () => {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: (res) => {
|
success: async (res) => {
|
||||||
|
console.log("🚀 ~ res:", res)
|
||||||
if(res.result) {
|
if(res.result) {
|
||||||
code.value = res.result
|
code.value = res.result
|
||||||
|
uni.showLoading({ title: '兑换中...' })
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
store_id: storeId.value,
|
||||||
|
code: res.result.replace(/\s+/g, ''),
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
await checkDouyinCoupon(params)
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
// 跳转页面
|
||||||
|
Excharge.handleToExcharge()
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
@ -89,13 +118,35 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 确认兑换
|
/**
|
||||||
handleConfirm: () => {
|
* 确认兑换
|
||||||
|
*/
|
||||||
|
handleConfirm: async () => {
|
||||||
if(!code.value) {
|
if(!code.value) {
|
||||||
toast.info('兑换失败 请检查兑换码')
|
toast.info('兑换失败 请检查兑换码')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uni.showLoading({ title: '兑换中...' })
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
store_id: storeId.value,
|
||||||
|
code: code.value.replace(/\s+/g, ''),
|
||||||
|
type: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
await checkDouyinCoupon(params)
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
// 跳转页面
|
||||||
|
Excharge.handleToExcharge()
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleToExcharge: () => {
|
||||||
message.confirm({
|
message.confirm({
|
||||||
title: '兑换成功',
|
title: '兑换成功',
|
||||||
msg: '您的抖音券已经兑换成功,立即去预定茶室?',
|
msg: '您的抖音券已经兑换成功,立即去预定茶室?',
|
||||||
@ -109,6 +160,9 @@
|
|||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
// 点击确认按钮回调事件
|
// 点击确认按钮回调事件
|
||||||
|
if (res.action === 'confirm') {
|
||||||
|
router.redirectTo(`/bundle/order/douyin/order-list`)
|
||||||
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// 点击取消按钮回调事件
|
// 点击取消按钮回调事件
|
||||||
})
|
})
|
||||||
|
|||||||
@ -8,14 +8,46 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="order-list">
|
<view class="order-list sticky top-0 left-0 z-50">
|
||||||
<navbar title="抖音团购"></navbar>
|
<navbar title="抖音团购"></navbar>
|
||||||
<view class="bg-white pb-20rpx">
|
<view class="bg-white pb-20rpx">
|
||||||
<wd-search v-model="keywords" placeholder="搜索订单信息" hide-cancel placeholder-left custom-class="!h-72rpx"/>
|
<wd-search v-model="keywords" placeholder="搜索订单信息" hide-cancel placeholder-left custom-class="!h-72rpx"/>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="tabs relative">
|
||||||
|
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="OrderList.handleChangeTabs">
|
||||||
|
<wd-tab title="全部" :name="DouYinOrderStatusText.All"></wd-tab>
|
||||||
|
<wd-tab title="待使用" :name="DouYinOrderStatusText.ToUse"></wd-tab>
|
||||||
|
<wd-tab title="已使用" :name="DouYinOrderStatusText.Used"></wd-tab>
|
||||||
|
</wd-tabs>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="tabs relative">
|
<view class="tabs mt-18rpx mx-30rpx pb-20rpx">
|
||||||
|
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption">
|
||||||
|
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||||
|
<combo-card :type="OrderSource.DouYin" :order="item"></combo-card>
|
||||||
|
</view>
|
||||||
|
</mescroll-body>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- <view class="order-list sticky top-0 left-0 z-50 bg-[#fff] pb-10rpx">
|
||||||
|
<wd-navbar safeAreaInsetTop custom-class='!bg-[#fff]' :bordered="false" placeholder>
|
||||||
|
<template #left>
|
||||||
|
<view class="h-48rpx flex items-center">
|
||||||
|
<view class="mt-4rpx" @click="router.navigateBack()">
|
||||||
|
<wd-icon name="thin-arrow-left" size="30rpx"></wd-icon>
|
||||||
|
</view>
|
||||||
|
<view class="">抖音团购</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</wd-navbar>
|
||||||
|
|
||||||
|
<view class="search-box">
|
||||||
|
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索茶室订单" @search="OrderList.handleSearch()" custom-class="!mx-28rpx !bg-[#fff]" custom-input-class="!bg-[#F6F7F8] rounded-48rpx"></wd-search>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view> -->
|
||||||
|
<!-- <view class="tabs relative">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" @change="orderList.handleChangeTab" :lazy="false">
|
<wd-tabs v-model="tab" swipeable slidable="always" @change="orderList.handleChangeTab" :lazy="false">
|
||||||
<wd-tab title="全部">
|
<wd-tab title="全部">
|
||||||
<view class="content mx-30rpx mt-34rpx">
|
<view class="content mx-30rpx mt-34rpx">
|
||||||
@ -42,7 +74,8 @@
|
|||||||
<view class="absolute right-0 top-10rpx excharge w-178rpx h-80rpx leading-80rpx text-[#fff] text-center font-bold text-24rpx leading-34rpx" @click="orderList.handleToExcharge">
|
<view class="absolute right-0 top-10rpx excharge w-178rpx h-80rpx leading-80rpx text-[#fff] text-center font-bold text-24rpx leading-34rpx" @click="orderList.handleToExcharge">
|
||||||
去兑换
|
去兑换
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -51,34 +84,29 @@
|
|||||||
import ComboCard from '@/components/order/ComboCard.vue'
|
import ComboCard from '@/components/order/ComboCard.vue'
|
||||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||||
import { OrderSource } from '@/utils/order'
|
import { OrderSource, DouYinOrderStatusText } from '@/utils/order'
|
||||||
|
|
||||||
|
|
||||||
/* mescroll */
|
/* mescroll */
|
||||||
const { mescrollInit, downCallback } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||||
|
const downOption = {
|
||||||
|
auto: true
|
||||||
|
}
|
||||||
|
const upOption = {
|
||||||
|
auto: true,
|
||||||
|
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
|
||||||
|
}
|
||||||
|
const orderStatus = ref<string>('')
|
||||||
|
const list = ref<Array<any>>([]) // 茶室列表
|
||||||
|
const keywords = ref<string>('') // 搜索关键词
|
||||||
|
|
||||||
// 菜单
|
// 菜单
|
||||||
const currentType = ref<number>(1)
|
const currentType = ref<number>(1)
|
||||||
const menuList = reactive<Array<{ type: number; title: string }>>([
|
|
||||||
{
|
|
||||||
type: 1,
|
|
||||||
title: '直营店',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 2,
|
|
||||||
title: '加盟店',
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
// 店铺类型
|
|
||||||
|
|
||||||
// 搜索
|
|
||||||
const keywords = ref<string>('')
|
|
||||||
|
|
||||||
// tab
|
// tab
|
||||||
const tab = ref<number>(0)
|
const tab = ref<string>('all')
|
||||||
|
|
||||||
const orderList = {
|
const OrderList = {
|
||||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||||
upCallback: (mescroll) => {
|
upCallback: (mescroll) => {
|
||||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
// 需要留一下数据为空的时候显示的空数据图标内容
|
||||||
@ -134,9 +162,18 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 切换tab
|
// 切换tab
|
||||||
handleChangeTab: (e: any) => {
|
handleChangeTabs: (e: {index: number, name: string}) => {
|
||||||
tab.value = e.index
|
tab.value = e.name
|
||||||
}
|
if (e.name === TeaRoomOrderStatusText.Pending) {
|
||||||
|
orderStatus.value = '0'
|
||||||
|
} else {
|
||||||
|
orderStatus.value = TeaRoomOrderStatusValue[e.name] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换tab时,重置当前的mescroll
|
||||||
|
list.value = []
|
||||||
|
getMescroll().resetUpScroll();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="order-list">
|
<view class="order-list sticky top-0 left-0 z-50">
|
||||||
<navbar layoutLeft>
|
<navbar layoutLeft>
|
||||||
<template #left>
|
<template #left>
|
||||||
<view class="flex items-center ml-24rpx">
|
<view class="flex items-center ml-24rpx">
|
||||||
@ -21,15 +21,17 @@
|
|||||||
<view class="bg-white pb-20rpx">
|
<view class="bg-white pb-20rpx">
|
||||||
<wd-search v-model="keywords" placeholder="搜索订单信息" hide-cancel placeholder-left custom-class="!h-72rpx" @search="OrderList.handleResetSearch()"/>
|
<wd-search v-model="keywords" placeholder="搜索订单信息" hide-cancel placeholder-left custom-class="!h-72rpx" @search="OrderList.handleResetSearch()"/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="tabs bg-[#F6F7F9] pb-20rpx">
|
||||||
|
<wd-tabs v-model="tab" swipeable slidable="always" @change="OrderList.handleChangeTabs" :lazy="false">
|
||||||
|
<wd-tab title="全部" :name="TeaRoomPackageOrderStatusText.All"></wd-tab>
|
||||||
|
<wd-tab title="待使用" :name="TeaRoomPackageOrderStatusText.ToUse"></wd-tab>
|
||||||
|
<wd-tab title="已使用" :name="TeaRoomPackageOrderStatusText.Used"></wd-tab>
|
||||||
|
</wd-tabs>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="tabs">
|
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" @change="OrderList.handleChangeTabs" :lazy="false">
|
|
||||||
<wd-tab title="全部" :name="TeaRoomPackageOrderStatusText.All"></wd-tab>
|
|
||||||
<wd-tab title="待使用" :name="TeaRoomPackageOrderStatusText.ToUse"></wd-tab>
|
|
||||||
<wd-tab title="已使用" :name="TeaRoomPackageOrderStatusText.Used"></wd-tab>
|
|
||||||
</wd-tabs>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="content mx-30rpx mt-34rpx">
|
<view class="content mx-30rpx mt-34rpx">
|
||||||
<mescroll-body ref="mescrollItem" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption">
|
<mescroll-body ref="mescrollItem" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption">
|
||||||
|
|||||||
@ -85,9 +85,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</wd-popup>
|
</wd-popup>
|
||||||
|
|
||||||
<!-- 选择预定时间 -->
|
|
||||||
<booking-time v-model="showBookTimePopup" :day="sevenDay" @selectedTime="OrderDetail.handleChooseReserveTime"></booking-time>
|
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<navbar :title="title" custom-class='!bg-[#F6F7F8]'></navbar>
|
<navbar :title="title" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||||
</view>
|
</view>
|
||||||
@ -140,7 +137,7 @@
|
|||||||
<view class="mt-28rpx pb-36rpx">
|
<view class="mt-28rpx pb-36rpx">
|
||||||
<view class="text-30rpx leading-42rpx text-[#303133] px-30rpx">预约信息</view>
|
<view class="text-30rpx leading-42rpx text-[#303133] px-30rpx">预约信息</view>
|
||||||
<view class="font-500 text-26rpx leading-48rpx text-[#606266] mt-20rpx">
|
<view class="font-500 text-26rpx leading-48rpx text-[#606266] mt-20rpx">
|
||||||
<view class="mb-20rpx px-30rpx">预约时间:{{ order.day_time }} {{ order.renew_dtime.start_time || order.start_time }}-{{ order.renew_dtime.end_time || order.end_time }}</view>
|
<view class="mb-20rpx px-30rpx">预约时间:{{ order.day_time }} {{ order?.renew_dtime?.start_time || order?.start_time }}-{{ order?.renew_dtime?.end_time || order?.end_time }}</view>
|
||||||
<view class="flex justify-between items-center pl-30rpx" >
|
<view class="flex justify-between items-center pl-30rpx" >
|
||||||
<view>预约时长:{{ order.hours }}小时</view>
|
<view>预约时长:{{ order.hours }}小时</view>
|
||||||
<!-- 已预约和消费中显示一键续订 -->
|
<!-- 已预约和消费中显示一键续订 -->
|
||||||
@ -388,14 +385,18 @@
|
|||||||
// 一键续订的金额
|
// 一键续订的金额
|
||||||
const totalReserveMoney = ref<number>(0)
|
const totalReserveMoney = ref<number>(0)
|
||||||
|
|
||||||
|
// 获取当前年月日,格式:YYYY-MM-DD
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
const currentDate = `${year}-${month}-${day}`;
|
||||||
|
|
||||||
onLoad(async (args) => {
|
onLoad(async (args) => {
|
||||||
orderId.value = args.orderId
|
orderId.value = args.orderId
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
OrderDetail.handleInit()
|
OrderDetail.handleInit()
|
||||||
|
|
||||||
// 预定时间
|
|
||||||
const next7 = await getNext7Days()
|
|
||||||
Object.assign(sevenDay, next7)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
@ -425,6 +426,11 @@
|
|||||||
console.log("🚀 ~ order.value :", order.value )
|
console.log("🚀 ~ order.value :", order.value )
|
||||||
title.value = TeaRoomOrderStatusTextValue[order.value.order_status].title || '订单详情'
|
title.value = TeaRoomOrderStatusTextValue[order.value.order_status].title || '订单详情'
|
||||||
orderStatus.value = order.value.order_status
|
orderStatus.value = order.value.order_status
|
||||||
|
|
||||||
|
|
||||||
|
// 预定时间
|
||||||
|
const next7 = await getNext7Days(order.value.room_msg.id, currentDate)
|
||||||
|
Object.assign(sevenDay, next7)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -479,16 +485,6 @@
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 选中预定时间
|
|
||||||
*/
|
|
||||||
handleChooseReserveTime: (params: any) => {
|
|
||||||
reserveTime.value = params
|
|
||||||
|
|
||||||
// 一键续订的金额
|
|
||||||
totalReserveMoney.value = Number(toTimes(params[3], order.value.room_price))
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认一键续订
|
* 确认一键续订
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -191,7 +191,7 @@
|
|||||||
try {
|
try {
|
||||||
const response = JSON.parse(e.file.response)
|
const response = JSON.parse(e.file.response)
|
||||||
if (response.code) {
|
if (response.code) {
|
||||||
const avatarUrl = response.data.uri
|
const avatarUrl = response.data.url
|
||||||
await updateUserInfo({ field: 'avatar', value: avatarUrl })
|
await updateUserInfo({ field: 'avatar', value: avatarUrl })
|
||||||
user.value.avatar = avatarUrl
|
user.value.avatar = avatarUrl
|
||||||
toast.info('头像上传成功')
|
toast.info('头像上传成功')
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent;" :height="navbarHeight">
|
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent;" :height="navbarHeight">
|
||||||
<template #left>
|
<template #left>
|
||||||
<view class="h-48rpx flex items-center" @click="StoreRecharge.back">
|
<view class="h-48rpx flex items-center" @click="router.navigateBack()">
|
||||||
<wd-img width="48rpx" height="48rpx" :src="`${OSS}icon/icon_arrow_left.png`" class="mt-6rpx"></wd-img>
|
<wd-img width="48rpx" height="48rpx" :src="`${OSS}icon/icon_arrow_left.png`" class="mt-6rpx"></wd-img>
|
||||||
<view class="text-[#303133] text-36rpx ml-24rpx leading-48rpx">充值</view>
|
<view class="text-[#303133] text-36rpx ml-24rpx leading-48rpx">充值</view>
|
||||||
</view>
|
</view>
|
||||||
@ -34,12 +34,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="text-28rpx font-400 text-[#303133] leading-40rpx mx-70rpx mt-38rpx">推广方式</view>
|
<!-- <view class="text-28rpx font-400 text-[#303133] leading-40rpx mx-70rpx mt-38rpx">推广方式</view>
|
||||||
|
|
||||||
<view class="bg-white mt-28rpx rounded-16rpx px-38rpx mx-32rpx h-150rpx flex items-center">
|
<view class="bg-white mt-28rpx rounded-16rpx px-38rpx mx-32rpx h-150rpx flex items-center">
|
||||||
<view class="text-[#303133] text-30rpx font-bold leading-42rpx">门店推广</view>
|
<view class="text-[#303133] text-30rpx font-bold leading-42rpx">门店推广</view>
|
||||||
<view class="flex-1 bg-[#F8F9FA] text-[#9CA3AF] rounded-8rpx ml-28rpx h-80rpx leading-80rpx rounded-8rpx pl-28rpx">{{ storeName }}</view>
|
<view class="flex-1 bg-[#F8F9FA] text-[#9CA3AF] rounded-8rpx ml-28rpx h-80rpx leading-80rpx rounded-8rpx pl-28rpx">{{ storeName }}</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view @click="StoreRecharge.handleRecharge" class="fixed left-0 right-0 bottom-0 z-50 mx-60rpx flex items-center justify-center bg-[#4C9F44] rounded-8rpx text-[#fff] text-30rpx font-bold" :style="{ height: '90rpx', bottom: 'calc(env(safe-area-inset-bottom) + 26rpx)', city: canRecharge ? 1 : 0.5 }">
|
<view @click="StoreRecharge.handleRecharge" class="fixed left-0 right-0 bottom-0 z-50 mx-60rpx flex items-center justify-center bg-[#4C9F44] rounded-8rpx text-[#fff] text-30rpx font-bold" :style="{ height: '90rpx', bottom: 'calc(env(safe-area-inset-bottom) + 26rpx)', city: canRecharge ? 1 : 0.5 }">
|
||||||
确定转入
|
确定转入
|
||||||
@ -51,7 +51,8 @@
|
|||||||
import { getNavBarHeight } from '@/utils/index'
|
import { getNavBarHeight } from '@/utils/index'
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast'
|
||||||
import { router } from '@/utils/tools'
|
import { router } from '@/utils/tools'
|
||||||
import { wxpay } from '@/hooks/usePay'
|
// import { wxpay } from '@/hooks/usePay'
|
||||||
|
import { teaRoomRecharge } from '@/api/tea-room'
|
||||||
|
|
||||||
let navbarHeight = ref<number>(0)
|
let navbarHeight = ref<number>(0)
|
||||||
let OSS = inject('OSS')
|
let OSS = inject('OSS')
|
||||||
@ -69,14 +70,24 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const StoreRecharge = {
|
const StoreRecharge = {
|
||||||
handleRecharge: () => {
|
handleRecharge: async () => {
|
||||||
if (rechargeMoney.value) {
|
if (rechargeMoney.value) {
|
||||||
|
uni.showLoading({
|
||||||
} else {
|
title: '加载中...',
|
||||||
uni.showToast({
|
mask: true
|
||||||
title: '请输入充值金额',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
|
try {
|
||||||
|
const res = await teaRoomRecharge(Number(rechargeMoney.value))
|
||||||
|
rechargeMoney.value = ''
|
||||||
|
uni.hideLoading()
|
||||||
|
toast.success('操作成功')
|
||||||
|
} catch(e) {
|
||||||
|
uni.hideLoading()
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toast.info('请输入转入金额')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="pb-200rpx">
|
<view class="pb-200rpx">
|
||||||
<!-- 费用明细 -->
|
<!-- 费用明细 -->
|
||||||
<wd-popup v-model="showCostPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" @close="showCostPopup = false" position="bottom">
|
<wd-popup v-model="showCostPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" @close="showCostPopup = false" position="bottom">
|
||||||
<view class='bg-[#FBFBFB] py-40rpx realtive'>
|
<view class='bg-[#FBFBFB] py-40rpx realtive'>
|
||||||
<view class="absolute top-18rpx right-30rpx" @click="showCostPopup = false">
|
<view class="absolute top-18rpx right-30rpx" @click="showCostPopup = false">
|
||||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
||||||
@ -30,10 +30,10 @@
|
|||||||
<view>优惠</view>
|
<view>优惠</view>
|
||||||
<view class="text-[#4C9F44]">-¥{{ bill.totalDiscount }}</view>
|
<view class="text-[#4C9F44]">-¥{{ bill.totalDiscount }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
<!-- <view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
||||||
<view>优惠券</view>
|
<view>优惠券</view>
|
||||||
<view>-¥{{ bill.coupon }}</view>
|
<view>-¥{{ bill.coupon }}</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
||||||
<view>团购券</view>
|
<view>团购券</view>
|
||||||
<view>-¥{{ bill.groupCoupon || 0 }}</view>
|
<view>-¥{{ bill.groupCoupon || 0 }}</view>
|
||||||
@ -87,11 +87,11 @@
|
|||||||
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current" mode="aspectFit"></wd-swiper>
|
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current" mode="aspectFit"></wd-swiper>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 使用说明 -->
|
<!-- 其他说明 -->
|
||||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">使用说明</view>
|
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">其他说明</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<rich-text :nodes="teaRoom.textarea1"></rich-text>
|
<rich-text :nodes="teaRoom.other_describe"></rich-text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -102,8 +102,8 @@
|
|||||||
<view class="text-[26rpx] text-[#606266] leading-36rpx">{{ sevenDay.minimum_time }}小时起订</view>
|
<view class="text-[26rpx] text-[#606266] leading-36rpx">{{ sevenDay.minimum_time }}小时起订</view>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
|
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
|
||||||
<template v-if="reserveTime.length > 0">
|
<template v-if="dayHours">
|
||||||
{{ reserveTime[0] }} {{ reserveTime[1].join(',') }}
|
{{ dayTime }} {{ dayHours }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
请选择
|
请选择
|
||||||
@ -117,14 +117,14 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 优惠券 -->
|
<!-- 优惠券 -->
|
||||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="ChooseRoomReserve.handleToCoupon(CouponType.Discount)">
|
<!-- <view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="ChooseRoomReserve.handleToCoupon(CouponType.Discount)">
|
||||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view>
|
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view>
|
||||||
<view class="flex items-center justify-between">
|
<view class="flex items-center justify-between">
|
||||||
<view class="text-[26rpx] text-[#606266] leading-36rpx">优惠券</view>
|
<view class="text-[26rpx] text-[#606266] leading-36rpx">优惠券</view>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<view class="text-[28rpx] text-[#909399] leading-40rpx">
|
<view class="text-[28rpx] text-[#909399] leading-40rpx">
|
||||||
<template v-if="selectedCoupon?.id > 0">
|
<template v-if="dayHours">
|
||||||
{{ selectedCoupon.name }}
|
{{ dayTime }} {{ dayHours }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
请选择
|
请选择
|
||||||
@ -135,7 +135,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view class="fixed left-0 right-0 bottom-0 z-2 bg-[#fff]" :style="{ height: '140rpx' }">
|
<view class="fixed left-0 right-0 bottom-0 z-2 bg-[#fff]" :style="{ height: '140rpx' }">
|
||||||
<view class="mt-12rpx w-full" >
|
<view class="mt-12rpx w-full" >
|
||||||
@ -170,28 +170,26 @@
|
|||||||
import { getTeaRoomDetail } from '@/api/tea-room'
|
import { getTeaRoomDetail } from '@/api/tea-room'
|
||||||
import { getNext7Days, getTeaRoomBalance, createTeaRoomOrder, getTeaRoomPackageDetail, calculateTeaRoomPrice } from '@/api/tea-room'
|
import { getNext7Days, getTeaRoomBalance, createTeaRoomOrder, getTeaRoomPackageDetail, calculateTeaRoomPrice } from '@/api/tea-room'
|
||||||
import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
|
import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
|
||||||
import { router, toTimes, toPlus, toMinus } from '@/utils/tools'
|
import { router } from '@/utils/tools'
|
||||||
import { getUserInfo } from '@/api/user'
|
import { getUserInfo } from '@/api/user'
|
||||||
import { CouponType } from '@/utils/coupon'
|
import { CouponType } from '@/utils/coupon'
|
||||||
import { ReserveServiceCategory, OrderType } from '@/utils/order'
|
import { OrderType } from '@/utils/order'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
|
||||||
|
// 获取当前年月日,格式:YYYY-MM-DD
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
const currentDate = `${year}-${month}-${day}`;
|
||||||
|
|
||||||
// 轮播图
|
// 轮播图
|
||||||
const swiperList = ref<string[]>([])
|
const swiperList = ref<any>([])
|
||||||
const current = ref<number>(0)
|
const current = ref<number>(0)
|
||||||
|
|
||||||
const html: string = '<p>这里是富文本内容,需要后台传递</p>'
|
|
||||||
|
|
||||||
const showAction = ref<boolean>(false)
|
|
||||||
const sheetMenu = ref([])
|
|
||||||
const showServicePopup = ref<boolean>(false)
|
|
||||||
|
|
||||||
const storeType = ref<number>(1) // 1:直营 2:加盟
|
|
||||||
|
|
||||||
// 费用明细相关
|
// 费用明细相关
|
||||||
const showCostPopup = ref<boolean>(false) // 费用明细popup
|
const showCostPopup = ref<boolean>(false) // 费用明细popup
|
||||||
const showPayPopup = ref<boolean>(false) // 支付popup
|
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userInfo = ref<IUserInfoVo>(null)
|
const userInfo = ref<IUserInfoVo>(null)
|
||||||
@ -215,6 +213,10 @@
|
|||||||
time: []
|
time: []
|
||||||
})
|
})
|
||||||
const reserveTime = ref<Array<any>>([])
|
const reserveTime = ref<Array<any>>([])
|
||||||
|
const timeSlots = ref<Array<string>>([]) // 连续选择的预约时间
|
||||||
|
const dayTitle = ref<string>('') // 周三03/18
|
||||||
|
const dayTime = ref<string>('') // 2024-03-18
|
||||||
|
const dayHours = ref<string>('') // 预定时长00:00,00:30
|
||||||
|
|
||||||
// 选择的优惠券
|
// 选择的优惠券
|
||||||
const selectedCoupon = ref<{id: number, name: string}>({id: 0, name: ''})
|
const selectedCoupon = ref<{id: number, name: string}>({id: 0, name: ''})
|
||||||
@ -246,7 +248,7 @@
|
|||||||
|
|
||||||
onLoad((args) => {
|
onLoad((args) => {
|
||||||
storeId.value = Number(args.storeId)
|
storeId.value = Number(args.storeId)
|
||||||
id.value = Number(args.id)
|
id.value = Number(args.id) // 包间ID
|
||||||
teaRoomPrice.value = Number(args.price) || 0
|
teaRoomPrice.value = Number(args.price) || 0
|
||||||
groupCouponId.value = Number(args.groupCouponId) || 0
|
groupCouponId.value = Number(args.groupCouponId) || 0
|
||||||
groupCouponOrderId.value = Number(args.groupCouponOrderId) || 0
|
groupCouponOrderId.value = Number(args.groupCouponOrderId) || 0
|
||||||
@ -271,42 +273,65 @@
|
|||||||
id: storeId.value,
|
id: storeId.value,
|
||||||
latitude: uni.getStorageSync('latitude'),
|
latitude: uni.getStorageSync('latitude'),
|
||||||
longitude: uni.getStorageSync('longitude'),
|
longitude: uni.getStorageSync('longitude'),
|
||||||
|
room_id: id.value,
|
||||||
user_id: userInfo.value.id || 0
|
user_id: userInfo.value.id || 0
|
||||||
})
|
})
|
||||||
teaRoom.value = res.details
|
teaRoom.value = res.details
|
||||||
swiperList.value = teaRoom.value.img_arr
|
|
||||||
|
|
||||||
// 预定时间
|
|
||||||
const next7 = await getNext7Days()
|
|
||||||
Object.assign(sevenDay, next7)
|
|
||||||
|
|
||||||
// 获取门店余额
|
// 获取门店余额
|
||||||
const balance = await getTeaRoomBalance({ store_id: storeId.value })
|
const balance = await getTeaRoomBalance({ store_id: storeId.value })
|
||||||
storeMoney.value = balance.data.money || 0
|
storeMoney.value = balance.data.money || 0
|
||||||
|
|
||||||
// 获取团购优惠券
|
// 获取团购详情
|
||||||
const coupon = await getTeaRoomPackageDetail({ id: groupCouponId.value })
|
const coupon = await getTeaRoomPackageDetail({ id: groupCouponId.value })
|
||||||
groupCoupon.value = coupon.details
|
groupCoupon.value = coupon.details
|
||||||
|
swiperList.value = coupon.details.img
|
||||||
|
|
||||||
|
console.log("🚀 ~ groupCoupon.value:", groupCoupon.value)
|
||||||
|
|
||||||
|
// 预定时间
|
||||||
|
const next7 = await getNext7Days(id.value, currentDate)
|
||||||
|
Object.assign(sevenDay, next7.data)
|
||||||
|
Object.assign(sevenDay, {minimum_time: teaRoom.value.room.hours})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选中预定时间
|
* 选中预定时间
|
||||||
*/
|
*/
|
||||||
handleChooseReserveTime: (params: any) => {
|
handleChooseReserveTime: (params: any) => {
|
||||||
|
// reserveTime.value = params
|
||||||
|
|
||||||
|
// const roomPrice = toTimes(teaRoomPrice.value, params[3])
|
||||||
|
// const useGroupCouponPrice = toTimes(teaRoomPrice.value, groupCoupon.value.hour)
|
||||||
|
|
||||||
|
// bill.value.service = {
|
||||||
|
// total: roomPrice,
|
||||||
|
// unitPrice: teaRoomPrice.value,
|
||||||
|
// num: params[3],
|
||||||
|
// startTime: params[2][0],
|
||||||
|
// endTime: params[2][params[2].length - 1],
|
||||||
|
// dayTime: params[0],
|
||||||
|
// startHour: params[1][0],
|
||||||
|
// endHour: params[1][params[1].length - 1]
|
||||||
|
// }
|
||||||
|
|
||||||
reserveTime.value = params
|
reserveTime.value = params
|
||||||
|
|
||||||
const roomPrice = toTimes(teaRoomPrice.value, params[3])
|
timeSlots.value = params.selectedTimestamps
|
||||||
const useGroupCouponPrice = toTimes(teaRoomPrice.value, groupCoupon.value.hour)
|
dayTitle.value = params.dayTitle
|
||||||
|
dayTime.value = params.dayTime
|
||||||
|
const times = params.selectedTime.map(item => {
|
||||||
|
return item.time
|
||||||
|
}).join(',')
|
||||||
|
dayHours.value = times
|
||||||
|
|
||||||
bill.value.service = {
|
bill.value.service = {
|
||||||
total: roomPrice,
|
total: 0,
|
||||||
unitPrice: teaRoomPrice.value,
|
unitPrice: 0,
|
||||||
num: params[3],
|
num: params.countSelectedTime,
|
||||||
startTime: params[2][0],
|
startHour: params.selectedTime[0].time,
|
||||||
endTime: params[2][params[2].length - 1],
|
endHour: params.selectedTime[params.selectedTime.length - 1].time
|
||||||
dayTime: params[0],
|
|
||||||
startHour: params[1][0],
|
|
||||||
endHour: params[1][params[1].length - 1]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChooseRoomReserve.handleCalculateTeaRoomPrice()
|
ChooseRoomReserve.handleCalculateTeaRoomPrice()
|
||||||
@ -350,16 +375,20 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let res = await createTeaRoomOrder({
|
const params = {
|
||||||
store_id: storeId.value,
|
store_id: storeId.value,
|
||||||
room_id: id.value,
|
room_id: id.value,
|
||||||
day_time: bill.value.service.dayTime,
|
day_title: dayTitle.value,
|
||||||
|
day_time: dayTime.value,
|
||||||
start_time: bill.value.service.startHour,
|
start_time: bill.value.service.startHour,
|
||||||
end_time: bill.value.service.endHour,
|
end_time: bill.value.service.endHour,
|
||||||
user_coupon_id: selectedCoupon.value.id || 0,
|
user_coupon_id: selectedCoupon.value.id || 0,
|
||||||
hours: bill.value.service.num,
|
hours: bill.value.service.num,
|
||||||
group_coupon_id: groupCouponOrderId.value
|
group_coupon_id: groupCouponOrderId.value,
|
||||||
})
|
timeslot: timeSlots.value
|
||||||
|
}
|
||||||
|
|
||||||
|
let res = await createTeaRoomOrder(params)
|
||||||
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
|
||||||
|
|||||||
@ -57,37 +57,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</wd-popup>
|
</wd-popup>
|
||||||
|
|
||||||
<!-- 支付 -->
|
|
||||||
<wd-popup v-model="showPayPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" @close="showPayPopup = false" position="bottom">
|
|
||||||
<view class='bg-[#FBFBFB] py-40rpx realtive'>
|
|
||||||
<view class="absolute top-18rpx right-30rpx" @click="showPayPopup = false">
|
|
||||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
|
||||||
</view>
|
|
||||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center">支付</view>
|
|
||||||
<view class="mx-30rpx bg-white rounded-16rpx px-30rpx pt-40rpx mt-40rpx pb-30rpx">
|
|
||||||
<wd-radio-group v-model="pay" shape="dot" checked-color="#4C9F44">
|
|
||||||
<view class="pay" v-for="(item, index) in payList" :key="index" @click="pay = item.id">
|
|
||||||
<view class="flex justify-between items-center" v-if="pay == item.value" >
|
|
||||||
<view class="flex items-center">
|
|
||||||
<wd-img width="50rpx" height="50rpx" :src="item.icon"></wd-img>
|
|
||||||
<view class="ml-20rpx text-30rpx text-[#303133] leading-42rpx">{{ item.name }}</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center">
|
|
||||||
<wd-radio :value="item.value">
|
|
||||||
<view class="text-[#303133] text-26rpx leading-36rpx mr-20rpx">可用202.22</view>
|
|
||||||
</wd-radio>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</wd-radio-group>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class='bg-[#4C9F44] text-[#fff] rounded-8rpx h-90rpx leading-90rpx mx-60rpx box-border text-center mt-170rpx' @click="Detail.handlePay">确定付款</view>
|
|
||||||
</view>
|
|
||||||
</wd-popup>
|
|
||||||
|
|
||||||
<!-- 选择预定时间 -->
|
<!-- 选择预定时间 -->
|
||||||
<booking-time v-model="showBookTimePopup" :day="sevenDay" @selectedTime="Detail.handleChooseReserveTime"></booking-time>
|
<booking-time v-model="showBookTimePopup" :day="sevenDay" @selectedTime="Detail.handleChooseReserveTime"></booking-time>
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<navbar :title="isGroupBuying ? '团购套餐' : '预定'" custom-class='!bg-[#F6F7F8]'></navbar>
|
<navbar :title="isGroupBuying ? '团购套餐' : '预定'" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||||
@ -104,42 +75,51 @@
|
|||||||
<view class="font-bold text-36rpx text-[#303133] leading-50rpx">{{ isGroupBuying ? teaRoomPackage.title : teaRoom.name }}</view>
|
<view class="font-bold text-36rpx text-[#303133] leading-50rpx">{{ isGroupBuying ? teaRoomPackage.title : teaRoom.name }}</view>
|
||||||
<view class="mt-14rpx flex" v-if="!isGroupBuying">
|
<view class="mt-14rpx flex" v-if="!isGroupBuying">
|
||||||
<template v-for="(label, labelIndex) in teaRoom.label" :key="labelIndex">
|
<template v-for="(label, labelIndex) in teaRoom.label" :key="labelIndex">
|
||||||
<view class="mr-20rpx flex items-start" v-if="label.category_id == 1">
|
<view class="mr-20rpx flex items-start">
|
||||||
<wd-tag color="#40AE36" bg-color="#40AE36" plain custom-class="!rounded-4rpx">文艺小清新</wd-tag>
|
<wd-tag
|
||||||
</view>
|
:color="randomLabelColor(labelIndex)"
|
||||||
<view class="flex items-start" v-if="label.category_id == 2">
|
:bg-color="randomLabelColor(labelIndex)"
|
||||||
<wd-tag color="#F55726" bg-color="#F55726" plain>全息投影</wd-tag>
|
plain
|
||||||
|
custom-class="!rounded-4rpx"
|
||||||
|
>{{ label.label_name }}</wd-tag>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex justify-between items-center" :class="`${ isGroupBuying ? 'mt-24rpx' : ''}`">
|
<view class="flex justify-between items-center" :class="`${ isGroupBuying ? 'mt-24rpx' : ''}`">
|
||||||
<view class="text-[#303133] text-26rpx leading-48rpx font-500" v-if="isGroupBuying">{{ teaRoomPackage.introduce }}</view>
|
<view class="text-[#303133] text-26rpx leading-48rpx font-500" v-if="isGroupBuying">{{ teaRoomPackage.introduce }}</view>
|
||||||
<!-- <view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售 10+</view> -->
|
<view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售
|
||||||
|
<template v-if="isGroupBuying">
|
||||||
|
{{ teaRoomPackage.sold > 10 ? teaRoomPackage.sold + '+' : teaRoomPackage.sold }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ teaRoom.sold > 10 ? teaRoom.sold + '+' : teaRoom.sold }}
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isGroupBuying">
|
<view v-if="isGroupBuying">
|
||||||
<view class="mt-20rpx mb-24rpx" >
|
<view class="mt-20rpx mb-24rpx" >
|
||||||
<wd-gap height="2rpx" bgColor="#F6F7F9"></wd-gap>
|
<wd-gap height="2rpx" bgColor="#F6F7F9"></wd-gap>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-[#303133] text-28rpx leading-48rpx">
|
<view class="text-[#303133] text-28rpx leading-48rpx">
|
||||||
<rich-text :nodes="teaRoomPackage.details"></rich-text>
|
<!-- <rich-text :nodes="teaRoomPackage.details"></rich-text> -->
|
||||||
<!-- <view>
|
<view>
|
||||||
<text class="font-bold mr-26rpx">须知</text>
|
<text class="font-bold mr-26rpx">须知</text>
|
||||||
<text class="font-500">{{ teaRoomPackage.details }}</text>
|
<text class="font-500">需预约</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-22rpx">
|
<view class="mt-22rpx">
|
||||||
<text class="font-bold mr-26rpx">保障</text>
|
<text class="font-bold mr-26rpx">保障</text>
|
||||||
<text class="font-500">随时退</text>
|
<text class="font-500">随时退</text>
|
||||||
</view> -->
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="!isGroupBuying">
|
<view v-if="!isGroupBuying">
|
||||||
<!-- 使用说明 -->
|
<!-- 其他说明 -->
|
||||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">使用说明</view>
|
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">其他说明</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<rich-text :nodes="teaRoom.textarea1"></rich-text>
|
<rich-text :nodes="teaRoom.other_describe"></rich-text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -147,11 +127,11 @@
|
|||||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="showBookTimePopup = true">
|
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="showBookTimePopup = true">
|
||||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">预定时间</view>
|
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">预定时间</view>
|
||||||
<view class="flex items-center justify-between">
|
<view class="flex items-center justify-between">
|
||||||
<view class="text-[26rpx] text-[#606266] leading-36rpx">{{ sevenDay.minimum_time }}小时起订</view>
|
<view class="text-[26rpx] text-[#606266] leading-36rpx">{{ teaRoom?.room?.hours }}小时起订</view>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
|
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
|
||||||
<template v-if="reserveTime.length > 0">
|
<template v-if="dayHours">
|
||||||
{{ reserveTime[0] }} {{ reserveTime[1].join(',') }}
|
{{ dayTime }} {{ dayHours }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
请选择
|
请选择
|
||||||
@ -211,16 +191,60 @@
|
|||||||
<!-- 套餐详情 -->
|
<!-- 套餐详情 -->
|
||||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">套餐详情</view>
|
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">套餐详情</view>
|
||||||
<view class="">
|
<view class="mt-24rpx" v-if="teaRoomPackage.introduce">
|
||||||
<rich-text :nodes="teaRoomPackage.introduce_details"></rich-text>
|
<view class="flex items-center mb-20rpx">
|
||||||
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_tcsm.png`"></wd-img>
|
||||||
|
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">套餐介绍</view>
|
||||||
|
</view>
|
||||||
|
<rich-text :nodes="teaRoomPackage.introduce"></rich-text>
|
||||||
|
</view>
|
||||||
|
<view class="mt-30rpx" v-if="teaRoomPackage.rests_introduce">
|
||||||
|
<view class="flex items-center mb-20rpx">
|
||||||
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_qtsm.png`"></wd-img>
|
||||||
|
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx"> 其他说明</view>
|
||||||
|
</view>
|
||||||
|
<rich-text :nodes="teaRoomPackage.rests_introduce"></rich-text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 购买须知 -->
|
<!-- 购买须知 -->
|
||||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">购买须知</view>
|
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">购买须知</view>
|
||||||
<view class="">
|
|
||||||
<rich-text :nodes="teaRoomPackage.buy_details"></rich-text>
|
<view class="mt-30rpx" v-if="teaRoomPackage.room_name">
|
||||||
|
<view class="flex items-center mb-20rpx">
|
||||||
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_sybj.png`"></wd-img>
|
||||||
|
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">适用包间</view>
|
||||||
|
</view>
|
||||||
|
<rich-text :nodes="teaRoomPackage.room_name"></rich-text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mt-30rpx" v-if="teaRoomPackage.hour">
|
||||||
|
<view class="flex items-center mb-20rpx">
|
||||||
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_sysc.png`"></wd-img>
|
||||||
|
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">适用时长</view>
|
||||||
|
</view>
|
||||||
|
<view class="">{{ teaRoomPackage.hour }}小时</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mt-30rpx" v-if="teaRoomPackage.pl_number">
|
||||||
|
<view class="flex items-center mb-20rpx">
|
||||||
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_syrs.png`"></wd-img>
|
||||||
|
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">使用人数</view>
|
||||||
|
</view>
|
||||||
|
<view class="">{{ teaRoomPackage.pl_number }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mt-20rpx mb-24rpx">
|
||||||
|
<wd-gap height="2rpx" bgColor="#F6F7F9"></wd-gap>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mt-30rpx" v-if="teaRoomPackage.returd_details">
|
||||||
|
<view class="flex items-center mb-20rpx">
|
||||||
|
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_tgsm.png`"></wd-img>
|
||||||
|
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">退改说明</view>
|
||||||
|
</view>
|
||||||
|
<rich-text :nodes="teaRoomPackage.returd_details"></rich-text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -259,7 +283,7 @@
|
|||||||
import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
|
import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
|
||||||
import { getNext7Days, getTeaRoomBalance, createTeaRoomOrder } from '@/api/tea-room'
|
import { getNext7Days, getTeaRoomBalance, createTeaRoomOrder } from '@/api/tea-room'
|
||||||
import { CouponType } from '@/utils/coupon'
|
import { CouponType } from '@/utils/coupon'
|
||||||
import { router, toTimes, toPlus, toMinus } from '@/utils/tools'
|
import { router, toTimes, toPlus, toMinus, randomLabelColor } from '@/utils/tools'
|
||||||
import type { IUserInfoVo } from '@/api/types/login'
|
import type { IUserInfoVo } from '@/api/types/login'
|
||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import { getTeaRoomDetail, createTeaRoomPackageOrder, getTeaRoomPackageDetail, calculateTeaRoomPrice } from '@/api/tea-room'
|
import { getTeaRoomDetail, createTeaRoomPackageOrder, getTeaRoomPackageDetail, calculateTeaRoomPrice } from '@/api/tea-room'
|
||||||
@ -268,6 +292,13 @@
|
|||||||
import { getUserInfo } from '@/api/user'
|
import { getUserInfo } from '@/api/user'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
|
||||||
|
// 获取当前年月日,格式:YYYY-MM-DD
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
const currentDate = `${year}-${month}-${day}`;
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userInfo = ref<IUserInfoVo>(null)
|
const userInfo = ref<IUserInfoVo>(null)
|
||||||
@ -276,30 +307,6 @@
|
|||||||
const current = ref<number>(0)
|
const current = ref<number>(0)
|
||||||
const html: string = '<p>这里是富文本内容,需要后台传递</p>'
|
const html: string = '<p>这里是富文本内容,需要后台传递</p>'
|
||||||
const isGroupBuying = ref<boolean>(false)// 是否是团购套餐
|
const isGroupBuying = ref<boolean>(false)// 是否是团购套餐
|
||||||
const pay = ref<number>(1) // 支付方式
|
|
||||||
const payList = ref<Array<any>>([
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '平台余额',
|
|
||||||
icon: `${OSS}icon/icon_platform_balance.png`,
|
|
||||||
balance: 0,
|
|
||||||
value: 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '门店余额',
|
|
||||||
icon: `${OSS}icon/icon_store_balance.png`,
|
|
||||||
balance: 0,
|
|
||||||
value: 2
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '微信支付',
|
|
||||||
icon: `${OSS}icon/icon_weichat.png`,
|
|
||||||
balance: 0,
|
|
||||||
value: 3
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
// 选择预定时间
|
// 选择预定时间
|
||||||
const showBookTimePopup = ref<boolean>(false)
|
const showBookTimePopup = ref<boolean>(false)
|
||||||
@ -308,6 +315,10 @@
|
|||||||
time: []
|
time: []
|
||||||
})
|
})
|
||||||
const reserveTime = ref<Array<any>>([])
|
const reserveTime = ref<Array<any>>([])
|
||||||
|
const timeSlots = ref<Array<string>>([]) // 连续选择的预约时间
|
||||||
|
const dayTitle = ref<string>('') // 周三03/18
|
||||||
|
const dayTime = ref<string>('') // 2024-03-18
|
||||||
|
const dayHours = ref<string>('') // 预定时长00:00,00:30
|
||||||
|
|
||||||
// 计算费用明细 service(服务费) coupon(优惠券) discount(会员优惠) totalDiscount(总优惠) total(总费用) groupCoupon(团购券)
|
// 计算费用明细 service(服务费) coupon(优惠券) discount(会员优惠) totalDiscount(总优惠) total(总费用) groupCoupon(团购券)
|
||||||
const bill = ref<{service: any, discount:number, totalDiscount: number, coupon: number, groupCoupon: number, total: number}>({
|
const bill = ref<{service: any, discount:number, totalDiscount: number, coupon: number, groupCoupon: number, total: number}>({
|
||||||
@ -335,7 +346,11 @@
|
|||||||
// 包间内容
|
// 包间内容
|
||||||
const storeId = ref<number>(0) // 门店ID
|
const storeId = ref<number>(0) // 门店ID
|
||||||
const id = ref<number>(0) // id
|
const id = ref<number>(0) // id
|
||||||
const teaRoom = ref<any>({})
|
const teaRoom = ref<any>({
|
||||||
|
order: {
|
||||||
|
hours: 0
|
||||||
|
}
|
||||||
|
})
|
||||||
const teaRoomPrice = ref<number>(0)
|
const teaRoomPrice = ref<number>(0)
|
||||||
|
|
||||||
// 门店余额
|
// 门店余额
|
||||||
@ -351,14 +366,17 @@
|
|||||||
// 套餐
|
// 套餐
|
||||||
const teaRoomPackage = ref<any>({})
|
const teaRoomPackage = ref<any>({})
|
||||||
|
|
||||||
|
// 页面类型
|
||||||
|
const pageType = ref<string>('')
|
||||||
|
|
||||||
onLoad((args) => {
|
onLoad((args) => {
|
||||||
storeId.value = Number(args.storeId)
|
storeId.value = Number(args.storeId)
|
||||||
id.value = Number(args.id)
|
id.value = Number(args.id) // 在茶室下这个id是包间ID,在团购下是套餐ID
|
||||||
teaRoomPrice.value = Number(args.price) || 0
|
teaRoomPrice.value = Number(args.price) || 0
|
||||||
|
pageType.value = args.type || ''
|
||||||
|
|
||||||
if (args.type == ReserveServiceCategory.GroupBuying) {
|
if (args.type == ReserveServiceCategory.GroupBuying) {
|
||||||
isGroupBuying.value = true
|
isGroupBuying.value = true
|
||||||
pay.value = 3
|
|
||||||
Detail.handleInitGroupBuying()
|
Detail.handleInitGroupBuying()
|
||||||
}
|
}
|
||||||
Detail.handleInitReserveRoom()
|
Detail.handleInitReserveRoom()
|
||||||
@ -382,14 +400,20 @@
|
|||||||
id: storeId.value,
|
id: storeId.value,
|
||||||
latitude: uni.getStorageSync('latitude'),
|
latitude: uni.getStorageSync('latitude'),
|
||||||
longitude: uni.getStorageSync('longitude'),
|
longitude: uni.getStorageSync('longitude'),
|
||||||
user_id: userInfo.value.id || 0
|
user_id: userInfo.value.id || 0,
|
||||||
|
room_id: id.value
|
||||||
})
|
})
|
||||||
teaRoom.value = res.details
|
teaRoom.value = res.details
|
||||||
swiperList.value = teaRoom.value.img_arr
|
if (pageType.value == ReserveServiceCategory.ReserveRoom) {
|
||||||
|
swiperList.value = [teaRoom.value.image]
|
||||||
|
|
||||||
|
// 预定时间
|
||||||
|
const next7 = await getNext7Days(id.value, currentDate)
|
||||||
|
// disabled = 0 可预约 1不可逾越
|
||||||
|
Object.assign(sevenDay, next7.data)
|
||||||
|
Object.assign(sevenDay, {minimum_time: teaRoom.value.room.hours})
|
||||||
|
}
|
||||||
|
|
||||||
// 预定时间
|
|
||||||
const next7 = await getNext7Days()
|
|
||||||
Object.assign(sevenDay, next7)
|
|
||||||
|
|
||||||
// 获取门店余额
|
// 获取门店余额
|
||||||
const balance = await getTeaRoomBalance({ store_id: storeId.value })
|
const balance = await getTeaRoomBalance({ store_id: storeId.value })
|
||||||
@ -402,6 +426,9 @@
|
|||||||
handleInitGroupBuying: async () => {
|
handleInitGroupBuying: async () => {
|
||||||
const res = await getTeaRoomPackageDetail({ id: id.value })
|
const res = await getTeaRoomPackageDetail({ id: id.value })
|
||||||
teaRoomPackage.value = res.details
|
teaRoomPackage.value = res.details
|
||||||
|
if (pageType.value == ReserveServiceCategory.GroupBuying) {
|
||||||
|
swiperList.value = teaRoomPackage.value.img
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -409,16 +436,22 @@
|
|||||||
*/
|
*/
|
||||||
handleChooseReserveTime: (params: any) => {
|
handleChooseReserveTime: (params: any) => {
|
||||||
reserveTime.value = params
|
reserveTime.value = params
|
||||||
|
console.log("🚀 ~ params:", params)
|
||||||
|
|
||||||
|
timeSlots.value = params.selectedTimestamps
|
||||||
|
dayTitle.value = params.dayTitle
|
||||||
|
dayTime.value = params.dayTime
|
||||||
|
const times = params.selectedTime.map(item => {
|
||||||
|
return item.time
|
||||||
|
}).join(',')
|
||||||
|
dayHours.value = times
|
||||||
|
|
||||||
bill.value.service = {
|
bill.value.service = {
|
||||||
total: 0,
|
total: 0,
|
||||||
unitPrice: 0,
|
unitPrice: 0,
|
||||||
num: params[3],
|
num: params.countSelectedTime,
|
||||||
startTime: params[2][0],
|
startHour: params.selectedTime[0].time,
|
||||||
endTime: params[2][params[2].length - 1],
|
endHour: params.selectedTime[params.selectedTime.length - 1].time
|
||||||
dayTime: params[0],
|
|
||||||
startHour: params[1][0],
|
|
||||||
endHour: params[1][params[1].length - 1]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Detail.handleCalculateTeaRoomPrice()
|
Detail.handleCalculateTeaRoomPrice()
|
||||||
@ -452,15 +485,11 @@
|
|||||||
router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&numbers=${count}&type=${type}&storeId=${storeId.value}`)
|
router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&numbers=${count}&type=${type}&storeId=${storeId.value}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 选择支付方式
|
|
||||||
handleGetPayValue: (value: number) => {
|
|
||||||
pay.value = value
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交订单
|
* 提交订单
|
||||||
*/
|
*/
|
||||||
handleSubmitOrder: async () => {
|
handleSubmitOrder: async () => {
|
||||||
|
|
||||||
// 只有预定茶室才会选择时间
|
// 只有预定茶室才会选择时间
|
||||||
if (!isGroupBuying.value && bill.value.service.num == 0) {
|
if (!isGroupBuying.value && bill.value.service.num == 0) {
|
||||||
toast.info('请选择预定时间')
|
toast.info('请选择预定时间')
|
||||||
@ -475,21 +504,24 @@
|
|||||||
let res: any = null
|
let res: any = null
|
||||||
if (isGroupBuying.value) {
|
if (isGroupBuying.value) {
|
||||||
res = await createTeaRoomPackageOrder({
|
res = await createTeaRoomPackageOrder({
|
||||||
group_id: id.value
|
group_id: id.value,
|
||||||
|
room_id: 0
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
res = await createTeaRoomOrder({
|
const params = {
|
||||||
store_id: storeId.value,
|
store_id: storeId.value,
|
||||||
room_id: id.value,
|
room_id: id.value,
|
||||||
day_time: bill.value.service.dayTime,
|
day_title: dayTitle.value,
|
||||||
|
day_time: dayTime.value,
|
||||||
start_time: bill.value.service.startHour,
|
start_time: bill.value.service.startHour,
|
||||||
end_time: bill.value.service.endHour,
|
end_time: bill.value.service.endHour,
|
||||||
user_coupon_id: selectedCoupon.value.id || 0,
|
user_coupon_id: selectedCoupon.value.id || 0,
|
||||||
hours: bill.value.service.num,
|
hours: bill.value.service.num,
|
||||||
group_coupon_id: selectedGroupCoupon.value.id || 0
|
group_coupon_id: selectedGroupCoupon.value.id || 0,
|
||||||
})
|
timeslot: timeSlots.value
|
||||||
|
}
|
||||||
|
res = await createTeaRoomOrder(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
|
||||||
// 支付后的处理
|
// 支付后的处理
|
||||||
@ -540,7 +572,7 @@
|
|||||||
bill.value.totalDiscount = res.details.discount_all_price // 总优惠
|
bill.value.totalDiscount = res.details.discount_all_price // 总优惠
|
||||||
bill.value.groupCoupon = res.details.group_price // 团购优惠
|
bill.value.groupCoupon = res.details.group_price // 团购优惠
|
||||||
bill.value.total = res.details.order_amount // 订单金额
|
bill.value.total = res.details.order_amount // 订单金额
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
<view @click="Room.handleToRecharge">
|
<view @click="Room.handleToRecharge">
|
||||||
<recharge-btn name="充值"></recharge-btn>
|
<recharge-btn name="充值"></recharge-btn>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-24rpx text-[#818CA9] mt-18rpx">{{ teaRoom.rechange_times }} 分钟前有人充值</view>
|
<!-- <view class="text-24rpx text-[#818CA9] mt-18rpx">{{ teaRoom.rechange_times }} 分钟前有人充值</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-26rpx">
|
<view class="mt-26rpx">
|
||||||
@ -80,12 +80,29 @@
|
|||||||
<wd-gap bg-color="#F6F7F9" height="20rpx"></wd-gap>
|
<wd-gap bg-color="#F6F7F9" height="20rpx"></wd-gap>
|
||||||
</view>
|
</view>
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" @change="Room.handleChangeTab" :lazy="false">
|
<wd-tabs ref="tabsRef" v-model="tab" swipeable slidable="always" @change="Room.handleChangeTab" :lazy="false" :duration="0">
|
||||||
<wd-tab title="茶室预定" v-if="storeType != 2"></wd-tab>
|
<wd-tab title="茶室预定" v-if="storeType != 2"></wd-tab>
|
||||||
<wd-tab title="团购套餐"></wd-tab>
|
<wd-tab title="团购套餐"></wd-tab>
|
||||||
|
<wd-tab title="抖音兑换" v-if="storeType != 2"></wd-tab>
|
||||||
</wd-tabs>
|
</wd-tabs>
|
||||||
|
|
||||||
<view class="mx-30rpx mt-34rpx">
|
<view class="mx-30rpx mt-34rpx">
|
||||||
|
<view class="text-24rpx flex items-center justify-end" v-if="storeType != 2">
|
||||||
|
<view class="flex items-center mr-12rpx">
|
||||||
|
<view class="bg-[#C9C9C9] w-20rpx h-20rpx rounded-10rpx mr-10rpx"></view>
|
||||||
|
<view>过期</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flex items-center mr-12rpx">
|
||||||
|
<view class="bg-[#4C9F44] w-20rpx h-20rpx rounded-10rpx mr-10rpx"></view>
|
||||||
|
<view>可预约</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flex items-center mr-12rpx">
|
||||||
|
<view class="bg-[#F55726] w-20rpx h-20rpx rounded-10rpx mr-10rpx"></view>
|
||||||
|
<view>已预约</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<mescroll-body @init="mescrollInit" @down="downCallback" :down="downOption" :up="upOption" @up="Room.upCallback">
|
<mescroll-body @init="mescrollInit" @down="downCallback" :down="downOption" :up="upOption" @up="Room.upCallback">
|
||||||
<room-list :is-reserve="tabIndexs === 0" :is-group-buying="tabIndexs === 1" :list="list"></room-list>
|
<room-list :is-reserve="tabIndexs === 0" :is-group-buying="tabIndexs === 1" :list="list"></room-list>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
@ -123,11 +140,7 @@
|
|||||||
const rightPadding = inject('capsuleOffset')
|
const rightPadding = inject('capsuleOffset')
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
|
||||||
const swiperList = ref<string[]>([
|
const swiperList = ref<string[]>([])
|
||||||
`${OSS}images/banner1.png`,
|
|
||||||
`${OSS}images/banner1.png`,
|
|
||||||
`${OSS}images/banner1.png`
|
|
||||||
])
|
|
||||||
const current = ref<number>(0)
|
const current = ref<number>(0)
|
||||||
|
|
||||||
// 茶室ID
|
// 茶室ID
|
||||||
@ -139,6 +152,7 @@
|
|||||||
|
|
||||||
// tab
|
// tab
|
||||||
const tab = ref<number>(0)
|
const tab = ref<number>(0)
|
||||||
|
const tabsRef = ref()
|
||||||
|
|
||||||
// 弹窗
|
// 弹窗
|
||||||
const showAction = ref<boolean>(false)
|
const showAction = ref<boolean>(false)
|
||||||
@ -159,6 +173,15 @@
|
|||||||
const list = ref<Array<any>>([])
|
const list = ref<Array<any>>([])
|
||||||
const tabIndexs = ref<number>(0)
|
const tabIndexs = ref<number>(0)
|
||||||
|
|
||||||
|
// 随机颜色列表
|
||||||
|
const tagColors = ['#40AE36', '#F55726']
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
// 刷新茶室详情
|
||||||
|
list.value = []
|
||||||
|
getMescroll().resetUpScroll()
|
||||||
|
})
|
||||||
|
|
||||||
onLoad((args) => {
|
onLoad((args) => {
|
||||||
console.log("🚀 ~ args:", uni.getStorageSync('latitude'), uni.getStorageSync('longitude'))
|
console.log("🚀 ~ args:", uni.getStorageSync('latitude'), uni.getStorageSync('longitude'))
|
||||||
if (args.id) {
|
if (args.id) {
|
||||||
@ -227,7 +250,7 @@
|
|||||||
teaRoom.value = res.details
|
teaRoom.value = res.details
|
||||||
storeType.value = teaRoom.value.operation_type
|
storeType.value = teaRoom.value.operation_type
|
||||||
|
|
||||||
swiperList.value = teaRoom.value.img_arr
|
swiperList.value = teaRoom.value.image_arr
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,6 +340,23 @@
|
|||||||
* tab切换获取index
|
* tab切换获取index
|
||||||
*/
|
*/
|
||||||
handleChangeTab: (item: { index: number }) => {
|
handleChangeTab: (item: { index: number }) => {
|
||||||
|
console.log("🚀 ~ item.index:", item.index)
|
||||||
|
if (item.index == 2) {
|
||||||
|
uni.showLoading({ title: '跳转中...' })
|
||||||
|
|
||||||
|
// 直营店抖音兑换,强制切回第一个tab
|
||||||
|
nextTick(() => {
|
||||||
|
if (tabsRef.value && typeof tabsRef.value.setActive === 'function') {
|
||||||
|
tabsRef.value.setActive(0, false, true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tab.value = 0
|
||||||
|
tabIndexs.value = 0
|
||||||
|
|
||||||
|
router.navigateTo(`/bundle/order/douyin/excharge?storeId=${teaRoomId.value}`, 200)
|
||||||
|
uni.hideLoading()
|
||||||
|
return
|
||||||
|
}
|
||||||
tabIndexs.value = item.index
|
tabIndexs.value = item.index
|
||||||
list.value = []
|
list.value = []
|
||||||
getMescroll().resetUpScroll()
|
getMescroll().resetUpScroll()
|
||||||
|
|||||||
@ -31,11 +31,6 @@
|
|||||||
<wd-img width="50rpx" height="50rpx" :src="`${OSS}${item.icon}`"></wd-img>
|
<wd-img width="50rpx" height="50rpx" :src="`${OSS}${item.icon}`"></wd-img>
|
||||||
<view class="ml-20rpx text-30rpx text-[#303133] leading-42rpx">{{ item.name }}</view>
|
<view class="ml-20rpx text-30rpx text-[#303133] leading-42rpx">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center">
|
|
||||||
<wd-radio :value="item.value">
|
|
||||||
<view class="text-[#303133] text-26rpx leading-36rpx mr-20rpx">可用202.22</view>
|
|
||||||
</wd-radio>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</wd-radio-group>
|
</wd-radio-group>
|
||||||
@ -43,7 +38,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 推广方式 -->
|
<!-- 推广方式 -->
|
||||||
<view class="mt-60rpx">
|
<!-- <view class="mt-60rpx">
|
||||||
<view class="mx-30rpx text-32rpx leading-44rpx text-[#303133]">推广方式</view>
|
<view class="mx-30rpx text-32rpx leading-44rpx text-[#303133]">推广方式</view>
|
||||||
<view class="bg-white rounded-16rpx py-26rpx mt-28rpx pay-tabs">
|
<view class="bg-white rounded-16rpx py-26rpx mt-28rpx pay-tabs">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always">
|
<wd-tabs v-model="tab" swipeable slidable="always">
|
||||||
@ -73,7 +68,7 @@
|
|||||||
</wd-tab>
|
</wd-tab>
|
||||||
</wd-tabs>
|
</wd-tabs>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view class="fixed left-0 right-0 bottom-92rpx z-2 bg-[#4C9F44] text-[#fff] flex justify-center items-center h-90rpx rounded-8rpx mx-60rpx" @click="buy.handleBuyVip">
|
<view class="fixed left-0 right-0 bottom-92rpx z-2 bg-[#4C9F44] text-[#fff] flex justify-center items-center h-90rpx rounded-8rpx mx-60rpx" @click="buy.handleBuyVip">
|
||||||
立即购买
|
立即购买
|
||||||
@ -114,6 +109,9 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { PayList, PayCategory, PayValue } from '@/utils/pay'
|
import { PayList, PayCategory, PayValue } from '@/utils/pay'
|
||||||
|
import { wechatPay } from '@/hooks/usePay'
|
||||||
|
import { prePay, balancePay } from '@/api/pay'
|
||||||
|
import { toast } from '@/utils/toast'
|
||||||
|
|
||||||
const pay = ref<number>(PayValue.WeChatPay) // 默认微信支付方式
|
const pay = ref<number>(PayValue.WeChatPay) // 默认微信支付方式
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
@ -141,10 +139,41 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 购买会员
|
// 购买会员
|
||||||
handleBuyVip: () => {
|
handleBuyVip: async () => {
|
||||||
uni.navigateTo({
|
uni.showLoading({ title: '支付中...' })
|
||||||
url: '/pages/notice/pay?type=vip'
|
try {
|
||||||
})
|
// 预支付
|
||||||
|
const pay = await prePay({
|
||||||
|
from: 'wx',
|
||||||
|
order_id: 0,
|
||||||
|
pay_way: 2,
|
||||||
|
order_source: 1, //订单来源:1-小程序; 2-h5; 3app
|
||||||
|
order_type: 3 // 0为茶艺师 1为茶室包间 2为茶室套餐
|
||||||
|
})
|
||||||
|
|
||||||
|
wechatPay(pay.pay.config).then((res) => {
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res === 'success') {
|
||||||
|
toast.success('支付成功')
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 800)
|
||||||
|
return
|
||||||
|
} else if (res === 'cancel') {
|
||||||
|
toast.info('已取消支付')
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
toast.info('支付失败,请重试')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
|
toast.info('支付失败,请重试')
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading()
|
||||||
|
toast.info('支付失败,请重试')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -36,9 +36,9 @@
|
|||||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133]">余额</view>
|
<view class="font-400 text-28rpx leading-40rpx text-[#303133]">余额</view>
|
||||||
<view class="flex justify-between items-center mt-24rpx">
|
<view class="flex justify-between items-center mt-24rpx">
|
||||||
<view>
|
<view>
|
||||||
<price-format color="#000" :first-size="48" :second-size="48" :subscript-size="28" :price="23.02"></price-format>
|
<price-format color="#000" :first-size="48" :second-size="48" :subscript-size="28" :price="userMoney"></price-format>
|
||||||
</view>
|
</view>
|
||||||
<view class="w-200rpx h-80rpx bg-[#4C9F44] rounded-8rpx font-bold text-28rpx leading-80rpx text-center text-[#fff]" @click="wallet.handleToRecharge">
|
<view class="w-200rpx h-80rpx bg-[#4C9F44] rounded-8rpx font-bold text-28rpx leading-80rpx text-center text-[#fff]" @click="Wallet.handleToRecharge">
|
||||||
充值
|
充值
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -53,7 +53,7 @@
|
|||||||
<view class="border-2rpx border-solid border-[#E5E5E5] w-196rpx h-56rpx flex justify-center items-center rounded-8rpx">
|
<view class="border-2rpx border-solid border-[#E5E5E5] w-196rpx h-56rpx flex justify-center items-center rounded-8rpx">
|
||||||
<view class="text-24rpx leading-34rpx text-[#606266] wall-date">
|
<view class="text-24rpx leading-34rpx text-[#606266] wall-date">
|
||||||
<!-- 2019年5月 -->
|
<!-- 2019年5月 -->
|
||||||
<wd-datetime-picker v-model="value" :maxDate="Date.now()" type="year-month" @confirm="wallet.handleConfirmDate"></wd-datetime-picker>
|
<wd-datetime-picker v-model="value" :maxDate="Date.now()" type="year-month" @confirm="Wallet.handleConfirmDate"></wd-datetime-picker>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<wd-icon name="fill-arrow-down" size="32rpx" color="#BFC2CC"></wd-icon>
|
<wd-icon name="fill-arrow-down" size="32rpx" color="#BFC2CC"></wd-icon>
|
||||||
@ -63,22 +63,23 @@
|
|||||||
|
|
||||||
<view>
|
<view>
|
||||||
<!-- 最后一个元素不显示border -->
|
<!-- 最后一个元素不显示border -->
|
||||||
<mescroll-body @init="mescrollInit" @down="downCallback" @up="wallet.upCallback" :up="upOption">
|
<mescroll-body @init="mescrollInit" @down="downCallback" @up="Wallet.upCallback" :up="upOption">
|
||||||
<view class="h-144rpx leading-144rpx mt-18rpx border-b border-b-solid border-b-[#E5E5E5] flex flex-col justify-center" @click="wallet.handleToBillDetail(item)" v-for="(item, index) in 5" :key="index">
|
<view
|
||||||
|
v-for="item in list" :key="item.id"
|
||||||
|
class="h-144rpx leading-144rpx mt-18rpx border-b border-b-solid border-b-[#E5E5E5] flex flex-col justify-center"
|
||||||
|
@click="Wallet.handleToBillDetail(item)">
|
||||||
<view class="text-28rpx leading-40rpx text-[#303133] flex justify-between items-center">
|
<view class="text-28rpx leading-40rpx text-[#303133] flex justify-between items-center">
|
||||||
<view>茶艺师预定</view>
|
<view>{{ item.remark }}</view>
|
||||||
<view>-402.33</view>
|
<view>{{ item.action == 1 ? '+' : '-' }}{{ item.amount }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-24rpx leading-34rpx text-[#909399] flex justify-between items-center mt-10rpx">
|
<view class="text-24rpx leading-34rpx text-[#909399] flex justify-between items-center mt-10rpx">
|
||||||
<view>2025-03-18 11:20</view>
|
<view>{{ item.create_time }}</view>
|
||||||
<view>余额24.55</view>
|
<view>余额{{ item.after_amount }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-body>
|
</mescroll-body>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -86,80 +87,83 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
import { getUserInfo, getUserMoneyLog } from '@/api/user'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
/* mescroll */
|
/* mescroll */
|
||||||
const upOption = reactive({
|
|
||||||
empty: {
|
|
||||||
icon : OSS + 'icon/icon_reserver_empty.png',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||||
|
const downOption = {
|
||||||
|
auto: true
|
||||||
|
}
|
||||||
|
const upOption = {
|
||||||
|
auto: true,
|
||||||
|
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
|
||||||
|
}
|
||||||
|
const list = ref<Array<any>>([]) // 茶室列表
|
||||||
|
const userMoney = ref<number>(0) // 用户余额
|
||||||
|
|
||||||
// 日期过滤
|
// 日期过滤
|
||||||
const value = ref<number>(Date.now())
|
const value = ref<number>(Date.now())
|
||||||
|
const selectTime = ref<string>('')
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
getUserInfo().then(res => {
|
||||||
|
userMoney.value = Number(res.user_money)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const wallet = {
|
const Wallet = {
|
||||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
/**
|
||||||
|
* 上拉加载
|
||||||
|
* @param mescroll
|
||||||
|
*/
|
||||||
upCallback: (mescroll) => {
|
upCallback: (mescroll) => {
|
||||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
const filter = {
|
||||||
// list({
|
page: mescroll.num,
|
||||||
// page: mescroll.num,
|
size: mescroll.size,
|
||||||
// size: mescroll.size
|
month: selectTime.value
|
||||||
// }).then((res: { list: Array<any>, totalPages: Number }) => {
|
}
|
||||||
// const curPageData = res.list || [] // 当前页数据
|
|
||||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
|
||||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
|
||||||
|
|
||||||
// console.log("🚀 ~ goods:", goods)
|
getUserMoneyLog(filter).then((res) => {
|
||||||
|
const curPageData = res.list || [] // 当前页数据
|
||||||
// mescroll.endByPage(curPageData.length, res.totalPages); //必传参数(当前页的数据个数, 总页数)
|
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||||
|
list.value = list.value.concat(curPageData) //追加新数据
|
||||||
// }).catch(() => {
|
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||||
// mescroll.endErr(); // 请求失败, 结束加载
|
}).catch(() => {
|
||||||
// })
|
mescroll.endErr() // 请求失败, 结束加载
|
||||||
// apiGoods(mescroll.num, mescroll.size).then(res=>{
|
})
|
||||||
// const curPageData = res.list || [] // 当前页数据
|
|
||||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
|
||||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
|
||||||
// //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
|
||||||
// //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
|
|
||||||
|
|
||||||
// //方法一(推荐): 后台接口有返回列表的总页数 totalPage
|
|
||||||
// //mescroll.endByPage(curPageData.length, totalPage); //必传参数(当前页的数据个数, 总页数)
|
|
||||||
|
|
||||||
// //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
|
|
||||||
// //mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
|
|
||||||
|
|
||||||
// //方法三(推荐): 您有其他方式知道是否有下一页 hasNext
|
|
||||||
// //mescroll.endSuccess(curPageData.length, hasNext); //必传参数(当前页的数据个数, 是否有下一页true/false)
|
|
||||||
|
|
||||||
// //方法四 (不推荐),会存在一个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据当前页的数据个数判断,则需翻到第三页才会知道无更多数据.
|
|
||||||
// mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载
|
|
||||||
// }).catch(()=>{
|
|
||||||
mescroll.endErr(); // 请求失败, 结束加载
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 确认日期-
|
/**
|
||||||
|
* 日期筛选
|
||||||
|
* @param date
|
||||||
|
*/
|
||||||
handleConfirmDate: (date: {value: number}) => {
|
handleConfirmDate: (date: {value: number}) => {
|
||||||
const d = new Date(date.value)
|
const d = new Date(date.value)
|
||||||
console.log("🚀 ~ d:", d)
|
|
||||||
const year = d.getFullYear()
|
const year = d.getFullYear()
|
||||||
const month = d.getMonth() + 1
|
const month = d.getMonth() + 1
|
||||||
console.log(`${year}年${month}月`);
|
selectTime.value = `${year}-${month < 10 ? '0' + month : month}`
|
||||||
|
|
||||||
|
// 切换tab时,重置当前的mescroll
|
||||||
|
list.value = []
|
||||||
|
getMescroll().resetUpScroll();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 去充值
|
/**
|
||||||
|
* 去充值
|
||||||
|
*/
|
||||||
handleToRecharge: () => {
|
handleToRecharge: () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/bundle/wallet/recharge'
|
url: '/bundle/wallet/recharge'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转对应账单详情
|
/**
|
||||||
|
* 跳转对应账单详情
|
||||||
|
*/
|
||||||
handleToBillDetail: (id: number) => {
|
handleToBillDetail: (id: number) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/bundle/wallet/bill?id=${id}`
|
url: `/bundle/wallet/bill?id=${id}`
|
||||||
|
|||||||
@ -9,45 +9,44 @@
|
|||||||
<view class="">
|
<view class="">
|
||||||
<view class="booking-time">
|
<view class="booking-time">
|
||||||
<wd-tabs v-model="selectedDay" color="#4C9F44" @click="BookingTime.handleChangeTimeTab">
|
<wd-tabs v-model="selectedDay" color="#4C9F44" @click="BookingTime.handleChangeTimeTab">
|
||||||
<block v-for="item in day.time" :key="item">
|
<scroll-view scroll-y class="!h-500rpx pb-100rpx">
|
||||||
<scroll-view scroll-y>
|
<block v-for="item in day.time" :key="item">
|
||||||
<wd-tab :title="`${item.display}`" :name="item.display">
|
<wd-tab :title="`${item.display}`" :name="item.display">
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="!h-500rpx mt-30rpx">
|
<view class=" mt-30rpx">
|
||||||
<view class="grid grid-cols-4 gap-x-20rpx gap-y-20rpx mx-30rpx">
|
<view class="grid grid-cols-4 gap-x-20rpx gap-y-20rpx mx-30rpx">
|
||||||
<view v-for="item2 in item.time_slots" :key="item2.start_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="h-72rpx rounded-16rpx flex items-center justify-center text-28rpx leading-40rpx"
|
||||||
:class="[
|
:class="[
|
||||||
item2.disabled == 0
|
item2.disabled == 1
|
||||||
? 'bg-[#F7F7F7] text-[#C9C9C9]' // 禁用高亮
|
? 'bg-[#F7F7F7] text-[#C9C9C9]' // 禁用高亮
|
||||||
: selectedTime.includes(item2.start_time)
|
: selectedTime.some(t => t.date === item.date && t.time === item2.start_time)
|
||||||
? 'bg-[#F1F8F0] text-[#4C9F44]' // 选中高亮
|
? 'bg-[#F1F8F0] text-[#4C9F44]' // 选中高亮
|
||||||
: 'bg-[#F7F7F7] text-[#303133]', // 可选高亮
|
: 'bg-[#F7F7F7] text-[#303133]', // 可选高亮
|
||||||
]" @click="item2.disabled == 1 && BookingTime.handleSelectTime(item2.start_time, item2.timestamp, item.time_slots)">
|
]" @click="item2.disabled == 0 && BookingTime.handleSelectTime(item2.start_time, item2.timestamp, item.time_slots, item.date, item.display)">
|
||||||
{{ item2.start_time }}
|
{{ item2.start_time }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="">
|
|
||||||
<view>
|
|
||||||
<wd-gap height="2rpx" bg-color="#E5E5E5"></wd-gap>
|
|
||||||
</view>
|
|
||||||
<view class="">
|
|
||||||
<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">
|
|
||||||
<text>确定</text>
|
|
||||||
<text v-if="countSelectedTime">({{countSelectedTime}}小时)</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</wd-tab>
|
</wd-tab>
|
||||||
</scroll-view>
|
</block>
|
||||||
</block>
|
</scroll-view>
|
||||||
</wd-tabs>
|
</wd-tabs>
|
||||||
|
<view class="">
|
||||||
|
<view>
|
||||||
|
<wd-gap height="2rpx" bg-color="#E5E5E5"></wd-gap>
|
||||||
|
</view>
|
||||||
|
<view class="">
|
||||||
|
<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">
|
||||||
|
<text>确定</text>
|
||||||
|
<text v-if="countSelectedTime">({{countSelectedTime}}小时)</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -78,61 +77,61 @@
|
|||||||
|
|
||||||
// 初始化时间
|
// 初始化时间
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
console.log("🚀 ~ day:", props.day)
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 日期相关 **/
|
/** 日期相关 **/
|
||||||
|
|
||||||
const days = ref<string[]>([])
|
const days = ref<string[]>([])
|
||||||
const selectedDay = ref<number>(0)
|
const selectedDay = ref<number>(0)
|
||||||
const selectedTime = ref<string[]>([])
|
// 支持跨天选择,结构为 { date, time, timestamp }
|
||||||
const selectedTimeStamp = ref<number[]>([])
|
const selectedTime = ref<Array<{ date: string, time: string, timestamp: number }>>([])
|
||||||
const countSelectedTime = ref<number>(0)
|
const countSelectedTime = ref<number>(0)
|
||||||
|
const selectTimeIndex = ref<number>(0) // 选择的时间tab索引
|
||||||
|
|
||||||
const BookingTime = {
|
const BookingTime = {
|
||||||
/**
|
/**
|
||||||
* 选择时间段逻辑
|
* 选择时间段逻辑,支持跨天
|
||||||
|
* @param time 选择的时间字符串 "HH:MM"
|
||||||
|
* @param timestamp 选择的时间戳
|
||||||
|
* @param timeSlots 当前日期的所有时间段
|
||||||
|
* @param date 当前选择的日期 "2025-12-20"
|
||||||
|
* @param display 当前选择的日期展示 "12/20周六"
|
||||||
*/
|
*/
|
||||||
handleSelectTime: (time: string, timestamp: number, timeSlots: any[]) => {
|
handleSelectTime: (time: string, timestamp: number, timeSlots: any[], date: string, display: string) => {
|
||||||
// 获取当前tab下所有可选时间段(未禁用)
|
// 获取当前tab的日期
|
||||||
const availableSlots = timeSlots.filter(slot => slot.disabled == 1)
|
const currentDate = props.day.time[selectTimeIndex.value].date
|
||||||
const times = availableSlots.map(slot => slot.start_time)
|
const idx = selectedTime.value.findIndex(t => t.date === currentDate && t.time === time)
|
||||||
const timestamps = availableSlots.map(slot => slot.timestamp)
|
if (selectedTime.value.length === 0 || selectedTime.value.length > 1) {
|
||||||
const idx = times.indexOf(time)
|
// 第一次点击或已选2个及以上,重置为只选当前
|
||||||
|
selectedTime.value = [{ date: currentDate, time, timestamp }]
|
||||||
// 当前已选的索引
|
} else if (selectedTime.value.length === 1) {
|
||||||
const selectedIdxArr = selectedTime.value.map(t => times.indexOf(t)).sort((a, b) => a - b)
|
// 第二次点击,做范围选择
|
||||||
|
const first = selectedTime.value[0]
|
||||||
if (selectedTime.value.length === 0) {
|
const second = { date: currentDate, time, timestamp }
|
||||||
// 没有已选,直接选中
|
// 获取所有可选时间段(含跨天)
|
||||||
selectedTime.value = [time]
|
let allSlots = []
|
||||||
selectedTimeStamp.value = [timestamp]
|
props.day.time.forEach(dayItem => {
|
||||||
} else if (selectedTime.value.includes(time)) {
|
dayItem.time_slots.forEach(slot => {
|
||||||
// 如果点击的是已选的端点,则取消该端及之后/之前的所有时间
|
if (slot.disabled == 0) {
|
||||||
const minIdx = selectedIdxArr[0]
|
allSlots.push({ date: dayItem.date, time: slot.start_time, timestamp: slot.timestamp })
|
||||||
const maxIdx = selectedIdxArr[selectedIdxArr.length - 1]
|
}
|
||||||
if (idx === minIdx) {
|
})
|
||||||
// 取消左端
|
})
|
||||||
selectedTime.value = times.slice(idx + 1, maxIdx + 1)
|
// 按 timestamp 排序
|
||||||
selectedTimeStamp.value = timestamps.slice(idx + 1, maxIdx + 1)
|
allSlots = allSlots.sort((a, b) => a.timestamp - b.timestamp)
|
||||||
} else if (idx === maxIdx) {
|
// 找到 first 和 second 的索引
|
||||||
// 取消右端
|
const idx1 = allSlots.findIndex(t => t.date === first.date && t.time === first.time)
|
||||||
selectedTime.value = times.slice(minIdx, idx)
|
const idx2 = allSlots.findIndex(t => t.date === second.date && t.time === second.time)
|
||||||
selectedTimeStamp.value = timestamps.slice(minIdx, idx)
|
if (idx1 > -1 && idx2 > -1) {
|
||||||
|
const [start, end] = idx1 < idx2 ? [idx1, idx2] : [idx2, idx1]
|
||||||
|
selectedTime.value = allSlots.slice(start, end + 1)
|
||||||
} else {
|
} else {
|
||||||
// 如果点的是中间的,直接只保留左侧
|
// 找不到则只选当前
|
||||||
selectedTime.value = times.slice(minIdx, idx)
|
selectedTime.value = [second]
|
||||||
selectedTimeStamp.value = timestamps.slice(minIdx, idx)
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// 新选,补全区间
|
|
||||||
const allIdx = selectedIdxArr.concat(idx)
|
|
||||||
const minIdx = Math.min(...allIdx)
|
|
||||||
const maxIdx = Math.max(...allIdx)
|
|
||||||
selectedTime.value = times.slice(minIdx, maxIdx + 1)
|
|
||||||
selectedTimeStamp.value = timestamps.slice(minIdx, maxIdx + 1)
|
|
||||||
}
|
}
|
||||||
|
countSelectedTime.value = BookingTime.handleCalcContinuousHours(selectedTime.value.map(t => t.timestamp))
|
||||||
countSelectedTime.value = BookingTime.handleCalcContinuousHours(selectedTime.value)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 确认选择的时间
|
// 确认选择的时间
|
||||||
@ -146,45 +145,87 @@
|
|||||||
toast.info(props.day.minimum_time + '小时起订')
|
toast.info(props.day.minimum_time + '小时起订')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 返回所有已选的时间段(含日期、时间、timestamp)及所有timestamp数组
|
||||||
|
const sortedSelected = selectedTime.value.slice().sort((a, b) => a.timestamp - b.timestamp)
|
||||||
|
const timestamps = sortedSelected.map(t => t.timestamp)
|
||||||
|
|
||||||
|
// 格式化时间戳为 2025-12-18 和 周三03/18
|
||||||
|
function formatDate(ts: number) {
|
||||||
|
const d = new Date(ts * 1000)
|
||||||
|
const y = d.getFullYear()
|
||||||
|
const m = (d.getMonth() + 1).toString().padStart(2, '0')
|
||||||
|
const day = d.getDate().toString().padStart(2, '0')
|
||||||
|
return `${y}-${m}-${day}`
|
||||||
|
}
|
||||||
|
function formatWeek(ts: number) {
|
||||||
|
const d = new Date(ts * 1000)
|
||||||
|
const weekArr = ['周日','周一','周二','周三','周四','周五','周六']
|
||||||
|
const week = weekArr[d.getDay()]
|
||||||
|
const m = (d.getMonth() + 1).toString().padStart(2, '0')
|
||||||
|
const day = d.getDate().toString().padStart(2, '0')
|
||||||
|
return `${week}${m}/${day}`
|
||||||
|
}
|
||||||
|
const formattedStartDates = formatDate(timestamps[0])
|
||||||
|
const formattedEndtDates = formatDate(timestamps[timestamps.length - 1])
|
||||||
|
|
||||||
|
let dayTime = '' // 2025-12-18
|
||||||
|
if (formattedStartDates == formattedEndtDates) {
|
||||||
|
dayTime = formattedStartDates
|
||||||
|
} else {
|
||||||
|
dayTime = `${formattedStartDates} 至 ${formattedEndtDates}`
|
||||||
|
}
|
||||||
|
|
||||||
|
let dayTitle = '' // 周三03/18
|
||||||
|
const formattedStartWeeks = formatWeek(timestamps[0])
|
||||||
|
const formattedEndWeeks = formatWeek(timestamps[timestamps.length - 1])
|
||||||
|
if (formattedStartWeeks == formattedEndWeeks) {
|
||||||
|
dayTitle = formattedStartWeeks
|
||||||
|
} else {
|
||||||
|
dayTitle = `${formattedStartWeeks} 至 ${formattedEndWeeks}`
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
selectedDay: dayTime,
|
||||||
|
selectedTime: sortedSelected,
|
||||||
|
selectedTimestamps: timestamps,
|
||||||
|
dayTitle,
|
||||||
|
dayTime,
|
||||||
|
countSelectedTime: countSelectedTime.value
|
||||||
|
}
|
||||||
|
|
||||||
const data = [
|
|
||||||
selectedDay.value,
|
|
||||||
selectedTime.value.sort(),
|
|
||||||
selectedTimeStamp.value.sort(),
|
|
||||||
countSelectedTime.value
|
|
||||||
]
|
|
||||||
emit('selectedTime', data)
|
emit('selectedTime', data)
|
||||||
showPopup.value = false
|
showPopup.value = false
|
||||||
},
|
},
|
||||||
|
|
||||||
// 切换时间tab的时候把之前选中的时间重置
|
// 切换时间tab的时候不重置已选,实现跨天选择
|
||||||
handleChangeTimeTab: () => {
|
handleChangeTimeTab: (e: any) => {
|
||||||
selectedTime.value = []
|
selectTimeIndex.value = e.index
|
||||||
selectedTimeStamp.value = []
|
// 不重置 selectedTime
|
||||||
countSelectedTime.value = 0
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCalcContinuousHours(times: string[]): number {
|
// 计算所有连续区间的小时数总和,timestamps 为时间戳数组
|
||||||
if (times.length < 2) return 0
|
handleCalcContinuousHours(timestamps: number[]): number {
|
||||||
// 排序
|
if (timestamps.length < 1) return 0
|
||||||
const sorted = times.slice().sort()
|
const sorted = timestamps.slice().sort((a, b) => a - b)
|
||||||
let count = 0
|
let count = 0
|
||||||
|
let segment = 1
|
||||||
for (let i = 1; i < sorted.length; i++) {
|
for (let i = 1; i < sorted.length; i++) {
|
||||||
// 取前后时间的小时数
|
if (sorted[i] - sorted[i - 1] === 1800) {
|
||||||
const [h1, m1] = sorted[i - 1].split(':').map(Number)
|
segment++
|
||||||
const [h2, m2] = sorted[i].split(':').map(Number)
|
} else {
|
||||||
// 如果是连续的1小时(分钟相同且小时差1),则+1
|
count += (segment - 1) * 0.5
|
||||||
if (m1 === m2 && h2 - h1 === 1) {
|
segment = 1
|
||||||
count++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
count += (segment - 1) * 0.5
|
||||||
return count
|
return count
|
||||||
},
|
},
|
||||||
|
|
||||||
// 重置选择的时间
|
// 重置选择的时间
|
||||||
handleResetSelectedTime: () => {
|
handleResetSelectedTime: () => {
|
||||||
selectedTime.value = []
|
selectedTime.value = []
|
||||||
selectedTimeStamp.value = []
|
countSelectedTime.value = 0
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,12 +241,6 @@
|
|||||||
export default {}
|
export default {}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss">
|
||||||
.booking-time {
|
|
||||||
:deep() {
|
</style>
|
||||||
.wd-tabs__line {
|
|
||||||
background-color: #4C9F44 !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="pay-radio">
|
<view class="pay-radio relative">
|
||||||
<wd-radio-group v-model="pay" shape="dot" checked-color="#4C9F44" @change="Pay.handleChangePay">
|
<wd-radio-group v-model="pay" shape="dot" checked-color="#4C9F44" @change="Pay.handleChangePay">
|
||||||
<block v-for="(item, index) in PayList" :key="index">
|
<block v-for="(item, index) in PayList" :key="index">
|
||||||
<wd-radio :value="item.value">
|
<wd-radio :value="item.value" custom-class="!relative">
|
||||||
<view
|
<view
|
||||||
class="flex justify-between items-center pb-10rpx"
|
class="flex justify-between items-center pb-10rpx "
|
||||||
v-if="!(hidePlatformBalance && item.type === PayCategory.PlatformBalance) && !(hideStoreBalance && item.type === PayCategory.StoreBalance) && !(hideWechat && item.type === PayCategory.WeChatPay)"
|
v-if="!(hidePlatformBalance && item.type === PayCategory.PlatformBalance) && !(hideStoreBalance && item.type === PayCategory.StoreBalance) && !(hideWechat && item.type === PayCategory.WeChatPay)"
|
||||||
>
|
>
|
||||||
<view class="flex items-center mt-10rpx">
|
<view class="flex items-center mt-10rpx">
|
||||||
@ -12,8 +12,8 @@
|
|||||||
<view class="ml-20rpx text-30rpx text-[#303133] leading-42rpx">{{ item.name }}</view>
|
<view class="ml-20rpx text-30rpx text-[#303133] leading-42rpx">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="absolute right-0 top-6rpx right-60rpx" v-if="item.type == PayCategory.PlatformBalance">可用{{ userInfo.user_money }}</view>
|
<view class="absolute right-0 top-16rpx right-60rpx" v-if="item.type == PayCategory.PlatformBalance">可用{{ userInfo.user_money || 0 }}</view>
|
||||||
<view class="absolute right-0 top-6rpx right-60rpx" v-if="item.type == PayCategory.StoreBalance && storeMoney > 0">可用{{ storeMoney }}</view>
|
<view class="absolute right-0 top-16rpx right-60rpx" v-if="item.type == PayCategory.StoreBalance && storeMoney > 0">可用{{ storeMoney || 0 }}</view>
|
||||||
</wd-radio>
|
</wd-radio>
|
||||||
</block>
|
</block>
|
||||||
</wd-radio-group>
|
</wd-radio-group>
|
||||||
@ -53,6 +53,8 @@
|
|||||||
// 获取个人用户信息
|
// 获取个人用户信息
|
||||||
const userRes = await getUserInfo()
|
const userRes = await getUserInfo()
|
||||||
Object.assign(userInfo, userRes || {})
|
Object.assign(userInfo, userRes || {})
|
||||||
|
console.log("🚀 ~ userInfo:", userInfo)
|
||||||
|
console.log("🚀 ~ userInfo:", userInfo.user_money)
|
||||||
})
|
})
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
<view class="mt-22rpx">
|
<view class="mt-22rpx">
|
||||||
<view class="flex">
|
<view class="flex">
|
||||||
<view class="mr-28rpx">
|
<view class="mr-28rpx">
|
||||||
<wd-img width="200rpx" height="200rpx" :src="`${OSS}images/home/home_image5.png`"></wd-img>
|
<wd-img width="200rpx" height="200rpx" :src="order.img"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-1">
|
<view class="flex-1">
|
||||||
<view @click="ComboCard.handleToOrderDetail">
|
<view @click="ComboCard.handleToOrderDetail">
|
||||||
@ -122,7 +122,7 @@
|
|||||||
<view @click="ComboCard.handleToOrderDetail">
|
<view @click="ComboCard.handleToOrderDetail">
|
||||||
<view class="font-500 text-30rpx text-[#303133] leading-42rpx line-1 w-400rpx">{{ order.room_name }}</view>
|
<view class="font-500 text-30rpx text-[#303133] leading-42rpx line-1 w-400rpx">{{ order.room_name }}</view>
|
||||||
<view class="font-400 leading-36rpx text-26rpx text-[#606266] mt-34rpx">
|
<view class="font-400 leading-36rpx text-26rpx text-[#606266] mt-34rpx">
|
||||||
<view>预约时间:{{ order.day_time }} {{ order.start_time }}-{{ order.end_time }}</view>
|
<view>预约时间:{{ order.day_title }} {{ order.start_time }}-{{ order.end_time }}</view>
|
||||||
<view class="mt-18rpx">预约时长:{{ order.hours }}小时</view>
|
<view class="mt-18rpx">预约时长:{{ order.hours }}小时</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -11,11 +11,13 @@
|
|||||||
<view class="text-28rpx text-[#303133] leading-40rpx line-1 w-420rpx">{{ item.title }}</view>
|
<view class="text-28rpx text-[#303133] leading-40rpx line-1 w-420rpx">{{ item.title }}</view>
|
||||||
<view class="mt-22rpx flex">
|
<view class="mt-22rpx flex">
|
||||||
<template v-for="(label, labelIndex) in item.label" :key="labelIndex">
|
<template v-for="(label, labelIndex) in item.label" :key="labelIndex">
|
||||||
<view class="mr-20rpx flex items-start" v-if="label.category_id == 1">
|
<view class="mr-20rpx flex items-start">
|
||||||
<wd-tag color="#40AE36" bg-color="#40AE36" plain custom-class="!rounded-4rpx">文艺小清新</wd-tag>
|
<wd-tag
|
||||||
</view>
|
:color="randomLabelColor(labelIndex)"
|
||||||
<view class="flex items-start" v-if="label.category_id == 2">
|
:bg-color="randomLabelColor(labelIndex)"
|
||||||
<wd-tag color="#F55726" bg-color="#F55726" plain>全息投影</wd-tag>
|
plain
|
||||||
|
custom-class="!rounded-4rpx"
|
||||||
|
>{{ label.label_name }}</wd-tag>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
@ -26,7 +28,7 @@
|
|||||||
<wd-radio checked-color="#4C9F44" size='large' shape="dot" :value="index"></wd-radio>
|
<wd-radio checked-color="#4C9F44" size='large' shape="dot" :value="index"></wd-radio>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!isUseCoupon">
|
<view v-if="!isUseCoupon">
|
||||||
<view class="text-[#6A6363] text-22rpx leading-30rpx">已售 {{ item.buy_nums > 10 ? item.buy_nums + '+' : item.buy_nums }}</view>
|
<view class="text-[#6A6363] text-22rpx leading-30rpx">已售 {{ item.sold > 10 ? item.sold + '+' : item.sold }}</view>
|
||||||
<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"
|
class="w-104rpx h-52rpx mt-16rpx text-26rpx font-400 text-[#4C9F44] leading-52rpx text-center border-[2rpx] border-[#4C9F44] rounded-10rpx"
|
||||||
@click="RoomList.handleToPage(ReserveServiceCategory.ReserveRoom, item.store_id, item.id, item.price)">
|
@click="RoomList.handleToPage(ReserveServiceCategory.ReserveRoom, item.store_id, item.id, item.price)">
|
||||||
@ -67,11 +69,23 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex justify-around items-center ml-12rpx mt-18rpx" v-if="isReserve">
|
<view class="flex flex-wrap justify-between gap-4rpx ml-12rpx mt-18rpx" v-if="isReserve">
|
||||||
<view class="w-20rpx text-center" v-for="(timeItem, timeIndex) in item.room_time" :key="timeIndex">
|
<view
|
||||||
<view class="font-400 text-20rpx text-[#606266] leading-28rpx">{{ timeItem.value }}</view>
|
v-for="(group, groupIndex) in getTimeGroups(item.room_time)"
|
||||||
<!-- timeItem.status: 1可选 2不可选 -->
|
:key="groupIndex"
|
||||||
<view class="h-12rpx rounded-6rpx bg-[#4C9F44] mt-4rpx" :class="`${timeItem.status == 2 ? 'bg-[#C9C9C9]' : ''}`"></view>
|
class="flex flex-col items-center w-20rpx"
|
||||||
|
>
|
||||||
|
<view class="flex" style="width: 20rpx; height: 12rpx; border-radius: 6rpx; overflow: hidden;">
|
||||||
|
<view
|
||||||
|
style="width: 10rpx; height: 12rpx;"
|
||||||
|
:style="{ background: getTimeColor(group[0]) }"
|
||||||
|
></view>
|
||||||
|
<view
|
||||||
|
style="width: 10rpx; height: 12rpx;"
|
||||||
|
:style="{ background: getTimeColor(group[1]) }"
|
||||||
|
></view>
|
||||||
|
</view>
|
||||||
|
<view class="text-16rpx text-[#606266] mt-2rpx">{{ groupIndex }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="my-24rpx gap" v-if="index !== props.list.length - 1">
|
<view class="my-24rpx gap" v-if="index !== props.list.length - 1">
|
||||||
@ -90,7 +104,7 @@
|
|||||||
|
|
||||||
import PriceFormat from '@/components/PriceFormat.vue'
|
import PriceFormat from '@/components/PriceFormat.vue'
|
||||||
import {ReserveServiceCategory} from '@/utils/order'
|
import {ReserveServiceCategory} from '@/utils/order'
|
||||||
import { router } from '@/utils/tools'
|
import { router, randomLabelColor } from '@/utils/tools'
|
||||||
import { StoreType } from '@/utils/tea'
|
import { StoreType } from '@/utils/tea'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
@ -122,6 +136,24 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 将48个时间段两两分组
|
||||||
|
function getTimeGroups(roomTime: any[]) {
|
||||||
|
const groups = []
|
||||||
|
for (let i = 0; i < roomTime.length; i += 2) {
|
||||||
|
groups.push([roomTime[i], roomTime[i + 1]])
|
||||||
|
}
|
||||||
|
return groups
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据type返回对应颜色
|
||||||
|
function getTimeColor(timeItem: any) {
|
||||||
|
if (!timeItem) return '#F0F0F0'
|
||||||
|
if (timeItem.type == 1) return '#4C9F44' // 可预约
|
||||||
|
if (timeItem.type == 2) return '#C9C9C9' // 过期
|
||||||
|
if (timeItem.type == 3) return '#F55726' // 已预约
|
||||||
|
return '#F0F0F0'
|
||||||
|
}
|
||||||
|
|
||||||
const RoomList = {
|
const RoomList = {
|
||||||
/**
|
/**
|
||||||
* 跳转页面
|
* 跳转页面
|
||||||
@ -144,12 +176,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit('chooseCouponRoom', params)
|
emit('chooseCouponRoom', params)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleGetTimeGroups(roomTime: any[]) {
|
||||||
|
const groups = []
|
||||||
|
for (let i = 0; i < roomTime.length; i += 2) {
|
||||||
|
groups.push([roomTime[i], roomTime[i + 1]])
|
||||||
|
}
|
||||||
|
return groups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义emit事件
|
// 定义emit事件
|
||||||
const emit = defineEmits(['chooseCouponRoom'])
|
const emit = defineEmits(['chooseCouponRoom'])
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|||||||
@ -5,8 +5,8 @@ const LOCATION_DENY_INTERVAL = 60 * 60 * 1000 // 未授权定位,弹窗间隔1
|
|||||||
|
|
||||||
export const LOCATION_EXPIRE_KEY = 'location_expire_time' // 定位缓存KEY
|
export const LOCATION_EXPIRE_KEY = 'location_expire_time' // 定位缓存KEY
|
||||||
export const LOCATION_DEFAULT_CITY = '上海市' // 默认城市
|
export const LOCATION_DEFAULT_CITY = '上海市' // 默认城市
|
||||||
export const LOCATION_DEFAULT_LAT = 31.230393 // 上海经度
|
export const LOCATION_DEFAULT_LNG = 121.473629 // 上海经度
|
||||||
export const LOCATION_DEFAULT_LNG = 121.473629 // 上海纬度
|
export const LOCATION_DEFAULT_LAT = 31.230393 // 上海纬度
|
||||||
export const LOCATION_DENY_TIME_KEY = 'location_deny_time' // 未授权定位,重新授权时间KEY
|
export const LOCATION_DENY_TIME_KEY = 'location_deny_time' // 未授权定位,重新授权时间KEY
|
||||||
export const LOCATION_CITY_KEY = 'city' // 城市缓存KEY
|
export const LOCATION_CITY_KEY = 'city' // 城市缓存KEY
|
||||||
export const LOCATION_LAT_KEY = 'latitude' // 城市缓存KEY
|
export const LOCATION_LAT_KEY = 'latitude' // 城市缓存KEY
|
||||||
@ -33,50 +33,112 @@ export function handleSetLocationCacheHooks(lat: number, lng: number) {
|
|||||||
|
|
||||||
// 初始化经纬度
|
// 初始化经纬度
|
||||||
export async function handleEnsureLocationAuthHooks() {
|
export async function handleEnsureLocationAuthHooks() {
|
||||||
// 1. 检查缓存
|
const SEARCH_CONFIRM_KEY = 'search_nearby_confirmed'
|
||||||
if (handleCheckLocationCacheHooks()) {
|
const confirmed = uni.getStorageSync(SEARCH_CONFIRM_KEY)
|
||||||
|
|
||||||
|
// 1. 检查缓存和是否已确认搜索附近茶室
|
||||||
|
if (confirmed && handleCheckLocationCacheHooks()) {
|
||||||
const lat = uni.getStorageSync(LOCATION_LAT_KEY)
|
const lat = uni.getStorageSync(LOCATION_LAT_KEY)
|
||||||
const lng = uni.getStorageSync(LOCATION_LNG_KEY)
|
const lng = uni.getStorageSync(LOCATION_LNG_KEY)
|
||||||
if (lat && lng) return { lat, lng }
|
if (lat && lng) return { lat, lng }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取定位
|
// 2. 判断是否已弹过确认弹窗(授权后不再弹)
|
||||||
return new Promise<{ lat: number, lng: number, }>((resolve) => {
|
|
||||||
uni.authorize({
|
return new Promise<{ lat: number, lng: number }>((resolve) => {
|
||||||
scope: 'scope.userLocation',
|
if (confirmed) {
|
||||||
success() {
|
// 已确认过,直接走授权
|
||||||
uni.getLocation({
|
uni.authorize({
|
||||||
type: 'gcj02',
|
scope: 'scope.userLocation',
|
||||||
success(res) {
|
success() {
|
||||||
handleSetLocationCacheHooks(res.latitude, res.longitude)
|
uni.getLocation({
|
||||||
resolve({ lat: res.latitude, lng: res.longitude})
|
type: 'gcj02',
|
||||||
},
|
success(res) {
|
||||||
fail() {
|
handleSetLocationCacheHooks(res.latitude, res.longitude)
|
||||||
// 定位失败,返回默认上海
|
resolve({ lat: res.latitude, lng: res.longitude })
|
||||||
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
},
|
||||||
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG})
|
fail() {
|
||||||
}
|
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
})
|
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
||||||
},
|
|
||||||
fail() {
|
|
||||||
// 用户拒绝授权
|
|
||||||
if (shouldShowAuthModal()) {
|
|
||||||
uni.setStorageSync(LOCATION_DENY_TIME_KEY, Date.now())
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '需要获取您的地理位置,请授权定位服务',
|
|
||||||
showCancel: false,
|
|
||||||
success: () => {
|
|
||||||
// 可引导用户去设置页面
|
|
||||||
uni.openSetting({})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
fail() {
|
||||||
|
// 用户拒绝授权
|
||||||
|
if (shouldShowAuthModal()) {
|
||||||
|
uni.setStorageSync(LOCATION_DENY_TIME_KEY, Date.now())
|
||||||
|
uni.removeStorageSync(SEARCH_CONFIRM_KEY) // 授权失败,下次启动继续弹窗
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '需要获取您的地理位置,请授权定位服务',
|
||||||
|
showCancel: false,
|
||||||
|
success: () => {
|
||||||
|
uni.openSetting({})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
|
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
||||||
}
|
}
|
||||||
// 返回默认上海
|
})
|
||||||
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
} else {
|
||||||
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
// 未确认,弹窗
|
||||||
}
|
uni.showModal({
|
||||||
})
|
title: '提示',
|
||||||
|
content: '是否搜索附近茶室?',
|
||||||
|
showCancel: true,
|
||||||
|
confirmText: '是',
|
||||||
|
cancelText: '否',
|
||||||
|
success: (modalRes) => {
|
||||||
|
console.log("🚀 ~ handleEnsureLocationAuthHooks ~ modalRes:", modalRes)
|
||||||
|
if (modalRes.confirm) {
|
||||||
|
// 用户点击“是”,标记已确认,下次不再弹窗
|
||||||
|
uni.setStorageSync(SEARCH_CONFIRM_KEY, true)
|
||||||
|
uni.authorize({
|
||||||
|
scope: 'scope.userLocation',
|
||||||
|
success() {
|
||||||
|
uni.getLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
success(res) {
|
||||||
|
handleSetLocationCacheHooks(res.latitude, res.longitude)
|
||||||
|
resolve({ lat: res.latitude, lng: res.longitude })
|
||||||
|
},
|
||||||
|
fail() {
|
||||||
|
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
|
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail() {
|
||||||
|
// 用户拒绝授权
|
||||||
|
if (shouldShowAuthModal()) {
|
||||||
|
uni.setStorageSync(LOCATION_DENY_TIME_KEY, Date.now())
|
||||||
|
uni.removeStorageSync(SEARCH_CONFIRM_KEY) // 授权失败,下次启动继续弹窗
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '需要获取您的地理位置,请授权定位服务',
|
||||||
|
showCancel: false,
|
||||||
|
success: () => {
|
||||||
|
uni.openSetting({})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
|
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modalRes.cancel) {
|
||||||
|
// 用户点击“否”,直接返回默认上海
|
||||||
|
handleSetLocationCacheHooks(LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
|
console.log("🚀 ~ handleEnsureLocationAuthHooks ~ LOCATION_DEFAULT_LAT:", LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG)
|
||||||
|
|
||||||
|
resolve({ lat: LOCATION_DEFAULT_LAT, lng: LOCATION_DEFAULT_LNG })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
export function wxPay(opt) {
|
export function wechatPay(opt) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let params;
|
let params;
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
@ -27,7 +27,7 @@ export function wxPay(opt) {
|
|||||||
resolve('success');
|
resolve('success');
|
||||||
},
|
},
|
||||||
cancel: res => {
|
cancel: res => {
|
||||||
resolve('fail');
|
resolve('cancel');
|
||||||
},
|
},
|
||||||
fail: res => {
|
fail: res => {
|
||||||
resolve('fail');
|
resolve('fail');
|
||||||
|
|||||||
@ -54,7 +54,7 @@
|
|||||||
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
|
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
|
||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast'
|
||||||
import { router } from '@/utils/tools'
|
import { router } from '@/utils/tools'
|
||||||
import { PayValue } from '@/utils/pay'
|
import { PayValue, PayValueMap } from '@/utils/pay'
|
||||||
import { prePay, balancePay } from '@/api/pay'
|
import { prePay, balancePay } from '@/api/pay'
|
||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import type {IUserInfoVo } from '@/api/types/login'
|
import type {IUserInfoVo } from '@/api/types/login'
|
||||||
@ -139,7 +139,6 @@
|
|||||||
title.value = `茶室预定-${args.name}`
|
title.value = `茶室预定-${args.name}`
|
||||||
} else {
|
} else {
|
||||||
title.value = `茶室套餐购买-${args.name}`
|
title.value = `茶室套餐购买-${args.name}`
|
||||||
hidePlatformBalance.value = true // 隐藏平台余额支付
|
|
||||||
hideStoreBalance.value = true // 隐藏门店余额支付
|
hideStoreBalance.value = true // 隐藏门店余额支付
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,6 +217,7 @@
|
|||||||
// 获取支付方式
|
// 获取支付方式
|
||||||
handleGetPayValue: (value: number) => {
|
handleGetPayValue: (value: number) => {
|
||||||
pay.value = value
|
pay.value = value
|
||||||
|
console.log("🚀 ~ pay.value:", pay.value)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -234,18 +234,23 @@
|
|||||||
uni.showLoading({ title: '支付中...' })
|
uni.showLoading({ title: '支付中...' })
|
||||||
try {
|
try {
|
||||||
// 预支付
|
// 预支付
|
||||||
|
let ordeType = 1
|
||||||
|
if (isGroupBuying.value) {
|
||||||
|
ordeType = 2
|
||||||
|
}
|
||||||
|
|
||||||
const res1 = await prePay({
|
const res1 = await prePay({
|
||||||
from: isGroupBuying.value ? 'wx' : 'balance',
|
from: PayValueMap[pay.value],
|
||||||
order_id: orderId.value,
|
order_id: orderId.value,
|
||||||
pay_way: pay.value,
|
pay_way: pay.value,
|
||||||
order_source: 1, //订单来源:1-小程序; 2-h5; 3app
|
order_source: 1, //订单来源:1-小程序; 2-h5; 3app
|
||||||
order_type: 1 // 0为茶艺师 1为茶室包间
|
order_type: ordeType // 0为茶艺师 1为茶室包间 2为茶室套餐
|
||||||
})
|
})
|
||||||
|
|
||||||
// 余额支付(平台余额、门店余额)
|
// 余额支付(平台余额、门店余额)
|
||||||
if (pay.value == PayValue.PlatformBalance || pay.value == PayValue.StoreBalance) {
|
if (pay.value == PayValue.PlatformBalance || pay.value == PayValue.StoreBalance) {
|
||||||
await balancePay({
|
await balancePay({
|
||||||
id: res1.pay_id
|
id: res1.pay
|
||||||
})
|
})
|
||||||
} else if (pay.value == PayValue.WeChatPay) {
|
} else if (pay.value == PayValue.WeChatPay) {
|
||||||
// 微信支付
|
// 微信支付
|
||||||
|
|||||||
@ -198,15 +198,16 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
getHomeTeaStoreList(filter).then( res => {
|
getHomeTeaStoreList(filter).then( res => {
|
||||||
|
uni.hideLoading()
|
||||||
const curPageData = res.list || [] // 当前页数据
|
const curPageData = res.list || [] // 当前页数据
|
||||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||||
list.value = list.value.concat(curPageData) //追加新数据
|
list.value = list.value.concat(curPageData) //追加新数据
|
||||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
mescroll.endErr() // 请求失败, 结束加载
|
mescroll.endErr() // 请求失败, 结束加载
|
||||||
})
|
})
|
||||||
|
|
||||||
uni.hideLoading()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,13 @@
|
|||||||
// 服务协议条款
|
// 服务协议条款
|
||||||
const agree = ref<boolean>(false)
|
const agree = ref<boolean>(false)
|
||||||
|
|
||||||
|
const redirectUrl = ref<string>('')
|
||||||
|
|
||||||
|
onLoad((args) => {
|
||||||
|
console.log("🚀 ~ login args:", args)
|
||||||
|
redirectUrl.value = args.redirect || ''
|
||||||
|
})
|
||||||
|
|
||||||
const Login = {
|
const Login = {
|
||||||
// 获取手机号
|
// 获取手机号
|
||||||
handleLogin: async (e: object) => {
|
handleLogin: async (e: object) => {
|
||||||
@ -55,13 +62,27 @@
|
|||||||
toast.info('请同意服务协议和隐私政策')
|
toast.info('请同意服务协议和隐私政策')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const userStore = useUserStore()
|
uni.showLoading({
|
||||||
const res = await userStore.wxLogin()
|
title: '登录中...',
|
||||||
if (res) {
|
mask: true
|
||||||
toast.info('登录成功')
|
})
|
||||||
router.navigateBack(1, 500)
|
try {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const res = await userStore.wxLogin()
|
||||||
|
uni.hideLoading()
|
||||||
|
if (res) {
|
||||||
|
toast.info('登录成功')
|
||||||
|
if (redirectUrl.value) {
|
||||||
|
router.redirectTo(redirectUrl.value)
|
||||||
|
} else {
|
||||||
|
router.navigateBack(1, 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(error) {
|
||||||
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 手机登录
|
// 手机登录
|
||||||
|
|||||||
@ -34,10 +34,11 @@
|
|||||||
<wd-img width="36rpx" height="36rpx" mode="aspectFill" :src="`${OSS}icon/icon_crown.png`" round></wd-img>
|
<wd-img width="36rpx" height="36rpx" mode="aspectFill" :src="`${OSS}icon/icon_crown.png`" round></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<!-- 这里要根据用户身份显示不同的文字 -->
|
<!-- 这里要根据用户身份显示不同的文字 -->
|
||||||
<view class="text-24rpx text-[#675649] leading-34rpx flex items-center">茶址会员</view>
|
<view class="text-24rpx text-[#675649] leading-34rpx flex items-center">{{ isVip ? '茶址会员' : '品茶爱好者' }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="w-178rpx h-80rpx relative">
|
<!-- TODO 暂时隐藏 -->
|
||||||
|
<!-- <view class="w-178rpx h-80rpx relative">
|
||||||
<wd-img width="100%" height="100%" mode="aspectFill" :src="`${OSS}images/my/my_image2.png`"></wd-img>
|
<wd-img width="100%" height="100%" mode="aspectFill" :src="`${OSS}images/my/my_image2.png`"></wd-img>
|
||||||
<view class="absolute left-36rpx top-28rpx flex items-center" @click="My.handleShowPromoCode">
|
<view class="absolute left-36rpx top-28rpx flex items-center" @click="My.handleShowPromoCode">
|
||||||
<view class="flex items-center mr-8rpx">
|
<view class="flex items-center mr-8rpx">
|
||||||
@ -45,7 +46,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="font-bold text-[#fff] text-24rpx leading-34rpx mt--6rpx">推广码</view>
|
<view class="font-bold text-[#fff] text-24rpx leading-34rpx mt--6rpx">推广码</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -83,7 +84,7 @@
|
|||||||
<wd-img width="100%" height="100%" :src="`${OSS}icon/icon_vip.png`" mode="aspectFill"></wd-img>
|
<wd-img width="100%" height="100%" :src="`${OSS}icon/icon_vip.png`" mode="aspectFill"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center leading-34rpx" @click="router.navigateTo('/bundle/vip/benefits')">
|
<view class="flex items-center leading-34rpx" @click="router.navigateTo('/bundle/vip/benefits')">
|
||||||
<view class="font-400 text-24rpx ml-12rpx mr-20rpx text-[#EECC99]">{{ isLogin ? '会员到期时间' : '- -' }}</view>
|
<view class="font-400 text-24rpx ml-12rpx mr-20rpx text-[#EECC99]">{{ expireTime }}到期</view>
|
||||||
<view class="flex items-center mt-4rpx">
|
<view class="flex items-center mt-4rpx">
|
||||||
<wd-icon name="arrow-right" size="24rpx" color="#EECC99"></wd-icon>
|
<wd-icon name="arrow-right" size="24rpx" color="#EECC99"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
@ -92,20 +93,20 @@
|
|||||||
<view class="font-400 text-24rpx text-[#EECC99] leading-34rpx">会员预定茶室享受8折</view>
|
<view class="font-400 text-24rpx text-[#EECC99] leading-34rpx">会员预定茶室享受8折</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mx-40rpx">
|
<view class="mx-40rpx h-40rpx">
|
||||||
<wd-progress :percentage="60" hide-text color="#EECC99" custom-class="!my-10rpx"></wd-progress>
|
<!-- <wd-progress :percentage="60" hide-text color="#EECC99" custom-class="!my-10rpx"></wd-progress> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center justify-between mx-40rpx">
|
<view class="flex items-center justify-between mx-40rpx">
|
||||||
<view class="flex item-center leading-34rpx text-[#EECC99]">
|
<view class="flex item-center leading-34rpx text-[#EECC99]">
|
||||||
<view class="font-400 text-24rpx mr-18rpx">上月消费</view>
|
<view class="font-400 text-24rpx mr-18rpx">上月消费</view>
|
||||||
<view class="font-400 text-28rpx mr-18rpx">¥{{ isLogin ? '上月消费金额显示' : '- -' }}</view>
|
<view class="font-400 text-28rpx mr-18rpx">¥{{ user.last_month }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-400 text-24rpx text-[#D2D0D0] leading-34rpx">请尽快领取会员权益</view>
|
<!-- <view class="font-400 text-24rpx text-[#D2D0D0] leading-34rpx">请尽快领取会员权益</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-50rpx ml-24rpx">
|
<view class="mt-50rpx ml-24rpx">
|
||||||
<scroll-view class="w-[100%] whitespace-nowrap" :scroll-x="true" scroll-left="120">
|
<scroll-view class="w-[100%] whitespace-nowrap" :scroll-x="true" scroll-left="120">
|
||||||
<view class="scroll-item mr-20rpx" v-for="(item, index) in couponList" :key="index">
|
<view class="scroll-item mr-20rpx" v-for="(item, index) in couponList" :key="index">
|
||||||
<view class="font-bold text-22rpx text-[#AF6400] leading-32rpx mt-6rpx">茶室券</view>
|
<view class="font-bold text-22rpx text-[#AF6400] leading-32rpx mt-6rpx">{{ item.type_id == 1 ? '茶艺师券' : '茶室券' }}</view>
|
||||||
<view class="font-bold text-[#1C1C1D] leading-34rpx mt-8rpx">
|
<view class="font-bold text-[#1C1C1D] leading-34rpx mt-8rpx">
|
||||||
<text class="text-24rpx">¥</text>
|
<text class="text-24rpx">¥</text>
|
||||||
<text class="text-30rpx">{{ item.coupon_price }}</text>
|
<text class="text-30rpx">{{ item.coupon_price }}</text>
|
||||||
@ -124,9 +125,9 @@
|
|||||||
<view v-if="!isVip" class="mt-16rpx flex justify-center">
|
<view v-if="!isVip" class="mt-16rpx flex justify-center">
|
||||||
<view class="w-690rpx h-228rpx relative">
|
<view class="w-690rpx h-228rpx relative">
|
||||||
<wd-img width="100%" height="100%" :src="`${OSS}images/my/my_image4.png`" mode="aspectFill"></wd-img>
|
<wd-img width="100%" height="100%" :src="`${OSS}images/my/my_image4.png`" mode="aspectFill"></wd-img>
|
||||||
<view class="absolute top-76rpx left-30rpx text-30rpx leading-42rpx">
|
<view class="absolute top-76rpx left-30rpx text-30rpx leading-42rpx" @click="router.navigateTo('/bundle/vip/benefits')">
|
||||||
<view class="text-[#EDCE91]">会员可以享受预定折扣</view>
|
<view class="text-[#EDCE91]">会员可以享受预定折扣</view>
|
||||||
<view class="vip-btn text-[#251C1C] font-bold text-center mt-20rpx">立即成为会员</view>
|
<view class="vip-btn text-[#251C1C] font-bold text-center mt-20rpx w-244rpx h-56rpx text-center leading-56rpx rounded-26rpx">立即成为会员</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -244,7 +245,7 @@
|
|||||||
import { toast } from '@/utils/toast'
|
import { toast } from '@/utils/toast'
|
||||||
import { router } from '@/utils/tools'
|
import { router } from '@/utils/tools'
|
||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import { getUserInfo, getMyCoupon, claimMyCoupon } from '@/api/user'
|
import { getUserInfo, getMyCoupon, claimMyCoupon, getUserMember } from '@/api/user'
|
||||||
import type { IUserResult } from '@/api/types/user'
|
import type { IUserResult } from '@/api/types/user'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
@ -269,7 +270,8 @@
|
|||||||
member: 0,
|
member: 0,
|
||||||
mobile: "",
|
mobile: "",
|
||||||
user_money: "0.00",
|
user_money: "0.00",
|
||||||
version: ""
|
version: "",
|
||||||
|
last_month: 0
|
||||||
})
|
})
|
||||||
const isLogin = ref<boolean>(false)
|
const isLogin = ref<boolean>(false)
|
||||||
const isVip = ref<boolean>(true)
|
const isVip = ref<boolean>(true)
|
||||||
@ -308,6 +310,9 @@
|
|||||||
// 领取优惠券
|
// 领取优惠券
|
||||||
const couponList = ref<any[]>([])
|
const couponList = ref<any[]>([])
|
||||||
|
|
||||||
|
// 过期时间
|
||||||
|
const expireTime = ref<string>('')
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
isLogin.value = userStore.isLoggedIn
|
isLogin.value = userStore.isLoggedIn
|
||||||
@ -315,6 +320,11 @@
|
|||||||
// 获取用户详情信息接口
|
// 获取用户详情信息接口
|
||||||
getUserInfo().then(res => {
|
getUserInfo().then(res => {
|
||||||
user.value = res
|
user.value = res
|
||||||
|
if (res.member === 1) {
|
||||||
|
isVip.value = true
|
||||||
|
} else {
|
||||||
|
isVip.value = false
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Object.keys(user.value).forEach(key => {
|
Object.keys(user.value).forEach(key => {
|
||||||
@ -351,6 +361,11 @@
|
|||||||
couponList.value = Array.isArray(res) ? res : []
|
couponList.value = Array.isArray(res) ? res : []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取会员过期时间
|
||||||
|
getUserMember().then(res => {
|
||||||
|
expireTime.value = res.data.expiration_time
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -360,6 +375,9 @@
|
|||||||
await claimMyCoupon({id})
|
await claimMyCoupon({id})
|
||||||
toast.info('领取成功')
|
toast.info('领取成功')
|
||||||
My.handleInit()
|
My.handleInit()
|
||||||
|
getUserInfo().then(res => {
|
||||||
|
user.value = res
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到个人信息
|
// 跳转到个人信息
|
||||||
@ -433,4 +451,8 @@
|
|||||||
.service-badge {
|
.service-badge {
|
||||||
background: linear-gradient( 315deg, #F4C99A 0%, #FFE3BA 100%);
|
background: linear-gradient( 315deg, #F4C99A 0%, #FFE3BA 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vip-btn {
|
||||||
|
background: linear-gradient(180deg, #fff 0%, #F0BA6A 100%);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<wd-tabs v-model="tab" swipeable slidable="always" @change="Reserve.handleChangeTab" :lazy="false">
|
<wd-tabs v-model="tab" swipeable slidable="always" @change="Reserve.handleChangeTab" :lazy="false">
|
||||||
<wd-tab title="茶室预约"></wd-tab>
|
<wd-tab title="茶室预约"></wd-tab>
|
||||||
<wd-tab title="茶艺师预约"></wd-tab>
|
<!-- <wd-tab title="茶艺师预约"></wd-tab> -->
|
||||||
</wd-tabs>
|
</wd-tabs>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -259,7 +259,6 @@ export const TeaRoomOrderStatusValue: Record<TeaRoomOrderStatusText, string | nu
|
|||||||
[TeaRoomOrderStatusText.Cancelled]: 4,
|
[TeaRoomOrderStatusText.Cancelled]: 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 包间订单状态数字(根据UI图还缺已退款、待接单、售后中、售后完成)
|
// 包间订单状态数字(根据UI图还缺已退款、待接单、售后中、售后完成)
|
||||||
export enum TeaRoomPackageOrderStatus {
|
export enum TeaRoomPackageOrderStatus {
|
||||||
Pending = 0, // 待付款
|
Pending = 0, // 待付款
|
||||||
@ -286,7 +285,7 @@ export const TeaRoomPackageOrderStatusValue: Record<TeaRoomPackageOrderStatusTex
|
|||||||
[TeaRoomPackageOrderStatusText.Refunded]: 3,
|
[TeaRoomPackageOrderStatusText.Refunded]: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 状态内容映射
|
// 套餐订单状态内容映射
|
||||||
export const TeaRoomPackageOrderStatusTextValue: Record<TeaRoomPackageOrderStatus, any> = {
|
export const TeaRoomPackageOrderStatusTextValue: Record<TeaRoomPackageOrderStatus, any> = {
|
||||||
[TeaRoomPackageOrderStatus.Pending]: {
|
[TeaRoomPackageOrderStatus.Pending]: {
|
||||||
title: '待付款'
|
title: '待付款'
|
||||||
@ -301,3 +300,18 @@ export const TeaRoomPackageOrderStatusTextValue: Record<TeaRoomPackageOrderStatu
|
|||||||
title: '售后完成'
|
title: '售后完成'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 抖音订单状态文本
|
||||||
|
export enum DouYinOrderStatusText {
|
||||||
|
All = 'all', // 全部
|
||||||
|
ToUse = 'tousee', // 待使用
|
||||||
|
Used = 'used', // 已使用
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum DouYinOrderStatus {
|
||||||
|
Pending = 0, // 待付款
|
||||||
|
ToUse = 1, // 待使用
|
||||||
|
Used = 2, // 已使用
|
||||||
|
Refunded = 3, // 已退款
|
||||||
|
}
|
||||||
@ -20,6 +20,12 @@ export enum PayValue {
|
|||||||
StoreBalance = 3, // 门店余额
|
StoreBalance = 3, // 门店余额
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const PayValueMap = {
|
||||||
|
[PayValue.PlatformBalance]: 'balance',
|
||||||
|
[PayValue.WeChatPay]: 'wx',
|
||||||
|
[PayValue.StoreBalance]: 'store_balance',
|
||||||
|
}
|
||||||
|
|
||||||
// 支付方式列表
|
// 支付方式列表
|
||||||
export const PayList: PayMethod[] = [
|
export const PayList: PayMethod[] = [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -135,4 +135,15 @@ export function copy(data: any) {
|
|||||||
toast.info('已复制到剪贴板')
|
toast.info('已复制到剪贴板')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机标签颜色
|
||||||
|
* @param index 索引
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function randomLabelColor (index: number) {
|
||||||
|
const tagColors = ['#40AE36', '#F55726']
|
||||||
|
return tagColors[index % tagColors.length]
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user