调试接口

This commit is contained in:
wangxiaowei
2025-12-20 22:44:12 +08:00
parent fc3072980c
commit a2f1023de8
32 changed files with 982 additions and 483 deletions

View File

@ -54,7 +54,7 @@
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
import { toast } from '@/utils/toast'
import { router } from '@/utils/tools'
import { PayValue } from '@/utils/pay'
import { PayValue, PayValueMap } from '@/utils/pay'
import { prePay, balancePay } from '@/api/pay'
import { useUserStore } from '@/store'
import type {IUserInfoVo } from '@/api/types/login'
@ -139,7 +139,6 @@
title.value = `茶室预定-${args.name}`
} else {
title.value = `茶室套餐购买-${args.name}`
hidePlatformBalance.value = true // 隐藏平台余额支付
hideStoreBalance.value = true // 隐藏门店余额支付
}
}
@ -218,6 +217,7 @@
// 获取支付方式
handleGetPayValue: (value: number) => {
pay.value = value
console.log("🚀 ~ pay.value:", pay.value)
},
/**
@ -234,18 +234,23 @@
uni.showLoading({ title: '支付中...' })
try {
// 预支付
let ordeType = 1
if (isGroupBuying.value) {
ordeType = 2
}
const res1 = await prePay({
from: isGroupBuying.value ? 'wx' : 'balance',
from: PayValueMap[pay.value],
order_id: orderId.value,
pay_way: pay.value,
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) {
await balancePay({
id: res1.pay_id
id: res1.pay
})
} else if (pay.value == PayValue.WeChatPay) {
// 微信支付

View File

@ -198,15 +198,16 @@
try {
getHomeTeaStoreList(filter).then( res => {
uni.hideLoading()
const curPageData = res.list || [] // 当前页数据
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
list.value = list.value.concat(curPageData) //追加新数据
mescroll.endSuccess(curPageData.length, Boolean(res.more))
}).catch(() => {
uni.hideLoading()
mescroll.endErr() // 请求失败, 结束加载
})
uni.hideLoading()
} catch (error) {
uni.hideLoading()
}

View File

@ -48,6 +48,13 @@
// 服务协议条款
const agree = ref<boolean>(false)
const redirectUrl = ref<string>('')
onLoad((args) => {
console.log("🚀 ~ login args:", args)
redirectUrl.value = args.redirect || ''
})
const Login = {
// 获取手机号
handleLogin: async (e: object) => {
@ -55,13 +62,27 @@
toast.info('请同意服务协议和隐私政策')
return
}
const userStore = useUserStore()
const res = await userStore.wxLogin()
if (res) {
toast.info('登录成功')
router.navigateBack(1, 500)
uni.showLoading({
title: '登录中...',
mask: true
})
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()
}
},
// 手机登录

View File

@ -34,10 +34,11 @@
<wd-img width="36rpx" height="36rpx" mode="aspectFill" :src="`${OSS}icon/icon_crown.png`" round></wd-img>
</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 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>
<view class="absolute left-36rpx top-28rpx flex items-center" @click="My.handleShowPromoCode">
<view class="flex items-center mr-8rpx">
@ -45,7 +46,7 @@
</view>
<view class="font-bold text-[#fff] text-24rpx leading-34rpx mt--6rpx">推广码</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>
</view>
<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">
<wd-icon name="arrow-right" size="24rpx" color="#EECC99"></wd-icon>
</view>
@ -92,20 +93,20 @@
<view class="font-400 text-24rpx text-[#EECC99] leading-34rpx">会员预定茶室享受8折</view>
</view>
</view>
<view class="mx-40rpx">
<wd-progress :percentage="60" hide-text color="#EECC99" custom-class="!my-10rpx"></wd-progress>
<view class="mx-40rpx h-40rpx">
<!-- <wd-progress :percentage="60" hide-text color="#EECC99" custom-class="!my-10rpx"></wd-progress> -->
</view>
<view class="flex items-center justify-between mx-40rpx">
<view class="flex item-center leading-34rpx text-[#EECC99]">
<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 class="font-400 text-24rpx text-[#D2D0D0] leading-34rpx">请尽快领取会员权益</view>
<!-- <view class="font-400 text-24rpx text-[#D2D0D0] leading-34rpx">请尽快领取会员权益</view> -->
</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 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">
<text class="text-24rpx">¥</text>
<text class="text-30rpx">{{ item.coupon_price }}</text>
@ -124,9 +125,9 @@
<view v-if="!isVip" class="mt-16rpx flex justify-center">
<view class="w-690rpx h-228rpx relative">
<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="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>
@ -244,7 +245,7 @@
import { toast } from '@/utils/toast'
import { router } from '@/utils/tools'
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'
const OSS = inject('OSS')
@ -269,7 +270,8 @@
member: 0,
mobile: "",
user_money: "0.00",
version: ""
version: "",
last_month: 0
})
const isLogin = ref<boolean>(false)
const isVip = ref<boolean>(true)
@ -308,6 +310,9 @@
// 领取优惠券
const couponList = ref<any[]>([])
// 过期时间
const expireTime = ref<string>('')
onShow(() => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
@ -315,6 +320,11 @@
// 获取用户详情信息接口
getUserInfo().then(res => {
user.value = res
if (res.member === 1) {
isVip.value = true
} else {
isVip.value = false
}
})
} else {
Object.keys(user.value).forEach(key => {
@ -351,6 +361,11 @@
couponList.value = Array.isArray(res) ? res : []
})
}
// 获取会员过期时间
getUserMember().then(res => {
expireTime.value = res.data.expiration_time
})
},
/**
@ -360,6 +375,9 @@
await claimMyCoupon({id})
toast.info('领取成功')
My.handleInit()
getUserInfo().then(res => {
user.value = res
})
},
// 跳转到个人信息
@ -433,4 +451,8 @@
.service-badge {
background: linear-gradient( 315deg, #F4C99A 0%, #FFE3BA 100%);
}
.vip-btn {
background: linear-gradient(180deg, #fff 0%, #F0BA6A 100%);
}
</style>

View File

@ -25,7 +25,7 @@
<view class="tabs">
<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-tabs>
</view>
</view>