<template>
	<view class="wallet">
<!-- 		<view class="select-date" @click="openCalendar">
			<u-icon class="icon" size="22" name="calendar"></u-icon>
			<text v-if="createTimeStart && createTimeEnd">{{ createTimeStart }} ~ {{ createTimeEnd }}</text>
		</view> -->
		<view class="order" v-for="(item,index) in pageData" :key="index">
			<view class="fenqi">
				<block>
					<view class="item">
						<view class="goods-info">
							<view class="goods-name">
								<text class="name">{{item.applyStatusDis}}</text>
								<text v-if="item.rejectReason" class="selling-point">拒绝理由：{{ item.rejectReason }}</text>
								<image v-if="item.image" :src="item.image" mode="widthFix" style="width: 100px;" @click="proView(item.image)"></image>
								<text class="selling-point">申请时间：{{ item.createTime }}</text>
							</view>
							<view class="goods-price">
								<!-- <text class="add-price"
									v-if="item.scene == 10 || item.scene == 40">+￥{{ item.money }}</text>
								<text class="sub-price" v-if="item.scene == 20">-￥{{ item.money }}</text>
								<block v-if="item.scene == 30">
									<text class="add-price" v-if="item.money > 0">+￥{{ item.money }}</text>
									<text class="sub-price" v-else>-￥{{ Math.abs(item.money) }}</text>
								</block> -->
								<text class="num">￥{{ item.money }}</text>
							</view>
						</view>
					</view>
				</block>
			</view>
		</view>
		<!-- <uni-pagination @change="handlePageChange"></uni-pagination> -->
		
		<!-- <u-empty mode="order" icon="http://cdn.uviewui.com/uview/empty/car.png" text="暂无提现记录" v-if="pageData.length == 0">
		</u-empty> -->
		<u-loadmore :status="status" v-if="pageData.length > 0" line icon-color="#028BF7" marginBottom="20" @loadmore="onLoadMoreData()"/>
	</view>
</template>

<script>
	import {
		dateFormat
	} from '@/utils/util.js'
	import store from '@/store';
	import { ref } from 'vue';
	import { withdrawPage } from '@/websoft/api/merchant.js';

	export default {
		data() {
			return {
				pageNo:1,//当前页数
				pageSize:10,//页数大小
				totalPage:"",//总页数
				pageData:[],//列表数据
				status: 'loadmore',//状态
			};
		},
		// onLoad(option) {
		// 	const app = this
		// 	app.minDate = uni.$u.timeFormat(new Date().getTime() - 2592000000 * 2, 'yyyy-mm-dd');
		// },
		// onShow() {
		// },
		methods: {	
			openCalendar() {
				this.show = true
			},
			closeShow(){
				this.show = false
			},
			proView(url){
				uni.previewImage({
					urls: [url]
				})
			},
			//点击空布局按钮的回调
			emptyClick(){
				uni.showToast({
					title:'点击了按钮,具体逻辑自行实现'
				})
			},
			loadData() {
				const app = this
				withdrawPage({page:app.pageNo,limit:app.pageSize}).then(res=>{
					if(app.pageNo == 1) app.pageData = []
					app.pageData = app.pageData.concat(res.data.list)
					app.totalPage = Math.ceil(res.data.count / app.pageSize)
				})
			},
			onLoadMoreData() {
			    if (this.pageNo < this.totalPage) {
					this.pageNo++
					this.loadData()
			    } else {
					this.status = ''
					uni.showToast({ title: '没有更多数据', icon: 'none' })
			    }
			},
			onReachBottom() {
				console.log('上拉刷新')
			  	this.onLoadMoreData();//修改页数后，重新获取数据
			},
			onPullDownRefresh() {
				console.log('下拉刷新')
			    // 调用加载更多数据的方法
				
			    this.onLoadMoreData();
				setTimeout(function () {
					uni.stopPullDownRefresh();
				}, 500);
			}
		},
		mounted() {
		    this.loadData(); // 初次加载数据
		}
	}
</script>

