完善接口
This commit is contained in:
@ -12,8 +12,10 @@
|
||||
<view class="home-bg w-[100%] fixed top-0 left-0 z-100">
|
||||
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
|
||||
<template #right>
|
||||
<view class="mr-16rpx flex items-center right-slot" @click="My.handleShowService">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_service.png`"></wd-img>
|
||||
<view class="mr-16rpx flex items-center right-slot">
|
||||
<a :href="'tel:' + userInfo.mobile">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_service.png`"></wd-img>
|
||||
</a>
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
@ -25,7 +27,8 @@
|
||||
<view>
|
||||
<wd-img width="120rpx" height="120rpx" :src="`${OSS}icon/icon_avatar.png`" mode="aspectFill" round />
|
||||
</view>
|
||||
<view class="flex-1 ml-22rpx flex justify-between items-center" @click="My.handleToProfile">
|
||||
<!-- <view class="flex-1 ml-22rpx flex justify-between items-center" @click="My.handleToProfile"> -->
|
||||
<view class="flex-1 ml-22rpx flex justify-between items-center">
|
||||
<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" >
|
||||
@ -39,7 +42,7 @@
|
||||
</view>
|
||||
<view class="w-178rpx h-80rpx relative">
|
||||
<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.stop="My.handleShowPromoCode">
|
||||
<view class="flex items-center mr-8rpx">
|
||||
<wd-img width="32rpx" height="32rpx" mode="aspectFill" :src="`${OSS}icon/icon_ercode.png`"></wd-img>
|
||||
</view>
|
||||
@ -53,11 +56,11 @@
|
||||
<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="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="font-bold text-36rpx leading-50rpx"> {{ isLogin ? user.collect_count : '- -' }}</view>
|
||||
<view class="text-24rpx leading-34rpx">收藏</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -66,7 +69,7 @@
|
||||
<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 ? user.user_money : '- -' }}</view>
|
||||
<view class="text-30rpx leading-36rpx fon-bold">{{ isLogin ? user?.user_money : '- -' }}</view>
|
||||
<view class="text-20rpx leading-28rpx ml-10rpx">平台余额</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -104,16 +107,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="font-bold text-22rpx text-[#AF6400] leading-32rpx mt-6rpx">茶室券</view>
|
||||
<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">{{ item.title }}</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>
|
||||
@ -148,6 +151,21 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 我的地址 -->
|
||||
<view class="bg-white rounded-16rpx mx-30rpx mt-20rpx px-30rpx py-28rpx">
|
||||
<view class="flex items-center justify-between" @click="router.navigateTo('/pages/address/list')">
|
||||
<view class="flex items-center">
|
||||
<view class="flex items-center mr-28rpx">
|
||||
<wd-img :src="`${OSS}icon/icon_location.png`" width="44rpx" height="44rpx"></wd-img>
|
||||
</view>
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#313131]">我的地址</view>
|
||||
</view>
|
||||
<view>
|
||||
<wd-icon name="chevron-right" size="22px"></wd-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推广码 -->
|
||||
@ -182,7 +200,8 @@
|
||||
import { toast } from '@/utils/toast'
|
||||
import { useUserStore } from '@/store'
|
||||
import { getUrlCode, snsapiBaseAuthorize } from '@/hooks/useWeiXin'
|
||||
import { getUserInfo } from '@/api/user'
|
||||
import { getUserInfo, getMyCoupon, claimMyCoupon } from '@/api/user'
|
||||
import { router } from '@/utils/tools'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
const navbarHeight = inject('navbarHeight')
|
||||
@ -211,6 +230,7 @@
|
||||
const sheetMenu = ref<{ name: string}[]>([])
|
||||
|
||||
// 领取优惠券
|
||||
const couponList = ref<any[]>([])
|
||||
const isClaimCoupon = ref<boolean>(false)
|
||||
|
||||
onShow(() => {
|
||||
@ -243,6 +263,8 @@
|
||||
}
|
||||
// 你可以在这里做跳转或弹窗提示
|
||||
})
|
||||
|
||||
My.handleInit()
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
@ -250,6 +272,19 @@
|
||||
})
|
||||
|
||||
const My = {
|
||||
handleInit: () => {
|
||||
getMyCoupon().then(res => {
|
||||
couponList.value = Array.isArray(res) ? res : []
|
||||
})
|
||||
},
|
||||
|
||||
// 领取优惠券
|
||||
handleClaimCoupon: async (id: number) => {
|
||||
const res = await claimMyCoupon({id})
|
||||
toast.info('领取成功')
|
||||
My.handleInit()
|
||||
},
|
||||
|
||||
// 点击显示客服电话
|
||||
handleShowService: () => {
|
||||
showServiceMobile.value = true
|
||||
@ -260,9 +295,8 @@
|
||||
|
||||
// 选择菜单-拨打客服电话
|
||||
handleSelectMenu: (item: any) => {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: item.item.name
|
||||
})
|
||||
// window.location.href = 'tel: ' + item.item.name
|
||||
// console.log("🚀 ~ item.item.name:", item.item.name)
|
||||
},
|
||||
|
||||
// 显示推广码
|
||||
@ -272,9 +306,7 @@
|
||||
} else {
|
||||
toast.info('请先登录')
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
router.navigateTo('/pages/login/login')
|
||||
}, 800)
|
||||
}
|
||||
},
|
||||
@ -282,9 +314,7 @@
|
||||
// 跳转到个人信息
|
||||
handleToProfile: async () => {
|
||||
if (isLogin.value) {
|
||||
uni.navigateTo({
|
||||
url: '/bundle/profile/profile'
|
||||
})
|
||||
router.navigateTo('/bundle/profile/profile')
|
||||
} else {
|
||||
await snsapiBaseAuthorize()
|
||||
}
|
||||
@ -292,30 +322,22 @@
|
||||
|
||||
// 跳转到会员权益
|
||||
handleToVipBenefits: () => {
|
||||
uni.navigateTo({
|
||||
url: '/bundle/vip/benefits'
|
||||
})
|
||||
router.navigateTo('/bundle/vip/benefits')
|
||||
},
|
||||
|
||||
// 跳转到优惠券
|
||||
handleToCoupon: () => {
|
||||
uni.navigateTo({
|
||||
url: '/bundle/coupon/my-coupon'
|
||||
})
|
||||
router.navigateTo('/bundle/coupon/my-coupon')
|
||||
},
|
||||
|
||||
// 跳转到收藏
|
||||
handleToCollect: () => {
|
||||
uni.navigateTo({
|
||||
url: '/bundle/collect/collect'
|
||||
})
|
||||
router.navigateTo('/bundle/collect/collect')
|
||||
},
|
||||
|
||||
// 跳转到我的钱包
|
||||
handleToWallet: () => {
|
||||
uni.navigateTo({
|
||||
url: '/bundle/wallet/wallet'
|
||||
})
|
||||
router.navigateTo('/bundle/wallet/wallet')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user