<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="author" content="HANCHAO"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<?php $csscommon="/Public/bootstrap/css/bootstrap.min.css" ?>
<?php $csscommon.="|/Public/HanChaoUI/css/hanchaoui.css" ?>
<?php $CSSARR[]=THEME_PATH."/common/css/main.css" ?>
<?php $CSSARR[]="/Public/HanChaoUI/css/weebox.css" ?>
<link rel="stylesheet" href="<?php echo min_css($CSSARR,$csscommon);?>" media="all"/>
<?php $jscommon="/Public/script/jquery.min.js" ?>
<?php $jscommon.="|/Public/bootstrap/js/bootstrap.min.js" ?>
<?php $JSARR['min2']=THEME_PATH."/common/js/common.js" ?>
<?php $JSARR['min3']="/Public/HanChaoUI/js/weebox.js" ?>
<script language="javascript">var URL = '/admin.php?s=/shops_delivery/';var THEME_COLOR = '';var ROOT_PATH = '/';var APP   =   '/admin.php?s=/';var CONTROLLER_NAME   =   '<?php echo (CONTROLLER_NAME); ?>';var THEME_PATH   =   '<?php echo (TPL_PATH); ?>/';</script>
<script type="text/javascript" src="<?php echo min_js($JSARR,$jscommon);?>"></script><!--[if IE]>
<link href="/Public/bootstrap/css/bootstrap.ie.css" rel="stylesheet" type="text/css"/>
 <script src="/Public/bootstrap/js/html5shiv.js"></script>
<![endif]-->
<script language="javascript">
$(function($){
    $(window.parent.document).find('#loading').hide();
    var topid='<?php echo ($_GET['topid']); ?>';
    var leftid='<?php echo ($_GET['leftid']); ?>';
    changemenu(topid,leftid);
});
function changemenu(topid,leftid){
    if(!topid && !leftid)return false;
    if(topid)parent._OPENleft(topid);
    if(leftid){
        $(window.parent.document).find('#_OPENright'+leftid).parent().prev().click();
        $(window.parent.document).find('#_OPENright'+leftid+' a').click();
    }
}
</script>
<title><?php echo (L("website_manage")); ?>Powered by hanchao</title>
</head>
<body><?php if(!empty($big_menu)): ?><div class="pad-lr-10 col-sm-12">
    <div class="btn-handle mt15">
   <?php if(is_array($big_menu)): foreach($big_menu as $k=>$vo): ?><a class="btn <?php if(!empty($menu_hover)): if(in_array(($k), is_array($menu_hover)?$menu_hover:explode(',',$menu_hover))): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>                
   <?php else: ?>btn-primary<?php endif; ?>" href="<?php echo (isset($vo)?$vo:''); ?>"><?php echo (isset($k)?$k:''); ?></a>&nbsp;&nbsp;<?php endforeach; endif; ?>
    </div>
