完善茶室订单

This commit is contained in:
wangxiaowei
2025-11-20 17:29:26 +08:00
parent 0cad65c295
commit 3a8488dc18
29 changed files with 1812 additions and 765 deletions

View File

@ -27,7 +27,7 @@
</view>
<view class="flex-1 ml-22rpx flex justify-between items-center">
<view @click="My.handleToProfile">
<view class="text-[#303133] text-36rpx leading-50rpx ml-8rpx">{{ isLogin ? '王大帅' : '立即登录' }}</view>
<view class="text-[#303133] text-36rpx leading-50rpx ml-8rpx">{{ isLogin ? userInfo.nickname : '立即登录' }}</view>
<view v-if="isLogin" class="flex justify-center items-center vip-bg mt-10rpx">
<!-- 会员显示图标 -->
<view v-if="isVip" class="flex items-center mr-12rpx">
@ -52,21 +52,21 @@
<!-- 余额显示 -->
<view class="mt-16rpx mx-30rpx flex justify-between">
<view class="flex items-center">
<view class="w-160rpx text-[#303133] text-center" @click="My.handleToCoupon">
<view class="font-bold text-36rpx leading-50rpx"> {{ isLogin ? 51 : '- -' }}</view>
<view class="w-160rpx text-[#303133] text-center" @click="router.navigateTo('/bundle/coupon/my-coupon')">
<view class="font-bold text-36rpx leading-50rpx"> {{ isLogin ? user?.coupon_count : '- -' }}</view>
<view class="text-24rpx leading-34rpx">优惠券</view>
</view>
<view class="w-160rpx text-[#303133] text-center" @click="My.handleToCollect">
<view class="font-bold text-36rpx leading-50rpx"> {{ isLogin ? 51 : '- -' }}</view>
<view class="w-160rpx text-[#303133] text-center" @click="router.navigateTo('/bundle/collect/collect')">
<view class="font-bold text-36rpx leading-50rpx"> {{ isLogin ? user?.collect_count : '- -' }}</view>
<view class="text-24rpx leading-34rpx">收藏</view>
</view>
</view>
<view class="relative" @click="My.handleToWallet">
<view class="relative" @click="router.navigateTo('/bundle/wallet/wallet')">
<view class="w-300rpx h-148rpx">
<wd-img width="100%" height="100%" :src="`${OSS}images/my/my_image3.png`" mode="aspectFill"></wd-img>
</view>
<view class="text-[#303133] absolute bottom-12rpx left-24rpx text-center">
<view class="text-30rpx leading-36rpx fon-bold">{{ isLogin ? '¥2106.3623' : '- -' }}</view>
<view class="text-30rpx leading-36rpx font-bold">{{ isLogin ? user?.user_money : '- -' }}</view>
<view class="text-20rpx leading-28rpx ml-10rpx">平台余额</view>
</view>
</view>
@ -82,7 +82,7 @@
<view class="w-40rpx h-36rpx flex items-center">
<wd-img width="100%" height="100%" :src="`${OSS}icon/icon_vip.png`" mode="aspectFill"></wd-img>
</view>
<view class="flex items-center leading-34rpx" @click="My.handleToVipBenefits">
<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="flex items-center mt-4rpx">
<wd-icon name="arrow-right" size="24rpx" color="#EECC99"></wd-icon>
@ -104,16 +104,16 @@
</view>
<view class="mt-50rpx ml-24rpx">
<scroll-view class="w-[100%] whitespace-nowrap" :scroll-x="true" scroll-left="120">
<view class="scroll-item mr-20rpx" v-for="(item, index) in 10" :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-[#1C1C1D] leading-34rpx mt-8rpx">
<text class="text-24rpx">¥</text>
<text class="text-30rpx">20</text>
<text class="text-30rpx">{{ item.coupon_price }}</text>
</view>
<view class="font-400 text-20rpx leading-28rpx text-[#1C1C1D]">满200可用</view>
<view class="font-400 text-20rpx leading-28rpx text-[#1C1C1D]">{{ item.name }}</view>
<view class="font-400 text-20rpx w-126rpx h-40rpx rounded-20rpx mt-18rpx leading-40rpx mx-auto"
:class="isClaimCoupon ? 'bg-[#E6E3DF]' : 'bg-[#FCCA84]'" @click="isClaimCoupon = true">
{{ isClaimCoupon ? '已领取' : '立即领取' }}
:class="item.use == 1 ? 'bg-[#E6E3DF]' : 'bg-[#FCCA84]'" @click="My.handleClaimCoupon(item.id)">
{{ item.use == 1 ? '已领取' : '立即领取' }}
</view>
</view>
</scroll-view>
@ -134,7 +134,7 @@
<!-- 团购 -->
<view class="bg-white rounded-16rpx mx-30rpx mt-28rpx px-56rpx py-48rpx flex items-center justify-between">
<view class="flex items-center" @click="My.handleToDouYinGroupBuying">
<view class="flex items-center" @click="router.navigateTo('/bundle/order/douyin/order-list')">
<view class="w-40rpx h-40rpx ">
<wd-img width="100%" height="100%" :src="`${OSS}icon/icon_douyin.png`"></wd-img>
</view>
@ -146,7 +146,7 @@
<view>
<wd-divider vertical />
</view>
<view class="flex items-center" @click="My.handleToPlatformGroupBuying">
<view class="flex items-center" @click="router.navigateTo('/bundle/order/platform/order-list')">
<view class="w-40rpx h-40rpx ">
<wd-img width="100%" height="100%" :src="`${OSS}icon/icon_platform.png`"></wd-img>
</view>
@ -244,6 +244,7 @@
import { toast } from '@/utils/toast'
import { router } from '@/utils/tools'
import { useUserStore } from '@/store'
import { getUserInfo, getMyCoupon, claimMyCoupon } from '@/api/user'
const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight')
@ -251,6 +252,7 @@
// 登录信息相关
const userInfo = ref<any>(null)
const user = ref<any>(null)
const isLogin = ref<boolean>(false)
const isVip = ref<boolean>(true)
@ -286,22 +288,45 @@
const sheetMenu = ref<{ name: string}[]>([])
// 领取优惠券
const isClaimCoupon = ref<boolean>(false)
const couponList = ref<any[]>([])
onShow(() => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
console.log("🚀 ~ isLogin.value:", isLogin.value)
if (isLogin.value) {
userInfo.value = userStore.userInfo
// 获取用户详情信息接口
getUserInfo().then(res => {
user.value = res
})
} else {
userInfo.value = null
user.value = null
}
})
onLoad(() => {
My.handleInit()
})
const My = {
// 跳转抖音团购
handleToDouYinGroupBuying: () => {
router.navigateTo('/bundle/order/douyin/order-list')
/**
* 初始化
*/
handleInit: () => {
getMyCoupon().then(res => {
couponList.value = Array.isArray(res) ? res : []
})
},
/**
* 领取优惠券
*/
handleClaimCoupon: async (id: number) => {
await claimMyCoupon({id})
toast.info('领取成功')
My.handleInit()
},
// 跳转到个人信息
@ -313,11 +338,6 @@
}
},
// 跳转平台团购
handleToPlatformGroupBuying: () => {
router.navigateTo('/bundle/order/platform/order-list')
},
// 点击显示客服电话
handleShowService: () => {
showServiceMobile.value = true
@ -341,46 +361,6 @@
toast.info('请先登录')
router.navigateTo('/pages/login/login', 800)
}
},
// 跳转到会员权益
handleToVipBenefits: () => {
if (isLogin.value) {
router.navigateTo('/bundle/vip/my-benefits')
} else {
toast.info('请先登录')
router.navigateTo('/pages/login/login', 800)
}
},
// 跳转到优惠券
handleToCoupon: () => {
if (isLogin.value) {
router.navigateTo('/bundle/coupon/my-coupon')
} else {
toast.info('请先登录')
router.navigateTo('/pages/login/login', 800)
}
},
// 跳转到收藏
handleToCollect: () => {
if (isLogin.value) {
router.navigateTo('/bundle/collect/collect')
} else {
toast.info('请先登录')
router.navigateTo('/pages/login/login', 800)
}
},
// 跳转到我的钱包
handleToWallet: () => {
if (isLogin.value) {
router.navigateTo('/bundle/wallet/wallet')
} else {
toast.info('请先登录')
router.navigateTo('/pages/login/login', 800)
}
}
}
</script>