<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>订单发货</title>
{js:jquery}
{js:dialog}
{js:validate}
{js:artTemplate}
{js:areaSelect}
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="{webroot:public/css/twitter-bootstrap/3.3.7/css/bootstrap.min.css}">
<script type='text/javascript' src="{webroot:public/javascript/public.js}"></script>
</head>

<body style="width:750px;min-height:420px;overflow-x:hidden;">
<div class="container">
	<form action="{url:/order/order_delivery_doc}" method="post" id="deliver_form">
		<input type="hidden" name="order_no" value="{$order_no}"/>
		<input type="hidden" name="id" value="{$order_id}"/>
		<input type="hidden" name="user_id" value="{$user_id}"/>
		<input type="hidden" name="freight" value="{$real_freight}" />
		<input type="hidden" name="delivery_type" value="{$distribution}" />

		<table class="table list-table">
			<colgroup>
				<col />
				<col width="80px" />
				<col width="130px" />
				<col width="60px" />
			</colgroup>

			<thead>
				<tr>
					<th>商品名称</th>
					<th>商品价格</th>
					<th>购买数量</th>
					<th>选择</th>
				</tr>
			</thead>

			<tbody>
                {foreach:items=Api::run('getOrderGoodsRowByOrderId',array('id'=>$order_id))}
				<tr>
					<td>
						{if:$item['seller_id']}<span class="glyphicon glyphicon-user" title="第三方商家"></span>{/if}
						{set:$goodsRow = JSON::decode($item['goods_array'])}
						{$goodsRow['name']} &nbsp;&nbsp; {$goodsRow['value']}
					</td>
					<td>{$item['real_price']}</td>
					<td>{$item['goods_nums']}</td>
					<td>
						{if:$item['is_send'] == 0}
						<input type="checkbox" name="sendgoods[]" value="{$item['id']}" />
						{else:}
						{echo:Order_class::goodsSendStatus($item)}
						{/if}
					</td>
				</tr>
				{/foreach}
			</tbody>
		</table>

		<table class="table">
			<colgroup>
				<col width="120px" />
				<col />
				<col width="120px" />
				<col />
			</colgroup>

			<tbody>
				<tr>
					<td>订单号:</td><td>{$order_no}</td>
					<td>配送方式:</td>
					<td>
                        {foreach:items=Api::run('getDeliveryById',array('distribution'=>$distribution))}
                            {$item['name']}
                        {/foreach}
					</td>
				</tr>
				<tr>
					<td>配送费用:</td><td>￥{$real_freight}</td>
					<td>保价费用:</td><td>￥{$insured}</td>
				</tr>
				<tr>
					<td>收货人姓名:</td><td><input type="text" class="form-control" name="name" value="{$accept_name}" pattern="required"/></td>
					<td>电话:</td><td><input type="text" class="form-control" name="telphone" value="{$telphone}" pattern="phone" empty /></td>
				</tr>
				<tr>
					<td>手机:</td><td><input type="text" class="form-control" name="mobile" value="{$mobile}" pattern="mobi"/></td>
					<td>邮政编码:</td><td><input type="text" name="postcode" class="form-control" value="{$postcode}" pattern="zip" empty /></td>
				</tr>
				<tr>
					<td>快递物流公司:</td>
					<td>
						<select class="form-control" style="width:auto;display:inline;" name="freight_id" alt="物流公司" pattern="required">
							<option value="">请选择物流公司</option>
                            {foreach:items=Api::run('getFreightCompany')}
							<option value="{$item['id']}">{$item['freight_name']}</option>
							{/foreach}
						</select>
					</td>
					<td>配送单号:</td>
					<td>
						<input type="text" class="form-control" name="delivery_code" pattern="required" />
					</td>
				</tr>
				<tr>
					<td>地区:</td>
					<td colspan="3">
						<select name="province" child="city,area" class="form-control" style="width:auto;display:inline"></select>
						<select name="city" child="area" class="form-control" style="width:auto;display:inline"></select>
						<select name="area" pattern="required" alt="选择地区" class="form-control" style="width:auto;display:inline"></select>
					</td>
				</tr>
				<tr>
					<td>地址:</td><td colspan="3"><input type="text" class="form-control" name="address" value="{$address}" pattern="required"/></td>
				</tr>
				<tr>
					<td>发货单备注:</td><td colspan="3"><textarea name="note" class="form-control" style="width:100%;height:90px"></textarea></td>
				</tr>
			</tbody>
		</table>
	</form>
</div>

<script type="text/javascript">
var areaInstance = new areaSelect('province');
areaInstance.init({"province":"{$province}","city":"{$city}","area":"{$area}"});
</script>
</body>
</html>