This commit is contained in:
2025-10-10 13:41:42 +08:00
parent a2faab2646
commit f1f65961dd
33 changed files with 4424 additions and 119 deletions
+182
View File
@@ -0,0 +1,182 @@
<template>
<view class="content">
<TopSafe bgColor="rgba(0,0,0,0)"></TopSafe>
<Header :title="topText" bgColor="rgba(0,0,0,0)" />
<view class="setting-view">
<view class="mid-view">
<text class="text-zu1 text-32" v-if="type == 1">注:请与当前登录微信信息一致</text>
<text class="text-zu1 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>
</view>
<text class="text-zu1 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>
</view>
</view>
</view>
<view class="bottom-btn">
<MyBtn text="添加" @ok="onAdd"></MyBtn>
</view>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import { bindWithdraw } from '@/api/common.js';
import Header from '@/components/common/header.vue';
import { clear } from '@/utils/auth.js';
import TopSafe from '@/components/common/top-safe.nvue'
import MyBtn from '@/components/common/my-btn.vue'
import func from '@/utils/func.js';
import AccountItem from './components/account-item.vue'
export default {
components: { Header, TopSafe,MyBtn,AccountItem },
data() {
return {
topText:'',
type:0,
account:'',
name:'',
wxCode:'',
inputCss: {
"height": '80rpx',
"background": "#F3F3F3FF",
"border-radius": "30rpx",
"border": "0rpx",
"padding-left": "12rpx",
},
};
},
onLoad(option) {
if(option && option.type){
this.type = Number(option.type);
this.init();
}
},
methods: {
init() {
if(this.type == 0 ){
this.topText = '绑定支付宝账户';
}else if(this.type == 1){
this.topText = '绑定微信账户';
}
},
setBindWithdraw(){
if(!this.account){
this.$refs.uToastRef.show({
type: 'error',
message: '账户不可为空',
});
return;
}
if(!this.name){
this.$refs.uToastRef.show({
type: 'error',
message: '名字不可为空',
});
return;
}
let params = {
platform:this.type + 1,
accountNumber:this.account,
accountName:this.name
}
if(this.type == 1){
params['code'] = this.wxCode;
}
console.log('wxCode',params)
bindWithdraw(params).then(res=>{
if (res.bizcode === 100) {
this.$refs.uToastRef.show({
type: 'success',
message: '绑定成功',
});
this.account = '';
this.name = '';
setTimeout(()=>{
uni.navigateBack();
},1000)
} else {
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
});
return null;
}
})
},
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);
}
});
}else{
this.setBindWithdraw();
}
}
}
}
</script>
<style lang="scss" scoped>
.bottom-btn{
width: 100%;
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));
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
.mid-view{
width:100%;
display: flex;
flex-direction: column;
overflow-y: auto;
box-sizing: border-box;
background-color: #fff;
border-radius: 16rpx;
padding: 48rpx 32rpx;
margin-top:24rpx;
.input-view{
width:100%;
height:100rpx;
background-color: #f5f5f5;
border-radius: 20rpx;
margin-top:32rpx;
display: flex;
flex-direction: row;
align-items: center;
}
}
}
</style>
@@ -0,0 +1,84 @@
<template>
<view class="shop-item-view" >
<image :src="type == 0 ? '../../../static/new/zfb.png' : '../../../static/new/wx.png'" ></image>
<view class="show-item-left">
<text class="text-32 text-zu1">{{itemData.name}}</text>
<text class="text-26 text-fu1">账号:{{itemData.account}}</text>
</view>
<view class="item-right-btn" @click="onBtn">
<text class="text-zu1 text-24">解绑</text>
</view>
</view>
</template>
<script>
export default {
props:{
obj:{
type:Object,
default:null
},
type:{
type:Number,
default:0
},
itemData:{
type:[Array,Object],
default:()=>{}
},
},
mounted(){
},
methods: {
onBtn(){
this.$emit('ok',this.itemData);
}
}
}
</script>
<style lang="scss" scoped>
.shop-item-view{
width:100%;
min-height:152rpx;
display: flex;
flex-direction: row;
align-items: center;
padding: 32rpx 28rpx;
box-sizing: border-box;
position: relative;
border-radius: 24rpx;
overflow: hidden;
background-color: #fff;
margin-top:24rpx;
.show-item-left{
display: flex;
flex-direction: column;
height:88rpx;
min-height:88rpx;
margin-left:24rpx;
}
.item-right-btn{
width:112rpx;
height:48rpx;
min-height:48rpx;
display: flex;
align-items: center;
justify-content: center;
background-color: #f3f3f3;
border-radius: 24rpx;
position: absolute;
right:28rpx;
}
image{
width:88rpx;
height:88rpx;
border-radius: 44rpx;
}
}
</style>
@@ -0,0 +1,148 @@
<template>
<u-popup :show="codeShow" mode="bottom" bgColor="transparent">
<view class="select-item">
<view class="select-head">
<view></view>
<text class="text-28 text-fu1">验证码</text>
<u-icon name="close" color="#333" size="16" @click="onClose"></u-icon>
</view>
<view class="item-mid-view">
<view class="input-view">
<up-input placeholder="请输入验证码" border="surround" v-model="code"
:customStyle="inputCss">
<template #suffix style="margin-right: 10rpx;">
<view v-if="countdown" class="code-warp">
<up-count-down :time="60 * 1000" format="ss" @finish="countdown = false"></up-count-down>
<text style="margin-left: 10rpx;">s</text>
</view>
<view v-else @click="getMobileCode" class="code_msg">
获取验证码
</view>
</template>
</up-input>
</view>
</view>
<view class="item-bottom-btn">
<MyBtn @ok="onOk" text="确定"></MyBtn>
</view>
</view>
<up-toast ref="uToastRef"></up-toast>
</u-popup>
</template>
<script>
import { getUserList } from '@/api/common.js';
import MyBtn from '@/components/common/my-btn.vue'
export default {
data() {
return {
code:'',
countdown:'',
inputCss: {
"background": "#fff",
},
}
},
components: { MyBtn },
props:{
codeShow:{
type:Boolean,
default:false
},
phone:{
type:String,
default:''
},
},
mounted(){
},
methods: {
onOk(){
if(!this.code){
this.$refs.uToastRef.show({
type: 'error',
message: "验证码不可为空",
});
return;
}
this.$emit('ti',this.code);
this.code = '';
},
onClose(){
this.$emit('close');
this.countdown = false;
},
async getMobileCode() {
if (!this.phone) {
this.$refs.uToastRef.show({
type: 'error',
message: "请输入手机号码",
});
return;
}
this.countdown = true;
const params = {
mobile: this.phone,
type: 'withdraw'
}
const response = await getUserList(params);
if (response && response.bizcode === 100) {
this.$refs.uToastRef.show({
type: 'success',
message: response.msg,
});
} else {
this.countdown = false;
}
},
}
}
</script>
<style scoped lang="scss">
.select-item{
width:100%;
min-height:418rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 32rpx 24rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
.item-bottom-btn{
width:100%;
margin-top:24rpx;
min-height:88rpx;
display: flex;
}
.item-mid-view{
width:100%;
height:218rpx;
min-height:218rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow-y: auto;
.input-view{
width:100%;
height:88rpx;
min-height:88rpx;
}
}
.select-head{
width:100%;
height:88rpx;
min-height:88rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
}
</style>
@@ -0,0 +1,159 @@
<template>
<u-popup :show="itemShow" mode="bottom" bgColor="transparent">
<view class="select-item">
<view class="select-head">
<view></view>
<text class="text-28 text-fu1">选择{{type == 0 ? '微信' : '支付宝'}}账户</text>
<u-icon name="close" color="#333" size="16" @click="onClose"></u-icon>
</view>
<view class="item-mid-view">
<view class="item-mid-list" v-for="(item,index) in data" :key="item.id">
<image :src="type == 1 ? '../../../static/new/zfb.png' : '../../../static/new/wx.png'" ></image>
<view class="show-item-left">
<text class="text-32 text-zu1">{{item.name}}</text>
<text class="text-26 text-fu1">账号:{{item.account}}</text>
</view>
<u-radio-group v-model="itemSelect" style="position: absolute;right:28rpx">
<u-radio :name="item.id" activeColor="#7934F6"></u-radio>
</u-radio-group>
<!-- <view class="item-right-btn">
<u-radio-group v-model="itemSelect">
<u-radio :name="item.id" activeColor="#7934F6"></u-radio>
</u-radio-group>
</view> -->
</view>
</view>
<view class="item-bottom-btn">
<MyBtn @ok="onOk" text="确定"></MyBtn>
</view>
</view>
</u-popup>
</template>
<script>
import MyBtn from '@/components/common/my-btn.vue'
export default {
data() {
return {
itemSelect:''
}
},
components: { MyBtn },
computed:{
data(){
let tmp = [];
if(this.itemData.length){
this.itemSelect = this.itemData[0].id;
tmp = this.itemData;
console.log('tmp',tmp)
}
return tmp;
}
},
props:{
itemShow:{
type:Boolean,
default:false
},
itemData:{
type:[Array,Object],
default:()=>{}
},
type:{
type:[Number,String],
default:'0'
}
},
mounted(){
},
methods: {
onOk(){
console.log('this',this.itemSelect);
this.$emit('ok',this.itemSelect);
},
onClose(){
this.$emit('close');
}
}
}
</script>
<style scoped lang="scss">
.select-item{
width:100%;
min-height:942rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 32rpx 24rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
.item-bottom-btn{
width:100%;
margin-top:24rpx;
min-height:88rpx;
display: flex;
}
.item-mid-view{
width:100%;
height:742rpx;
min-height:742rpx;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
.item-mid-list{
display: flex;
flex-direction: row;
align-items: center;
width:98%;
height:152rpx;
min-height:152rpx;
border-radius: 16rpx;
margin-top:24rpx;
background: #FFFFFF;
box-shadow: 0px 0px 16rpx 0px #F4F4F4;
border-radius: 16px;
border: 1px solid #E3E3E3;
padding: 0 24rpx;
box-sizing: border-box;
position: relative;
.show-item-left{
display: flex;
flex-direction: column;
height:88rpx;
min-height:88rpx;
margin-left:24rpx;
}
.item-right-btn{
display: flex;
align-items: center;
justify-content: center;
background-color: #f3f3f3;
border-radius: 24rpx;
position: absolute;
right:28rpx;
}
image{
width:88rpx;
height:88rpx;
border-radius: 44rpx;
}
}
}
.select-head{
width:100%;
height:88rpx;
min-height:88rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
}
</style>
+88 -79
View File
@@ -1,84 +1,102 @@
<template>
<view class="content">
<TopSafe bgColor="rgba(0,0,0,0)"></TopSafe>
<Header title="注销账号" bgColor="rgba(0,0,0,0)" />
<Header title="账户管理" bgColor="rgba(0,0,0,0)" />
<view class="setting-view">
<view class="tab-view">
<view class="tab-list" v-for="(item,index) in tabList" :key="index" @click="onTab(index)">
<text class="text-fu text-28" :style="{color:type == index ? '#7934F6' :'#666' }">{{item}}</text>
<view class="tab-line" v-if="type == index"></view>
</view>
</view>
<view class="mid-view">
<AccountItem :type="type" :itemData="item" @ok="onItemOk" v-for="(item,index) in dataList" :key="index"></AccountItem>
</view>
</view>
<view class="bottom-btn">
<MyBtn text="已清楚风险,确定注销" @ok="onZhu"></MyBtn>
<MyBtn :text="type == 0 ? '添加支付宝账户' : '添加微信账户'" @ok="onJump"></MyBtn>
</view>
<u-modal :show="tipsShow" title="提示" showCancelButton @cancel="onCancel" @confirm="onConfirm" :content='content'></u-modal>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import { getUserInfo,updateName,deleteAccount } from '@/api/auth.js';
import { getWithdraw,unbindWithdraw } from '@/api/common.js';
import Header from '@/components/common/header.vue';
import { clear } from '@/utils/auth.js';
import TopSafe from '@/components/common/top-safe.nvue'
import MyBtn from '@/components/common/my-btn.vue'
import func from '@/utils/func.js';
import AccountItem from './components/account-item.vue'
export default {
components: { Header, TopSafe,MyBtn },
components: { Header, TopSafe,MyBtn,AccountItem },
data() {
return {
userInfo: null,
inputText:'',
tipsShow:false,
content:'是否确定注销账号?'
type:0,
tabList:['支付宝账户','微信账户'],
dataList:[]
};
},
onShow() {
},
onLoad() {
this.init();
// this.userinfo();
},
methods: {
init() {
this.userinfo()
// this.userinfo()
// #ifdef WEB
this.tabList = ['支付宝账户'];
// #endif
this.getList();
},
onItemOk(item){
let params = {
bindId:item.id
}
unbindWithdraw(params).then(res=>{
if (res.bizcode === 100) {
this.$refs.uToastRef.show({
type: 'success',
message:'解绑成功',
});
this.init();
return null;
} else {
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
});
return null;
}
})
},
getList(){
getWithdraw({platform:this.type == 0?1:2}).then(res=>{
if (res.bizcode === 100) {
this.dataList = res.data;
this.dataList.forEach(item=>{
item.name = item.accountName;
item.account = item.accountNumber;
})
} else {
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
});
return null;
}
})
},
onTab(index){
if(index != this.type){
this.type = index;
this.init();
}
},
onJump(){
uni.navigateTo({
url:'/pages/rwa_package/setting/out-agreement'
})
},
onZhu(){
this.tipsShow = true;
},
onConfirm(){
// uni.navigateTo({
// url:'/pages/rwa_package/setting/out-code'
// })
this.onCancel();
deleteAccount().then(res=>{
if (res.bizcode == 100) {
clear()
this.$refs.uToastRef.show({
type: 'success',
message: "注销成功",
});
setTimeout(()=>{
uni.redirectTo({
url:'/pages/login_package/login/login'
})
},2000)
}
})
},
onCancel(){
this.tipsShow = false;
},
userinfo() {
getUserInfo().then(res => {
if (res.bizcode == 100) {
this.userInfo = res.data;
this.inputText = this.userInfo.nickname;
}
url:`/pages/rwa_package/account/bind?type=${this.type}`
})
}
}
@@ -107,43 +125,34 @@ export default {
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
.name-box{
.mid-view{
width:100%;
border-radius: 16rpx;
height:calc(100% - 88rpx);
display: flex;
flex-direction: column;
background-color: #fff;
padding: 64rpx 32rpx;
overflow-y: auto;
padding-bottom: 24rpx;
box-sizing: border-box;
margin-top:24rpx;
.mid-view{
width:100%;
padding: 40rpx 32rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
border:2rpx solid #eaeaea;
border-radius: 16rpx;
margin-top:48rpx;
}
.top-view{
width:100%;
}
.tab-view{
width:100%;
height:88rpx;
display: flex;
flex-direction: row;
// align-items: center;
.tab-list{
margin-right:32rpx;
height:55rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.input-view{
border-radius: 20rpx;
margin-top:52rpx;
width:100%;
padding: 0 32rpx;
min-height:104rpx;
display: flex;
flex-direction: row;
align-items: center;
background-color: #f5f5f5;
box-sizing: border-box;
justify-content: space-between;
.tab-line{
width:50rpx;
height:4rpx;
min-height:4rpx;
background-color: #7934F6;
}
}
}
+94
View File
@@ -0,0 +1,94 @@
<template>
<view class="content">
<TopSafe bgColor="rgba(0,0,0,0)"></TopSafe>
<Header bgColor="rgba(0,0,0,0)" />
<view class="setting-view">
<u-icon size="54" name="checkmark-circle-fill" style="margin-top:84rpx" color="#7934F6" ></u-icon>
<text class="text-zu text-32 mt-24">提现成功 ¥{{money || 0}}</text>
<text class="text-fu1 text-28 mt-24" style="text-align: center;">由于第三方结算原因,提现成功后可能存在一定延迟请关注提现账户变动情况~</text>
</view>
<view class="bottom-btn">
<MyBtn text="好的我知道了" @ok="onAdd"></MyBtn>
</view>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import { bindWithdraw } from '@/api/common.js';
import Header from '@/components/common/header.vue';
import { clear } from '@/utils/auth.js';
import TopSafe from '@/components/common/top-safe.nvue'
import MyBtn from '@/components/common/my-btn.vue'
import func from '@/utils/func.js';
import AccountItem from './components/account-item.vue'
export default {
components: { Header, TopSafe,MyBtn,AccountItem },
data() {
return {
money:''
};
},
onLoad(option) {
if(option && option.money){
this.money = Number(option.money);
}
},
methods: {
onAdd(){
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.bottom-btn{
width: 100%;
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));
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
.mid-view{
width:100%;
display: flex;
flex-direction: column;
overflow-y: auto;
box-sizing: border-box;
background-color: #fff;
border-radius: 16rpx;
padding: 48rpx 32rpx;
margin-top:24rpx;
.input-view{
width:100%;
height:100rpx;
background-color: #f5f5f5;
border-radius: 20rpx;
margin-top:32rpx;
display: flex;
flex-direction: row;
align-items: center;
}
}
}
</style>
+455
View File
@@ -0,0 +1,455 @@
<template>
<view class="content">
<TopSafe bgColor="rgba(0,0,0,0)"></TopSafe>
<Header :title="topText" bgColor="rgba(0,0,0,0)" />
<view class="setting-view">
<view class="top-view">
<view class="top-left">
<text class="text-bold text-52 text-white">
{{amount}}
</text>
<text class="text-20 text-white" style="font-weight: 100;">可用余额</text>
</view>
<view class="top-right">
<text class="text-bold text-36 text-white">
0
</text>
<text class="text-20 text-white" style="font-weight: 100;">不可用余额</text>
</view>
</view>
<view class="mid-view">
<text class="text-zu1 text-32">{{type == 0 ? '提现' : '充值'}}方式</text>
<view class="item-view" @click="onSelect('0')">
<image src="../../../static/new/wx.png"></image>
<text class="text-zu1 text-32 " style="margin-left:20rpx;">微信</text>
<view class="right-icon-view" v-if="type == 1">
<u-radio-group v-model="curSelect">
<u-radio name="0" activeColor="#7934F6"></u-radio>
</u-radio-group>
</view>
<view class="right-icon-view" v-else>
<text class="text-32 text-zu1" style="margin-right:12rpx"v-if="selectVal && curSelect == '0'">{{selectVal.name + '/' + selectVal.account}}</text>
<u-icon size="14" name="arrow-right" color="#333" ></u-icon>
</view>
</view>
<view class="item-view" @click="onSelect('1')" style="border-width: 0;" >
<image src="../../../static/new/zfb.png"></image>
<text class="text-zu1 text-32 " style="margin-left:20rpx;">支付宝</text>
<view class="right-icon-view" v-if="type == 1">
<u-radio-group v-model="curSelect">
<u-radio name="1" activeColor="#7934F6"></u-radio>
</u-radio-group>
</view>
<view class="right-icon-view" v-else>
<text class="text-32 text-zu1" style="margin-right:12rpx" v-if="selectVal && curSelect == '1'">{{selectVal.name + '/' + selectVal.account}}</text>
<u-icon size="14" name="arrow-right" color="#333" ></u-icon>
</view>
</view>
</view>
<view class="mid-view">
<view class="flex-r-lr">
<text class="text-zu1 text-32">{{type == 0 ? '提现' : '充值'}}金额</text>
<text class="text-fu1 text-28" v-if="type == 0" style="font-weight:400">每日仅限提现1次</text>
</view>
<view class="input-view">
<text class="text-52 text-zu text-bold">¥</text>
<input style="background: #fff;margin-top:10rpx;"
:placeholder="type == 0 ? '请输入提现金额(0.3-2000)' : '输入充值金额'"
placeholder-style="color:#999;font-weight:400"
@input="onInput"
border="0" v-model="money" :customStyle="inputCss"></input>
</view>
</view>
<view class="zhu-view" v-if="selectVal">
<u-icon size="12" style="margin-top:5rpx;margin-right:12rpx" name="error-circle" color="#7934F6"></u-icon>
<text class="text-24 text-zi" style="font-weight: 400;">通过支付宝或微信提现时,将由支付宝/微信官方收取0.6%的费用,本平台不收取任何费用。</text>
</view>
</view>
<view class="bottom-btn">
<MyBtn :text="bottomText" @ok="onAdd"></MyBtn>
</view>
<SelectItem :itemData="dataList" @close="onClose" @ok="onOk"
:type="curSelect" :itemShow="selectShow"></SelectItem>
<CodeItem @ti="onTi" @close="onClose" :codeShow="codeShow" :phone="userInfo ? userInfo.mobile :''"></CodeItem>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import { getWithdraw,sendWithdraw } from '@/api/common.js';
import { getUserInfo,updateName,deleteAccount } from '@/api/auth.js';
import Header from '@/components/common/header.vue';
import { clear } from '@/utils/auth.js';
import TopSafe from '@/components/common/top-safe.nvue'
import MyBtn from '@/components/common/my-btn.vue'
import func from '@/utils/func.js';
import SelectItem from './components/select-item.vue'
import CodeItem from './components/code-item.vue'
import { getRechargeSupportPay, recharge,getAcctBalance } from '@/api/finance.js';
import { feedback } from '@/api/payment.js';
import { appWxpayFun, zfbPayFun } from '@/utils/payUtils.js'
export default {
components: { Header, TopSafe,MyBtn,SelectItem,CodeItem },
data() {
return {
topText:'',
type:0,
amount:'',
money:'',
noAmount:'',
account:'',
bottomText:'',
curSelect:'0',
selectShow:false,
codeShow:false,
name:'',
inputCss: {
"height": '80rpx',
"background": "#F3F3F3FF",
"border-radius": "30rpx",
"border": "0rpx",
"padding-left": "12rpx",
},
dataList:[
],
selectVal:null,
userInfo:null,
};
},
onLoad(option) {
if(option && option.type){
this.type = Number(option.type);
this.init();
}
},
methods: {
userinfo() {
getUserInfo().then(res => {
if (res.bizcode == 100) {
this.userInfo = res.data;
}
})
},
onInput(e){
this.$nextTick(() => {
this.money = func.checkInputPrice(e.detail.value);
})
},
onOk(val){
this.selectVal = this.dataList.filter(i=>i.id == val)[0];
this.onClose();
},
onClose(){
this.selectShow = false;
this.codeShow = false;
},
getList(val){
let params = {
platform:this.curSelect == 0 ? 2 : 1
}
getWithdraw(params).then(res=>{
if (res.bizcode === 100) {
this.dataList = res.data;
this.dataList.forEach(item=>{
item.name = item.accountName;
item.account = item.accountNumber;
})
this.selectShow = true;
} else {
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
});
return null;
}
})
},
onSelect(val){
this.curSelect = val;
if(this.type == 0){
this.selectVal = null;
this.getList();
}
},
async getAcctBalance() {
this.balanceLoading = true;
const resp = await getAcctBalance();
let data = [];
if (resp && resp.bizcode === 100) {
data = resp.data || [];
data.forEach(item=>{
if("balance" == item.categoty){
this.noAmount = item.lockAmount;
this.amount = item.curAmount;
}
})
}
this.balanceList = data;
this.balanceLoading = false;
},
init() {
if(this.type == 0 ){
this.topText = '现金余额提现';
this.bottomText = '提现';
}else if(this.type == 1){
this.topText = '现金余额充值';
this.bottomText = '充值';
}
this.userinfo();
this.getAcctBalance();
},
onAdd(){
if(this.type == 0){
if(!this.money){
this.$refs.uToastRef.show({
type: "error",
message: "请输入金额",
});
return;
}
if(Number(this.money) < 0.3){
this.$refs.uToastRef.show({
type: "error",
message: "提现金额不能低于0.3元",
});
return;
}
if(Number(this.money) > 2000){
this.$refs.uToastRef.show({
type: "error",
message: "提现金额不能大于2000元",
});
return;
}
if(Number(this.money)> Number(this.amount)){
this.$refs.uToastRef.show({
type: "error",
message: "输入金额大于可用余额",
});
return;
}
if(this.type == 0 && !this.selectVal){
this.$refs.uToastRef.show({
type: "error",
message: "请选择提现方式",
});
return;
}
this.codeShow = true;
}else{
if(!this.money){
this.$refs.uToastRef.show({
type: "error",
message: "请输入金额",
});
return;
}
let params = {
amount:this.money,
category:'balance',
payway:this.curSelect == '0' ? 'wechat' : 'alipay'
}
recharge(params).then(result=>{
if (result && result.bizcode === 100) {
const item = result.data;
if (item.wechat && Object.keys(item.wechat).length !== 0) {
this.appWxpay(item.wechat, item.orderId, item.orderNum);
} else if (item.alipay && Object.keys(item.alipay).length !== 0 && item.alipay) {
this.zfbPay(item.alipay, item.orderId, item.orderNum);
} else {
this.$refs.uToastRef.show({
type: 'error',
message: "充值失败",
});
}
}
})
}
},
async appWxpay(alipay, orderId, orderNum) {
try {
const result = await appWxpayFun(alipay, orderId, orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
// 支付宝支付
async zfbPay(alipay, orderId, orderNum) {
try {
const result = await zfbPayFun(alipay, orderId, orderNum);
console.log('支付成功', result);
// 处理支付成功后的逻辑,如更新订单状态等
} catch (error) {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
onTi(code){
let params = {
verificationCode:code,
bindId:this.selectVal.id,
amount:Number(this.money),
accountType:this.curSelect == '0' ? 1 : 2
}
console.log('absc',params)
sendWithdraw(params).then(res=>{
console.log('absc',res)
if (res && res.bizcode === 100) {
console.log('absc',res)
// data = resp.data || [];
if(this.curSelect == '1'){
uni.navigateTo({
url:'/pages/rwa_package/account/success?money=' + params.amount
})
}else{
uni.requestMerchantTransfer({
"mchId": "mchId",
"appId": "wx7a5902cd556d9396",
"package": "package",
success: (res) => {
uni.navigateTo({
url:'/pages/rwa_package/account/success?money=' + params.amount
})
},
fail: (res) => {
console.log(res.errMsg)
},
})
}
}
})
this.money = '';
this.curSelect = '0';
this.selectVal = null;
this.onClose();
}
}
}
</script>
<style lang="scss" scoped>
.bottom-btn{
width: 100%;
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));
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
.top-view{
width:100%;
margin-top:40rpx;
height:188rpx;
min-height:188rpx;
display: flex;
background:linear-gradient( 270deg, #B164FB 0%, #7934F6 100%);
padding: 36rpx 32rpx;
box-sizing: border-box;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-radius: 16rpx;
.top-left{
display: flex;
flex-direction: column;
justify-content: space-between;
height:108rpx;
}
.top-right{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
height:108rpx;
}
}
.zhu-view{
width:100%;
display: flex;
margin-top:32rpx;
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
padding: 16rpx;
box-sizing: border-box;
background: rgba(121, 52, 246, 0.05);
border-radius:8rpx ;
}
.mid-view{
width:100%;
display: flex;
flex-direction: column;
overflow-y: auto;
box-sizing: border-box;
background-color: #fff;
border-radius: 16rpx;
padding: 32rpx;
padding-bottom:0 ;
margin-top:24rpx;
.item-view{
width:100%;
heihgt:110rpx;
min-height:110rpx;
display: flex;
flex-direction: row;
position: relative;
align-items: center;
border-bottom: 2rpx solid #ececec;
.right-icon-view{
position: absolute;
right:0;
display: flex;
}
image{
width:48rpx;
height:48rpx;
}
}
.input-view{
width:100%;
height:100rpx;
border-radius: 20rpx;
margin:32rpx 0 ;
display: flex;
flex-direction: row;
align-items: center;
}
}
}
</style>