<!DOCTYPE html>
<html>
	<head>
		<title>入境登记-列表</title>
		<meta charset="utf-8">
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!-- 所有的 css & js 资源 -->
		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
		<link rel="stylesheet" href="../../static/sa.css">
		<script src="../../static/kj/vue.min.js"></script>
		<script src="../../static/kj/element-ui/index.js"></script>
		<script src="../../static/kj/httpVueLoader.js"></script>
		<script src="../../static/kj/jquery.min.js"></script>
		<script src="../../static/kj/layer/layer.js"></script>
		<script src="../../static/sa.js"></script>
		<script src="../../static/kj/upload-util.js"></script>
	</head>
	<style>
		.complete-modal .c-label,
		.confirm-in .c-label,
		.confirm-info .c-label {
			width: 140px;
		}
	</style>
	<body>
		<div class="vue-box" style="display: none;" :style="'display: block;'">
			<div class="c-panel">
				<!-- ------------- 检索参数 ------------- -->
				<div class="c-title">检索参数</div>
				<el-form ref="form" :model='p' @submit.native.prevent>
					<sa-item type="text" name="车牌号" placeholder="越南车牌" v-model="p.cardNo"></sa-item>
					<div class="c-item">
						<label class="c-label">确认状态：</label>
						<el-select v-model="p.adminConfirmInput" placeholder="请选择" @change="f5()">
							<el-option label="全部" :value="-1"></el-option>
							<el-option label="已确认" :value="1"></el-option>
							<el-option label="未确认" :value="0"></el-option>
						</el-select>
					</div>
					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
					<el-button type="info" icon="el-icon-search" @click="p.cardNo = ''; f5()">重置</el-button>
					<br />
				</el-form>
				<!-- ------------- 快捷按钮 ------------- -->
				<!-- <div class="fast-btn">
					<el-button  v-if="sa.isAuth('tb-business-add')" size="mini" type="primary" @click="add()">
						新增</el-button>
					<el-button size="mini" type="success" @click="getBySelect()">查看</el-button>
					<el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
				</div> -->
				<!-- ------------- 数据列表 ------------- -->
				<el-table class="data-table" ref="data-table" :data="dataList">
					<sa-td name="业务单号" prop="no" width="160"></sa-td>
					<sa-td name="业务类型" prop="goodsName" ></sa-td>
					<sa-td name="车牌号"  prop="carNo"></sa-td>
					<sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td>
					<sa-td name="业务用费(元)" prop="itemPrice" width="130"></sa-td>
					<sa-td name="停车用费(元)" prop="basePartMoney" width="130"></sa-td>
					<sa-td name="总用费(元)" prop="totalMoney"></sa-td>
					<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>
					<sa-td name="入场时间" prop="realInTime" width="140"></sa-td>
					<sa-td name="离场时间" prop="realOutTime" width="140"></sa-td>
					<sa-td width="160" name="创建时间" prop="createTime"></sa-td>
					</sa-td>
					<el-table-column label="操作" width="240px" fixed="right">
						<template slot-scope="s">
							<el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-business-confirm')
								&&currentCustomerId=='1'" @click="confirmFn(s.row)">业务确认</el-button>
						</template>
					</el-table-column>
				</el-table>
				<!-- ------------- 分页 ------------- -->
				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
				</sa-item>
			</div>
			<el-dialog title="业务确认" :visible.sync="confirm.visible" width="650px">
				<div class="confirm-info">
					<el-row>
						<el-col span="12">
							<sa-info name="订单号" br>{{confirm.form.no}}</sa-info>
							<sa-info :name="item.itemName" br v-for="item in confirm.form.items">
								{{item.itemPrice}}x{{item.num}}={{item.total}}元
							</sa-info>
						</el-col>
						<el-col span="12">
							<sa-info name="业务费用" br>{{confirm.form.itemPrice}}（元）</sa-info>
							<sa-info name="停车费" br>{{confirm.form.basePartMoney}}（元）</sa-info>
							<sa-info name="合计费用" br>{{confirm.form.totalMoney}}（元）</sa-info>
						</el-col>
					</el-row>
				</div>
				<span slot="footer" class="dialog-footer">
					<div v-if="confirm.form.adminConfirmInput==0">
						<el-button @click="confirm.visible = false">取 消</el-button>
						<el-button type="primary" @click="sureConfirmFn" >确 认</el-button>
					</div>
					<div v-else>
						<el-button @click="confirm.visible = false">关闭</el-button>
						<el-button type="info">已确认</el-button>
					</div>
				</span>
			</el-dialog>
		</div>
		<script>
			var app = new Vue({
				components: {
					"sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
				},
				el: '.vue-box',
				data: {
					value: '',
					currentCustomerId: '1',
					confirm: {
						visible: false,
						form: {
							ids: ''
						}
					},
					p: { // 查询参数  
						id: '', // 主键 
						no: '', // 编号 
						isCar: 1,
						adminConfirmInput:-1,
						cardNo: '', // 车牌号 
						outDayTime: '', // 离境时间 
						partMoney: '', // 停车费用 
						partTime: '', // 停车时常(分) 
						pageNo: 1, // 当前页 
						pageSize: 10, // 页大小 
						sortType: 0 // 排序方式 
					},
					dataCount: 0,
					dataList: [], // 数据集合 
					timmer: null,
					fresh: {
						value: 60
					}
				},
				methods: {
					getPcodeByCurrRid() {
						sa.ajax('/SpRolePermission/getPcodeByCurrRid', function(resp) {
							this.perCode = resp.data;
						}.bind(this))
					},
					confirmFn(data) {
						console.log(data);
						sa.ajax('/TbBusinessItem/getList', {
							businessId: data.id
						}, function(resp) {
							data.items = resp.data;
							Object.assign(this.confirm, {
								visible: true,
								form: data,
							})
							this.confirm.form.ids = data.id;
						}.bind(this));
					},
					sureConfirmFn() {
						sa.ajax('/TbBusiness/confirm', {
							ids: this.confirm.form.ids
						}, function(resp) {
							this.confirm.visible = false;
							this.f5();
						}.bind(this))
					},
					// 刷新
					f5: function() {
						sa.ajaxNoLoading('/TbBusiness/getCarDisincleList', sa.removeNull(this.p), function(res) {
							this.dataList = res.data; // 数据
							this.dataCount = res.dataCount; // 数据总数 
							sa.f5TableHeight(); // 刷新表格高度 
						}.bind(this));
					},
				},
				created: function() {
					sa.onInputEnter();
				},
				mounted() {
					this.f5();
				},
			})
		</script>
	</body>
</html>
