调试接口

This commit is contained in:
wangxiaowei
2025-12-23 17:55:14 +08:00
parent 3af440cd21
commit 716160c113
13 changed files with 133 additions and 50 deletions

View File

@ -71,13 +71,6 @@ export function updateInfo(data: IUpdateInfo) {
return http.Get('/user/updateInfo', data)
}
/**
* 修改用户密码
*/
export function updateUserPassword(data: IUpdatePassword) {
return http.Get('/user/updatePassword', data)
}
/**
* 获取微信登录凭证
* @returns Promise 包含微信登录凭证(code)

View File

@ -185,3 +185,10 @@ export function transferOrder(order_id: number) {
export function getMobileByMnp(code: string) {
return http.Post('/api/user/getMobileByMnp', {code})
}
/**
* 用户开门
*/
export function openLock(order_id: number, type: number) {
return http.Post('/api/Common/ce_ttlock', {order_id, type})
}

View File

@ -198,6 +198,8 @@
} else {
coupon = groupCouponList.value.find(item => item.id === checkedId.value)
}
console.log("🚀 ~ coupon:", coupon)
uni.$emit('chooseCoupon', { coupon })
router.navigateBack()
}

View File

@ -49,7 +49,7 @@
<view class="text-[#606266] text-right mt-26rpx">
<text class="text-24rpx leading-34rpx mr-12rpx">实付</text>
<text class="tetx-32rpx leading-36rpx">{{ order.order_amount }}</text>
<wd-icon name="chevron-right" size="32rpx"></wd-icon>
<!-- <wd-icon name="chevron-right" size="32rpx"></wd-icon> -->
</view>
</view>
</view>
@ -67,7 +67,8 @@
<view class="mt-30rpx font-500 leading-48rpx" v-if="order.store.operation_type === StoreType.Franchise">
<view class="px-30rpx mt-60rpx">
<view class="text-center">
<wd-img width="230rpx" height="230rpx" :src="order.user_group.qr_url"></wd-img>
<!-- <wd-img width="230rpx" height="230rpx" :src="order.user_group.qr_url" enable-preview></wd-img> -->
<image :src="order.user_group.qr_url" style="width: 230rpx; height: 230rpx" show-menu-by-longpress></image>
</view>
<view class="text-28rpx text-[#303133] mt-32rpx text-center">
<text class="mr-20rpx">券码 {{ order.user_group.qr_sn }}</text>

View File

@ -144,7 +144,7 @@
<view class="text-[#606266] text-right mt-26rpx" v-if="orderStatus !== TeaRoomOrderStatus.Pending">
<text class="text-24rpx leading-34rpx mr-12rpx">实付</text>
<text class="tetx-32rpx leading-36rpx">{{ order.order_amount }}</text>
<wd-icon name="chevron-right" size="32rpx"></wd-icon>
<!-- <wd-icon name="chevron-right" size="32rpx"></wd-icon> -->
</view>
</view>
</view>
@ -164,20 +164,10 @@
一键续订
</view>
</view>
<!-- <view class="mt-20rpx px-30rpx" >续订时长1小时</view> -->
<!-- <view class="mb-20rpx px-30rpx" v-if="order.renew_hour">续订时长{{ order?.renew_hour }}小时</view> -->
</view>
</view>
</view>
<view class="bg-white rounded-16rpx px-30rpx py-34rpx mx-30rpx mt-20rpx" v-if="order.renew_hour">
<view class="text-[#303133] text-32rpx leading-44rpx">续订信息</view>
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
<view>续订时长</view>
<view>{{ order.renew_hour }} 小时</view>
</view>
</view>
<!-- 已预约和消费中显示开门锁 -->
<view class="bg-white rounded-16rpx mx-30rpx mt-20rpx" v-if="orderStatus === TeaRoomOrderStatus.Pay || orderStatus === TeaRoomOrderStatus.Consumption">
<view class="pt-32rpx text-[#303133] text-32rpx leading-44rpx px-30rpx">开门锁</view>
@ -187,7 +177,7 @@
<view class="">
<view class="flex justify-between items-center mt-18rpx pb-18rpx px-62rpx">
<view class="w-224rpx">
<view class="relative h-64rpx">
<view class="relative h-64rpx" @click="OrderDetail.handleOpenDoorLock('door')">
<wd-img width="224rpx" height="64rpx" :src="`${OSS}images/reserve_room/reserve_room_image5.png`"/>
<view class="text-[#4C9F44] font-bold text-32rpx leading-44rpx absolute top-[50%] transform translate-y-[-50%] right-22rpx">点击开锁</view>
</view>
@ -195,7 +185,7 @@
<view class="text-[#606266] text-26rpx leading-48rpx mt-4rpx text-center font-500">手动输入 1052 32#</view>
</view>
<view class="border-r-2rpx border-r-solid border-r-[#F6F7F9] h-224rpx"></view>
<view class="w-224rpx">
<view class="w-224rpx" @click="OrderDetail.handleOpenDoorLock('room')">
<view class="relative h-64rpx">
<wd-img width="224rpx" height="64rpx" :src="`${OSS}images/reserve_room/reserve_room_image6.png`"/>
<view class="text-[#4C9F44] font-bold text-32rpx leading-44rpx absolute top-[50%] transform translate-y-[-50%] right-22rpx">点击开锁</view>
@ -310,6 +300,7 @@
import { toTimes, copy } from '@/utils/tools'
import { useUserStore } from '@/store'
import { PayOrderType } from '@/utils/pay'
import { openLock } from '@/api/user'
const OSS = inject('OSS')
@ -703,6 +694,23 @@
}
}
}).catch(() => {})
},
/**
* 开锁
* @param type 锁的类型 room-房间锁 door-大门锁
*/
handleOpenDoorLock: async (lockType: string) => {
uni.showLoading({ title: '开锁中...', mask: true })
try {
const type = lockType === 'door' ? 1 : 2
await openLock(orderId.value, type)
uni.hideLoading()
toast.info('开锁成功')
} catch(e) {
uni.hideLoading()
return false
}
}
}
</script>

