<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
<div class="container list blank">
    <div class="row-5">
        <div class="col-1">
            {widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
        </div>
        <div class="col-4">
            <h1 class="title"><span>我的订单：</span></h1>
            <table class="table table-list">
                <tr class="title"><td><b>订单号：</b><i class="icon-order-{$order['type']}-32"></i>{$order['order_no']}<b>下单日期：</b>{$order['create_time']} <b>状态：</b> {echo:$this->order_status($order)}</td>
                </tr >
                <tr><td>{$order['create_time']}&nbsp;&nbsp;<span class="black">订单创建</span></td></tr>
                {if:$order['pay_status']>0}
                <tr><td>{$order['pay_time']}&nbsp;&nbsp;<span class="black">订单{$order['order_no']} 付款 {$currency_symbol}<b>{$order['order_amount']}</b></span></td></tr>
                {/if} {if:$order['status']>=3}
                <tr><td><span class="black">订单{$order['order_no']} 已审核通过！</span></td></tr>
                {/if} {if:$order['delivery_status']>0}
                <tr><td>{$order['send_time']}&nbsp;&nbsp;<span class="black">订单<b class="orange">全部商品</b>已发货</span></td></tr>
                {/if} {if:$order['status']==4}
                <tr><td>{$order['completion_time']}&nbsp;&nbsp;<span class="black">订单完成</span></td></tr>
                {/if}
            </table>
            {!$goods_total = count($order_goods);$virtual_total=0}
            {list:items=$order_goods}
            {if:$item['goods_type']!=0}{!$virtual_total=$virtual_total+1;}{/if}
            {/list}
            {if:$goods_total!=$virtual_total}
            <div>
                <table class="table table-list">
                    <tr>
                        <th class="tl" style="padding-left: 20px;" colspan=2>收货人信息：</th>
                    </tr>
                    <tr>
                        <td class="label">收货人：</td>
                        <td>{$order['accept_name']}</td>
                    </tr>
                    <tr>
                        <td class="label">地&nbsp;&nbsp;&nbsp;&nbsp;址：</td>
                        <td>{$parse_area[$order['province']]} {$parse_area[$order['city']]} {$parse_area[$order['county']]} {$order['addr']}</td>
                    </tr>
                    <tr>
                        <td class="label">电&nbsp;&nbsp;&nbsp;&nbsp;话：</td>
                        <td>{$order['phone']}</td>
                    </tr>
                    <tr>
                        <td class="label">手&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
                        <td>{$order['mobile']}</td>
                    </tr>
                </table>
            </div>
            {/if}
            <div>
                <table class="table table-list">
                    <tr>
                        <th class="tl" style="padding-left: 20px;" colspan=2>支付及配送方式：</th>
                    </tr>
                    <tr>
                        <td class="label">支付方式：</td>
                        <td>{$order['pay_name']}</td>
                    </tr>
                    {if:$goods_total!=$virtual_total}
                    <tr>
                        <td class="label">运&nbsp;&nbsp;&nbsp;&nbsp;费：</td>
                        <td>{$order['real_freight']}</td>
                    </tr>
                    {if:$order['delivery_status']>0}
                    <tr>
                        <td class="label">物流公司：</td>
                        <td>{$invoice['ec_name']}</td>
                    </tr>
                    <tr>
                        <td class="label">快递单号：</td>
                        <td>{$invoice['express_no']}&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-main btn-mini" href="http://www.kuaidi100.com/chaxun?com={$invoice['ec_code']}&nu={$invoice['express_no']}" target="_blank">查询物流</a>
                        </td>
                    </tr>
                    {/if}
                    {/if}
                </table>
            </div>
            {if:$order['is_invoice']==1} {set:$invoice = explode(':',$order['invoice_title'])}
            <div>
                <table class="table table-list">
                    <tr>
                        <th class="tl" style="padding-left: 20px;" colspan=2>索要发票信息：</th>
                    </tr>
                    <tr>
                        <td class="label">发票类型：</td>
                        <td>{if:$invoice[0]==1}单位{else:}个人{/if}</td>
                    </tr>
                    <tr>
                        <td class="label">发票抬头：</td>
                        <td>{$invoice[1]}</td>
                    </tr>
                </table>
            </div>
            {/if}
            {set:$total=0.00;$subtotal=0.00;}
            {if:$goods_total!=$virtual_total}
            <div>
                <h2 class="mt20">实物商品购物清单</h2>
                <table class="table table-list">
                    <tr>
                        <th width="40"></th>
                        <th>商品名称</th>
                        <th width="140">商品编号</th>
                        <th width="100">规格</th>
                        <th width="80">商品价格</th>
                        <th width="80">优惠后价格</th>
                        <th width="40">数量</th>
                        <th width="80">小计</th>
                    </tr>
                    {list:items=$order_goods}
                    {if:$item['goods_type']==0}
                    {set:$subtotal = ($item['real_price']*$item['goods_nums']);$total+=$subtotal; $subtotal = sprintf ("%01.2f",$subtotal);}
                    <tr class="{if:$key%2==1}even{else:}odd{/if}">
                        <td>
                            <a href="{url:/index/product/id/$item[goods_id]}" target="_blank"><img src="{echo:Common::thumb($item['img'],100,100);}" width="40"></a>
                        </td>
                        <td><a href="{url:/index/product/id/$item[goods_id]}" target="_blank">{$item['name']}</a>
                        </td>
                        <td>{$item['pro_no']}</td>
                        <td> {set:$specs = unserialize($item['spec'])} {if:!empty($specs)} {list:items=$specs item=$spec} {$spec['name']}：{$spec['value'][2]} {/list} {/if}
                        </td>
                        <td>{$currency_symbol}{$item['goods_price']}</td>
                        <td>{$currency_symbol}{$item['real_price']}</td>
                        <td>{$item['goods_nums']}</td>
                        <td>{$currency_symbol}{$subtotal}</td>
                    </tr>
                    {/if}
                    {/list}
                </table>
            </div>
            {/if}
            {if:$virtual_total!=0}
            <div>
                <h2 class="mt20">虚拟商品购物清单</h2>
                <table class="table table-list">
                    <tr>
                        <th width="40"></th>
                        <th>商品名称</th>
                        <th width="140">商品编号</th>
                        <th width="100">规格</th>
                        <th width="80">商品价格</th>
                        <th width="80">优惠后价格</th>
                        <th width="40">数量</th>
                        <th width="80">商品详情</th>
                    </tr>
                     {list:items=$order_goods}
                     {if:$item['goods_type']!=0}
                     {set:$subtotal = ($item['real_price']*$item['goods_nums']);$total+=$subtotal; $subtotal = sprintf ("%01.2f",$subtotal);}
                    <tr class="{if:$key%2==1}even{else:}odd{/if}">
                        <td>
                            <a href="{url:/index/product/id/$item[goods_id]}" target="_blank"><img src="{echo:Common::thumb($item['img'],100,100);}" width="40"></a>
                        </td>
                        <td><a href="{url:/index/product/id/$item[goods_id]}" target="_blank">{$item['name']}</a>
                        </td>
                        <td>{$item['pro_no']}</td>
                        <td> {set:$specs = unserialize($item['spec'])} {if:!empty($specs)} {list:items=$specs item=$spec} {$spec['name']}：{$spec['value'][2]} {/list} {/if}
                        </td>
                        <td>{$currency_symbol}{$item['goods_price']}</td>
                        <td>{$currency_symbol}{$item['real_price']}</td>
                        <td>{$item['goods_nums']}</td>
                        <td><a href="javascript:virtual_goods_show('{url:/ucenter/virtual_goods_show/order_id/$item[order_id]/goods_type/$item[goods_type]/virtual_extend/$item[virtual_extend]}')">获取商品</a></td>
                    </tr>
                    {/if}
                    {/list}
                </table>
            </div>
            {/if}
            {set:$total = sprintf ("%01.2f",$total);}
            <table class="table table-list tr" >
                    {if:$order['type']==3}
                    <tr>
                        <td><p>套餐总金额：{$currency_symbol}{$order['real_amount']}</p></td>
                    </tr>
                    {else:}
                    <tr>
                        <td><p>商品总金额：{$currency_symbol}{$total}</p></td>
                    </tr>
                    {/if}
                    <tr>
                        <td><p>+ 运费：{$currency_symbol}{$order['real_freight']}</p></td>
                    </tr>
                    {if:$order['taxes']>0}
                    <tr>
                        <td><p>+ 税：{$currency_symbol}{$order['taxes']}</p></td>
                    </tr>
                    {/if}
                    <tr>
                        <td><p>- 优惠：{$currency_symbol}{$order['discount_amount']}</p></td>
                    </tr>
                    {if:$order['adjust_amount']!=0}
                    <tr>
                        <td><p>{if:$order['adjust_amount']>0}+{else:}-{/if} 价格调整：{$currency_symbol}{echo:trim($order['adjust_amount'],'-')}</p></td>
                    </tr>
                    <tr>
                        <td><p>调价原因：{$order['adjust_note']|'无原因'}</p></td>
                    </tr>
                    {/if}
                    <tr>
                        <td style="font-size:20px">订单支付金额：<b>{$currency_symbol}{$order['order_amount']}</b></td>
                    </tr>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript">
function virtual_goods_show(url) {
    layer.open({
            type: 2,
            title: '虚拟商品',
            shadeClose: true,
            shade: 0.8,
            area: ['660px', '416px'],
            content: url
        });
}
function order_sign(id) {
    $.post("{url:/ucenter/order_sign}", {
        id: id
    }, function(data) {
        if (data['status'] == 'success') {
            location.reload();
        }
    }, 'json');
}

</script>
