<template>
	<view class="running-water">
		<mNavbar :title="$route.query.status ? title[$route.query.status] : '流水'" :leftClick="leftClick" />
		<view class="tab-box">
			<view class="tab-box1" v-if="agentFlow.pageList && agentFlow.pageList.total">
				<van-cell center border :title="item.title"
				v-for="(item, index) in agentFlow.pageList.records"
				:value="x[item.type] + item.money" :label="item.createTime" />
			</view>
			<van-empty v-else description="暂无数据" image="/static/ms/empty.png" />
		</view>
	</view>
</template>

<script>
	import mNavbar from '@/components/base/m-navbar.vue'
	export default {
		components: {
			mNavbar
		},
		data() {
			return {
				title : ['充值记录','提现记录','下单记录','佣金记录'],
				agentFlow : [],
				x : ['+', '-' , '-' , '+']
			}
		},
		onShow(){
			this.getAgentFlow();
		},
		methods: {
			leftClick() {		//返回钱包
				uni.navigateTo({
					url: '/pages/mine/wallet'
				})
			},
			getAgentFlow(){		//获取流水记录
				let type = this.$route.query.status;
				this.$api('getAgentFlow', { type }, res => {
					if(res.code == 200){
						this.agentFlow = res.result
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.running-water{
	width: 750rpx;
	background: #F5F5F5;
	margin: 0 auto;
	min-height: 100vh;
}
</style>
