<template>
	<view>
		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">开始时间:</view>
			<view class="width50">{{classGroupTaskDetails.startTime | timeFormat('yyyy-mm-dd hh:mm:ss')}}</view>
		</view>
		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">结束时间:</view>
			<view class="width50">{{classGroupTaskDetails.endTime | timeFormat('yyyy-mm-dd hh:mm:ss')}}</view>
		</view>
		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">加油金额汇总:</view>
			<view class="width50">{{classGroupTaskDetails.refuelPrice}} 元</view>
		</view>
		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">加油笔数汇总:</view>
			<view class="width50">{{classGroupTaskDetails.refuelNum}} 笔</view>
		</view>
		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">加油升数汇总:</view>
			<view class="width50">{{classGroupTaskDetails.refuelLiters}} 升</view>
		</view>
		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">退款金额汇总:</view>
			<view class="width50">{{classGroupTaskDetails.refundPrice }} 元</view>
		</view>
		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">退款笔数汇总:</view>
			<view class="width50">{{classGroupTaskDetails.refundNum }} 笔</view>
		</view>

		<view class="width92 fcor666 font14 mart20 alijusstart">
			<view class="width30 fcor333">退款升数汇总:</view>
			<view class="width50">{{classGroupTaskDetails.refundLiters}} 升</view>
		</view>

		<view class="alijusstart fotct font14 height40p backcor9 mart30 fcor333">
			<view class="width25">油号</view>
			<view class="width25">金额</view>
			<view class="width25">升数</view>
			<view class="width25">笔数</view>
		</view>

		<view v-if="classGroupTaskDetails.groupTaskOilCountList == '' " class="mart60 fotct font14 fcor666">
			<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
		</view>
		<view class="width100 alijusstart fotct font14 height45 fcor666 mart5  bor-botm1 marb5" :key="index"
			v-for="(item,index) in classGroupTaskDetails.groupTaskOilCountList">
			<view class="width25">{{item.oilNo}}#</view>
			<view class="width25">{{item.refuelPrice}}元</view>
			<view class="width25">{{item.refuelLiters}}升</view>
			<view class="width25">{{item.refuelNum}}笔</view>
		</view>
		<view class="height80"></view>
		<view class="width40w height40 backcor008 border-r font14 fotct fcorfff" style="position: fixed;bottom: 15px;"
			@click="print()">
			打印小票
		</view>
	</view>
</template>

<script>
	import {
		getClassGroupTaskById,
		print
	} from '../../../Utils/Api.js';
	let app = getApp();
	export default {
		data() {
			return {
				taskId: '', //班次id
				classGroupTaskDetails: '', //详情
				imgadres: 'noorder.png',
				imagewxUrl: app.globalData.imageWxImg,
			}
		},
		onLoad(options) {
			this.taskId = options.id;
			this.getClassGroupTaskById();
		},
		methods: {
			//查询详情
			getClassGroupTaskById() {
				uni.showLoading({
					title: '加载中...'
				})
				let datas = {
					gasClassGroupTaskId: this.taskId
				}
				getClassGroupTaskById(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000') {
						this.classGroupTaskDetails = JSON.parse(res.return_data.dataCount);
					}
				})
			},
			//打印小票
			print() {
				uni.showLoading({
					title: '打印小票'
				})
				let datas = {
					gasClassGroupTaskId: this.taskId
				}
				print(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000') {
						uni.showToast({
							title: '打印成功',
							icon: 'none',
							duration: 2000
						})
					} else {
						uni.showToast({
							title: res.return_msg,
							icon: 'none',
							duration: 2000
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
