feat:登录

This commit is contained in:
2026-07-31 10:55:02 +08:00
parent 4b9e5a3cc1
commit 8225be60c6
6 changed files with 187 additions and 69 deletions
+61 -52
View File
@@ -5,13 +5,15 @@
<view class="setting-view">
<view class="mid-view">
<text class="text-gray text-32" v-if="type == 1">注:请与当前登录微信信息一致</text>
<text class="text-gray text-32 mt-24">{{type == 0 ? '支付宝账号' : '微信账号'}}</text>
<text class="text-gray text-32 mt-24">{{ type == 0 ? '支付宝账号' : '微信账号' }}</text>
<view class="input-view">
<up-input :placeholder="`请输入${type == 0 ? '支付宝' : '微信'}账号`" border="surround" v-model="account" :customStyle="inputCss"></up-input>
<up-input :placeholder="`请输入${type == 0 ? '支付宝' : '微信'}账号`" border="surround" v-model="account"
:customStyle="inputCss"></up-input>
</view>
<text class="text-gray text-32 mt-48">{{type == 0 ? '支付宝姓名' : '微信姓名'}}</text>
<text class="text-gray text-32 mt-48">{{ type == 0 ? '支付宝姓名' : '微信姓名' }}</text>
<view class="input-view">
<up-input :placeholder="`请输入${type == 0 ? '支付宝' : '微信真实'}姓名`" border="surround" v-model="name" :customStyle="inputCss"></up-input>
<up-input :placeholder="`请输入${type == 0 ? '支付宝' : '微信真实'}姓名`" border="surround" v-model="name"
:customStyle="inputCss"></up-input>
</view>
</view>
</view>
@@ -32,14 +34,14 @@ import func from '@/utils/func.js';
import AccountItem from './components/account-item.vue'
export default {
components: { Header, TopSafe,MyBtn,AccountItem },
components: { Header, TopSafe, MyBtn, AccountItem },
data() {
return {
topText:'',
type:0,
account:'',
name:'',
wxCode:'',
topText: '',
type: 0,
account: '',
name: '',
wxCode: '',
inputCss: {
"height": '80rpx',
"background": "#F3F3F3FF",
@@ -50,28 +52,28 @@ export default {
};
},
onLoad(option) {
if(option && option.type){
if (option && option.type) {
this.type = Number(option.type);
this.init();
}
},
methods: {
init() {
if(this.type == 0 ){
if (this.type == 0) {
this.topText = '绑定支付宝账户';
}else if(this.type == 1){
} else if (this.type == 1) {
this.topText = '绑定微信账户';
}
},
setBindWithdraw(){
if(!this.account){
setBindWithdraw() {
if (!this.account) {
this.$refs.uToastRef.show({
type: 'error',
message: '账户不可为空',
});
return;
}
if(!this.name){
if (!this.name) {
this.$refs.uToastRef.show({
type: 'error',
message: '名字不可为空',
@@ -79,15 +81,19 @@ export default {
return;
}
let params = {
platform:this.type + 1,
accountNumber:this.account,
accountName:this.name
platform: this.type + 1,
accountNumber: this.account,
accountName: this.name
}
if(this.type == 1){
if (this.type == 1) {
params['code'] = this.wxCode;
}
console.log('wxCode',params)
bindWithdraw(params).then(res=>{
// #ifdef MP-WEIXIN
params.platform = 3;
// #endif
console.log('wxCode', params)
bindWithdraw(params).then(res => {
if (res.bizcode === 100) {
this.$refs.uToastRef.show({
type: 'success',
@@ -95,9 +101,9 @@ export default {
});
this.account = '';
this.name = '';
setTimeout(()=>{
setTimeout(() => {
uni.navigateBack();
},1000)
}, 1000)
} else {
this.$refs.uToastRef.show({
type: 'error',
@@ -107,43 +113,44 @@ export default {
}
})
},
onAdd(){
if(this.type == 1){
onAdd() {
if (this.type == 1) {
let _this = this;
uni.login({
provider: 'weixin',
onlyAuthorize:true,
success: function (loginRes) {
_this.wxCode = loginRes.code;
console.log('aaaaa',loginRes.code)
console.log('bbbb',loginRes)
_this.setBindWithdraw();
},
fail:(err)=>{
console.log('login',err);
}
provider: 'weixin',
onlyAuthorize: true,
success: function (loginRes) {
_this.wxCode = loginRes.code;
console.log('aaaaa', loginRes.code)
console.log('bbbb', loginRes)
_this.setBindWithdraw();
},
fail: (err) => {
console.log('login', err);
}
});
}else{
} else {
this.setBindWithdraw();
}
}
}
}
</script>
<style lang="scss" scoped>
.bottom-btn{
.bottom-btn {
width: 100%;
margin-bottom:92rpx;
margin-bottom: 92rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
}
.setting-view {
width: 100%;
height: calc(100% - 88rpx - 92rpx - 88rpx - var(--status-bar-height));
@@ -154,8 +161,9 @@ export default {
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
.mid-view{
width:100%;
.mid-view {
width: 100%;
display: flex;
flex-direction: column;
overflow-y: auto;
@@ -163,20 +171,21 @@ export default {
background-color: #fff;
border-radius: 16rpx;
padding: 48rpx 32rpx;
margin-top:24rpx;
.input-view{
width:100%;
height:100rpx;
margin-top: 24rpx;
.input-view {
width: 100%;
height: 100rpx;
background-color: #f5f5f5;
border-radius: 20rpx;
margin-top:32rpx;
margin-top: 32rpx;
display: flex;
flex-direction: row;
align-items: center;
}
}
}
</style>