Files
tcwm-uniapp-shop/my/other/zhifubao.vue
2024-06-06 11:49:50 +08:00

152 lines
3.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="container" v-if="XCXIsSelect=='是'">
<list-cell title="收款人姓名" type="text" placeholder="请输入支付宝收款人姓名" v-model="zhiFuBaoName"></list-cell>
<list-cell title="支付宝账号" type="text" placeholder="请输入要绑定的支付宝账号" v-model="zhiFuBao"></list-cell>
<wButton text="绑定账户" :rotate="logining" @click.native="toLogin()"></wButton>
<view style="padding: 32upx 64upx;font-size: 24upx;color: #999999;">提示请正确填写收款人的支付宝账户和真实的收款人姓名否则将无法正常收款</view>
</view>
</view>
</template>
<script>
import listCell from '../components/com-input';
import wButton from '../components/watch-login/watch-button.vue'; //button
export default {
components: {
listCell,
wButton
},
data() {
return {
zhiFuBao: '',
zhiFuBaoName: '',
logining: false,
XCXIsSelect: '否'
}
},
onLoad() {
// #ifdef MP-WEIXIN
this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
// #endif
// #ifndef MP-WEIXIN
this.XCXIsSelect = '是'
// #endif
if (this.XCXIsSelect == '否') {
uni.setNavigationBarTitle({
title: '隐私政策'
});
} else {
uni.setNavigationBarTitle({
title: '提现账号'
});
}
this.getUserInfo()
let userId = this.$queue.getData("userId");
if (userId) {
this.$Request.get("/sys/user/info").then(res => {
if (res.code == 0) {
if (res.user.userEntity.zhiFuBao) {
this.zhiFuBao = res.user.userEntity.zhiFuBao;
}
if (res.user.userEntity.zhiFuBaoName) {
this.zhiFuBaoName = res.user.userEntity.zhiFuBaoName;
}
}
});
}
},
methods: {
inputChange(e) {
const key = e.currentTarget.dataset.key;
this[key] = e.detail.value;
},
navBack() {
uni.navigateBack();
},
toLogin() {
let userId = this.$queue.getData("userId");
let token = uni.getStorageSync("token");
const {
zhiFuBao,
zhiFuBaoName
} = this;
if (!zhiFuBao) {
this.$queue.showToast("请设置收款人支付宝账号");
} else if (!zhiFuBaoName) {
this.$queue.showToast("请设置收款人姓名");
} else {
this.$queue.showLoading("修改中...");
let data = {
zhiFuBao: this.zhiFuBao,
zhiFuBaoName: this.zhiFuBaoName
}
this.$Request.postJson('/shop/shopmoney/updateUser', data).then(res => {
if (res.code === 0) {
// uni.setStorageSync('zhiFuBao',zhiFuBao)
// uni.setStorageSync('zhiFuBaoName',zhiFuBaoName)
uni.showToast({
title: '修改成功',
icon: 'none',
complete() {
setTimeout(function() {
uni.navigateBack();
}, 1000)
}
})
} else {
this.$queue.showToast(res.msg)
}
uni.hideLoading();
});
}
},
getUserInfo() {
this.$Request.getA("/sys/user/info").then(res => {
if (res.code == 0) {
this.$queue.setData("zhiFuBao", res.user.userEntity.zhiFuBao);
this.$queue.setData("zhiFuBaoName", res.user.userEntity.zhiFuBaoName);
}
});
},
},
}
</script>
<style lang='scss'>
page {
background-color: #FFFFFF;
}
.container {
padding-top: 32upx;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #FFFFFF;
}
.confirm-btn {
width: 300px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 70upx;
background: #e10a07;
color: #fff;
font-size: 32rpx;
&:after {
border-radius: 60px;
}
}
</style>