<template>
	<view class="recharge">
		<view class="recharge-bd">
			<view class="item" v-for="item in list" :key="i" v-if="list.length>0">
				<view class="item_box">
					<view class="l">
						<view class="a">采集数量：<text>{{item.total_count}}</text></view>
						<view class="a">成功数量：<text>{{item.success_count}}</text></view>
					</view>
					<view class="l">
						<view class="a">采集状态：<text :style="{'color': item.status==20?'#55BD6A':'#F34A40' }">{{item.status==20?'已采集':'未采集'}}</text></view>
						<view class="a">失败数量：<text>{{item.fail_count}}</text></view>
					</view>
				</view>
				<view class="item_tiem">
					<view class="a">开始时间：<text>{{item.start_time}}</text></view>
				</view>
				<view class="item_tiem">
					<view class="a">结束时间：<text>{{item.end_time}}</text></view>
				</view>
			</view>
			<u-empty text="暂无数据显示哦～" v-if="list.length==0" mode="list"></u-empty>
		</view>
		<image src="/static/order/share.png" @click="onGather" mode="" class="recharge_image"></image>
	</view>
</template>

<script>
	import * as newFunApi from '@/api/newFun'
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.getRechargeList()
		},
		methods: {
			onGather() {
				uni.navigateTo({
					url: '/pages/news/goods/addOneGround'
				})
			},
			getRechargeList() {
				let that = this;
				newFunApi.collectorList()
					.then(res => {
						that.list = res.data.list.data
					})
					.finally()
			},
			timestampToYds(timestamp) {
				//时间戳为10位需*1000，为13位不需乘1000
				let times = timestamp.length == 10 ? times * 1000 : timestamp;
				var date = new Date(times);
				let Y = date.getFullYear(),
					M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1),
					D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()),
					h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()),
					m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()),
					s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
				return Y + '-' + M + '-' + D + ' ' + h + ':' + m + ':' + s
			},
		}
	}
</script>

<style lang="scss" scoped>
	.recharge {
		padding: 25rpx;
		overflow: hidden;

		.recharge_image {
			width: 50rpx;
			height: 50rpx;
			position: fixed;
			right: 30rpx;
			bottom: 60rpx;
		}

		&-bd {
			border-radius: 12rpx;
			overflow: hidden;

			.item {
				padding: 20rpx 28rpx;
				// border-top: 1px solid #F3F3F3;
				background-color: #fff;
                margin-bottom: 20rpx;
				border-radius: 16rpx;
				.item_tiem {
					padding: 16rpx 0;
					margin: 0 6rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: #757575;
					text{
						color: #303030;
					}
				}

				.item_box {
					display: flex;
					justify-content: space-between;

					&:first-child {
						border-top-color: #fff;
					}

					.l {
						flex: 1;

						.a {
							padding: 16rpx 0;
							margin: 0 6rpx;
							font-size: 28rpx;
							font-weight: 400;
							color: #757575;
							text{
								color: #303030;
							}
						}
					}

					.r {
						flex: 1;
						text-align: right;

						.a {
							font-size: 40rpx;
							font-weight: 500;
							color: #414141;
						}

						.b {
							font-size: 28rpx;
							font-weight: 400;
							color: #A3A3A3;
						}
					}
				}
			}
		}
	}

	.empty {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 100%;

		image {
			width: 114rpx;
			height: auto;
			margin-top: 200rpx;
		}
	}
</style>
