From f6824f84d67f4eeb435cf7528e95886cb517e6c0 Mon Sep 17 00:00:00 2001
From: lin <1005713861@163.com>
Date: Fri, 12 Jun 2026 11:42:21 +0800
Subject: [PATCH] feat:澜品优选 支付宝支付+退款
---
pages/login/login.vue | 198 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 149 insertions(+), 49 deletions(-)
diff --git a/pages/login/login.vue b/pages/login/login.vue
index cb4068e..1ea4db6 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -77,61 +77,161 @@
agreeClick () {
this.loginAct = !this.loginAct
},
- loginUser () {
+ // loginUser () {
+ // let t = this
+ // if(!t.loginAct) {
+ // return uni.showToast({
+ // title: '请阅读并同意协议政策',
+ // icon: 'error'
+ // })
+ // }
+ // if(t.formData.phone == '' || !t.phoneReg.test(t.formData.phone)){
+ // return uni.showToast({
+ // title: '手机号错误!',
+ // icon: 'error',
+ // })
+ // }
+ // if(t.formData.pass == '' && t.formData.loginType == 1){
+ // return uni.showToast({
+ // title: '请输入密码!',
+ // icon: 'error',
+ // })
+ // }
+ // if(t.formData.code == '' && t.formData.loginType == 2){
+ // return uni.showToast({
+ // title: '请输入验证码!',
+ // icon: 'error',
+ // })
+ // }
+ // t.$util.post('User/Login', this.formData).then(res => {
+ // if(res.code == 1) {
+ // uni.setStorageSync('pig-token', res.data.userToken)
+ // uni.setStorageSync('user-info', JSON.stringify(res.data))
+ // let isSwitch = 0
+ // let goUrl = ''
+ // if(this.backUrl == ''){
+ // isSwitch = 1
+ // goUrl = '/pages/index/index'
+ // } else {
+ // goUrl = this.backUrl
+ // }
+ // uni.showToast({
+ // title: res.msg || '登录成功'
+ // })
+ // setTimeout(() => {
+ // if(isSwitch == 1) {
+ // t.$util.goSwitch(goUrl)
+ // } else {
+ // t.$util.goPages(goUrl)
+ // }
+ // }, 1500)
+ // } else {
+ // uni.showToast({
+ // title: res.msg || '登录失败',
+ // icon: 'error'
+ // })
+ // }
+ // })
+ // },
+ async loginUser() {
let t = this
- if(!t.loginAct) {
- return uni.showToast({
- title: '请阅读并同意协议政策',
- icon: 'error'
- })
+
+ if (!t.loginAct) {
+ return uni.showToast({
+ title: '请阅读并同意协议政策',
+ icon: 'error'
+ })
}
- if(t.formData.phone == '' || !t.phoneReg.test(t.formData.phone)){
- return uni.showToast({
- title: '手机号错误!',
- icon: 'error',
- })
+
+ if (t.formData.phone == '' || !t.phoneReg.test(t.formData.phone)) {
+ return uni.showToast({
+ title: '手机号错误!',
+ icon: 'error'
+ })
}
- if(t.formData.pass == '' && t.formData.loginType == 1){
- return uni.showToast({
- title: '请输入密码!',
- icon: 'error',
- })
+
+ if (t.formData.pass == '' && t.formData.loginType == 1) {
+ return uni.showToast({
+ title: '请输入密码!',
+ icon: 'error'
+ })
}
- if(t.formData.code == '' && t.formData.loginType == 2){
- return uni.showToast({
- title: '请输入验证码!',
- icon: 'error',
- })
+
+ if (t.formData.code == '' && t.formData.loginType == 2) {
+ return uni.showToast({
+ title: '请输入验证码!',
+ icon: 'error'
+ })
}
- t.$util.post('User/Login', this.formData).then(res => {
- if(res.code == 1) {
- uni.setStorageSync('pig-token', res.data.userToken)
- uni.setStorageSync('user-info', JSON.stringify(res.data))
- let isSwitch = 0
- let goUrl = ''
- if(this.backUrl == ''){
- isSwitch = 1
- goUrl = '/pages/index/index'
- } else {
- goUrl = this.backUrl
- }
- uni.showToast({
- title: res.msg || '登录成功'
- })
- setTimeout(() => {
- if(isSwitch == 1) {
- t.$util.goSwitch(goUrl)
- } else {
- t.$util.goPages(goUrl)
- }
- }, 1500)
- } else {
- uni.showToast({
- title: res.msg || '登录失败',
- icon: 'error'
- })
+
+ try {
+
+ // 登录接口
+ const res = await t.$util.post('User/Login', this.formData)
+
+ if (res.code == 1) {
+
+ uni.setStorageSync('pig-token', res.data.userToken)
+ uni.setStorageSync('user-info', JSON.stringify(res.data))
+
+ let isSwitch = 0
+ let goUrl = ''
+
+ // qxgLogin接口
+ const ygxRes = await new Promise((resolve, reject) => {
+ uni.request({
+ url: t.$webHost + '/api/v2/auth/iosShopUnionLogin?phone=' + t.$util.getUserInfo().phone+'&configureToDomain=10',
+ success: resolve,
+ fail: reject
+ })
+ })
+ console.log(ygxRes);
+ if(!ygxRes.data.data.boughtEquity){
+ goUrl = '/pages/quanyi/index'
+ // t.$util.goPages(goUrl)
+ uni.navigateTo({
+ url: '/pages/quanyi/index'
+ })
+ return
}
- })
+
+ t.ygxLogin = ygxRes.data.data
+ uni.setStorageSync('ygxLogin', t.ygxLogin)
+
+ if (this.backUrl == '') {
+ isSwitch = 1
+ goUrl = '/pages/index/index'
+ } else {
+ goUrl = this.backUrl
+ }
+
+ uni.showToast({
+ title: res.msg || '登录成功'
+ })
+
+ setTimeout(() => {
+ if (isSwitch == 1) {
+ t.$util.goSwitch(goUrl)
+ } else {
+ t.$util.goPages(goUrl)
+ }
+ }, 1500)
+
+ } else {
+ uni.showToast({
+ title: res.msg || '登录失败',
+ icon: 'error'
+ })
+ }
+
+ } catch (err) {
+ console.error(err)
+
+ uni.showToast({
+ title: '请求失败',
+ icon: 'error'
+ })
+ }
},
sendCode () {
let t = this
--
Gitblit v1.9.3