<template>
	<view class="enterpriseRecharge_body">
		<topBar height="343rpx" title="企业充值预处理">
			<view slot="coment">
				<view class="header_seach">
					<view class="header_seach_seach">
						<view class="seach_input">
							<uni-easyinput :letfText='letfText' confirmType='search'
								@confirm='getData.currentPage=1;getList()'
								placeholder-style="color:#bbbbbb;font-weight: 100;" v-model="getData.params.siteName"
								placeholder="企业名称">
							</uni-easyinput>
						</view>
					</view>
					<view class="Navigation">
						<view @tap="seleFn(item);seleindex = index"
							:class="seleindex==index?'navigation_seleitem':'navigation_item'"
							v-for="(item,index) in navigation" :key="index">
							{{item.text}}
							<uni-icons :animation="animationData" class="icoon" v-if="index==0" type="refreshempty"
								style="margin-left: 10rpx;" size="15" color="#bbbbbb"></uni-icons>
						</view>
					</view>
				</view>
			</view>
		</topBar>
		<view class="listContainer" style='flex: 1;overflow: hidden;'>
			<scroll-view :refresher-triggered='isShow.refresherTriggered' @refresherrefresh='refresherrefresh' :refresher-enabled='true' @scrolltolower='scrolltolower' style="height: 100%;" scroll-y="true">
				<view v-for="(item,index) in list" @tap="jump(item)" class="list_item_car" >
					<view style="">
						<view class=" list_item_car_title flex jb">
							<view class="flex">
								<view class="flex jcenter acenter" style="min-width: 93rpx;">
									<view>浪潮：{{item.lcCollectId}}</view>
								</view>
							</view>
						</view>
						<view class=" list_item_car_title flex ">
							<view class="flex">
								<view class="pricr_text">
									<view class="flex" style="padding: 15rpx 0;">
										企业名称
										<view style="margin: 0 10rpx; min-width: 150rpx;" class="blackcolor">
											{{item.companyName}}
										</view>
									</view>
									<view class="flex" style="padding: 15rpx 0;">
										交易金额
										<view style="margin: 0 10rpx;min-width: 150rpx;" class="blackcolor">
											{{ Number(item.collectionAmount).toFixed(2) }}
										</view>
									</view>
									<view class="flex" style="padding: 15rpx 0;">
										创建时间
										<view style="margin: 0 10rpx;min-width: 150rpx;" class="blackcolor">
											{{ item.createTime }}
										</view>
									</view>
								</view>
							</view>
							<view class="preTreatmentSignFlex">
								<view v-if="item.preTreatmentSign ==0" class="preTreatmentSign colorFFBA00">
									未处理
								</view>
								<view v-if="item.preTreatmentSign ==1" class="preTreatmentSign color13D6C4">
									已处理
								</view>
								<view v-if="item.preTreatmentSign ==-1" class="preTreatmentSign colorFF4949">
									已驳回
								</view>
							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import scroll from '@/components/scroll'
	import enterpriseRecharge from '@/api/enterpriseRecharge'
	export default {
		components: {
			scroll
		},
		data() {
			return {
				list: [],
				animationData: null,
				seleindex: '',
				isShow: {
					refresherTriggered:false
				},
				getData: {
					pageSize: 15,
					currentPage: 1,
					params: {
						preTreatmentSign: '', //申请状态审核状态
						siteName: '', //油站名称

					}
				},
				navigation: [{
						text: '全部',
						index: ''
					},
					{
						text: '未处理',
						index: '0'
					},
					{
						text: '已处理',
						index: '1'
					},
					{
						text: '已驳回',
						index: '-1'
					}
				],
			}
		},
		onShow() {
			this.getList()
		},
		onLoad() {
			this.getData.currentPage = 1
			this.getList()
		},
		methods: {
			jump(item){
				uni.navigateTo({
					url: './detail?jsData=' + JSON.stringify(item)
				})
			},
			refresherrefresh(e){
				this.isShow.refresherTriggered = true
				this.getList()
			},
			seleFn(e) {
				if (e.index == '') {
					this.getData.params.preTreatmentSign = ''
				} else {
					this.getData.params.preTreatmentSign = e.index
				}
				this.getData.currentPage = 1
				this.getList()
			},
			getList() {
				let page = JSON.parse(JSON.stringify(this.getData))
				enterpriseRecharge.getByPage(page).then(res => {
					this.isShow.refresherTriggered = false
					if (res.code !== 20000) return
					if (res.data.list.length == 0) {
						uni.showToast({
							title: '没有数据了哦',
							icon: 'none'
						})
					}
					if (page.currentPage !== 1) {
						this.list = this.list.concat(res.data.list)
						return
					}
					this.list = res.data.list
				})
			},
			scrolltolower() {
				this.getData.currentPage += 1
				this.getList()
			},
		}
	}
</script>

<style>
	@import url("./index.css");
</style>
