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

		<view v-if="accountRecordList == ''" 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 accountRecordList" :key="index" @click="jumpdetails(item.tradeNumber)">
			<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="width94">
					<view class="font13 fcor999 width100">交易编号: <text class="font14 fcor333 margle">{{item.tradeNumber}}
						</text></view>

					<view class="font13 fcor999 width100">交易对象类型:
						<text class="font14 fcor333 margle" v-if="item.objectType == 1">充值</text>
						<text class="font14 fcor333 margle" v-if="item.objectType == 2">返利金</text>
						<text class="font14 fcor333 margle" v-if="item.objectType == 3">活动金额充值</text>
						<text class="font14 fcor333 margle" v-if="item.objectType == 4">活动金额回收</text>
					</view>

					<view class="alijusstart font13 ">
						<view class="width50 fcor999">交易类型 :
							<text class="font14 fcor333 margle" v-if="item.tradeType == 1"> 进账</text>
							<text class="font14 fcor333 margle" v-if="item.tradeType == 2"> 出账</text>
						</view>
						<view class="width50 fcor999 fotrt">交易金额 :¥
							<text class="fcor41c margle font18">{{item.tradeAmount}}</text>
							<!-- <text class="fcoreb5 margle font18">12.2</text> -->
						</view>
					</view>
				</view>
			</view>

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

<script>
	import {
		queryAccountRecordList
	} from '../../../Utils/Api.js';
	export default {
		data() {
			return {
				accountRecordList: [], //交易记录
				accountNumber: '', //账户编号
				tradeNos: '', //交易编号
				pageNum: 1,
				pageSize: 10,
				isNoMoreData: false, //是否加载中
			}
		},
		onLoad(options) {
			this.accountNumber = options.merNo;
			this.queryAccountRecordList();
		},
		methods: {
			//查询列表
			queryAccountRecordList() {
				uni.showLoading({
					title: '加载中...'
				})
				if (this.isNoMoreData) {
					uni.hideLoading()
					return false;
				}
				let pagenum = this.pageNum;
				let datas = {
					accountNumber: this.accountNumber,
					pageNum: pagenum,
					pageSize: this.pageSize
				}
				queryAccountRecordList(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.accountRecordList = this.accountRecordList.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.accountRecordList = [];
						uni.showToast({
							title: res.return_msg,
							duration: 2000,
							icon: 'none'
						})
					}
				})
			},
			//跳转详情
			jumpdetails(item) {
				uni.navigateTo({
					url: '/pages/index/activity_transaction_details/activity_transaction_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>