修改续订时间方式
This commit is contained in:
@ -11,112 +11,7 @@
|
||||
<template>
|
||||
<view class="pb-254rpx">
|
||||
<!-- 一键续订 -->
|
||||
<!-- <wd-popup v-model="showRenewPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
|
||||
<view class="relative pb-26rpx">
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showRenewPopup = 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 pt-50rpx pb-40rpx">续订包间</view>
|
||||
<view>
|
||||
<view class="mx-60rpx">
|
||||
<view class="text-[#01000D] text-32rpx leading-44rpx">续订时间</view>
|
||||
<view class="grid grid-cols-4 gap-x-20rpx gap-y-20rpx mt-28rpx">
|
||||
<view v-for="item in timeList" :key="item.time"
|
||||
class="h-72rpx rounded-16rpx flex items-center justify-center text-28rpx leading-40rpx"
|
||||
:class="[item.id == selectedRenewTime ? 'bg-[#4C9F44] text-[#fff]' : 'bg-[#F7F7F7] text-[#606266]']"
|
||||
@click="selectedRenewTime = item.id">
|
||||
{{ item.time }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mx-60rpx mt-60rpx">
|
||||
<view class="text-[#01000D] text-32rpx leading-44rpx">支付方式</view>
|
||||
<view class="mt-28rpx">
|
||||
<wd-radio-group v-model="pay" shape="dot" checked-color="#4C9F44">
|
||||
<view class="flex justify-between items-center mb-40rpx" v-for="(item, index) in payList" :key="index" @click="pay = item.id">
|
||||
<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" v-if="item.id == 1">可用202.22</view>
|
||||
</wd-radio>
|
||||
</view>
|
||||
</view>
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-102rpx">
|
||||
<wd-gap height="2rpx" bg-color="#EFF0F2"></wd-gap>
|
||||
</view>
|
||||
|
||||
<view class="flex justify-between items-center mt-50rpx mx-60rpx">
|
||||
<view class="flex items-center">
|
||||
<view class="text-24rpx text-[#303133] leading-34rpx">合计:</view>
|
||||
<view class="flex items-center h-56rpx mr-16rpx">
|
||||
<price-format color="#FF5951" :first-size="40" :second-size="40" :subscript-size="28" :price="23.02"></price-format>
|
||||
<view class="ml-20rpx">
|
||||
<price-format color="#909399" :first-size="26" :second-size="26" :subscript-size="26" :price="23.02" lineThrough></price-format>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<wd-button custom-class='!bg-[#4C9F44] !rounded-8rpx !h-70rpx'>立即预定</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup> -->
|
||||
<wd-popup v-model="showRenewPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
|
||||
<view class="relative pb-26rpx">
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showRenewPopup = 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 pt-50rpx pb-40rpx">续订包间</view>
|
||||
<!-- 预定时间 -->
|
||||
<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="flex items-center justify-between">
|
||||
<view class="text-[26rpx] text-[#606266] leading-36rpx">{{ sevenDay.minimum_time }}小时起订</view>
|
||||
<view class="flex items-center">
|
||||
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
|
||||
<template v-if="reserveTime.length > 0">
|
||||
{{ reserveTime[0] }} {{ reserveTime[1].join(',') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
请选择
|
||||
</template>
|
||||
</view>
|
||||
<view>
|
||||
<wd-icon name="chevron-right" size="32rpx" color="#909399"></wd-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-102rpx">
|
||||
<wd-gap height="2rpx" bg-color="#EFF0F2"></wd-gap>
|
||||
</view>
|
||||
|
||||
<view class="flex justify-between items-center mt-50rpx mx-60rpx">
|
||||
<view class="flex items-center">
|
||||
<view class="text-24rpx text-[#303133] leading-34rpx">合计:</view>
|
||||
<view class="flex items-center h-56rpx mr-16rpx">
|
||||
<price-format color="#FF5951" :first-size="40" :second-size="40" :subscript-size="28" :price="totalReserveMoney"></price-format>
|
||||
<!-- <view class="ml-20rpx">
|
||||
<price-format color="#909399" :first-size="26" :second-size="26" :subscript-size="26" :price="23.02" lineThrough></price-format>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<wd-button custom-class='!bg-[#4C9F44] !rounded-8rpx !h-70rpx' @click="OrderDetail.handleRenewReserve">立即预定</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
<renew-time v-model="showRenewTimePopup" @selectedTime="OrderDetail.handleChooseRenewTime"></renew-time>
|
||||
|
||||
<!-- 续订成功 -->
|
||||
<wd-popup v-model="showRenewSuccessPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
|
||||
@ -251,7 +146,7 @@
|
||||
<!-- 已预约和消费中显示一键续订 -->
|
||||
<view v-if="orderStatus === TeaRoomOrderStatus.Pay || orderStatus === TeaRoomOrderStatus.Consumption"
|
||||
class="bg-[#4C9F44] rounded-[100rpx_0rpx_0rpx_100rpx] font-bold text-28rpx leading-40rpx text-[#fff] w-170rpx h-56rpx flex justify-center items-center"
|
||||
@click="showRenewPopup = true; showBookTimePopup = true">
|
||||
@click="showRenewTimePopup = true;">
|
||||
一键续订
|
||||
</view>
|
||||
</view>
|
||||
@ -427,7 +322,7 @@
|
||||
value: 3
|
||||
}
|
||||
])
|
||||
|
||||
const showRenewTimePopup = ref<boolean>(false) // 显示续订时间选择弹窗
|
||||
const showRenewSuccessPopup = ref<boolean>(false)
|
||||
|
||||
// 选择预定时间
|
||||
@ -667,6 +562,14 @@
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改一键续订时间
|
||||
*/
|
||||
handleChooseRenewTime: (item) => {
|
||||
console.log("🚀 ~ item:", item)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -230,12 +230,14 @@
|
||||
/**
|
||||
* 退出
|
||||
*/
|
||||
handleLogout: () => {
|
||||
handleLogout: async () => {
|
||||
const userStore = useUserStore()
|
||||
userStore.logout()
|
||||
await userStore.logout()
|
||||
if (!userStore.isLoggedIn) {
|
||||
toast.info('退出成功')
|
||||
setTimeout(() => {
|
||||
router.reLaunch('/pages/my/my')
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
103
src/components/RenewTime.vue
Normal file
103
src/components/RenewTime.vue
Normal file
@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<wd-popup v-model="showPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
|
||||
<view class="relative pb-78rpx">
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showPopup = 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 pt-50rpx pb-40rpx">续订包间</view>
|
||||
|
||||
<view class="booking-time mx-60rpx">
|
||||
<view class="text-32rpx leading-44rpx text-[#01000D] mb-28rpx">续订时间</view>
|
||||
<view class="grid grid-cols-4 gap-20rpx">
|
||||
<view
|
||||
@click="RenewTime.handleSelectTime(item)"
|
||||
v-for="(item, index) in timeList" :key="index"
|
||||
class="w-148rpx h-60rpx text-center leading-60rpx bg-[#F7F7F7] rounded-8rpx text-28rpx text-[#606266]"
|
||||
:class="currentTimeValue == item.value ? '!bg-[#4C9F44] text-white' : ''">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mx-auto mt-130rpx w-630rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="RenewTime.handleConfirmSelectedTime">
|
||||
确定续订
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="RenewTime">
|
||||
import {toast} from '@/utils/toast'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
|
||||
/**
|
||||
* BookingTime 预约时间
|
||||
* @description 茶室预约时间选择组件
|
||||
*/
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
})
|
||||
|
||||
// 初始化时间
|
||||
onMounted(() => {
|
||||
})
|
||||
|
||||
// 日期相关
|
||||
const currentTimeValue = ref<number>(0)
|
||||
const timeList = ref<Array<{ label: string, value: number }>>([
|
||||
{label: '1小时', value: 1},
|
||||
{label: '2小时', value: 2},
|
||||
{label: '3小时', value: 3},
|
||||
{label: '4小时', value: 4},
|
||||
{label: '5小时', value: 5},
|
||||
{label: '6小时', value: 6},
|
||||
])
|
||||
|
||||
const RenewTime = {
|
||||
/**
|
||||
* 选择时间
|
||||
*/
|
||||
handleSelectTime: (item: { label: string, value: number }) => {
|
||||
currentTimeValue.value = item.value
|
||||
},
|
||||
|
||||
/**
|
||||
* 确认选择时间
|
||||
*/
|
||||
handleConfirmSelectedTime: () => {
|
||||
if (currentTimeValue.value == 0) {
|
||||
toast.info('请选择续订时间')
|
||||
return
|
||||
}
|
||||
const selectedItem = timeList.value.find(item => item.value == currentTimeValue.value)
|
||||
emit('selectedTime', selectedItem)
|
||||
showPopup.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const showPopup = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (val: boolean) => emit('update:modelValue', val)
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'selectedTime'])
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.booking-time {
|
||||
:deep() {
|
||||
.wd-tabs__line {
|
||||
background-color: #4C9F44 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -49,6 +49,7 @@ const alovaInstance = createAlova({
|
||||
statesHook: VueHook,
|
||||
|
||||
beforeRequest: onAuthRequired((method) => {
|
||||
console.log("🚀 ~ method:", method)
|
||||
// 设置默认 Content-Type
|
||||
method.config.headers = {
|
||||
ContentType: ContentTypeEnum.JSON,
|
||||
|
||||
@ -311,15 +311,12 @@
|
||||
onShow(() => {
|
||||
const userStore = useUserStore()
|
||||
isLogin.value = userStore.isLoggedIn
|
||||
console.log("🚀 ~ isLogin.value:", 1)
|
||||
if (isLogin.value) {
|
||||
console.log("🚀 ~ isLogin.value:", 3)
|
||||
// 获取用户详情信息接口
|
||||
getUserInfo().then(res => {
|
||||
user.value = res
|
||||
})
|
||||
} else {
|
||||
console.log("🚀 ~ isLogin.value:", 4)
|
||||
Object.keys(user.value).forEach(key => {
|
||||
user.value[key] = ''
|
||||
})
|
||||
@ -328,8 +325,6 @@
|
||||
|
||||
onLoad(() => {
|
||||
uni.$on('clearUser', () => {
|
||||
console.log("🚀 ~ isLogin.value:", 2)
|
||||
|
||||
const userStore = useUserStore()
|
||||
isLogin.value = userStore.isLoggedIn
|
||||
|
||||
@ -350,9 +345,12 @@
|
||||
* 初始化
|
||||
*/
|
||||
handleInit: () => {
|
||||
const userStore = useUserStore()
|
||||
if (userStore.isLoggedIn) {
|
||||
getMyCoupon().then(res => {
|
||||
couponList.value = Array.isArray(res) ? res : []
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -54,8 +54,8 @@ export const useUserStore = defineStore(
|
||||
const removeUserInfo = () => {
|
||||
isLoggedIn.value = false
|
||||
userInfo.value = { ...userInfoState }
|
||||
uni.removeStorageSync('userInfo')
|
||||
uni.removeStorageSync('token')
|
||||
// 清除所有缓存
|
||||
uni.clearStorageSync()
|
||||
}
|
||||
/**
|
||||
* 获取用户信息
|
||||
@ -103,10 +103,7 @@ export const useUserStore = defineStore(
|
||||
* 退出登录 并 删除用户信息
|
||||
*/
|
||||
const logout = async () => {
|
||||
// 清除所有缓存
|
||||
uni.clearStorageSync()
|
||||
|
||||
_logout()
|
||||
// await _logout()
|
||||
removeUserInfo()
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user