<template>
	<view class="content">
		<view class="container">
			<view class="my-header">
				<view class="my-icons" @click="goback"> <uni-icons type="left" color="#ffffff" size="16"></uni-icons>
				</view>
				<view class="my-text">今日油价</view>
				<view class="my-icons"></view>
			</view>
			<!-- 顶部区域 -->
			<view class="top-box">
				<view style="font-size: 18px; font-weight: bold;">{{getTime()}}</view>
				<view style="font-size: 14px;">对比上次价格波动</view>
				<view class="tupian"></view>
			</view>
			<view class="box-list" v-for="(item,index) in oilPriceList" :key="index">
				<view class="dis-top">
					<view class="gang"></view>
					<view class="">{{item.oilName}}</view>
				</view>
				<view class="bottom-bt">
					<view style="width: 50%;">
						<view class="hui-box">政府指导油价(元)</view>
						<view class="dis-c">
							<view class="dlan">{{item.presetGbPrice}}</view>
							<!-- <view class="dis"> <u-icon name="arrow-up-fill" color="#FF5700" size="12"></u-icon>
								<text style="font-size: 12px; color: #FF5700; ">{{item.rate}}</text>
							</view> -->
						</view>
					</view>
					<view style="width: 50%;">
						<view class="hui-box">本站油价</view>
						<view class="dis-c">
							<view class="dlan" style="color: #333333;">{{item.presetOilPrices}}</view>
							<view class="dis"> <u-icon name="arrow-down-fill" color="#1FAD40" size="12"></u-icon>
								<text style="font-size: 12px; color: #1FAD40; ">{{item.rate}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>



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

<script>
	import request from '../../utils/request'
	export default {
		data() {
			return {
				oilPriceList: [],
				title: '',


			}
		},

		onShow() {
			this.getTodayOilPriceList();
		},
		components: {

		},
		methods: {
			// 获取当前时间
			getTime(){
				let date = new Date();
				let y = date.getFullYear() + "-";
				let mon = ((date.getMonth() + 1 < 10) ? ('0' + (+date.getMonth() + 1)) : (+date.getMonth() + 1)) + "月";
				let d = ((date.getDate() < 10) ? ('0' + date.getDate()) : date.getDate()) + "号";
				let h = ((date.getHours() < 10) ? ('0' + date.getHours()) : date.getHours()) + ":";
				let m = ((date.getMinutes() < 10) ? ('0' + date.getMinutes()) : date.getMinutes()) + ":";
				let s = ((date.getSeconds() < 10) ? ('0' + date.getSeconds()) : date.getSeconds());
				// return new Date(y , mon , d , h , m , s);
				return mon+d;
			},
			// 查询全部充值订单
			getTodayOilPriceList() {
				let params = {
					storeId: uni.getStorageSync("storeId")
				}
				request({
					url: 'business/petrolStationManagement/oilNumber/getList3',
					method: 'get',
					params: params
				}).then((res) => {
					if (res.code == 200) {
						this.oilPriceList = res.data
						console.log("11111" + res.data);
					}
				})
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;
	}

	.container {
		width: 100%;
		height: 100vh;
		box-sizing: border-box;
		padding-top: 88px;
		background: linear-gradient(180deg, #2F72F7 0%, rgba(47, 114, 247, 0) 50%, rgba(47, 114, 247, 0) 100%);
	}

	.my-header {
		width: 100%;
		height: 88px;
		background: #2F72F7;
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: #ffffff;
		box-sizing: border-box;
		padding: 0px 15px;
		padding-top: 40px;

		.my-icons {
			width: 20px;

		}

		position: fixed;
		top: 0px;
	}

	.top-box {
		width: 95%;
		color: #ffffff;
		height: 50px;
		margin: 10px auto;
		position: relative;
	}

	.tupian {
		background: url('http://47.95.206.185:83/imgriht.png')center no-repeat;
		background-size: 100% 100%;
		bottom: -45px;
		right: 0px;
		width: 130px;
		height: 105px;
		position: absolute;
	}

	.gang {
		width: 4px;
		height: 16px;
		background: #2F72F7;
		border-radius: 2px;
		margin-right: 5px;
	}

	.t-left-box {
		width: 50%;
		text-align: center;
	}

	.t-right-box {
		width: 50%;
		text-align: center;

	}

	.box-centenr {
		width: 100%;
		box-sizing: border-box;
		padding: 15px;
		background: #ffffff;
	}

	.box-bor {
		border-bottom: 1px solid #e8e8e8;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 10px;
	}



	.box-list {
		width: 95%;
		margin: 10px auto;
		border-radius: 8px;
		background: #ffffff;
		box-sizing: border-box;
		padding: 15px;

	}

	.dis-top {
		display: flex;
		align-items: center;
		font-size: 18px;
		font-weight: bold;
		color: #333333;
	}

	.bottom-bt {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 5px auto;
	}

	.dis {
		display: flex;

	}

	.dis-c {
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 10px;
	}

	.hui-box {
		width: 100%;
		text-align: center;
		font-size: 14px;
		color: #707070;
	}

	.dlan {
		color: #2F72F7;
		font-weight: bold;
		font-size: 25px;
	}
</style>