<template>
	<view class="contribution_body">
		<view style="display: flex;flex-direction: column;flex-wrap: wrap;" class="contribution_header_car">
			<view class="flex ac jc">
				<view class="flex  jc">
					<uni-icons v-if="dedata.routerIndex" color="#2866ff" custom-prefix="iconfont" type="iconjiayou" size="25"></uni-icons>
					<image v-else style="width: 60rpx; height: 60rpx;" src="../../../static/selegs.png"></image>
					<view style="width: 365rpx; overflow: hidden;margin-left: 24rpx;" >
						<view style="overflow: hidden;width: 100%;white-space: nowrap;text-overflow: ellipsis;" >
						{{ dedata.routerIndex?dedata.siteName:dedata.companyName}}
						</view>
						<view class="samalltext">{{dedata.id}}</view>
					</view>
					<view>
						<view  v-if="!dedata.routerIndex" :style="{background:dedata.parentMark=='0'?'':'#BC853B'}" style="height: fit-content;" class="list_item_tip">
						{{dedata.parentMark=='0'?'总公司':'子公司'}}
						</view>
						<view style="font-size: 24rpx;color: #ADCEFF;padding: 3rpx 0;">
							自营油卡
						</view>
					</view>
					
				</view>
			</view>
			<view style=" margin-top: 24rpx;justify-content: space-around;" class="flex">
				<view>{{dedata.totalAmount|price}}
				<text style="color: #BBBBBB;">¥</text>
				</view>
				<view>
				{{dedata.quantity|price}}
				<text style="color: #BBBBBB;">笔</text>
				</view>
			</view>
			<view class="contribution_header_car_tip flex ac jc">{{dedata.startTime.split(' ')[0]}} - {{dedata.endTime.split(' ')[0]}}</view>
		</view>
		<view style="flex: 1; margin-top: 73rpx; overflow: hidden; ">
			<scroll-view class="scroll-view" @scrolltolower='scrolltolower' style="height: 100%;" scroll-y="true">
				<view v-for="(item,index) in list" class="list_item">
					<image style="width: 80rpx;height: 80rpx;"  src="../../../static/tx.png"></image>
					<view style="width: 300rpx;margin-left: 10rpx;">
						<view v-if="item.nickName" style="font-size: 28rpx;font-weight: 700;" @click="callPhone(item.phone)">{{item.nickName}}-{{item.phone}}</view>
						<view v-if="!item.nickName" style="font-size: 28rpx;font-weight: 700;" @click="callPhone(item.phone)">{{item.phone}}-{{item.phone}}</view>
						<view style="font-size: 22rpx;color: #999999;margin-top: 6rpx;">{{item.createTime}}</view>
					</view>
					<view style="width: 200rpx;text-align: right;">
						<view style="font-size: 24rpx;">
							<view v-if="item.auditMark==0" style="color: 20.87rpx">待审核</view>
							<view v-if="item.auditMark==1" style="color: #0256FF">审核成功</view>
							<view v-if="item.auditMark==-1" style="color: #EA0000">审核失败</view>
						</view>
						<view>
							<view style="font-size: 30rpx;font-weight: 700;">{{item.disAmount|price}}</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import sy from '@/api/sy'
	import convertW from '../../components/convertW.js'
	export default {
		data() {
			return {
				routerIndex:true,
				list:[],
				dedata:null,
				getData: {
					pageSize: 10,
					currentPage: 1,
					params: {
						siteId: '',
						endTime: '',
						startTime: ''
					}
				},
			}
		},
		onLoad(e) {
			let routes = getCurrentPages();
			let routerIndex = routes[(routes.length - 2)].$page.fullPath.indexOf('?') != -1 ?
				routes[(routes.length - 2)].$page.fullPath.split('?')[0].split('/')[routes[(routes.length - 2)]
					.$page.fullPath.split('?')[0].split('/').length - 1] :
				routes[(routes.length - 2)].$page.fullPath.split('/')[routes[(routes.length - 2)].$page
					.fullPath.split('/').length - 1];
					// this.routerIndex= routerIndex =='enterpriseIndex'?false:true;
			if (e.jsData) {
				this.dedata = JSON.parse(e.jsData);
				this.getData.params.siteId = this.dedata.id
				this.getData.params.endTime = this.dedata.endTime.split(' ')[0]?this.dedata.endTime.split(' ')[0]:this.dedata.endTime
				this.getData.params.startTime = this.dedata.startTime.split(' ')[0]?this.dedata.startTime.split(' ')[0]:this.dedata.startTime
				this.getlist()
			}
		},
		filters:{
			price(e){
				return convertW.convertW(e)
			}
		},
		methods: {
			callPhone(phone){
				uni.makePhoneCall({
				         // 手机号
				        phoneNumber: phone
				     });
			},
			imgError(e){
				e.siteImages=null
			},
			getlist(){
				sy.distributeGetByPage({
					pageSize: this.getData.pageSize,
					currentPage: this.getData.currentPage,
					params: {
						disCompanyId:this.getData.params.siteId,
						createTimeEnd: this.getData.params.endTime+' 23:59:59',
						createTimeStart:this.getData.params.startTime+' 00:00:00',
						disTagType: "ESELF_SUPPORT",
						disType: '1'
					}
				}).then(res=>{
					if (res.code !== 20000) return
					if (res.data.list.length == 0) {
						uni.showToast({
							title: '没有数据了哦',
							icon: 'none'
						})
					}
					if (this.getData.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 scoped>
	@import url("./contribution.css");
	::-webkit-scrollbar {
		width: 0;
		color: transparent;
	}
</style>