<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<script src="../../../admin/index.js" door type="text/javascript" charset="utf-8"></script>
		<script type="text/html" id="shopTpl">
			<li>商户名称：{{d.name || ''}}</li>
			<li>经营地址：{{d.businessAddress || ''}}</li>
			<li>联系人：{{d.contact || ''}}</li>
			<li>绑定手机号：{{d.phone || ''}}</li>
		</script>
		<script type="text/html" id="businessTpl">
			<!-- <li>店铺名称：{{d.name || ''}}</li> -->
			<!-- <li><span>营业执照号：{{d.licenseCode || d.idCard || ''}}</span><span>证照类型：{{d.socialCreditType || "身份证"}}</span></li> -->
			<li>
				<span>法人姓名：{{d.legalPerson || ''}}</span>
			</li>
			<li>
				<span>法人身份证号：{{d.idCard || ''}}</span>
			</li>
			<li>
				<span>联系电话：{{d.legalPhone || ''}}</span>
			</li>
			<!-- <li>注册地址：{{d.registeredAddress || d.businessAddress || ''}}</li> -->
			<!-- <li>营业执照照片：<img src="{{window.hywa.config.href+d.headPortrait}}" layer-src="{{window.hywa.config.href+d.headPortrait}}"></li> -->
		</script>
	</head>

	<body>
		<div id="imgBox" style="display: none;">
			<img src="../../../img/face.jpg" alt="">
		</div>
		<div id="detailBox">
			<div class="layui-card">
				<div class="layui-card-header">店铺基本信息</div>
				<div class="layui-card-body">
					<ul id="shopInfo">
						<!-- <li>商户名称：</li>
						<li>经营地址：</li>
						<li>绑定手机号：</li> -->
					</ul>
				</div>
			</div>
			<div class="layui-card">
				<div class="layui-card-header">法人信息</div>
				<div class="layui-card-body">
					<ul id="businessInfo">
						<!-- <li>店铺名称：</li>
						<li><span>经营地址：</span><span>证照类型：</span></li>
						<li><span>法人姓名：</span><span>法人身份证号：</span></li>
						<li><span>联系人：</span><span>联系电话：</span></li>
						<li>注册地址：</li>
						<li>营业执照照片：</li> -->
					</ul>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			layui.config({
				base: "../../../admin/js/layuiPlugins/"
			}).use(["form", 'layer', 'cascade', 'laytpl', 'upload'], function() {
				var form = layui.form,
					$ = layui.$,
					layer = layui.layer,
					laytpl = layui.laytpl,
					cascade = layui.cascade,
					upload = layui.upload;
				var object = {
					id: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().id || null : null, //带参传入ID
					currentData: {}, //当前表单数据
					byIdUrl: "shopByIdUrl", //根据id查询详情
					formLayFilter: "addForm", //表单容器
					closeModal: function() { //关闭当前窗口
						parent.layer.close(parent.layer.getFrameIndex(window.name));
					}
				};

				//初始化
				object.main = function() {
					var _this = this;
					if (this.id) {
						_this.getCurrent(_this.id); //获取并初始化表单角色信息
					}
					return this;
				};
				//获取当前信息
				object.getCurrent = function(id) {
					var _this = this;
					$.ajax({
						url: _this.byIdUrl,
						data: {
							id: id || _this.id //当前ID
						},
						success: function(res) {
							laytpl(shopTpl.innerHTML).render(res.data[0], function(html) {
								$("#shopInfo").html(html);
								
							});
							laytpl(businessTpl.innerHTML).render(res.data[0], function(html) {
								$("#businessInfo").html(html);
								layer.photos({
									photos: '#businessInfo'
								});
							});
							$('#imgBox img').attr('src', window.hywa.config.href + res.data[0].headPortrait);
						}
					});
					return this;
				};
				
				object.main();
			});
		</script>
	</body>

</html>
