<!DOCTYPE html>
<html>
	<?php echo $this->fetch('head.html'); ?>
	<body>
		<div class="header">
			<div class="header-back"></div>
			<div class="header-title">商家信息</div>
		</div>
		<div class="header-row"></div>
		<div class="main-body">
			<form action="/moduleshop.php?m=olprint_shop&a=save&ajax=1">
			<div class="input-flex">
				<div class="input-flex-label">店铺名称</div>
				<input type="text" class="input-flex-text" name="shopname" value="<?php echo $this->_var['shop']['shopname']; ?>" />
			</div>
			<div class="input-flex flex-ai-center">
				<div class="input-flex-label">logo</div>
				<div class="flex-1">
					<div class="upimg-box bg-fff">
						<div class="upimg-item <?php if (! $this->_var['shop']['imgurl']): ?>none<?php endif; ?> js-upimg-btn">
							<img class="upimg-img" src="<?php echo images_site($this->_var['shop']['imgurl']); ?>.100x100.jpg" >								 
						</div>
						<?php if (! $this->_var['shop']['imgurl']): ?>	
						<div class="upimg-btn js-upimg-btn">
							<i class="upimg-btn-icon"></i>
						</div>
						<?php endif; ?>
						<input type="hidden" name="imgurl" value="<?php echo $this->_var['shop']['imgurl']; ?>" class="imgurl" />
						<input style="display: none;" type="file" name="upimg" id="upimg" /> 
					</div> 
				</div>
			</div>
			<div class="textarea-flex">
				<div class="textarea-flex-label">店铺介绍</div>
				<textarea class="textarea-flex-text h60" name="description"><?php echo $this->_var['shop']['description']; ?></textarea>
			</div>
			<div class="input-flex">
				<div class="input-flex-label">店铺公告</div>
				<input type="text" class="input-flex-text" name="gonggao" value="<?php echo $this->_var['shop']['gonggao']; ?>" />
			</div>
			<div class="input-flex flex-ai-center">
				<div class="input-flex-label">配送费</div>
				<input type="text" class="input-flex-text mgr-5" name="express_money" value="<?php echo $this->_var['shop']['express_money']; ?>" />
				<div class="mgr-5">￥</div>
				<div class="input-flex-note">默认配送用</div>
			</div>
			<div class="input-flex">
				<div class="input-flex-label">联系人</div>
				 
				<input type="text" class="input-flex-text" name="nickname" value="<?php echo $this->_var['shop']['nickname']; ?>" />
			</div>
			<div class="input-flex">
				<div class="input-flex-label">联系电话</div>
				<input type="text" class="input-flex-text" name="telephone" value="<?php echo $this->_var['shop']['telephone']; ?>" />
				 
			</div>
			<div class="input-flex">
				<div class="input-flex-label">所在区域</div>
				<select class="input-flex-select" name="sc_id">
					<?php $_from = $this->_var['site_city']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
                        	<option value="<?php echo $this->_var['c']['sc_id']; ?>" <?php if ($this->_var['shop']['sc_id'] == $this->_var['c']['sc_id']): ?> selected<?php endif; ?>><?php echo $this->_var['c']['title']; ?></option>
                            <?php if ($this->_var['c']['child']): ?>
                            <?php $_from = $this->_var['c']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'cc');if (count($_from)):
    foreach ($_from AS $this->_var['cc']):
?>
                        	<option value="<?php echo $this->_var['cc']['sc_id']; ?>"  <?php if ($this->_var['shop']['sc_id'] == $this->_var['cc']['sc_id']): ?> selected<?php endif; ?>>|--<?php echo $this->_var['cc']['title']; ?></option>
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                            <?php endif; ?>
                        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
				</select>
			</div>
			<div class="input-flex">
				<div class="input-flex-label">地址</div>
				<input type="text" id="address" class="input-flex-text" name="address" value="<?php echo $this->_var['shop']['address']; ?>" />
				<input type="hidden" name="lat" value="<?php echo $this->_var['shop']['lat']; ?>" id="lat" />
				<input type="hidden" name="lng" value="<?php echo $this->_var['shop']['lng']; ?>" id="lng" />
				<div class="input-flex-btn w60 flex-center iconfont icon-location_light js-map-show"></div>
			</div>
			
			<div class="sky-editor-content" id="e-content"  contenteditable="true"><?php echo $this->_var['data']['content']; ?></div>
			<div class="none">
				<textarea name="content" id="content"><?php echo $this->_var['data']['content']; ?></textarea>
			</div>
			<div class="btn-row-submit" id="submit">保存</div>
			</form>
		</div>
		<!--百度地图-->
		<div class="baiduMap">
			<div id="mapCanvas" style="width:100%; height:300px; margin-bottom: 10px;"></div>
			<div class="flex flex-center">
				<div class="btn mgr-10" onclick="hideMap()">取消</div>
				<div class="btn" onclick="sureAddressFn()">确定</div>
			</div>
		</div>
		 
		<?php echo $this->fetch('footer.html'); ?>
		<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=<?php echo BDMAPKEY; ?>"></script>
		<script>
		var lat="<?php echo $this->_var['shop']['lat']; ?>", lng="<?php echo $this->_var['shop']['lng']; ?>";
		</script>
		<script>
			$(document).on("click","#submit",function(){
				var form=$(this).parents("form");
				var url=form.attr("action");
				$("#content").val($("#e-content").html());
				$.post(url,form.serialize(),function(res){
					skyToast(res.message);
					if(!res.error){
					//	goBack();
					}
				},"json")
			})
		</script>
		<script src="/plugin/skyeditor/skyeditor.js"></script>
		<script src="<?php echo $this->_var['skins']; ?>olprint_shop/map.js"></script>
		<script src="/plugin/lrz/lrz.bundle.js"></script>
		<script src="/plugin/dt-ui/dt-ui-upload.js"></script>
	</body>
</html>
