<template>
    <view class="container">
        <view class="list" v-for="(item,index) in list" :key="index">
            <view class="list_con flex_r flex_ac">
                <view class="list_name">提现单号：</view>
                <view class="list_text">{{item.order_sn}}</view>
            </view>
            <view class="list_con flex_r flex_ac">
                <view class="list_name">结算状态：</view>
                <view class="list_text g_color">{{statusup(item.status)}}</view>
            </view>
            <view class="list_con flex_r flex_ac">
                <view class="list_name">提现金额：</view>
                <view class="list_text y_color">￥{{item.money}}</view>
            </view>
            <view class="list_con flex_r flex_ac">
                <view class="list_name">提现类型：</view>
                <view class="list_text y_color">云宝提现</view>
            </view>
            <view class="list_con flex_r flex_ac">
                <view class="list_name">申请时间：</view>
                <view class="list_text">{{item.create_time}}</view>
            </view>
            <view class="list_con flex_r flex_ac">
                <view class="list_name">处理时间：</view>
                <view class="list_text" v-if="item.status != 0">{{item.check_time}}</view>
            </view>
            <view class="list_hint flex_r flex_ac">
                <image class="hint_img" src="/static/notice.png" mode=""></image>
                <view class="hint_msg r_color">{{item.remark}}</view>
            </view>
        </view>
        <not-goods v-if="haveGoods" textStr="暂无提现信息"></not-goods>
    </view>
</template>
<script>
let page = 1;
let app = getApp();
var appEv = app.$vm.$options;
import { post } from "@/request/api.js";
import notGoods from "@/components/not-goods/index.vue";

export default {
    components: {
        notGoods,
    },
    data() {
        return {
            haveGoods: false,
            status: 0,
            list: [],
            rows: 20,
            page: 1,
            userinfo: undefined
        };
    },
    onShow: function() {
        this.userinfo = uni.getStorageSync("userinfo");
        this.page = 1;
        this.loadData();
    },
    methods: {
        loadData() {
            let data = {
                page: this.page,
                rows: this.rows,
            };
            uni.showLoading({ mask: true });
            post("v1/my/withdraw", data).then((res) => {
                uni.hideLoading();
                if (res.code === 0) {
                    if (res.data.data.data.length > 0) {
                        this.list = this.list.concat(res.data.data.data);
                    } else {
                        if (this.page == 1) {
                            this.haveGoods = true;
                            this.page = -1;
                        } else {
                            this.page = -1;
                            appEv.errTips("暂无更多");
                        }
                    }
                } else {
                    if (page == 1) {
                        this.haveGoods = true;
                        this.page = -1;
                    } else {
                        this.page = -1;
                        appEv.errTips("暂无更多");
                    }
                }
            });
        },
		statusup(va){
			let a = Number(va)
			switch (a) {
				case 0: return "审核中";
				case 1: return "审核通过";
				case 2: return "付款通过";
				case 3: return "付款失败";
				case 4: return "审核失败";
				case 5: return "删除作废";
				default: return ""
			}
		}
    },
    onReachBottom() {
        if (this.page != -1) {
            setTimeout(function() {
                ++this.page;
                this.loadData();
            }, 800);
        }
    },
};
</script>
<style lang="scss" scoped>
// 页面配置
page {
    background: #f4f4f4;
}

.container {
    padding-top: 16rpx;
}

// 页面配置-end

// 明细列表
.list_con{
	margin-bottom: 8rpx;
	:last-child{
		margin-bottom: 0;
	}
}
.hint_msg {
    font-size: 22rpx;
}

.list_name {
    width: 160rpx;
    overflow: hidden;
    font-size: 30rpx;
    color: #404142;
    font-family: "SourceHanSansCN-Medium";
}

.hint_img {
    width: 24rpx;
    height: 25rpx;
    margin-right: 36rpx;
}

.list_hint {
    width: 100%;
    overflow: hidden;
    margin-top: 12rpx;
}

.list_text {
    color: #7c7c7c;
    font-size: 28rpx;
    font-family: "SourceHanSansCN-Medium";
}

.list {
    width: 100%;
    overflow: hidden;
    padding: 30rpx 60rpx;
    box-sizing: border-box;
    background: #fff;
    margin-bottom: 20rpx;
}

// 明细列表-end

// 状态颜色
.g_color {
    color: #1bbd89;
}

.y_color {
    color: #fd9f33;
}

.r_color {
    color: #ec421a;
}

// 状态颜色-end
</style>