<template>
	<view class="content">
		<view class="container">
			<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
			<view class="input-box">
				<view style="margin-right: 10px;">收款金额</view>
				<view class="">{{AmountCollected}}</view>
				<!-- <input type="number" /> -->
			</view>
			<view class="input-box">
				<view style="margin-right: 10px;">优惠金额</view>
				<view class="">{{DiscountAmount}}</view>
				<!-- <input type="number" /> -->

			</view>
			<!-- <view class="title_">选择油号</view>
			<view class="warp-box">
				<view class="w-box" :class="{ 'acv' : oilIndex == index }" @click="getoilIndex(index)"
					v-for="(item,index) in oilList" :key="index">
					{{item}}
				</view>

			</view> -->
			<view class="title_">选择油枪</view>
			<view class="warp-box">
				<view class="w-box" :class="{ 'acv' : spearIndex == index }" @click="getspearIndex(index)"
					v-for="(item,index) in spearList" :key="index">
					{{item.gunName}}
				</view>

			</view>
			<view style="width: 100%; height: 500px; "></view>
			<view class="bai-kuang">
				<view class="kuang-top">
					<view class="w-shi">添加备注</view>
					<view style="color: #E8E8E8;"> | </view>
					<view class="w-shi" @click="gosearchVip()">搜索会员</view>
				</view>
				<!-- 键盘区域 -->
				<view class="num-box">

					<view class="k-box" v-for="(item,index) in keyboardList" :key="index" @click="KeyboardLogic(item)">
						<!-- pd- -->
						<view class="CentralLogic" v-if="item.type == 'num' ">
							{{item.value}}
						</view>
						<view class="Centralimg" v-if="item.type == 'img' ">
							<view class="icon-box">
								<image src="/static/imgs/smzf.png" v-if="item.value == 'smzf' "></image>
								<image src="/static/imgs/skzf.png" v-if="item.value == 'skzf' "></image>
								<image src="/static/imgs/hyzf.png" v-if="item.value == 'hyzf' "></image>
								<image src="/static/imgs/xjzf.png" v-if="item.value == 'xjzf' "></image>
								<image src="/static/imgs/scjian.png" style="height: 30px;" v-if="!item.value"></image>
							</view>
							<view class="icon-size" v-if="item.value == 'smzf' ">扫码支付</view>
							<view class="icon-size" v-if="item.value == 'skzf' ">刷卡支付</view>
							<view class="icon-size" v-if="item.value == 'hyzf' ">会员支付</view>
							<view class="icon-size" v-if="item.value == 'xjzf' ">现金支付</view>
						</view>
					</view>

				</view>
				<!-- 垫子 -->
				<view style="width: 100%; height: 25px; "></view>

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

<script>
	import request from "../../utils/request";
	import headers from '../../components/header/headers.vue'

	export default {
		data() {
			return {
				AmountCollected: '',
				DiscountAmount: '',
				titles: "收款",
				oilList: [
					"92#", "95#", "98#"
				],
				oilIndex: 0,
				spearList: [
					"1号枪", "2号枪", "3号枪"
				],
				spearIndex: 0,
				// 键盘
				keyboardList: [{
						value: '1',
						type: 'num'
					},
					{
						value: '2',
						type: 'num'
					},
					{
						value: '3',
						type: 'num'
					},
					{
						value: 'smzf',
						type: 'img'
					},
					{
						value: '4',
						type: 'num'
					},
					{
						value: '5',
						type: 'num'
					},
					{
						value: '6',
						type: 'num'
					},
					{
						value: 'skzf',
						type: 'img'
					},
					{
						value: '7',
						type: 'num'
					},
					{
						value: '8',
						type: 'num'
					},
					{
						value: '9',
						type: 'num'
					},
					{
						value: 'hyzf',
						type: 'img'
					},
					{
						value: '0',
						type: 'num'
					},
					{
						value: '.',
						type: 'num'
					},
					{
						value: null,
						type: 'img'
					},
					{
						value: 'xjzf',
						type: 'img'
					},
				]

			}
		},
		onShow() {
			// this.actList = ["1", "1", "1", "1", "1", ]
			// this.status = "nomore" 底部刷新结束
			this.getOilGun()
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers
		},
		methods: {
			// 获取油枪信息
			getOilGun(){
				request({
					url: 'business/petrolStationManagement/oilGun/queryOilGunList',
					method: 'get',
				}).then((res) => {
					this.spearList = res.data
				})
			},
			// 跳会员
			gosearchVip() {
				uni.navigateTo({
					url: '/pagesHome/searchVip/searchVip'
				})
			},
			// 键盘方法
			KeyboardLogic(data) {
				console.log(data);
				if (data.type == 'num') {
					this.AmountCollected = this.AmountCollected + data.value
				}
				if (data.type == 'img') {
					if (!data.value) {
						console.log('1');
						this.AmountCollected = this.AmountCollected.substring(0, this.AmountCollected.length - 1);
					}
					if (data.value == 'skzf') {
						uni.navigateTo({
							url: '/pagesHome/CardPayment/CardPayment'
						})

					}
				}

			},
			getoilIndex(num) {
				this.oilIndex = num
			},
			getspearIndex(num) {
				this.spearIndex = num
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #0864e9;
		// background: linear-gradient(180deg, #B2D2FC 0%, #B2D2FC 14%, rgba(255, 255, 255, 0.84) 24%, rgba(255, 255, 255, 0.84) 100%);
		height: 100vh;
	}

	.container {
		width: 100%;
		background: #0864e9;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.input-box {
		width: 95%;
		margin: 10px auto;
		border-bottom: 1px solid #fff;
		box-sizing: border-box;
		padding: 10px 0px;
		font-size: 20px;
		font-weight: bold;
		color: #fff;
		display: flex;
		align-items: center;
	}

	.title_ {
		font-weight: bold;
		font-size: 16px;
		color: #FFFFFF;
		width: 95%;
		margin: 10px auto;
	}

	.warp-box {
		width: 95%;
		margin: 10px auto;
		display: flex;
		align-items: center;
		flex-wrap: wrap;
	}

	.w-box {
		width: 60px;
		height: 32px;
		background: #FFFFFF;
		border-radius: 6px 6px 6px 6px;
		display: flex;
		align-items: center;
		justify-content: center;
		font-weight: 500;
		font-size: 14px;
		color: #333333;
		margin-right: 10px;
	}

	.acv {
		background: #E8F5FF !important;
		color: #0864E9 !important;
	}

	.s-h-box {
		width: 100%;
		border-top: 1px solid #E8E8E8;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.bai-kuang {
		position: fixed;
		bottom: 0px;
		left: 0px;
		background: #fff;
		border-radius: 18px 18px 0px 0px;
		overflow: hidden;
	}

	.num-box {

		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	.k-box {
		width: 24.5%;
		height: 80px;
		display: flex;
		align-items: center;
		justify-content: center;

		border-right: 1px solid #E8E8E8;
		border-top: 1px solid #E8E8E8;
	}

	.CentralLogic {
		font-weight: bold;
		font-size: 30px;
		color: #333333;
	}

	.Centralimg {}

	.icon-box {
		width: 40px;
		height: 40px;
		margin: 5px auto;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.icon-size {
		font-size: 14px;
		color: #333333;
		text-align: center;


	}

	.kuang-top {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;

	}

	.w-shi {
		width: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #0864E9;
		box-sizing: border-box;
		padding: 15px;
	}
</style>