<template>

	<view class="container">
		<view class="box-pack-between recharge_pof flex-y-center ">
			<view class="flex-y-center flex-grow-1 ft26 header-text">
				<!-- 		<view class="flex-grow-1 flex-center" data-text="1" :class="act_index==1?'act':''"
					@click="onTopBtnTap(1)">
					搜索
					<view class="d3"></view>
				</view>
 -->
				<view class="flex-grow-1 flex-center" data-text="3" :class="act_index==1?'act':''"
					@click="onTopBtnTap(1)">
					支付方式 <view class="d3"></view>
				</view>

				<view class="flex-grow-1 flex-center" data-text="4" :class="act_index==2?'act':''"
					@click="onTopBtnTap(2)">
					日期查找<view class="d3"></view>
				</view>

			</view>
		</view>

		<view class="header-hg100">

		</view>

		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index">

				<view class="top flex flex-y-center box-pack-between">

					<view class="pay-info flex flex-y-center">
						<image :src="item.type == 1?'../../static/images/wx.png':'../../static/images/ali.png'"
							class="pay-type-icon"></image>
						<view class="pay-status">{{item.type == 1?'微信':'支付宝'}}</view>
					</view>

					<view class="box-pack-between">
						<view class="cell flex flex-y-center">
							<view class="desc" style="color:#FEAF44">￥{{item.money}}</view>
						</view>
					</view>

				</view>

				<view class="content" style="border-bottom: 1rpx solid #f1f1f1;">
					<view class="cell flex flex-y-center">
						<view class="title">订单号：</view>
						<view class="desc">
							{{item.out_trade_no}}
						</view>
					</view>

					<view class="cell flex flex-y-center">
						<view class="title">订单时间 ：</view>
						<view class="desc">{{item.pay_time}}</view>
					</view>
				</view>
			</view>
			<view class="no-more">
				---没有更多了---
			</view>
		</view>

		<uni-popup-top ref="popup" type="top" :top="top" :maskClass="maskClass">
			<view class="showpay">
				<block v-if='act_index==1'>
					<view class="box-li" :class="pay_type==0?'active':''" @click="payType(0,'全部')" data-text='微信'>全部
					</view>
					<view class="box-li" :class="pay_type==1?'active':''" @click="payType(1,'微信')" data-text='微信'>微信
					</view>
					<view class="box-li" :class="pay_type==2?'active':''" @click="payType(2,'支付宝')" data-text='支付宝'>支付宝
					</view>
					<!-- 	<view class="box-li" :class="pay_type==3?'active':''" @click="payType(3,'余额支付')" data-text='余额支付'>
						余额支付
					</view> -->
				</block>

				<block v-if='act_index==2'>
					<view class="model">
						<view class="flex-center  model-date box-pack-between">
							<view class="model-item" :class="time_index==1?'act':''">
								<picker mode='date' :value="start" :start="startDate" :end="endDate"
									@change="bindDateChange1" data-index="1">
									<view class="flex-center">
										<text>{{start}}</text>
									</view>
								</picker>
							</view>
							<view class="model-item" :class="time_index==2?'act':''">
								<picker mode='date' :value="end" :start="startDate" :end="endDate"
									@change="bindDateChange2" data-index="1">
									<view class="flex-center">
										<text>{{end}}</text>
									</view>
								</picker>
							</view>
						</view>
						
						<view class="flex">
							<view class="model-btn-close  model-btn flex-center" @click="clear">
								清空
							</view>
							<view class="model-btn-success flex-center model-btn" @click="sure">
								确定
							</view>
						</view>
					</view>
				</block>
			</view>
		</uni-popup-top>

	</view>
</template>

<script>
	import uniPopupTop from '@/components/zx-uni-popup/uni-popup-top.vue'
	export default {
		components: {
			uniPopupTop
		},
		data() {
			return {
				URL: getApp().globalData.URL,
				store_id: "",
				list: [],
				page: 1,
				is_bottom: false,
				act_index: 1,
				time_index: 0,
				time_index2: 0,
				start: "开始时间",
				end: "结束时间",
				top: "100rpx",
				maskClass: {
					'position': 'fixed',
					'bottom': 0,
					'top': "100rpx",
					'left': 0,
					'right': 0,
					'backgroundColor': 'rgba(0, 0, 0, 0.4)'
				},
				serch: "",
				order_xdtime: "",
				pay_type: "",
			}
		},
		onLoad(options) {
			this.store_id = uni.getStorageSync("store_id");
			this.getData(1);
		},

		onReachBottom() {
			if (!this.is_bottom) {
				this.getData(this.page + 1)
			}
		},

		methods: {
			// 键盘完成事件
			firmSeach(e) {
				this.serch = e.detail.value;
				this.getData(1);
				this.$refs.popup.close();
			},
			// 监听input
			putSeach(e) {
				this.serch = e.detail.value;
				if (!e.detail.value) {
					this.getData(1);
				}
			},
			// 搜索
			bindSeach(e) {
				this.getData(1);
				this.$refs.popup.close();
			},

			// 支付方式搜索
			payType(e) {
				this.pay_type = e;
				this.getData(1);
				this.$refs.popup.close();
			},

			bindDateChange1(e) {
				this.time_index = e.currentTarget.dataset.index;
				this.start = e.target.value;
			},

			bindDateChange2(e) {
				this.time_index2 = e.currentTarget.dataset.index;
				this.end = e.target.value;
			},

			sure(e) {
				this.getData(1);
				this.$refs.popup.close();
			},

			clear() {
				this.start = '开始时间';
					this.end = '结束时间';
					this.start_text = '日期查找';
				this.getData(1);
				this.$refs.popup.close();
			},

			onTopBtnTap(e) {
				this.act_index = e;
				this.$refs.popup.open();
			},

			getData(page) {
				if (page == 1) {
					this.list = []
					this.page = 1
					this.is_bottom = false
				}
				this.request({
					url: 'Smdcshop/chongzhi_log',
					data: {
						page,
						// serch:this.serch,
						// order_xdtime:this.start=='选择时间'?'':this.start,
						type: this.pay_type,
						limit: 10,
						admin_id: uni.getStorageSync("admin_id"),
						start_time: this.start == '开始时间' ? '' : this.start,
						end_time: this.end == '结束时间' ? '' : this.end,
					}
				}).then(res => {
					if (res.code == 200 && res.data.length) {
						this.list = this.list.concat(res.data)
						this.page = page
					} else {
						this.is_bottom = true
					}
				})
			}
		},


	}
