<template>
	<view class="content">
		<view class="container">
			<headers :titles="titles"></headers>
			<view class="top-box">
				<view class="title_top">京博加油站</view>
				<view class="title_centen">
					<view class="sm-size">今日营业额(元)</view>
					<view class="big-size">{{indexData.totalPayMoney?indexData.totalPayMoney:0}}</view>
				</view>
				<!--        123-->
				<view class="ds-ab">
					<view class="sm-size">收款笔数 {{indexData.totalCount}}</view>
					<view class="sm-size">退款笔数 {{indexData.totalRefund}}</view>
				</view>
				<view class="jg-box">
					<view class="s-box" @click="goCollection()">
						<view class="">
							<image src="/static/imgs/sk.png" mode=""></image>
						</view>
						<view class="">收款</view>
					</view>
					<view class="s-box" @click="goRecharge()">
						<view class="">
							<image src="/static/imgs/cz.png" mode=""></image>
						</view>
						<view class="">充值</view>
					</view>
					<view class="s-box" @click="goCode()">
						<view class="">
							<image src="/static/imgs/skm.png" mode=""></image>
						</view>
						<view class="">收款码</view>
					</view>
				</view>
			</view>
			<!--  -->
			<view class="gq-box">
				<view class="ss-box" @click="goAdd()">
					<view class="">
						<image src="/static/imgs/xzhy.png" mode=""></image>
					</view>
					<view class="">新增会员</view>
				</view>
				<view class="ss-box" @click="goBusinessData()">
					<view class="">
						<image src="/static/imgs/jysj.png" mode=""></image>
					</view>
					<view class="">经营数据</view>
				</view>
				<view class="ss-box" @click="goOrderlist()">
					<view class="">
						<image src="/static/imgs/dd.png" mode=""></image>
					</view>
					<view class="">订单</view>
				</view>
				<view class="ss-box" @click="gochangeShifts()">
					<view class="">
						<image src="/static/imgs/jjb.png" mode=""></image>
					</view>
					<view class="">交接班</view>
				</view>
			</view>
			<!-- bai -->
			<!-- <view class="bai-box">
				<u-icon name="bell" color="#E61D2A" size="18"></u-icon>
				<view class="hy-size">您有新的交易日报生成,请点击查看</view>
			</view> -->
			<view class="box_" v-for="item,index in orderList" :key="index">
				<view class="b-bx">
					<!-- <view class="title_">京博加油站</view> -->
					<view class="zt-size" v-if="item.orderStatus == 'paid'">已支付</view>
					<view class="zt-size" v-if="item.orderStatus == 'refund'">已退款</view>
					<view class="zt-size" v-if="item.orderStatus == 'unpaid'">未支付</view>
				</view>
				<view class="centne">
					<view class="right-centne">
						<view class="h_"> <text class="hao_">订单号:</text> <text>{{item.orderNo}}</text>
						</view>
						<view class="h_"><text class="hao_">消费类型:</text>{{item.content}}</view>
						<template v-if="item.content == '储值卡充值'">
						</template>
						<template v-else>
							<view class="h_"><text class="hao_">油号:</text>{{item.oilName}}</view>
							<view class="h_"><text class="hao_">升数:</text>{{item.shengshu}}L</view>
						</template>
						<view class="h_"><text class="hao_">下单时间:</text>{{item.payTime}}</view>
						<view class="b-bx" v-if="!item.content == '储值卡充值'">
							<view class=""> <text class="hao_">应付:</text>¥{{item.goodsMoney}}</view>
							<view class=""><text class="hao_">优惠:</text>¥{{item.discountAmount?item.discountAmount:0}}
							</view>
						</view>
					</view>
				</view>
				<view class="end-box">实付:¥{{item.payMoney}}</view>
			</view>
		</view>
		<view style="width: 100%;height: 68px;"></view>
		<tabbar :msg='msg'></tabbar>
	</view>
</template>