View File

@ -223,6 +223,7 @@
*/
handleToEditMobile: async (e: any) => {
const res = await getMobileByMnp(e.code)
Profile.handleInit()
},
/**

View File

@ -398,6 +398,7 @@
})
})
// 防止重复提交
const Detail = {
@ -494,15 +495,18 @@
return
}
uni.$on('chooseCoupon', params => {
console.log("🚀 ~ params:", params)
uni.$off('chooseCoupon')
uni.$off('chooseCoupon');
uni.$on('chooseCoupon', params => {
console.log(12312312)
uni.$off('chooseCoupon')
console.log("🚀 ~ type:", type)
if (type === CouponType.Discount) {
selectedCoupon.value = {id: params.coupon.id, name: `${params.coupon.name}${params.coupon.coupon_price}` }
bill.value.coupon = params.coupon.coupon_price
selectCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID保存下来是为了回显列表的,没有其他作用
} else {
console.log('gropu')
selectedGroupCoupon.value = {id: params.coupon.id, name: `团购券-${params.coupon?.title}` }
bill.value.groupCoupon = params.coupon.coupon_price
selectGroupCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID保存下来是为了回显列表的,没有其他作用

View File

@ -12,14 +12,14 @@
<navbar title="预约茶室" fixed>
<template #right>
<view class="flex items-center ml-114rpx right-slot">
<view class="mr-16rpx flex items-center" @click="Room.handleCollect">
<!-- <view class="mr-16rpx flex items-center" @click="Room.handleCollect">
<template v-if="teaRoom.collect > 0">
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc_s.png`"></wd-img>
</template>
<template v-else>
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc.png`"></wd-img>
</template>
</view>
</view> -->
<view @click="showServicePopup = true" class="flex items-center">
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_kefu.png`"></wd-img>
</view>

View File

@ -67,7 +67,7 @@
const userInfo = ref<IUserInfoVo>(null)
// 支付倒计时取消
const time = ref<number>(30 * 60 * 60 * 1000)
const time = ref<number>(3 * 60 * 1000)
// 支付金额
const money = ref<number>(0)

View File

@ -70,7 +70,7 @@
{{ item.name }}
</view>
<view class="flex items-center mt-12rpx leading-34rpx">
<view class="font-400 text-[#F29747] text-24rpx mr-18rpx">半年预约{{ item.half_year_nums > 10 ? item.half_year_nums + '+' : item.half_year_nums }}</view>
<view class="font-400 text-[#F29747] text-24rpx mr-18rpx" v-if="item.operation_type == 1">半年预约{{ item.half_year_nums > 300 ? item.half_year_nums + '+' : item.half_year_nums }}</view>
<view class="font-400 bg-[#F3F3F3] text-[#818CA9] text-22rpx px-8rpx rounded-4rpx">刚有人预约了</view>
</view>
<view class="flex items-center mt-12rpx leading-34rpx">
@ -84,7 +84,7 @@
<view class="flex items-center mt-20rpx">
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_location.png`"
mode="aspectFit" />
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx">
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx w-175rpx">
{{ item.address }}
</view>
</view>

View File

@ -8,6 +8,17 @@
<template>
<view>
<wd-popup v-model="showBindMobilePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
<view class="relative pt-54rpx pb-74rpx">
<view class="text-[#303133] text-36rpx leading-46rpx text-center">绑定手机号码</view>
<view class="flex justify-center items-center mt-78rpx">
<wd-button type="text" open-type="getPhoneNumber" @getphonenumber="Login.handleBindMobile" custom-class="!p-0 !m-0 !bg-[#4C9F44] !h-90rpx !leading-90rpx !w-630rpx !text-[#fff] !rounded-8rpx">
一键绑定
</wd-button>
</view>
</view>
</wd-popup>
<view class="mx-48rpx mt-50rpx">
<view class="text-[#303133] text-40rpx leading-56rpx">
<text class="font-400 mr-24rpx">欢迎使用</text>
@ -20,7 +31,7 @@
</view>
<view class="mt-124rpx mx-60rpx box-border">
<wd-button custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border" @click="Login.handleLogin">立即登录</wd-button>
<wd-button custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border" @click="Login.handleMobileLogin">测试-账号登录</wd-button>
<!-- <wd-button custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border" @click="Login.handleMobileLogin">测试-账号登录</wd-button> -->
<!-- <wd-button open-type="getUserInfo" @getuserinfo="Login.handleWxLogin" custom-class="!bg-[#4C9F44] !rounded-8rpx !text-[#fff] !text-30rpx !leading-42rpx !h-90rpx !w-[100%] box-border">立即登录</wd-button> -->
<!-- <view class="text-30rpx font-400 text-[#303133] leading-42rpx text-center mt-32rpx">其它手机号登录</view> -->
</view>
@ -42,6 +53,7 @@
import { getWxCode } from '@/api/login'
import { useUserStore } from '@/store'
import { router } from '@/utils/tools'
import { getMobileByMnp } from '@/api/user'
const OSS = inject('OSS')
@ -51,6 +63,9 @@
const redirectUrl = ref<string>('')
const redirectParams = ref<string>('')
// 绑定手机号码popup
const showBindMobilePopup = ref<boolean>(false)
onLoad((args) => {
redirectUrl.value = args.redirect || ''
})
@ -70,8 +85,72 @@
try {
const userStore = useUserStore()
const res = await userStore.wxLogin()
console.log("🚀 ~ res:", res)
uni.hideLoading()
if (res) {
if (!res.mobile) {
showBindMobilePopup.value = true
return false
}
Login.handleToLogin()
// Login.handleToLogin()
// if (res) {
// const decoded = decodeURIComponent(redirectUrl.value)
// console.log("🚀 ~ decoded:", decoded)
// if (decoded == '/bundle/order/tea-room/order-detail') {
// const transferOrderParams = uni.getStorageSync('transferOrderParams')
// uni.$emit('transferOrder', transferOrderParams)
// }
// toast.info('登录成功')
// router.navigateBack(1, 500)
// }
} catch(error) {
uni.hideLoading()
}
},
/**
* 一键授权绑定手机号码
*/
handleBindMobile: async (e: any) => {
uni.showLoading({ title: '绑定中...', mask: true })
try {
await getMobileByMnp(e.code)
showBindMobilePopup.value = false
// 手动设置登录状态
const userStore = useUserStore()
userStore.isLoggedIn = true
uni.hideLoading()
Login.handleToLogin()
} catch(error) {
uni.hideLoading()
}
},
// 手机登录
/**
* 测试-账号登录
*/
// handleMobileLogin: async () => {
// const userStore = useUserStore()
// console.log("🚀 ~ userStore:", userStore)
// const res = await userStore.mobileLogin('18868040087', 1, 2)
// if (res) {
// uni.setStorageSync('latitude', '30.74744')
// uni.setStorageSync('longitude', '120.78483')
// toast.info('登录成功')
// router.navigateBack(1, 500)
// }
// },
/**
* 登录成功跳转页面
*/
handleToLogin: () => {
const decoded = decodeURIComponent(redirectUrl.value)
console.log("🚀 ~ decoded:", decoded)
if (decoded == '/bundle/order/tea-room/order-detail') {
@ -81,23 +160,6 @@
toast.info('登录成功')
router.navigateBack(1, 500)
}
} catch(error) {
uni.hideLoading()
}
},
// 手机登录
handleMobileLogin: async () => {
const userStore = useUserStore()
console.log("🚀 ~ userStore:", userStore)
const res = await userStore.mobileLogin('15005837859', 1, 2)
if (res) {
uni.setStorageSync('latitude', '30.74744')
uni.setStorageSync('longitude', '120.78483')
toast.info('登录成功')
router.navigateBack(1, 500)
}
},
handleAgree: async (e: any) => {

View File

@ -316,6 +316,7 @@
onShow(() => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
console.log("🚀 ~ isLogin.value:", isLogin.value)
if (isLogin.value) {
// 获取用户详情信息接口
getUserInfo().then(res => {

View File

@ -118,8 +118,12 @@ export const useUserStore = defineStore(
uni.setStorageSync('token', res.token)
const user = await getUserInfo()
if (user.mobile) {
isLoggedIn.value = true
} else {
isLoggedIn.value = false
}
return res && user
}