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

//DOM加载完毕
jQuery(function(){
	//虚拟商品更新
	orderFormInstance.goodsType("{$this->goodsType}");

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

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

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

<div class="wrapper clearfix">
	<div class="position mt_10"><span>您当前的位置：</span> <a href="{url:}"> 首页</a> » 填写核对订单信息</div>
	<div class="myshopping m_10">
		<ul class="order_step">
			<li class="current_prev"><span class="first"><a href='{if:IReq::get('id')}javascript:window.history.go(-1);{else:}{url:/simple/cart}{/if}'>1、查看购物车</a></span></li>
			<li class="current"><span>2、填写核对订单信息</span></li>
			<li class="last"><span>3、成功提交订单</span></li>
		</ul>
	</div>

	<form action='{url:/simple/cart3}' method='post' name='order_form' onsubmit='return orderFormInstance.isSubmit()'>
		<div class="cart_box m_10">
			<div class="title">填写核对订单信息</div>
			<div class="cont">

				<!--地址管理 开始-->
				<div class="wrap_box" id="addressBox">
					<h3>
						<span class="orange">收货人信息</span>
					</h3>

					<div class="prompt_4 m_15">
						<strong>常用收货地址</strong>
						<ul class="addr_list" id="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']});" />{$item['accept_name']} {$item['province_str']} {$item['city_str']} {$item['area_str']} {$item['address']} {$item['mobile']}</label> [<a href="javascript:orderFormInstance.addressEdit({$item['id']});" style="color:#005ea7;">修改地址</a>] [<a href="javascript:orderFormInstance.addressDel({$item['id']});" style="color:#005ea7">删除</a>]
							</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']%> <%=item['province_str']%> <%=item['city_str']%> <%=item['area_str']%> <%=item['address']%> <%=item['mobile']%></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>

                    {if:$this->takeselfList}
					<div>
					    <strong>自提点</strong>
						<ul class="addr_list" id="takeself_list">
							{foreach:items=$this->takeselfList}
							<input type='hidden' name='accept_name' value='{$item['accept_name']}' />
							<input type='hidden' name='accept_mobile' value='{$item['accept_mobile']}' />
							<li>
								<label><input class="radio" name="takeself" type="radio" value="{$item['id']}" onclick="orderFormInstance.takeselfSelected({$item['id']});" />{$item['name']} {$item['province_str']} {$item['city_str']} {$item['area_str']} {$item['address']} {$item['accept_name']} {$item['accept_mobile']}</label> [<a href="javascript:orderFormInstance.selectTakeself({$item['id']});" style="color:#005ea7;">修改自提点</a>]
							</li>
							{/foreach}
						</ul>

						<!--自提点模板-->
						<script type='text/html' id='takeselfLiTemplate'>
						<input type='hidden' name='accept_name' value='<%=item['accept_name']%>' />
						<input type='hidden' name='accept_mobile' value='<%=item['accept_mobile']%>' />
						<li>
							<label><input class="radio" name="takeself" type="radio" value="<%=item['id']%>" onclick="orderFormInstance.takeselfSelected(<%=item['id']%>);" /><%=item['name']%> <%=item['province_str']%> <%=item['city_str']%> <%=item['area_str']%> <%=item['address']%> <%=item['accept_name']%> <%=item['accept_mobile']%></label> [<a href="javascript:orderFormInstance.selectTakeself(<%=item['id']%>);" style="color:#005ea7;">修改自提点</a>]
						</li>
						</script>
					</div>
					{/if}
				</div>
				<!--地址管理 结束-->

				<!--联系人 开始-->
				{set:$contact = $this->addressList ? $this->addressList[0] : []}
				<div class="wrap_box" id="contactBox" style="display:none;">
					<h3>
						<span class="orange">联系人信息</span>
					</h3>

					<table width="100%" class="form_table">
						<tr>
							<td>
							    姓名：<input class='normal' type='text' name='accept_name' pattern='required' value='{$contact['accept_name']}' />
							    电话：<input class='normal' type='text' name='accept_mobile' pattern='mobi' value='{$contact['mobile']}' />
							</td>
						</tr>
					</table>
				</div>
				<!--联系人 结束-->

				<!--服务时间 开始-->
				<div class="wrap_box" id="preorderBox" style="display:none;">
					<h3>
						<span class="orange">选择日期</span>
					</h3>

					<table width="100%" class="border_table">
						<colgroup>
							<col width="110px" />
							<col />
						</colgroup>
						<tr>
    				        <th>预订日期：</th>
    				        <td>起始日期：<input type='text' class='small Wdate' autocomplete='off' id='start_date' name='start_date' onFocus="WdatePicker({'minDate':'%y-%M-%d','maxDate':'#F{ $dp.$D(\'end_date\',{d:-1}) }'})" value="" pattern='date' onchange='orderFormInstance.preorder();' /> 结束日期：<input id='end_date' autocomplete='off' type='text' class='small Wdate' name='end_date' onFocus="WdatePicker({'minDate':'#F{ $dp.$D(\'start_date\',{d:1}) }','maxDate':'#F{ $dp.$D(\'start_date\',{d:30}) }'})" value="" pattern='date' onchange='orderFormInstance.preorder();' /></td>
						</tr>
						<tr>
						    <th>预约价格：</th>
						    <td>
						        <ul id="preorderDetail"></ul>
						    </td>
						</tr>
					</table>
				</div>
				<!--服务时间 结束-->

				<!--配送方式 开始-->
				<div class="wrap_box" id="deliveryBox">
					<h3>
						<span class="orange">配送方式</span>
					</h3>

					<table width="100%" class="border_table m_10">
						<colgroup>
							<col width="180px" />
							<col />
						</colgroup>

						<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']}
								</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>

						<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>
				<!--配送方式 结束-->

				<!--支付方式 开始-->
				<div class="wrap_box" id="paymentBox">
					<h3>
						<span class="orange">支付方式</span>
					</h3>

					<table width="100%" class="border_table">
						<colgroup>
							<col width="320px" />
							<col />
						</colgroup>
						{foreach:items = Api::run('getPaymentList')}
						<tr>
							<th><label><input class="radio" name="payment" title="{$item['name']}" type="radio" value="{$item['id']}" /><img src='{url:plugins$item['logo']}' width='160px' /> {$item['name']}</label></th>
							<td>{$item['note']}</td>
						</tr>
						{/foreach}
					</table>
				</div>
				<!--支付方式 结束-->

				<!--订单留言 开始-->
				<div class="wrap_box">
					<h3>
						<span class="orange">订单附言</span>
					</h3>

					<table width="100%" class="form_table">
						<colgroup>
							<col width="120px" />
							<col />
						</colgroup>
						<tr>
							<th>订单附言：</th>
							<td><input class="normal" type="text" name='message' /></td>
						</tr>
					</table>
				</div>
				<!--订单留言 结束-->

				<!--购买清单 开始-->
				<div class="wrap_box">

					<h3><span class="orange">购买的商品</span></h3>

					<div class="cart_prompt f14 t_l m_10" {if:empty($this->promotion)}style="display:none"{/if}>
						<p class="m_10 gray"><b class="orange">恭喜，</b>您的订单已经满足了以下优惠活动！</p>
						{foreach:items = $this->promotion}
						<p class="indent blue">{$item['plan']}，{$item['info']}</p>
						{/foreach}
					</div>

					<table width="100%" class="cart_table t_c">
						<colgroup>
							<col width="115px" />
							<col />
							<col width="80px" />
							<col width="80px" />
							<col width="80px" />
							<col width="80px" />
							<col width="80px" />
						</colgroup>

						<thead>
							<tr>
								<th>图片</th>
								<th>商品名称</th>
								<th>赠送积分</th>
								<th>单价</th>
								<th>优惠</th>
								<th>数量</th>
								<th class="last">小计</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']}" title="{$item['name']}" /></td>
								<td class="t_l">
									<a href="{url:/site/products/id/$item['goods_id']}" class="blue">{$item['name']}</a>
									{if:isset($item['spec_array'])}
									<p>
									{set:$spec_array=goods_class::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><b>￥{$item['sell_price']}</b></td>
								<td>减￥{$item['reduce']}</td>
								<td>{$item['count']}</td>
								<td id="deliveryFeeBox_{$item['goods_id']}_{$item['product_id']}_{$item['count']}"><b class="red2">￥{$item['sum']}</b></td>
							</tr>
							{/foreach}
							<!-- 商品展示 结束-->
						</tbody>
					</table>
				</div>
				<!--购买清单 结束-->

			</div>
		</div>

		<!--金额结算-->
		<div class="cart_box">
			<div class="cont_2">
				<strong>结算信息</strong>
				<div class="pink_box">
					<p class="f14 t_l">{if:$this->final_sum != $this->sum}优惠后总金额{else:}商品总金额{/if}：<b id='goodsSum'>{$this->final_sum}</b> - 优惠券：<b name='ticket_value'>0</b> + 税金：<b id='tax_fee'>0</b> + 运费总计：<b id='delivery_fee_show'>0</b> + 保价：<b id='protect_price_value'>0</b> {if:$this->spend_point > 0} + 消耗积分：<b>{$this->spend_point}</b>{/if} </p>

					<a class="fold" href='javascript:orderFormInstance.ticketShow();'>
						{if:$this->ticketRow}<b class="orange">有可用优惠券</b>{else:}<b>无可用优惠券</b>{/if}
					</a>
				</div>

				<hr class="dashed" />
				<div class="pink_box gray m_10">
					<table width="100%" class="form_table t_l">
						<colgroup>
							<col width="220px" />
							<col />
							<col width="250px" />
						</colgroup>

						<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='attr' style='display:none'>
									<select name="invoice_id">
										<option value="">请选择发票...</option>
										{foreach:items=Api::run("getInvoiceListByUserId")}
										<option value="{$item['id']}">{$item['company_name']}</option>
										{/foreach}
									</select>
									<a href="javascript:orderFormInstance.editInvoice();" class="blue">添加</a>
								</label>
							</td>
							<td class="t_r"><b class="price f14">应付总额：<span class="red2">￥<b id='final_sum'>{$this->final_sum}</b></span>元</b></td>
						</tr>
					</table>
				</div>
				<p class="m_10 t_r"><input type="submit" class="submit_order" /></p>
			</div>
		</div>
	</form>
</div>