</div><?php endif; ?>
<?php $JSARR[]=THEME_PATH."common/js/takeout/location_takeout.js"; ?>
<style>
.hhh div{ margin-top: 7px;}
.mt3{ margin-top: 3px;}
.mt7{ margin-top: 7px;}
</style>
<div class="pad-lr-10 col-sm-12">
	<form action="<?php echo U('update_setting');?>" method="post" name="myform" id="myform">
		<div class="mt15">
			<ul class="nav nav-tabs" role="tablist">
				<li role="presentation" class="active"><a>同城配送</a></li>
				<li role="presentation"><a href="<?php echo U('ShopsDelivery/kd_edit',array('shop_id'=>$shop_id));?>">快递发货</a></li>
			</ul>
			<div class="cont_hanchao pd15 tab-content" id="myTabContent">
				<div class="present tab-pane fade active in" id="group_common">
					<table class="table_hanchao_z">
						<tr>
							<th width="120" class="text-r">配送信息：</th>
							<td>
							  <!-- [默认不收配送费] -->
								<div class="clearfix mb10 ml10"><a onclick="addRow()" href="javascript:void(0)">[+]</a></div>
								<div class="clearfix ml10" id="takeout_html">
									<?php if(is_array($shops_delivery)): $i = 0; $__LIST__ = $shops_delivery;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="hhh mt3" style="height:40px;">
											<input type="text" name="scale[]" id="scale[]" value="<?php echo (isset($vo['scale'])?$vo['scale']:''); ?>" class="form-control w80 f_l">
											<input type="hidden" name="start_price[]" value="0" />
											<!-- <div class="f_l">&nbsp;公里之内&nbsp;&nbsp;起送费&nbsp;</div>
											<input type="text" name="start_price[]" id="start_price[]" value="<?php echo (isset($vo['start_price'])?$vo['start_price']:''); ?>" class="form-control w80 f_l">
											<div class="f_l">&nbsp;元&nbsp;&nbsp;配送费&nbsp;</div> -->
											<div class="f_l">&nbsp;公里之内&nbsp;&nbsp;配送费&nbsp;</div>
											<input type="text" name="delivery_price[]" id="delivery_price[]" value="<?php echo (isset($vo['delivery_price'])?$vo['delivery_price']:''); ?>" class="form-control w80 f_l">
											<div class="f_l">&nbsp;元&nbsp;&nbsp;</div>
											<a onclick="delRow(this)" href="javascript:void(0)" class="f_l mt5">[-]</a>
										</div><?php endforeach; endif; else: echo "" ;endif; ?>
								</div>
								<input type="hidden" name="moreshipstr" value="<?php echo (isset($moreshipstr)?$moreshipstr:''); ?>" />
							</td>
						</tr>
						<tr>
							<th class="text-r">免邮金额：</th>
							<td>
								<input type="text" name="shipping_price" id="shipping_price" value="<?php echo (isset($shipping_price)?$shipping_price:''); ?>" class="form-control f_l w80 ml10">
								<span class="f_l mt7 ml10">元</span>
							</td>
						</tr>
						<tr>
							<th class="text-r">配送时间：</th>
							<td>
								<select name="time_type" class="form-control ml10">
									<option <?php if(($time_type) == "1"): ?>selected<?php endif; ?> value="1" >分钟</option>
									<option <?php if(($time_type) == "2"): ?>selected<?php endif; ?> value="2" >小时</option>
								</select>
								<input type="text" name="to_time" id="to_time" value="<?php echo (isset($to_time)?$to_time:''); ?>" class="form-control f_l w50 ml10">
								<!-- <span>以分钟为单位</span> -->
							</td>
						</tr>
						<tr>
							<th class="text-r">包装费：</th>
							<td>
								<!-- <span class="f_l mt7 ml10">基础价:</span>
								<input type="text" name="package_start_price" id="package_start_price" value="<?php echo (isset($package_start_price)?$package_start_price:''); ?>" class="form-control w80 mr5">
								<span class="f_l mt7">元以内收打包费（0为不收，－1为全收）；打包费:</span>
								<span class="f_l mt7">元打包费，打包费：</span>
								<input type="text" name="package_price" id="package_price" value="<?php echo (isset($package_price)?$package_price:''); ?>" class="form-control w80 mr5">
								<span class="f_l mt7">元/每份</span> -->
								<input type="text" name="package_price" id="package_price" value="<?php echo (isset($package_price)?$package_price:''); ?>" class="form-control w80 ml10 mr5">
								<span class="f_l mt7">元/份，</span>
								<input type="text" name="package_start_price" id="package_start_price" value="<?php echo (isset($package_start_price)?$package_start_price:''); ?>" class="form-control w80 mr5">
								<span class="f_l mt7">元以上免包装费</span>
							</td>
						</tr>
						<tr>
							<th class="text-r">配送时段：</th>
							<td>
								<span class="mt7 ml10"><?php echo (isset($business_week_start)?$business_week_start:''); ?><em class="mt7">&nbsp;-&nbsp;</em><?php echo (isset($business_week_end)?$business_week_end:''); ?></span>
								<span class="mt7 ml10"><?php echo (isset($business_hours_start)?$business_hours_start:''); ?><em class="mt7">&nbsp;-&nbsp;</em><?php echo (isset($business_hours_end)?$business_hours_end:''); ?></span>
								<a href="<?php echo U('Shops/edit',array('id'=>$shop_id));?>">去设置</a>
							</td>
						</tr>
						<tr>
							<th class="text-r">时段细分：</th>
							<td>
								<span class="mt7 ml10">
									<?php $selectdvalue=0; $time_int_arr=strtoarray("1|上午下午,2|小时,3|半小时"); $i=1;$total=count($time_int_arr);foreach($time_int_arr as $key=>$val) { ?><label class="radio-inline"><input type="radio" name="time_int" value="<?php echo $key;?>" id="time_int_<?php echo $i;?>"<?php if(empty($time_int) && !is_numeric($time_int))$time_int=array();if((!empty($time_int) || is_numeric($time_int)) && $time_int==$key){echo " checked='checked'";$selectdvalue=1;}?>><?php echo $val.' ';?></label><?php ++$i;} if($selectdvalue==0)echo "<script>$(\"input[name='time_int'][value='1']\").attr(\"checked\",true);</script>";?>
								</span>
							</td>
						</tr>
						<tr>
							<th class="text-r">最长预约：</th>
							<td>
								<select id="long_time" class="form-control f_l ml10" name="long_time" ><?php if(!empty($long_time_arr)){ $selectdvalue=0;foreach($long_time_arr as $key=>$val) { if(empty($long_time) && !is_numeric($long_time))$long_time=array();$long_timearr=remove_empty_array($long_time);if(in_array($key,$long_timearr)) { ?><option selected="selected" value="<?php echo $key ?>"><?php echo $val;$selectdvalue=1; ?></option><?php }else { ?><option value="<?php echo $key ?>"><?php echo $val ?></option><?php } } } ?></select>
								<div class="mt7">&nbsp;天内订单&nbsp;</div>
							</td>
						</tr>
					</table>
					<p class="mt-10">
						<input type="hidden" name="shop_id" value="<?php echo (isset($shop_id)?$shop_id:''); ?>" />
						<input class="btn radius btn-primary mr-15" type="submit" value="提交">
						<input class="btn radius btn-warning" type="button" onclick="javascript:history.back(-1);" value="返回">
					</p>
				</div>
			</div>
		</div>
    </form>
