|
|
|
@ -4,8 +4,8 @@ |
|
|
|
<view class="withdraw-input-box"> |
|
|
|
<view class="withdraw-title">提现金额</view> |
|
|
|
<view class="input-box"> |
|
|
|
¥ <input type="text" placeholder="输入金额" placeholder-class="pch" |
|
|
|
class="input-value" @blur="checkAmt()" value="" v-model="amt"/> |
|
|
|
¥ <input type="text" placeholder="输入金额" placeholder-class="pch" class="input-value" |
|
|
|
@blur="checkAmt()" value="" v-model="amt" /> |
|
|
|
</view> |
|
|
|
<view class="withdraw-amount"> |
|
|
|
<span>当前余额为¥{{userInfo.amt}}</span> |
|
|
|
@ -24,13 +24,16 @@ |
|
|
|
<view class="withdrawBox"> |
|
|
|
<view class="withdrawBox-title"> |
|
|
|
<view class="account-icon" v-if="item.type == '0'"> |
|
|
|
<uni-icons custom-prefix="iconfont" :type="payType[0].icon" size="20" :color="payType[0].color" ></uni-icons> |
|
|
|
<uni-icons custom-prefix="iconfont" :type="payType[0].icon" size="20" |
|
|
|
:color="payType[0].color"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="account-icon" v-if="item.type == '1'"> |
|
|
|
<uni-icons custom-prefix="iconfont" :type="payType[1].icon" size="20" :color="payType[1].color" ></uni-icons> |
|
|
|
<uni-icons custom-prefix="iconfont" :type="payType[1].icon" size="20" |
|
|
|
:color="payType[1].color"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="account-icon" v-if="item.type == '2'"> |
|
|
|
<uni-icons custom-prefix="iconfont" :type="payType[2].icon" size="20" :color="payType[2].color" ></uni-icons> |
|
|
|
<uni-icons custom-prefix="iconfont" :type="payType[2].icon" size="20" |
|
|
|
:color="payType[2].color"></uni-icons> |
|
|
|
</view><!-- 0->微信 1->银行卡 2->支付宝 --> |
|
|
|
<view class="account-title" v-if="item.type == '0'"> |
|
|
|
{{payType[0].title}} {{item.accountNo}} |
|
|
|
@ -43,7 +46,8 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view> |
|
|
|
<radio :value="JSON.stringify(item)" color="#0b6375" :checked="item.isUse === '1'" class="radioStyle"/> |
|
|
|
<radio :value="JSON.stringify(item)" color="#0b6375" :checked="item.isUse === '1'" |
|
|
|
class="radioStyle" /> |
|
|
|
<!-- <uni-data-checkbox v-model="item" :localdata="range" @change="change"></uni-data-checkbox> --> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -60,8 +64,10 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
getWithdrawList,getCreatorAccount, |
|
|
|
checkWithdraw,withdraw, |
|
|
|
getWithdrawList, |
|
|
|
getCreatorAccount, |
|
|
|
checkWithdraw, |
|
|
|
withdraw, |
|
|
|
getCreatorInfo |
|
|
|
} from '@/api/userInfo.js' |
|
|
|
export default { |
|
|
|
@ -70,14 +76,13 @@ |
|
|
|
amt: '', |
|
|
|
userInfo: {}, |
|
|
|
checkFlag: false, |
|
|
|
noClick:true, //防止重复提交 |
|
|
|
creatorAccountList:[], |
|
|
|
noClick: true, //防止重复提交 |
|
|
|
creatorAccountList: [], |
|
|
|
accountNo: '', |
|
|
|
accountRealNo: '', //真实已加密账户账号 |
|
|
|
type: '', |
|
|
|
current: 0, |
|
|
|
payType: [ |
|
|
|
{ |
|
|
|
payType: [{ |
|
|
|
icon: 'icon-weixin', |
|
|
|
title: '微信', |
|
|
|
color: '#15ba11' |
|
|
|
@ -95,7 +100,7 @@ |
|
|
|
], |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
onShow() { |
|
|
|
const userInfo = uni.getStorageSync('userInfo') |
|
|
|
if (!userInfo) { |
|
|
|
console.log('havent userInfo') |
|
|
|
@ -121,11 +126,26 @@ |
|
|
|
async getCreatorAccount() { |
|
|
|
let that = this; |
|
|
|
const res = await getCreatorAccount(that.userInfo.id) |
|
|
|
console.log('res', res) |
|
|
|
if (res.data.code === 200) { |
|
|
|
if (!res.data.data.length) { |
|
|
|
return uni.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '当前暂无银行卡,请点确认绑定', |
|
|
|
success: ({ |
|
|
|
confirm, |
|
|
|
cancel |
|
|
|
}) => { |
|
|
|
confirm && uni.navigateTo({ |
|
|
|
url: '/pages-userInfo/creatorAccount/createAccount' |
|
|
|
}) |
|
|
|
cancel && uni.navigateBack() |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
that.creatorAccountList.push(...res.data.data) |
|
|
|
for (let param of res.data.data) { |
|
|
|
if(param.isUse === '1'){ |
|
|
|
if (param.isUse === '1') { |
|
|
|
that.accountNo = param.accountNo; |
|
|
|
that.accountRealNo = param.accountRealNo; |
|
|
|
that.type = param.type; |
|
|
|
@ -148,13 +168,13 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
//检查是否超出余额或少于1元 |
|
|
|
checkAmt:function(){ |
|
|
|
checkAmt: function() { |
|
|
|
let that = this; |
|
|
|
if(parseFloat(that.amt) > parseFloat(that.userInfo.amt)){ |
|
|
|
if (parseFloat(that.amt) > parseFloat(that.userInfo.amt)) { |
|
|
|
that.checkFlag = true; |
|
|
|
}else if(parseFloat(that.amt) < parseFloat(1)){ |
|
|
|
} else if (parseFloat(that.amt) < parseFloat(1)) { |
|
|
|
that.checkFlag = true; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
that.checkFlag = false; |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -164,44 +184,44 @@ |
|
|
|
that.amt = that.userInfo.amt; |
|
|
|
}, |
|
|
|
//提现 |
|
|
|
async withdraw(){ |
|
|
|
async withdraw() { |
|
|
|
let that = this; |
|
|
|
console.log('点击了提现,金额为',that.type) |
|
|
|
if(that.amt == null || that.amt == ''){ |
|
|
|
console.log('点击了提现,金额为', that.type) |
|
|
|
if (that.amt == null || that.amt == '') { |
|
|
|
uni.showModal({ |
|
|
|
content: '请输入提现金额!', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
} |
|
|
|
if(that.checkFlag == true){ |
|
|
|
if (that.checkFlag == true) { |
|
|
|
//console.log('that.checkFlag',that.checkFlag) |
|
|
|
uni.showModal({ |
|
|
|
content: '输入金额超过或少于可提现余额!', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
//校验服务器是否可以提现 |
|
|
|
const param = { |
|
|
|
creatorId: that.userInfo.id, |
|
|
|
amt: that.amt |
|
|
|
} |
|
|
|
const checkRes = await checkWithdraw(param); |
|
|
|
if(checkRes.data.code === 200){ |
|
|
|
if (checkRes.data.code === 200) { |
|
|
|
//服务器返回true可提现 |
|
|
|
if(checkRes.data.data === true){ |
|
|
|
if (checkRes.data.data === true) { |
|
|
|
const withdrawParam = { |
|
|
|
creatorId: that.userInfo.id, |
|
|
|
amt: that.amt, |
|
|
|
accountNo: that.accountRealNo, |
|
|
|
channel: that.type |
|
|
|
} |
|
|
|
console.log('withdrawParam',withdrawParam) |
|
|
|
console.log('withdrawParam', withdrawParam) |
|
|
|
const withdrawRes = await withdraw(withdrawParam); |
|
|
|
if(withdrawRes.data.code === 200){ |
|
|
|
if (withdrawRes.data.code === 200) { |
|
|
|
//更新艺术家缓存 |
|
|
|
const creatorInfo = await getCreatorInfo(that.userInfo.id); |
|
|
|
console.log('creatorInfo',creatorInfo) |
|
|
|
if(creatorInfo.data.code === 200){ |
|
|
|
console.log('creatorInfo', creatorInfo) |
|
|
|
if (creatorInfo.data.code === 200) { |
|
|
|
uni.setStorage({ |
|
|
|
key: 'userInfo', |
|
|
|
data: creatorInfo.data.data, |
|
|
|
@ -218,7 +238,7 @@ |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
uni.showModal({ |
|
|
|
content: '获取艺术家信息失败!', |
|
|
|
showCancel: false |
|
|
|
@ -226,20 +246,20 @@ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
uni.showModal({ |
|
|
|
content: '发起提现申请失败!', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
//不可提现 |
|
|
|
uni.showModal({ |
|
|
|
content: '输入金额超过或少于可提现余额!', |
|
|
|
showCancel: false |
|
|
|
}); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
uni.showModal({ |
|
|
|
content: '检查艺术家是否可提现失败!', |
|
|
|
showCancel: false |
|
|
|
@ -307,18 +327,21 @@ |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
.withdraw-input-box{ |
|
|
|
|
|
|
|
.withdraw-input-box { |
|
|
|
width: 590rpx; |
|
|
|
padding: 40rpx; |
|
|
|
background: $uni-bg-base-color; |
|
|
|
border-radius: 10rpx; |
|
|
|
} |
|
|
|
.withdraw-title{ |
|
|
|
|
|
|
|
.withdraw-title { |
|
|
|
font-size: 28rpx; |
|
|
|
font-weight: 400; |
|
|
|
color: $uni-white; |
|
|
|
} |
|
|
|
.withdraw-amount{ |
|
|
|
|
|
|
|
.withdraw-amount { |
|
|
|
font-size: 28rpx; |
|
|
|
font-weight: 400; |
|
|
|
color: $uni-secondary-color; |
|
|
|
@ -330,7 +353,8 @@ |
|
|
|
color: $uni-primary; |
|
|
|
} |
|
|
|
} |
|
|
|
.withdraw-amount-tip{ |
|
|
|
|
|
|
|
.withdraw-amount-tip { |
|
|
|
font-size: 28rpx; |
|
|
|
font-weight: 400; |
|
|
|
color: $uni-white; |
|
|
|
@ -347,32 +371,36 @@ |
|
|
|
font-weight: bold; |
|
|
|
color: $uni-white; |
|
|
|
opacity: 1; |
|
|
|
border-bottom: 2rpx solid $uni-secondary-color;; |
|
|
|
border-bottom: 2rpx solid $uni-secondary-color; |
|
|
|
; |
|
|
|
} |
|
|
|
|
|
|
|
.input-box .input-value { |
|
|
|
flex: 1 auto; |
|
|
|
margin-left: 10rpx; |
|
|
|
height: 80rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.tl-flex-row{ |
|
|
|
.tl-flex-row { |
|
|
|
display: flex; |
|
|
|
justify-content: space-around; |
|
|
|
align-items: center; |
|
|
|
flex-wrap: wrap; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
.withdraw-account-list{ |
|
|
|
|
|
|
|
.withdraw-account-list { |
|
|
|
width: 590rpx; |
|
|
|
padding: 40rpx; |
|
|
|
background: $uni-bg-base-color; |
|
|
|
border-radius: 10rpx; |
|
|
|
} |
|
|
|
.tl-title-margin{ |
|
|
|
|
|
|
|
.tl-title-margin { |
|
|
|
margin: 20rpx 0; |
|
|
|
} |
|
|
|
|
|
|
|
.error-message{ |
|
|
|
.error-message { |
|
|
|
font-size: 26rpx; |
|
|
|
font-weight: 400; |
|
|
|
color: #E04646; |
|
|
|
@ -380,15 +408,19 @@ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.tl-text{ |
|
|
|
.tl-text { |
|
|
|
width: 450rpx; |
|
|
|
display: -webkit-box; /*弹性伸缩盒子模型显示*/ |
|
|
|
-webkit-box-orient: vertical; /*排列方式*/ |
|
|
|
-webkit-line-clamp: 1; /*显示文本行数(这里控制多少行隐藏)*/ |
|
|
|
overflow: hidden; /*溢出隐藏*/ |
|
|
|
display: -webkit-box; |
|
|
|
/*弹性伸缩盒子模型显示*/ |
|
|
|
-webkit-box-orient: vertical; |
|
|
|
/*排列方式*/ |
|
|
|
-webkit-line-clamp: 1; |
|
|
|
/*显示文本行数(这里控制多少行隐藏)*/ |
|
|
|
overflow: hidden; |
|
|
|
/*溢出隐藏*/ |
|
|
|
} |
|
|
|
|
|
|
|
.withdrawBox{ |
|
|
|
.withdrawBox { |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
@ -414,12 +446,11 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.tl-footer{ |
|
|
|
.tl-footer { |
|
|
|
margin-top: 120rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.withdraw-btn { |
|
|
|
color: $uni-btn-text-color; |
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
|