<template>
	<view>
		<mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
			:up="upOption">
			<view v-for="(item, index) in list" :key="index" class="flex align-center justify-between padding-sm bg-white margin-20 padding-20">
				<view class="padding-lr">
					<view class="title" style="display: flex;">
						渠道代理提现
						<text v-if="item.withdrawStatus=='WAITING'" style="font-size: 28rpx;color: #ff9900;padding-left: 20rpx;font-weight: 500;">处理中</text>
						<text v-if="item.withdrawStatus=='DONE'" style="font-size: 28rpx;color: #19be6b;padding-left: 20rpx;font-weight: 500;">已处理</text>
						<view v-if="item.withdrawStatus=='FAIL'" style="font-size: 28rpx;color: #F3484E;padding-left: 20rpx;font-weight: 500;">
							<text style="margin-right: 6rpx;">提现失败</text>
							<u-icon name="question-circle" @click="toast(item.failReason)"></u-icon>
						</view>
					</view>
					<view class="padding-top-sm" style="font-size: 24upx;font-family: PingFang SC;font-weight: bold;color: #686868;">
						{{item.createTime}}</view>
				</view>
				<view class="padding-right" v-if="item.withdrawStatus!=2">
					<text style="font-size: 36upx;font-family: PingFang SC;font-weight: bold;color: #F3484E;">+{{ item.actualPrice}}</text>
					<text class="text-bold padding-left-xs">元</text>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>
<script>
	import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin],
		data() {
			return {
				list: [],
				downOption:{
					auto:false
				},
			}
		},
		onLoad() {

		},
		methods: {
			downCallback() {
				setTimeout(() => {
					uni.showToast({
						title: "刷新成功",
						icon: "none"
					})
					this.mescroll.resetUpScroll();
				}, 1000)
			},
			toast(msg){
				this.$u.toast(msg)
			},
			upCallback(mescroll) {
				let params = {
					ownerId:this.vuex_userId,
					current:mescroll.num,
					size:mescroll.size,
				}
				try {
					this.$api.withdraw.list(params).then(res => {
						let data = res.data.records
						let total = res.data.total
						mescroll.endBySize(data.length, total);
						if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
						this.list = this.list.concat(data); //追加新数据
					})
				} catch (e) {
					this.mescroll.endErr()
				}
			},
		}
	}
</script>
<style lang="scss">
 .title {
 	font-size: 28upx;
 	font-family: PingFang SC;
 	font-weight: 800;
 	color: #000000;
	margin-bottom: 20rpx;
 }
</style>
