You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
huazhiyu/pages/my/withdraw.vue

355 lines
7.0 KiB

<template>
<view class="page">
<view class="totalContent">
<view class="totalitem">
<view class="price">
<text></text>
<text class="num">{{info.available_commission_amount}}</text>
</view>
<view class="descText">
可提现金额
</view>
</view>
<view class="withdraw-btn" @click="show=true">提现</view>
<!-- <view class="totalitem" style="border-left:1px solid #fff;">
<view class="price">
<text class="num">{{info.distribute_order_num}}</text>
</view>
<view class="descText">
订单数
</view>
</view> -->
</view>
<view class="yongjinTitle">
提现明细
</view>
<!-- 佣金明细 -->
<view class="record-list" v-show="tableData.length>0">
<view class="list" v-for="(item,index) in tableData" :key="index">
<!-- <image :src="baseUrl+item.avatar" mode="aspectFill" class="avatarPic"></image> -->
<view class="outer">
<view class="title-date">
<view class="title">
<text>提现金额</text>{{item.amount}}
</view>
<view class="date">
<text>提现时间</text>{{item.update_time_text}}
</view>
</view>
</view>
<view class="integral">
<text style="color: #22AA44;">{{item.total_commission_amount}}</text>
</view>
</view>
</view>
<view class="empty" v-show="tableData.length==0">
<image src="../../static/image/mescroll-empty.png" mode="widthFix"></image>
<view class="emptyText">
暂无数据
</view>
</view>
<u-modal z-index="99" :show="show" title="提现" :show-cancel-button="true" @cancel="show=false" @confirm="submit">
<view class="slot-content">
<u-radio-group style="margin-top: 10px;" v-model="value" @change="radioGroupChange">
<u-radio
@change="radioChange"
style="margin-left: 10px;"
v-for="(item, index) in list" :key="index"
:name="item.name"
:disabled="item.disabled"
>
{{item.name}}
</u-radio>
</u-radio-group>
<u-input type="digit" v-model="amount" style="margin-top: 20px;" placeholder="请输入充值金额"></u-input>
<view v-if="validate" style="color: red;">{{amount?'提现金额不能大于可提现金额':'请输入充值金额'}}</view>
</view>
</u-modal>
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script>
import {getUserInfo,getWithdrawList,withdraw} from '@/common/api.js'
export default {
data() {
return {
tabList:[
{id:1,name:'已到账'},
{id:0,name:'未到账'},
],
activeIndex:1,
info:{
},
page:1,
limit:10,
tableData:[],
total:0,
show: false,
value: '银联',
amount: '',
list: [
{
name: '银联',
disabled: false
},
{
name: '支付宝',
disabled: false
},
{
name: '微信',
disabled: false
}
],
typeMap: {
'银联': 'bank',
'微信': 'wechat',
'支付宝': 'alipay',
},
validate: false,
};
},
methods:{
submit(){
console.log(Number(this.info.available_commission_amount), 'this.amount')
if(!this.amount||Number(this.amount) > Number(this.info.available_commission_amount)){
this.validate = true
return;
}
withdraw({
amount: this.amount,
method: this.typeMap[this.value]
}).then(res => {
console.log(res,'res')
if(res.code === 1){
this.show = false;
this.$refs.uToast.show({
message:'申请已提交'
})
const tem = setTimeout(() => {
uni.navigateBack({
delta:1
})
clearTimeout(tem)
},2000)
}
})
},
getInfo(){
getUserInfo({status:this.activeIndex}).then(res=>{
this.info = res.data
})
},
getList(val){
let params={
page:this.page,
limit:this.limit,
}
getWithdrawList(params).then(res=>{
console.log(res, 'list')
if(val){
this.tableData.push(...res.data.data)
}else{
this.tableData = res.data.data;
this.total = res.data.total
}
})
},
getItem(item){
this.page = 1;
this.activeIndex = item.id;
this.getInfo();
this.getList()
},
},
onReachBottom() {
if(this.tableData.length<this.total){
this.page++;
this.getList('over')
}
},
mounted(){
this.getInfo()
this.getList()
}
}
</script>
<style scoped lang="scss">
.page{
// position: absolute;
// left: 0;
// top: 0;
// width: 100%;
// height: 100%;
// background-color: #FFFFFF;
}
.tabs{
height: 80rpx;
background-color: rgb(35, 96, 48);
padding: 6rpx;
border-radius: 5px;
display: flex;
margin:0 24rpx;
.tabsItem{
flex:1;
text-align: center;
line-height: 70rpx;
font-size: 26rpx;
color: #ffffff;
}
.active{
background-color: #fff;
font-size: 30rpx;
font-weight: bold;
border-radius: 5px;
color: rgb(35, 96, 48);
}
}
.withdraw-btn{
width: 60px;
height: 30px;
line-height: 30px;
background: #fff;
border-radius: 30px;
font-size: 12px;
font-weight: 500;
color: #9f751f;
position: absolute;
right: 15px;
top: 20px;
text-align: center;
}
.totalContent{
height: 160rpx;
background: url('../../static/image/total-bg.png');
background-size: cover;
background-repeat: no-repeat;
border-radius: 6px;
overflow: hidden;
position: relative;
// width:94%;
// margin:20rpx auto 0 auto;
display: flex;
padding:40rpx 0;
margin:20rpx 24rpx;
.totalitem{
flex:1;
text-align: center;
display: flex;
flex-direction: column;
// justify-content: center;
.price{
display: flex;
align-items: center;
justify-content: center;
text{
font-size: 30rpx;
color:#fff;
}
.num{
font-size: 48rpx;
}
}
.descText{
text-align: center;
font-size: 28rpx;
color:#fff;
}
}
}
.yongjinTitle{
padding: 13px 0 4px 0;
font-size: 30rpx;
color: #9f751f;
margin:0 24rpx;
}
.record-list{
// width: 100%;
background-color: #FFFFFF;
padding:0 24rpx;
margin:0 24rpx;
border-radius: 10rpx;
.list{
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #f6f6f6;
.avatarPic{
width:100rpx;
height:100rpx;
border-radius: 50%;
}
.outer{
flex:1;
margin-left:20rpx;
padding:20rpx 0;
}
.title-date{
height: 100%;
.title{
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 50rpx;
text{
font-size: 28rpx;
font-weight: bold;
// color: #236030;
color: #959595;
}
}
.date{
display: flex;
align-items: center;
width: 100%;
height: 60rpx;
display: flex;
align-items: center;
justify-content: space-between;
text{
font-size: 28rpx;
font-weight: bold;
color: #959595;
}
}
}
.integral{
display: flex;
align-items: center;
height: 100%;
text{
font-size: 36rpx;
font-weight: bold;
color: $base;
}
}
}
}
.empty{
text-align: center;
image{
width:50%;
height:auto
}
.emptyText{
text-align: center;
margin-top:20rpx;
color:#aaa;
}
}
</style>