<template>
    <view v-if="pageShow">
        <!-- 使用标题栏 -->
        <status-nav :statusBackw="true" :statusTitle="true" :title-val="titlename" :tabcolor="'#ffffff'"></status-nav>
        <view :style="{marginTop:(statusHNH+10)+'px'}">
            <view v-if="dataArr.length!=0" class="padding20 fon28 bacb margin-zy20 margin-x20" style="border-radius: 5rpx;" v-for="(item,index) in dataArr" :key="index">
                <view class="disba">
                    <view>{{item.title}}</view>
                    <view class="colorf78">-{{item.price}}</view>
                </view>
                <view class="fon24 color9 margin-s10">{{item.time}}</view>
            </view>
			<view v-if="dataArr.length==0" class="zanwu">暂无更多提现记录</view>
        </view>
        <backTop :showTop="showTop" @backTop="backTop"></backTop>
    </view>
</template>

<script>
    import backTop from '@/components/backTop.vue';
    export default {
        components:{
            backTop
        },
        data() {
            return {
                dataArr:[],
                showTop:false,
				titlename:'提现记录',
				page:1,
				size:50,
				statusHNH:uni.getStorageSync('statusHNH'),
				pageShow:false
            }
        },
        onLoad(options) {
            let num = options.index
			if(num==0){
				// 直卖提现记录
				this.titlename = '直卖提现记录'
				this.checkFenZhiList('sale')
			} else {
				// 分红提现记录
				this.titlename = '分红提现记录'
				this.checkFenZhiList('bonus')
			}
        },
		onShow() {
			this.$toolAll.tools.guoq()
		},
        onPageScroll(e) {
            e.scrollTop > 360 ? this.showTop = true : this.showTop = false
        },
        methods: {
			checkFenZhiList(newtype){
				this.$requst.post('user/withdraw-list',{page:this.page,size:this.size,type:newtype}).then(res=>{
					// console.log('提现记录：',res);
					this.pageShow = true
					if(res.data.list.length!=0){
						res.data.list.forEach(item=>{
							let fenObj = {
								title:'微信提现',
								time:item.created_at,
								price:item.amount/100
							}
							this.dataArr.push(fenObj)
						})
					}
				},error=>{})
				
			},
            backTop(){
                uni.pageScrollTo({
                    scrollTop: 0,
                    duration: 300
                });
            },
        }
    }
</script>

<style>
</style>