</script>
<style lang="scss">
	.search-content {
		padding: 20rpx 0;
		background: #FFFFFF;
		font-size: 28rpx;

		.search {
			width: 80%;
			border: 1rpx solid #F1F1F1;
			margin-right: 15rpx;
			padding: 10rpx;
			border-radius: 4rpx;

			icon {
				margin-right: 15rpx;
			}
		}
	}

	.header-text .act {
		color: #FEAF44;
	}

	.header-text .act .d3 {
		border-color: #FEAF44 transparent transparent transparent;
	}

	.model {
		width: 100%;
		z-index: 10;
		background: #FFFFFF;
		padding-bottom: 20rpx;

		.model-date {
			width: 100%;
			padding: 20rpx 40rpx;
			border-bottom: 1rpx solid #F1F1F1;

			.model-item {
				width: 300rpx;
				text-align: center;
				font-size: 28rpx;
				color: #999;
				position: relative;
				padding: 10rpx 0;
				text-align: center;
				border-radius: 8rpx;
				border: 1rpx solid #999;
			}

			// .act {
			// 	color: #FFFFFF;
			// 	background: #FFBE2C;
			// 	border: 1rpx solid #FFBE2C;
			// }
		}

		.model-btn {
			border-radius: 8rpx;
			box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.20);
			margin: 0 auto;
			margin-top: 20rpx;
			text-align: center;
			width: 41%;
			height: 80rpx;
			border-radius: none;
		}

		.model-btn-close {
			border: 1rpx solid #F1F1F1;
			color: #000;
		}

		.model-btn-success {
			color: #FFFFFF;
			background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);

		}
	}

	page {
		background-color: #F4F5F7;
	}

	.showpay .active {
		color:#FEAF44;
	}

	.recharge_pof {
		height: 100rpx;
		position: fixed;
		top: 0;
		width: 100%;
		z-index: 999;
		background: #fff;
	}

	.header-hg100 {
		height: 110rpx;
	}

	.list {
		padding: 0rpx 25rpx 0;
	}

	.list .item {
		background-color: #fff;
		border-radius: 8rpx;
		overflow: hidden;
		padding: 0 25rpx;
		margin-bottom: 30rpx;
		box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(213, 213, 213, 0.04);
	}

	.list .item .top {

		padding: 20rpx 0;

		border-bottom: 1rpx solid #f5f5f5;
	}

	.list .item .top .pay-info {
		flex: none;
	}

	.list .item .top .pay-type-icon {
		display: block;
		width: 28rpx;
		height: 28rpx;
		flex: none;
		margin-right: 8rpx;
		border-radius: 100px;
	}

	.list .item .top .pay-status {
		font-size: 28rpx;
		color: #464646;
	}

	.list .item .content {
		padding: 20rpx 0;
	}

	.list .content .cell {
		margin-bottom: 16rpx;
		font-size: 26rpx;
		color: #99A0AD;
	}

	.list .content .cell:last-child {
		margin-bottom: 0;
	}

	.list .content .cell .title {
		color: #99A0AD;
	}

	.list .content .cell .desc {
		color: #666;
	}

	.header-text {
		text-align: center;
	}

	.box-li {
		background-color: #fff;
		text-align: center;
		border-bottom: 1rpx solid #f1f1f1;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 26rpx;
	}

	.goods_list {
		font-size: 28rpx;
	}

	.goods_list-title {
		padding: 20rpx 0;
	}


	.goods_list-price {
		font-size: 26rpx;
		color: red;
	}

	.goods_list-num {
		font-size: 26rpx;
	}

	.d3 {
		width: 0;
		height: 0;
		border-width: 12rpx;
		border-style: solid;
		border-color: #000 transparent transparent transparent;
		margin-top: 14rpx;
	}

	.avatar-img {
		width: 80rpx;
		height: 80rpx;
		margin-right: 20rpx;
		border-radius: 100px;
	}

	.avatar-title {
		font-size: 26rpx;
	}
</style>