<style lang="scss" scoped>
	.wallet {
		background-color: #f3f3f3;
		padding-top: 42rpx;
	}

	.order {
		background-color: #ffffff;
		border-radius: 12rpx;
		width: 700rpx;
		margin: 20rpx auto;
		padding: 10rpx 0;

		.title {
			font-weight: bold;
			font-size: 30rpx;
			padding: 20rpx;
			display: flex;
			justify-content: space-between;
		}

		.xieyi {
			padding: 20rpx;
			font-size: 26rpx;
		}
	}

	.fenqi {
		padding: 10rpx 30rpx;
		font-size: 26rpx;

		.item {
			display: flex;
			padding: 10rpx 0;

			.image {
				width: 160rpx;
				height: 120rpx;
			}

			.goods-info {
				width: 700rpx;
				margin-left: 10rpx;
				display: flex;
				justify-content: space-between;
				
				.name {
					font-weight: 500;
					max-width: 300rpx;
					text-overflow: -o-ellipsis-lastline;
					overflow: hidden; //溢出内容隐藏
					text-overflow: ellipsis; //文本溢出部分用省略号表示
					display: -webkit-box; //特别显示模式
					-webkit-line-clamp: 2; //行数
					line-clamp: 2;
					-webkit-box-orient: vertical; //盒子中内容竖直排列
				}

				.goods-name {
					text-align: left;
					display: flex;
					flex-direction: column;
					
					.comments{
						
					}
				}

				
			}

		}
	}

	.select-date {
		text-align: center;
		font-size: 28rpx;
		padding: 12rpx 0;
		margin: auto;
		display: flex;
		justify-content: center;
		align-items: center;

		.icon {
			margin-right: 10rpx;
		}
	}
	
	.selling-point {
		margin-top: 0.2rem;
		max-width: 400rpx;
		color: #999999;
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden; //溢出内容隐藏
		text-overflow: ellipsis; //文本溢出部分用省略号表示
		display: -webkit-box; //特别显示模式
		-webkit-line-clamp: 1; //行数
		line-clamp: 1;
		-webkit-box-orient: vertical; //盒子中内容竖直排列
	}
	
	.goods-price {
		display: flex;
		flex-direction: column;
	
		.add-price {
			color: #27b900;
		}
	
		.sub-price {
			color: #ff0000;
		}
	
		.num {
			text-align: right;
			color: #ff0000;
		}
	}

	.on-buy {
		background-color: #804002;
	}

	.user-card {
		width: 700rpx;
		height: 260rpx;
		margin: 30rpx auto;
		border-radius: 24rpx;
		background: linear-gradient(to bottom, #9E1A91, #4D0868);
		
		.user-info {
			padding: 40rpx;
			position: relative;

			.avatar {
				display: flex;
				align-items: center;
				color: #ffffff;

				.avatar-img {
					border: 4rpx solid #ffffff;
				}

				.user {
					margin-left: 15rpx;

					.nickname {
						font-size: 34rpx;
					}

					.desc {
						font-size: 26rpx;
						color: #b2b2b2;
					}
				}

				image {
					border: 4rpx solid #ffffff;
				}
			}

			.buy-log {
				position: absolute;
				z-index: 999;
				text-align: center;
				top: 50rpx;
				right: 40rpx;
				font-size: 24rpx;
				padding: 5rpx 20rpx;
				border-radius: 12rpx 0 12rpx 0;
				background-color: #f3f3f3;
			}
		}
	}

	// 我的收益
	.my-profit {
		background: linear-gradient(to bottom, #9E1A91, #4D0868);
		display: flex;
		align-items: center;
		justify-content: space-around;
		color: #ffffff;
		margin: 0 auto;
		padding: 22rpx 0;
		width: 700rpx;
		height: 140rpx;
		box-shadow: 0 1rpx 5rpx 0px #eaebec;
		border-radius: 24rpx;

		.item {
			text-align: center;

			.profit {
				font-size: 38rpx;
				font-weight: 500;
				color: #ffffff;
			}

			.desc {
				font-size: 24rpx;
				color: #d8d9dc;
			}
		}

	}
</style>
