<!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="https://unpkg.com/element-ui@2.13.0/lib/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>

		<style type="text/css">
			.c-panel .c-label {
				width: 8em;
			}

			.c-item .image-box-2 {
				height: 90px;
			}
		</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.name}}</sa-info>
								<sa-info name="法人" br>{{m.legalPerson}}</sa-info>
								<sa-info name="身份证号" br>{{m.idCard}}</sa-info>
								<sa-info name="手机号码" br>{{m.contact}}</sa-info>
								<sa-info v-if="m.judgeBy" name="审核时间" br>{{m.judgeTime}}</sa-info>
								<sa-info v-if="m.judgeBy" name="审核结果" br>审核驳回</sa-info>
							</el-col>
							<el-col span="12">
								<sa-info name="地址" br>{{m.address}}</sa-info>
								<sa-info name="银行名称" br>{{m.bankName}}</sa-info>
								<sa-info name="银行账号" br>{{m.bankAccount}}</sa-info>
								<sa-info name="税号" br>{{m.dutyParagraph}}</sa-info>
								<sa-info v-if="m.judgeBy" name="审核意见" br>{{m.judgeContent}}</sa-info>
								<sa-info v-if="m.judgeBy" name="审核人" br>{{m.judgeBy}}</sa-info>
							</el-col>
							<sa-info type="img-list" name="营业执照" :value="m.businessLicense" br></sa-info>
						</el-row>
					</el-form>
				</div>
			</div>
			<!-- ------- 底部按钮 ------- -->
			<div class="s-foot" v-if="sa.isAuth('tb-enterprise-judge')">
				<el-button type="warning" @click="judgeBack">审核驳回</el-button>
				<el-button type="success" @click="judgePass">审核通过</el-button>
				<el-button @click="sa.closeCurrIframe()">取消</el-button>
			</div>
		</div>
		<script>
			var app = new Vue({
				components: {
					"sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue')
				},
				el: '.vue-box',
				data: {
					id: sa.p('id', 0), // 获取数据ID
					m: null
				},
				methods: {
					judgeBack() {
						let id = this.m.id;
						layer.prompt({
							title: '输入审核意见'
						}, function(content, index) {
							layer.close(index);
							sa.ajax('/level-one-server/TbEnterprise/audit', {
								id: id,
								judgeContent: content,
								judgeStatus: 2
							}, function(res) {
								layer.msg('审核已驳回');
								setTimeout(() => {
									parent.app.f5(); // 刷新父页面列表
									sa.closeCurrIframe(); // 关闭本页
								}, 800)
							})
						});
					},
					judgePass() {
						sa.ajax('/level-one-server/TbEnterprise/audit', {
							id: this.m.id,
							judgeContent: '审核通过',
							judgeStatus: 1
						}, function(res) {
							layer.msg('审核通过');
							setTimeout(() => {
								parent.app.f5(); // 刷新父页面列表
								sa.closeCurrIframe(); // 关闭本页
							}, 800)
						})
					},
				},
				mounted: function() {
					sa.ajax('/level-one-server/TbEnterprise/getById?id=' + this.id, function(res) {
						this.m = res.data;
						if (res.data == null) {
							sa.alert('未能查找到 id=' + this.id + " 详细数据");
						}
					}.bind(this))
				}
			})
		</script>
	</body>
</html>