<template>
	<view class="cdetailStyle" :style="{'height':contentHeight}">
		<view style="width: 100%;height: 100%;">
			<u-tabs height="100" :list="list" :is-scroll="false" :current="msg.AuditStatus" @change="change" :active-color='mainColor' bg-color='#f3f4f6'></u-tabs>
			<u-empty v-if="g.length==0" text="暂无数据" mode="data"></u-empty>
			<template v-if="g.length > 0">
				<view  
				  style="
						height: calc(100vh - 50px);
						width: calc(100vw);
						overflow: hidden;
						padding: 10px 0;
				  ">
					<scroll-view
						:scroll-y="true"
						:enable-back-to-top="true"
						:enable-flex="true"
						@scrolltolower="lower"
						:style="{ height: '100%' }">
						<view style="display: flex;flex-direction: column;align-items: center;">
							<view v-for="(item, index) in g" :key="index" class="listbox">
								<!-- <view style="padding: 10px;color: #999;">{{item.date}}</view> -->
								<!-- <view class="box_b" v-for="(c, i) in item.list" :key="i"> -->
								<view class="box_b" >
									<view class="box_b_l">
										<view style='display: flex;flex-direction: row;align-items: center;'>
											<Text>{{item.WithdrawalWayName}}</Text>
											<view  class="status">
												<Text :style="{'color':mainColor}">{{item.AuditStatusName}}</Text>
											</view>
										</view>
										<Text class='text_s' v-if='item.WithdrawalWay==1'>提现方式：自动打款</Text>
										<Text class='text_s' v-if='item.WithdrawalWay==2'>提现方式：微信线下转账</Text>
										<Text class='text_s' v-if='item.WithdrawalWay==3'>提现方式：支付宝线下转账</Text>
										<Text class='text_s' v-if='item.WithdrawalWay==4'>提现方式：银行卡线下转账</Text>
										<Text class='text_s' v-if='item.WithdrawalWay==5'>提现方式：余额提现</Text>
										<Text class='text_s'>提现时间：{{item.RemitDate}}</Text>
									</view>
									<view class="box_b_l" style="align-items: flex-end;">
										<Text style='font-size: 18px;'>{{item.AppliedMoney}}</Text>
										<Text class='text_s' > 手续费{{item.Fee}}</Text>
									</view>
								</view>
							</view>
						</view>
							<u-loadmore
							  :status="status"
							  :load-text="loadText"
							  :font-size="24"
							  :margin-top="20"
							  :margin-bottom="20"
							  bg-color="#f3f4f6"
							/>
					</scroll-view>
					
				</view>
			</template>
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: "提现明细",
				contentHeight:0,
				mainColor:'',
				secondary:'',
				g:[],
				
				list:[
					{name: '全部'},
					{name: '待审核'},
					{name: '待打款'},
					{name: '已打款'},
					{name: '无效'},
				],
				msg:{
					pageIndex: 1,
					pageSize:10,
					AuditStatus:0
				},
				page_count:1,
				status: "loadmore",
				loadText: {
				  loadmore: "轻轻上拉，加载更多",
				  loading: "努力加载中",
				  nomore: "没有更多了",
				},
			}
		},
	
		created(){
			 this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
			 this.mainColor = this.$uiConfig.mainColor;
			 this.secondary = this.$uiConfig.secondary;
			 this.init()
		},
		mounted() {
			let currentPages = getCurrentPages();
			 let u = "/" + currentPages[currentPages.length-1].route;
			 let pages = wx.getStorageSync("basedata")
			   ? wx.getStorageSync("basedata").bar_title
			   : [];
			 pages.forEach((x) => {
			   if (x.value == u) {
			     this.pageTitle = x.new_name ? x.new_name : x.name;
			   }
			 });
			 uni.setNavigationBarTitle({
			   title: this.pageTitle,
			 });
		},
		methods: {
			init(){
				
				uni.showLoading({
					title: '加载中'
				});
				this.request2(
				  {
				  	url: '/api/AppletUser/GetUserDistrbutorRemitPageList',
				  	data: this.msg
				  },
							
				  (res) => {
					 
					uni.hideLoading();
					
					this.g = this.g.concat(res.data.pageData);
					console.log(res.data.pageData)
					console.log(this.g)
					this.page_count = res.data.pageCount;
					if (this.page_count == 1) {
					  this.status = "nomore";
					}
					
				  }
			);
			},
			change(index){
				this.msg.AuditStatus = index;
				this.msg.pageIndex=1;
				this.g=[]
				this.init()
			},
			lower(e) {
			  if (this.msg.pageIndex < this.page_count) {
				this.msg.pageIndex++;
				this.status = "loading";
				this.init();
			  } else {
				this.status = "nomore";
			  }
			},
		}
	}
</script>

<style>
.cdetailStyle{
	background: #f3f4f6;
	
}

	.cdetailStyle .listbox{
		width: 94%;
		border-radius: 10rpx;
		background: #fff;
		margin-top: 15px;
	}
	.cdetailStyle .listbox .box_b{
		width: 100%;
		padding: 10px;
		/* border-top: 1px solid #f5f5f5; */
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		
	}
	.listbox .box_b .box_b_l{
		display: flex;
		flex-direction: column;
		
	}
	.box_b .box_b_l .status{
		height:20px ;
		padding: 0 5px;
		border: 1px solid #ff4544;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 10px;
		margin-left: 5px;
		font-size: 14px;
	}
	.cdetailStyle .text_s{
		font-size: 14px;
		color: #999999;
		margin-top: 3px;
	}
</style>
