完善功能

This commit is contained in:
wangxiaowei
2025-11-24 16:32:01 +08:00
parent e81704d812
commit a7f62ffaa2
10 changed files with 188 additions and 20 deletions

View File

@ -71,14 +71,13 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue'
import Coupon from '@/components/coupon/Coupon.vue' import Coupon from '@/components/coupon/Coupon.vue'
import GroupCoupon from '@/components/coupon/GroupCoupon.vue' import GroupCoupon from '@/components/coupon/GroupCoupon.vue'
import { getCoupons } from '@/api/user' import { getCoupons } from '@/api/user'
import type { IUserCouponListResult } from '@/api/types/user' import type { IUserCouponListResult } from '@/api/types/user'
import { router } from '@/utils/tools'
const couponType = ref<number>(2) // couponType 1:优惠券 2:团购券 const couponType = ref<number>(2) // couponType 1:优惠券 2:团购券
const OSS = inject('OSS')
const couponList = ref<IUserCouponListResult>({ const couponList = ref<IUserCouponListResult>({
no_use: [], no_use: [],
@ -107,14 +106,13 @@
// 选择优惠券 // 选择优惠券
handleCheck: (id: any) => { handleCheck: (id: any) => {
checkedId.value = id checkedId.value = id
console.log("🚀 ~ checkedId.value :", checkedId.value )
}, },
// 确认选择优惠券 // 确认选择优惠券
handleConfirmCoupon: () => { handleConfirmCoupon: () => {
const coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value) const coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value)
uni.$emit('chooseCoupon', { coupon }) uni.$emit('chooseCoupon', { coupon })
uni.navigateBack() router.navigateBack()
} }
} }
</script> </script>

View File

@ -1,6 +1,6 @@
<route lang="jsonc" type="page"> <route lang="jsonc" type="page">
{ {
// "needLogin": true, "needLogin": true,
"layout": "default", "layout": "default",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"

View File

@ -262,7 +262,7 @@
const comboCard = { const comboCard = {
// 跳转到对饮茶室的详情页 // 跳转茶室的详情页
handleToStore: () => { handleToStore: () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/store/store-detail/store-detail' url: '/pages/store/store-detail/store-detail'

View File

@ -27,19 +27,19 @@ export const getUrlCode = (): { [key: string]: string | undefined } => {
*/ */
export async function snsapiBaseAuthorize() { export async function snsapiBaseAuthorize() {
// TODO 测试代码 // TODO 测试代码
wxSnsapiBaseLogin({code: '011ganGa10NGEK0reKGa1l3rpS2ganGX'}).then((res: IUserInfoVo) => { // wxSnsapiBaseLogin({code: '011ganGa10NGEK0reKGa1l3rpS2ganGX'}).then((res: IUserInfoVo) => {
console.log("登录成功 ~ snsapiBaseAuthorize ~ res:", res) // console.log("登录成功 ~ snsapiBaseAuthorize ~ res:", res)
// 映射 IUserLogin 到 IUserInfoVo // // 映射 IUserLogin 到 IUserInfoVo
useUserStore().setUserInfo(res) // useUserStore().setUserInfo(res)
uni.$emit('loginSuccess') // uni.$emit('loginSuccess')
}).catch(err => { // }).catch(err => {
// 失败就重新授权 // // 失败就重新授权
uni.setStorageSync('wechatCode', 0) // uni.setStorageSync('wechatCode', 0)
console.log('请求失败', err) // console.log('请求失败', err)
}) // })
return // return
let local = window.location.href // 获取页面url let local = window.location.href // 获取页面url
let appid = import.meta.env.VITE_WX_SERVICE_ACCOUNT_APPID // 公众号的APPID let appid = import.meta.env.VITE_WX_SERVICE_ACCOUNT_APPID // 公众号的APPID

View File

@ -100,6 +100,7 @@
{ {
"path": "pages/cashier/cashier", "path": "pages/cashier/cashier",
"type": "page", "type": "page",
"needLogin": true,
"layout": "default", "layout": "default",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
@ -202,6 +203,7 @@
{ {
"path": "coupon/my-coupon", "path": "coupon/my-coupon",
"type": "page", "type": "page",
"needLogin": true,
"layout": "default", "layout": "default",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"

View File

@ -1,5 +1,6 @@
<route lang="jsonc" type="page"> <route lang="jsonc" type="page">
{ {
"needLogin": true,
"layout": "default", "layout": "default",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"

View File

@ -286,8 +286,12 @@
} }
try { try {
await wxGetLocation((res) => { await wxGetLocation((res) => {
latitude.value = res.latitude console.log("🚀 ~ res:", res)
longitude.value = res.longitude if (res) {
latitude.value = res.latitude
longitude.value = res.longitude
}
Index.handleSetLocationCache(latitude.value, longitude.value) Index.handleSetLocationCache(latitude.value, longitude.value)
Index.handleSearch() Index.handleSearch()
Index.handleGetCityList() Index.handleGetCityList()

View File

@ -69,7 +69,7 @@
<wd-img width="100%" height="100%" :src="`${OSS}images/my/my_image3.png`" mode="aspectFill"></wd-img> <wd-img width="100%" height="100%" :src="`${OSS}images/my/my_image3.png`" mode="aspectFill"></wd-img>
</view> </view>
<view class="text-[#303133] absolute bottom-12rpx left-24rpx text-center"> <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 font-bold">{{ isLogin ? user?.user_money : '- -' }}</view>
<view class="text-20rpx leading-28rpx ml-10rpx">平台余额</view> <view class="text-20rpx leading-28rpx ml-10rpx">平台余额</view>
</view> </view>
</view> </view>

View File

@ -70,6 +70,7 @@ export async function wxGetLocation(callback: (res: any) => void ) {
// 用户拒绝授权 // 用户拒绝授权
uni.setStorageSync('location_deny_time', Date.now()) uni.setStorageSync('location_deny_time', Date.now())
} }
callback(false)
} }
}); });
}); });

File diff suppressed because one or more lines are too long