<template>
	<view>
		<view class="input-box">
			<view class="icon search"></view>
			<input placeholder="请输入搜索的内容" v-model="tradeNo" placeholder-style="color:#c0c0c0;" @input="toSearch()" />
		</view>

		<view v-if="orderList == ''" class="mart60 fotct font14 fcor666">
			<image mode="widthFix" style="width: 70vw;" src="../../../static/img/noorder.png"></image>
		</view>
		<view class="width100 backcorfff" v-for="(item,index) in orderList" :key="index"
			@click="jumpdetails(item.orderNo)">
			<view class="width94 paddtop10 paddbotm10 alijusstart bor-botm1">
				<view class="width15">
					<image src="../../../static/img/wechat.png" mode="widthFix" class="iconw40"></image>
				</view>
				<view class="width85">
					<view class="font13 fcor999 width100">订单编号 :
						<text class="font14 fcor333 margle">{{item.orderNo}}</text>
					</view>
					<view class="font13 fcor999 mart5 width100">商户名称 :
						<text class="font14 fcor333 margle">
							{{item.merAbbreviate}}</text>
					</view>
					<view class="alijusstart font13 ">
						<view class="width50 fcor999 ">交易金额 : ¥
							<text class="fcoreb5 margle font18">{{item.tradePrice}}</text>
						</view>
						<view class="width50 fcor999 fotrt">交易状态 :
							<text class="fcoreb5 margle font16" v-if="item.status == 1">待支付</text>
							<text class="fcor41c margle font16" v-if="item.status == 2">已支付</text>
							<text class="fcoreb5 margle font16" v-if="item.status == 3">已退款</text>
						</view>
					</view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import {
		queryOrderList
	} from '../../../Utils/Api.js';
	export default {
		data() {
			return {
				orderList: [], //交易记录
				accountNumber: '', //账户编号
				tradeNo: '', //交易编号
				pageNum: 1,
				pageSize: 10,
				isNoMoreData: false, //是否加载中
			}
		},
		onLoad(options) {
			this.accountNumber = options.merNo;
			this.queryOrderList();
		},
		methods: {
			//查询列表
			queryOrderList() {
				uni.showLoading({
					title: '加载中...'
				})
				if (this.isNoMoreData) {
					uni.hideLoading()
					return false;
				}
				let pagenum = this.pageNum;
				let datas = {
					accountNumber: this.accountNumber,
					pageNum: pagenum,
					pageSize: this.pageSize
				}
				queryOrderList(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000' && res.return_data.list) {
						this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
						this.orderList = this.orderList.concat(res.return_data
							.list);
						if (res.return_data.total == (this.pageNum * this.pageSize)) {
							this.isNoMoreData = true;
						}
						this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;
					} else {
						this.orderList = [];
						uni.showToast({
							title: res.return_msg,
							duration: 2000,
							icon: 'none'
						})
					}
				})
			},
			//跳转详情
			jumpdetails(item) {
				uni.navigateTo({
					url: '/pages/index/activity_recharge_details/activity_recharge_details?orderNo=' + item
				})
			}
		}
	}
</script>

<style lang="scss">
	.input-box {
		width: 90%;
		margin-left: 5%;
		margin-top: 15px;
		margin-bottom: 15px;
		height: 70rpx;
		background-color: #f5f5f5;
		border-radius: 10rpx;
		position: relative;
		display: flex;
		align-items: center;

		.icon {
			display: flex;
			align-items: center;
			position: absolute;
			top: 2px;
			left: 5px;
			width: 60upx;
			height: 60upx;
			font-size: 34upx;
			color: #c0c0c0;
		}

		input {
			padding-left: 50upx;
			height: 28upx;
			font-size: 28upx;
			width: 100%;
		}
	}
</style>