<!DOCTYPE html>
<html>
	<head>
		<title>入境登记-详情</title>
		<meta http-equiv="Content-Type" content="text/html; 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/sa.js"></script>
		<script src="../../static/kj/upload-util.js"></script>
		<style type="text/css">
			.c-panel .c-label {
				width: 8em;
			}
		</style>
	</head>
	<body>
		<div class="vue-box sbot" style="display: none;" :style="'display: block;'">
			<!-- ------- 内容部分 ------- -->
			<div class="s-body">
				<div class="c-panel">
					<el-form v-if="m">
						<el-row>
							<el-col span="12">
								<sa-info name="客户名称" br>{{m.customerName}}</sa-info>

								<sa-info name="业务编号" br>{{m.no}}</sa-info>
								<sa-info name="境外车牌号" br>{{m.cardNo}}</sa-info>
								<sa-info name="境外车规格" br>{{m.cardSize}}（米）</sa-info>
								<sa-info name="入场时间" br>
									<label v-if="m.realInTime">{{m.realInTime}}</label>
									<label v-else>未入场</label>
								</sa-info>
								<sa-info name="出场时间" br>{{m.outDayTime}}</sa-info>
								<!-- <sa-info name="停车时长" br>{{m.partTime}}（分）</sa-info> -->
								<sa-info name="停车费用（元）" br>{{m.partMoney}}</sa-info>
								<sa-info name="载重" br>{{m.netWeight}}（吨）</sa-info>
								<sa-info name="录入时间" br>{{m.createTime}}</sa-info>
								<sa-info name="录入人" br>{{m.createBy}}</sa-info>
								<sa-info type="enum" name="支付状态" :value="m.payStatus"
									:jv="{1: '未支付', 2: '已支付未确认', 3: '已支付已确认'}" br></sa-info>
								<sa-info name="支付人" br>{{m.payBy}}</sa-info>
							</el-col>
							<el-col span="12">
								<sa-info name="货物" br>{{m.goodsName}}</sa-info>
								<sa-info name="中国车牌" br>{{m.chinaCarNo}}</sa-info>
								<sa-info name="中国司机" br>{{m.driverName}}</sa-info>
								<sa-info name="联系号码" br>{{m.driverPhone}}</sa-info>
								<sa-info name="入场时间" br>{{m.chinaCarInTime}}</sa-info>
								<sa-info name="出场时间" br>{{m.chinaCarOutTime}}</sa-info>
								<!-- <sa-info name="停车时长" br>{{m.partTime}}（分）</sa-info> -->
								<sa-info name="停车费用（元）" br>{{m.chinaPartMoney}}</sa-info>
								<sa-info name="业务费用（元）" br>{{m.itemPrice}}</sa-info>
								<sa-info name="合计费用（元）" br>{{m.totalMoney}}</sa-info>
								<sa-info name="支付时间" br>{{m.payTime}}</sa-info>
								<sa-info type="img-list" name="支付凭证" :value="m.payTicket" br></sa-info>
								<sa-info name="确认时间" br>{{m.confirmInputTime}}</sa-info>
								<sa-info name="确认人" br>{{m.confirmInputBy}}</sa-info>
							</el-col>
						</el-row>
						<el-row>
							<el-collapse value='1'>
								<el-collapse-item name="1">
									<div slot="title">
										具体业务项
										<label
											style="color: red; font-weight: bold;margin-left: 20px;">总费用：({{m.itemPrice}}元)</label>
									</div>
									<el-table :data="tableData" style="width: 100%">
										<el-table-column prop="itemTypeName" label="业务分类" width="180">
										</el-table-column>
										<el-table-column prop="itemName" label="具体" width="180">
										</el-table-column>
										<el-table-column prop="itemPrice" label="单价">
										</el-table-column>
										<el-table-column prop="unit" label="计费标准">
										</el-table-column>
										<el-table-column prop="num" label="数量">
										</el-table-column>
										<el-table-column prop="total" label="合计">
										</el-table-column>
										<sa-td type="img-list" name="凭据" prop="ticket"></sa-td>
										<el-table-column label="其他凭据">
											<template slot-scope="s">
												<el-button class="c-btn" type="primary" @click="uploadFn(s.row)">上传
												</el-button>
											</template>
										</el-table-column>
									</el-table>

								</el-collapse-item>
							</el-collapse>
						</el-row>
					</el-form>
				</div>
			</div>
			<!-- ------- 底部按钮 ------- -->
			<div class="s-foot">
				<el-button type="success" @click="sa.closeCurrIframe()">关闭</el-button>
			</div>

			<el-dialog title="上传凭据" :visible.sync="upload.visible" width="400">
				<el-form>
					<sa-item type="img-list" name="凭据图片" v-model="upload.form.ticket" br></sa-item>
				</el-form>
				<span slot="footer" class="dialog-footer">
					<el-button @click="upload.visible=false">取 消</el-button>
					<el-button type="primary" @click="ok()">确 定</el-button>
				</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: {
					id: sa.p('id', 0), // 获取数据ID 
					m: null,
					tableData: [],
					upload: {
						visible: false,
						form: {
							id: '',
							ticket: ''
						}
					}
				},
				methods: {
					uploadFn(data) {
						Object.assign(this.upload, {
							visible: true,
							form: data
						})
					},
					ok() {
						if (!this.upload.form.ticket) {
							sa.error('请上传凭据');
							return;
						}
						sa.ajax('/TbBusinessItem/update', this.upload.form, function(resp) {
							this.upload.visible = false;
						}.bind(this))
					},
					getInfo() {
						sa.ajax('/TbBusiness/getById?id=' + this.id, function(res) {
							this.m = res.data;
							this.tableData = res.data.items;
						}.bind(this))
					}
				},
				mounted: function() {
					this.getInfo()
				}
			})
		</script>
	</body>
</html>
