diff --git a/src/api/login.ts b/src/api/login.ts
index 2d8c49e..d229080 100644
--- a/src/api/login.ts
+++ b/src/api/login.ts
@@ -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)
diff --git a/src/api/user.ts b/src/api/user.ts
index 4d369b8..752a922 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -184,4 +184,11 @@ 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})
}
\ No newline at end of file
diff --git a/src/bundle/coupon/coupon.vue b/src/bundle/coupon/coupon.vue
index 6881328..eefe96d 100644
--- a/src/bundle/coupon/coupon.vue
+++ b/src/bundle/coupon/coupon.vue
@@ -198,6 +198,8 @@
} else {
coupon = groupCouponList.value.find(item => item.id === checkedId.value)
}
+ console.log("🚀 ~ coupon:", coupon)
+
uni.$emit('chooseCoupon', { coupon })
router.navigateBack()
}
diff --git a/src/bundle/order/platform/order-detail.vue b/src/bundle/order/platform/order-detail.vue
index 7036b14..c7e6be2 100644
--- a/src/bundle/order/platform/order-detail.vue
+++ b/src/bundle/order/platform/order-detail.vue
@@ -49,7 +49,7 @@
实付
¥{{ order.order_amount }}
-
+
@@ -67,7 +67,8 @@
-
+
+
券码 {{ order.user_group.qr_sn }}
diff --git a/src/bundle/order/tea-room/order-detail.vue b/src/bundle/order/tea-room/order-detail.vue
index cacd691..be42614 100644
--- a/src/bundle/order/tea-room/order-detail.vue
+++ b/src/bundle/order/tea-room/order-detail.vue
@@ -144,7 +144,7 @@
实付
¥{{ order.order_amount }}
-
+
@@ -164,20 +164,10 @@
一键续订
-
-
-
- 续订信息
-
- 续订时长
- {{ order.renew_hour }} 小时
-
-
-
开门锁
@@ -187,7 +177,7 @@
-
+
点击开锁
@@ -195,7 +185,7 @@
手动输入 1052 32#
-
+
点击开锁
@@ -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
+ }
}
}
diff --git a/src/bundle/profile/profile.vue b/src/bundle/profile/profile.vue
index 445a7f5..87a21e7 100644
--- a/src/bundle/profile/profile.vue
+++ b/src/bundle/profile/profile.vue
@@ -223,6 +223,7 @@
*/
handleToEditMobile: async (e: any) => {
const res = await getMobileByMnp(e.code)
+ Profile.handleInit()
},
/**
diff --git a/src/bundle/tea-room/detail.vue b/src/bundle/tea-room/detail.vue
index 6796d74..c89a490 100644
--- a/src/bundle/tea-room/detail.vue
+++ b/src/bundle/tea-room/detail.vue
@@ -398,6 +398,7 @@
})
})
+
// 防止重复提交
const Detail = {
@@ -494,15 +495,18 @@
return
}
+
+ uni.$off('chooseCoupon');
uni.$on('chooseCoupon', params => {
- console.log("🚀 ~ params:", 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,保存下来是为了回显列表的,没有其他作用
diff --git a/src/bundle/tea-room/room.vue b/src/bundle/tea-room/room.vue
index f0b573d..6b69407 100644
--- a/src/bundle/tea-room/room.vue
+++ b/src/bundle/tea-room/room.vue
@@ -12,14 +12,14 @@
-
+
diff --git a/src/pages/cashier/cashier.vue b/src/pages/cashier/cashier.vue
index e889213..12619f9 100644
--- a/src/pages/cashier/cashier.vue
+++ b/src/pages/cashier/cashier.vue
@@ -67,7 +67,7 @@
const userInfo = ref(null)
// 支付倒计时取消
- const time = ref(30 * 60 * 60 * 1000)
+ const time = ref(3 * 60 * 1000)
// 支付金额
const money = ref(0)
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 1c65506..f059790 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -70,7 +70,7 @@
{{ item.name }}
- 半年预约{{ item.half_year_nums > 10 ? item.half_year_nums + '+' : item.half_year_nums }}
+ 半年预约{{ item.half_year_nums > 300 ? item.half_year_nums + '+' : item.half_year_nums }}
刚有人预约了
@@ -84,7 +84,7 @@
-
+
{{ item.address }}
diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue
index 1124e42..4667a42 100644
--- a/src/pages/login/login.vue
+++ b/src/pages/login/login.vue
@@ -8,6 +8,17 @@
+
+
+ 绑定手机号码
+
+
+ 一键绑定
+
+
+
+
+
欢迎使用
@@ -20,7 +31,7 @@
立即登录
- 测试-账号登录
+
@@ -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('')
const redirectParams = ref('')
+ // 绑定手机号码popup
+ const showBindMobilePopup = ref(false)
+
onLoad((args) => {
redirectUrl.value = args.redirect || ''
})
@@ -70,34 +85,81 @@
try {
const userStore = useUserStore()
const res = await userStore.wxLogin()
+ console.log("🚀 ~ res:", res)
uni.hideLoading()
- 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)
+ 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('15005837859', 1, 2)
- if (res) {
- uni.setStorageSync('latitude', '30.74744')
- uni.setStorageSync('longitude', '120.78483')
- toast.info('登录成功')
- router.navigateBack(1, 500)
+ /**
+ * 测试-账号登录
+ */
+ // 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') {
+ const transferOrderParams = uni.getStorageSync('transferOrderParams')
+ uni.$emit('transferOrder', transferOrderParams)
}
+
+ toast.info('登录成功')
+ router.navigateBack(1, 500)
},
handleAgree: async (e: any) => {
diff --git a/src/pages/my/my.vue b/src/pages/my/my.vue
index 2156fa5..40417bd 100644
--- a/src/pages/my/my.vue
+++ b/src/pages/my/my.vue
@@ -316,6 +316,7 @@
onShow(() => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
+ console.log("🚀 ~ isLogin.value:", isLogin.value)
if (isLogin.value) {
// 获取用户详情信息接口
getUserInfo().then(res => {
diff --git a/src/store/user.ts b/src/store/user.ts
index c662790..c56b534 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -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
+ }
- isLoggedIn.value = true
return res && user
}