{js:artTemplate}
<script src='{webroot:public/javascript/orderFormClass.js}'></script>
<script>
//创建订单表单实例
orderFormInstance = new orderFormClass();

//DOM加载完毕
$(function(){
	//商家信息
	orderFormInstance.seller = {echo:JSON::encode($this->seller)};

	//商品价格
	orderFormInstance.goodsSum = "{$this->final_sum}";

	//配送方式初始化
	orderFormInstance.deliveryInit("{$this->custom['delivery']}");

	//收货地址数据
	orderFormInstance.addressInit();

	//支付方式
	orderFormInstance.paymentInit("{$this->custom['payment']}");

	//免运费
	orderFormInstance.freeFreight = {echo:JSON::encode($this->freeFreight)};
});
</script>

<section class="breadcrumb">
	<span>您当前的位置：</span> <a href="{url:}">首页</a> » 填写核对订单信息
</section>

<section class="cart_2">
	<header class="cart_header">填写核对订单信息</header>
	<form action='{url:/simple/cart3}' method='post' name='order_form' onsubmit='return orderFormInstance.isSubmit()'>
		<input type='hidden' name='direct_gid' value='{$this->gid}' />
		<input type='hidden' name='direct_type' value='{$this->type}' />
		<input type='hidden' name='direct_num' value='{$this->num}' />
		<input type='hidden' name='direct_promo' value='{$this->promo}' />
		<input type='hidden' name='direct_active_id' value='{$this->active_id}' />
		<section class="cart_item">
			<h3>收货人信息</h3>
			<div class="cart_item_addr">
				<h4>常用收货地址</h4>
				<ul class="addr_list">
					{foreach:items=$this->addressList}
					<li id="addressItem{$item['id']}">
						<label>
							<input class="radio" name="radio_address" type="radio" value="{$item['id']}" onclick="orderFormInstance.getDelivery({$item['province']});" />
							<strong>{$item['accept_name']}</strong> {$item['province_val']} {$item['city_val']} {$item['area_val']} {$item['address']}
						</label>
						[<span onclick="orderFormInstance.addressEdit({$item['id']})">修改地址</span>]
						[<span onclick="orderFormInstance.addressDel({$item['id']})">删除</span>]
					</li>
					{/foreach}
					<li>
						<label><a href="javascript:orderFormInstance.addressAdd();" style="color:#005ea7;">添加新地址</a></label>
					</li>
				</ul>
				<!--收货地址项模板-->
				<script type='text/html' id='addressLiTemplate'>
				<li id="addressItem<%=item['id']%>">
					<label><input class="radio" name="radio_address" type="radio" value="<%=item['id']%>" onclick="orderFormInstance.getDelivery(<%=item['province']%>);" /><%=item['accept_name']%>&nbsp;&nbsp;&nbsp;<%=item['province_val']%> <%=item['city_val']%> <%=item['area_val']%> <%=item['address']%></label> [<a href="javascript:orderFormInstance.addressEdit(<%=item['id']%>);" style="color:#005ea7;">修改地址</a>] [<a href="javascript:orderFormInstance.addressDel(<%=item['id']%>);" style="color:#005ea7">删除</a>]
				</li>
				</script>
			</div>
		</section>
		<section class="cart_item">
			<h3>配送方式</h3>
			<div class="cart_item_express">
				<table>
					<col width="180">
					<col>
					<tbody>
						{foreach:items = Api::run('getDeliveryList')}
						<tr>
							<th>
								<label>
									<input type="radio" name="delivery_id" value="{$item['id']}" paytype="{$item['type']}" onclick='orderFormInstance.deliverySelected({$item['id']});' />
									{$item['name']}
								</label>
							</th>
							<td>
								<span id="deliveryShow{$item['id']}"></span>
								{$item['description']}
								{if:$item['type'] == 2}
								<a href="javascript:orderFormInstance.selectTakeself({$item['id']});"><span class="red">选择自提点</span></a>
								<span id="takeself{$item['id']}"></span>
								{/if}
							</td>
						</tr>
						{/foreach}
					</tbody>

					<!--配送信息-->
					<script type='text/html' id='deliveryTemplate'>
						<span style="color:#e4393c">运费：￥<%=item['price']%></span>
						<%if(item['protect_price'] > 0){%>
						<span style="color:#e4393c">保价：￥<%=item['protect_price']%></span>
						<%}%>
					</script>

					<!--物流自提点-->
					<script type='text/html' id='takeselfTemplate'>
						[<%=item['address']%> <%=item['name']%> <%=item['phone']%> <%=item['mobile']%>]
					</script>

					<tfoot>
						<th>指定送货时间：</th>
						<td>
							<label class='attr'><input type='radio' name='accept_time' checked="checked" value='任意' /> 任意</label>
							<label class='attr'><input type='radio' name='accept_time' value='周一到周五' /> 周一到周五</label>
							<label class='attr'><input type='radio' name='accept_time' value='周末' /> 周末</label>
						</td>
					</tfoot>
				</table>
			</div>
		</section>
		<section class="cart_item" id="paymentBox">
			<h3>支付方式</h3>
			<div class="cart_item_pay">
				<table width="100%" class="border_table">
					<col width="180">
					<col>
					{foreach:items = Api::run('getPaymentList')}
					{set:$paymentPrice = CountSum::getGoodsPaymentPrice($item['id'],$this->sum);}
					<tr>
						<th>
							<label>
								<input class="radio" name="payment" alt="{$paymentPrice}" onclick='orderFormInstance.paymentSelected({$item['id']});' title="{$item['name']}" type="radio" value="{$item['id']}" />
								{$item['name']}
							</label>
						</th>
						<td>{$item['note']} {if:$paymentPrice}支付手续费：￥{$paymentPrice}{/if}</td>
					</tr>
					{/foreach}
				</table>
			</div>
		</section>
		<section class="cart_item">
			<h3>订单附言</h3>
			<div class="cart_item_msg">
				<table>
					<col width="120px">
					<col>
					<tr>
						<th>订单附言：</th>
						<td><input class="input_text" type="text" name='message' /></td>
					</tr>
				</table>
			</div>
		</section>
		<section class="cart_item">
			<h3>购买的商品</h3>
			<div class="cart_prompts {if:empty($this->promotion)}none{/if}">
				<strong>恭喜，您的订单已经满足了以下优惠活动！</strong>
				<ol>
					{foreach:items = $this->promotion}
					<li>{$item['plan']}，{$item['info']}</li>
					{/foreach}
				</ol>
			</div>
			<div class="cart_item_goods">
				<table>
					<col width="115">
					<col>
					<col width="80">
					<col width="80">
					<col width="80">
					<col width="80">
					<col width="80">
					<thead>
						<tr>
							<th>图片</th>
							<th>商品名称</th>
							<th>赠送积分</th>
							<th>单价</th>
							<th>优惠</th>
							<th>数量</th>
							<th>小计</th>
						</tr>
					</thead>
					<tbody>
						<!-- 商品展示 开始-->
						{foreach:items = $this->goodsList}
						<tr>
							<td><img src="{url:/pic/thumb/img/$item[img]/w/66/h/66}" width="66px" height="66px" alt="{$item['name']}"></td>
							<td>
								<a href="{url:/site/products/id/$item['goods_id']}" class="blue">{$item['name']}</a>
								{if:isset($item['spec_array'])}
								<p>
								{set:$spec_array=Block::show_spec($item['spec_array']);}
								{foreach:items=$spec_array item=$specValue key=$specName}
									{$specName}：{$specValue} &nbsp&nbsp
								{/foreach}
								</p>
								{/if}
							</td>
							<td>{$item['point']}</td>
							<td><em>￥{$item['sell_price']}</em></td>
							<td>减￥{$item['reduce']}</td>
							<td>{$item['count']}</td>
							<td id="deliveryFeeBox_{$item['goods_id']}_{$item['product_id']}_{$item['count']}"><em>￥{$item['sum']}</em></td>
						</tr>
						{/foreach}
						<!-- 商品展示 结束-->
					</tbody>
				</table>
			</div>
		</section>
		<section class="cart_item">
			<h3>结算信息</h3>
			<div class="cart_item_count">
				<div class="count">
					{if:$this->final_sum != $this->sum}优惠后总金额{else:}商品总金额{/if}：<strong>{$this->final_sum}</strong> -
					代金券：<strong name='ticket_value'>0</strong> +
					税金：<strong id='tax_fee'>0</strong> +
					运费总计：<strong id='delivery_fee_show'>0</strong> +
					保价：<strong id='protect_price_value'>0</strong> +
					支付手续费：<strong id='payment_value'>0</strong>
					<br>
					<div class="use_ticket_btn" onclick="orderFormInstance.ticketShow()">
						<i class="icon-tag"></i>
						<span>使用代金卷</span>
					</div>
				</div>
				<table>
					<col width="220">
					<col>
					<col width="250">
					<tr>
						<td>
							是否需要发票？(税金:￥{$this->goodsTax})
							<input class="radio" onclick="orderFormInstance.doAccount();$('#tax_title').toggle();" name="taxes" type="checkbox" value="{$this->goodsTax}">
						</td>
						<td>
							<label id="tax_title" class='none'>
								发票抬头：
								<input type='text' class='input_text' name='tax_title' pattern='required'/>
							</label>
						</td>
						<td>
							<div class="all_count">
								应付总额：<em>￥<span id='final_sum'>{$this->final_sum}</span></em> 元
							</div>
						</td>
					</tr>
				</table>
			</div>
		</section>
		<label class="cart_topay_btn">
			<input type="submit">
			<span>确定无误，提交订单</span>
		</label>
	</form>
</section>