</div>
<script>
//属性+
function addRow(){
	var html = '<div class="hhh mt3" style="height:40px;"><input type="text" name="scale[]" class="form-control f_l w80"/><input type="hidden" name="start_price[]" value="0" /><div class="f_l">&nbsp;公里之内&nbsp;&nbsp;配送费&nbsp;</div><input type="text" name="delivery_price[]" class="form-control f_l w80" /><div class="f_l">&nbsp;元&nbsp;&nbsp;</div><a onclick="delRow(this)" href="javascript:void(0)"  class="f_l mt5">[-]</a></div>';
	<!-- var html = '<div class="hhh mt3" style="height:40px;"><input type="text" name="scale[]" class="form-control f_l w80"/><div class="f_l">&nbsp;公里之内&nbsp;&nbsp;起送费&nbsp;</div><input type="text" name="start_price[]" class="form-control f_l w80" /><div class="f_l">&nbsp;元&nbsp;&nbsp;配送费&nbsp;</div><input type="text" name="delivery_price[]" class="form-control f_l w80" /><div class="f_l">&nbsp;元&nbsp;&nbsp;</div><a onclick="delRow(this)" href="javascript:void(0)">[-]</a></div>'; -->
	$('#takeout_html').append(html);
}
//属性-
function delRow(obj){
	$(obj).parent().remove();
}
</script>
</body>
</html>