<script>
	import request from "../../utils/request";
	import headers from '../../components/header/headers.vue'
	import tabbar from '../../components/tabbar/tabbar.vue'
	export default {
		data() {
			return {
				titles: "",
				msg: "0",
				List: [],
				show: false,
				status: 'loading',
				orderList: [],
				indexData: {
					totalPayMoney: '0',
					totalCount: '0',
					totalRefund: '0',
				},
				form: {
					page: 1,
					pageSize: 10,
					status: '',
					startTime: '',
					endTime: '',
					payType: ''
				},
			}
		},
		onShow() {
			// this.actList = ["1", "1", "1", "1", "1", ]
			// this.status = "nomore" 底部刷新结束
			this.getPageListByPos()
			this.getIndexData();
		},
		onPullDownRefresh() {
			console.log("刷新");
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// this.show = true
			setTimeout(() => {
				console.log("加载执行");
			}, 2000)
		},
		components: {
			headers,
			tabbar
		},
		methods: {
			getPageListByPos() {


				request({
					url: 'business/allOrderInfo/getPageListByPosRecentThree',
					method: 'get',
					params: this.form
				}).then((res) => {
					if (res.code == 200) {
						this.orderList = res.data.records;
					} else {
						uni.showToast({
							title: res.data,
							icon: "none"
						})
					}
				})
			},
			goRecharge() {
				uni.navigateTo({
					url: "/pagesHome/MemberRecharge/MemberRecharge"
				})
			},
			goCode() {
				uni.navigateTo({
					url: '/pagesHome/PaymentCode/SetUpCode'
				})
			},
			gochangeShifts() {
				uni.navigateTo({
					url: '/pagesHome/changeShifts/changeShifts'
				})
			},

			goAdd() {
				uni.navigateTo({
					url: '/pagesHome/AddVip/AddCode'
				})
			},
			goCollection() {
				uni.navigateTo({
					url: '/pagesHome/Collection/Collection'
				})
			},
			goOrderlist() {
				uni.navigateTo({
					url: '/pagesHome/orderList/orderList'
				})
			},
			goBusinessData() {
				uni.navigateTo({
					url: '/pagesHome/BusinessData/BusinessData'
				})
			},
			goback() {
				uni.navigateBack()
			},

			// 获取销售数据
			getIndexData() {
				request({
					url: 'business/allOrderInfo/getIndexData4Pos',
					method: 'get',
					params: this.form
				}).then((res) => {
					if (res.code == 200) {
						this.indexData = res.data
					} else {
						uni.showToast({
							title: res.data,
							icon: "none"
						})
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;
		// 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: #f4f5f6;
		box-sizing: border-box;
		padding-top: 88px;
	}

	.top-box {
		width: 100%;
		height: 185px;
		background: url('../../static/imgs/homeback.png');
		background-size: 100% 100%;
		box-sizing: border-box;
		padding: 15px;
		color: #fff;
		padding-top: 0px;
		position: relative;
	}

	.title_top {
		font-weight: bold;
		font-size: 16px;
		color: #FFFFFF;
		margin-bottom: 15px;
	}

	.title_centen {
		width: 100%;
		text-align: center;
		margin-bottom: 15px;
	}

	.sm-size {
		font-weight: bold;
		font-size: 14px;
		color: #FFFFFF;
		margin-bottom: 10px;
	}

	.big-size {
		font-weight: 800;
		font-size: 24px;
		color: #FFFFFF;
	}

	.ds-ab {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-around;
	}

	.jg-box {
		width: 95%;
		background: #fff;
		border-radius: 8px;
		box-sizing: border-box;
		padding: 10px;
		margin: 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.s-box {
		width: 33.3%;
		font-size: 14px;
		color: #333333;
		text-align: center;

		image {
			width: 40px;
			height: 40px;
			margin: 5px auto;
		}
	}

	.ss-box {
		width: 25%;
		font-size: 14px;
		color: #333333;
		text-align: center;

		image {
			width: 40px;
			height: 40px;
			margin: 5px auto;
		}
	}

	.gq-box {
		width: 95%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 0 auto;
		margin-top: 65px;
	}

	.bai-box {
		width: 95%;
		border-radius: 6px;
		background: #fff;
		box-sizing: border-box;
		padding: 10px 15px;
		display: flex;
		align-items: center;
		font-size: 14px;
		margin: 15px auto;
	}

	.hy-size {
		width: 80%;
		overflow: hidden;
		margin-left: 10px;
	}

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

	}

	.b-bx {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 10px;
	}

	.title_ {
		font-weight: bold;
		font-size: 16px;
		color: #333333;
	}

	.zt-size {
		font-weight: bold;
		font-size: 16px;
		color: #FD504E;
	}

	.centne {
		display: flex;
	}

	.touxiang {
		width: 60px;
		height: 60px;
		border-radius: 50%;
		background: #D9D9D9;
		margin-right: 15px;
	}

	.right-centne {
		width: 100%;
		font-size: 14px;
	}

	.h_ {
		width: 100%;
		margin-bottom: 5px;
	}

	.end-box {
		width: 100%;
		text-align: right;
		font-weight: bold;
		font-size: 16px;
		color: #0864E9;
	}

	.time {
		font-weight: 500;
		font-size: 14px;
		color: #333333;
		margin: 0px auto;
		margin-top: 15px;
	}

	.time-bs {
		width: 100%;
		box-sizing: border-box;
		background: #FFFFFF;
		padding: 15px;
		display: flex;
		align-items: center;
		justify-content: space-around;
	}

	.time-bs2 {
		width: 100%;
		box-sizing: border-box;
		background: #FFFFFF;
		padding: 30px;
		// display: flex;
		align-items: center;
		justify-content: space-around;
	}

	.time-box {
		border: 1px solid #0864E9;
		box-sizing: border-box;
		padding: 5px 15px;
		border-radius: 8px;
		font-size: 14px;
		color: #333;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.time-box2 {
		border: 1px solid #0864E9;
		box-sizing: border-box;
		padding: 5px 15px;
		border-radius: 8px;
		font-size: 14px;
		color: #333;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.hao_ {
		width: 30%;
		font-weight: bold;
		margin-right: 5px;
	}
</style>