<!-- $Id: order_info.htm 17060 2010-03-25 03:44:42Z liuhui $ -->

{include file="pageheader.htm"}
{insert_scripts files="topbar.js,../js/utils.js,listtable.js,selectzone.js,../js/common.js"}
{if $user}
<div id="topbar">
  <div align="right"><a href="" onclick="closebar(); return false"><img src="images/close.gif" border="0" /></a></div>
  <table width="100%" border="0">
    <caption><strong> {$lang.buyer_info} </strong></caption>
    <tr>
      <td> {$lang.email} </td>
      <td> <a href="mailto:{$user.email}">{$user.email}</a> </td>
    </tr>
    <tr>
      <td> {$lang.user_money} </td>
      <td> {$user.formated_user_money} </td>
    </tr>
    <tr>
      <td> {$lang.pay_points} </td>
      <td> {$user.pay_points} </td>
    </tr>
    <tr>
      <td> {$lang.rank_points} </td>
      <td> {$user.rank_points} </td>
    </tr>
    <tr>
      <td> {$lang.rank_name} </td>
      <td> {$user.rank_name} </td>
    </tr>
    <tr>
      <td> {$lang.bonus_count} </td>
      <td> {$user.bonus_count} </td>
    </tr>
  </table>

  {foreach from=$address_list item=address}
  <table width="100%" border="0">
    <caption><strong> {$lang.consignee} : {$address.consignee|escape} </strong></caption>
    <tr>
      <td> {$lang.email} </td>
      <td> <a href="mailto:{$address.email|escape}">{$address.email|escape}</a> </td>
    </tr>
    <tr>
      <td> {$lang.address} </td>
      <td>  </td>
    </tr>
    <tr>
      <td> {$lang.zipcode} </td>
      <td> {$address.zipcode|escape} </td>
    </tr>
    <tr>
      <td> {$lang.tel} </td>
      <td> {$address.tel|escape} </td>
    </tr>
    <tr>
      <td> {$lang.mobile} </td>
      <td> <a href="sms.php?act=display_send_ui&mobile={$address.mobile} ">{$address.mobile|escape}</a> </td>
    </tr>
  </table>
  {/foreach}
</div>
{/if}

<form action="order.php?act=operate" method="post" name="theForm">
<div class="list-div" style="margin-bottom: 5px">
    <table class="table table-bordered">  
      <tr>
        <td colspan="8">
          <div align="center">
            <input name="prev" type="button" class="button" onClick="location.href='order.php?act=info&order_id={$prev_id}';" value="{$lang.prev}" {if !$prev_id}disabled{/if} />
            <input name="next" type="button" class="button" onClick="location.href='order.php?act=info&order_id={$next_id}';" value="{$lang.next}" {if !$next_id}disabled{/if} />
            <input type="button" onclick="window.open('order.php?act=info&order_id={$order.order_id}&print=1')" class="button" value="{$lang.print_order}" />
        </div>
        </td>
      </tr>
    
      <tr>
        <th colspan="8" scope="col">{$lang.goods_info}<a href="order.php?act=edit&order_id={$order.order_id}&step=goods" class="special">{$lang.edit}</a></th>
        </tr>
      <tr>
        <td scope="col"><div align="center"><strong>{$lang.goods_name_brand}</strong></div></td>
        <td scope="col"><div align="center"><strong>{$lang.goods_sn}</strong></div></td>
        <td scope="col"><div align="center"><strong>{$lang.product_sn}</strong></div></td>
        <td scope="col"><div align="center"><strong>{$lang.goods_price}</strong></div></td>
        <td scope="col"><div align="center"><strong>{$lang.goods_number}</strong></div></td>
        <td scope="col"><div align="center"><strong>{$lang.goods_attr}</strong></div></td>
        <td scope="col"><div align="center"><strong>{$lang.storage}</strong></div></td>
        <td scope="col"><div align="center"><strong>{$lang.subtotal}</strong></div></td>
      </tr>
      {foreach from=$goods_list item=goods}
      <tr>
        <td>
        {if $goods.goods_id gt 0 && $goods.extension_code neq 'package_buy'}
        <a href="../goods.php?id={$goods.goods_id}" target="_blank">{$goods.goods_name} {if $goods.brand_name}[ {$goods.brand_name} ]{/if}
        {if $goods.is_gift}{if $goods.goods_price > 0}{$lang.remark_favourable}{else}{$lang.remark_gift}{/if}{/if}
        {if $goods.parent_id > 0}{$lang.remark_fittings}{/if}</a>
        {elseif $goods.goods_id gt 0 && $goods.extension_code eq 'package_buy'}
        <a href="javascript:void(0)" onclick="setSuitShow({$goods.goods_id})">{$goods.goods_name}<span style="color:#FF0000;">{$lang.remark_package}</span></a>
        <div id="suit_{$goods.goods_id}" style="display:none">
            {foreach from=$goods.package_goods_list item=package_goods_list}
              <a href="../goods.php?id={$package_goods_list.goods_id}" target="_blank">{$package_goods_list.goods_name}</a><br />
            {/foreach}
        </div>
        {/if}
        </td>
        <td>{$goods.goods_sn}</td>
        <td>{$goods.product_sn}</td>
        <td><div align="right">{$goods.formated_goods_price}</div></td>
        <td><div align="right">{$goods.goods_number}
        </div></td>
        <td>{$goods.goods_attr|nl2br}</td>
        <td><div align="right">{$goods.storage}</div></td>
        <td><div align="right">{$goods.formated_subtotal}</div></td>
      </tr>
      {/foreach}
      <tr>
        <td></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>{if $order.total_weight}<div align="right"><strong>{$lang.label_total_weight}
        </strong></div>{/if}</td>
        <td>{if $order.total_weight}<div align="right">{$order.total_weight}
        </div>{/if}</td>
        <td>&nbsp;</td>
        <td><div align="right"><strong>{$lang.label_total}</strong></div></td>
        <td><div align="right">{$order.formated_goods_amount}</div></td>
      </tr>
    </table>
</div>
    
<div class="list-div" style="margin-bottom: 5px">
<table class="table table-bordered">  
  <tr>
    <th colspan="4">{$lang.base_info}</th>
  </tr>
  <tr>
    <td width="18%"><div align="right"><strong>{$lang.label_order_sn}</strong></div></td>
    <td width="34%">{$order.order_sn}{if $order.extension_code eq "group_buy"}<a href="group_buy.php?act=edit&id={$order.extension_id}">{$lang.group_buy}</a>{elseif $order.extension_code eq "exchange_goods"}<a href="exchange_goods.php?act=edit&id={$order.extension_id}">{$lang.exchange_goods}</a>{/if}</td>
    <td width="15%"><div align="right"><strong>{$lang.label_order_status}</strong></div></td>
    <td>{$order.status}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_user_name}</strong></div></td>
    <td>{$order.user_name|default:$lang.anonymous} {if $order.user_id > 0}[ <a href="" onclick="staticbar();return false;">{$lang.display_buyer}</a> ] [ <a href="user_msg.php?act=add&order_id={$order.order_id}&user_id={$order.user_id}">{$lang.send_message}</a> ]{/if}</td>
    <td><div align="right"><strong>{$lang.label_order_time}</strong></div></td>
    <td>{$order.formated_add_time}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_payment}</strong></div></td>
    <td>{if $order.pay_id > 0}{$order.pay_name}{else}{$lang.require_field}{/if}<a href="order.php?act=edit&order_id={$order.order_id}&step=payment" class="special">{$lang.edit}</a>
    ({$lang.action_note}: <span onclick="listTable.edit(this, 'edit_pay_note', {$order.order_id})">{if $order.pay_note}{$order.pay_note}{else}N/A{/if}</span>)</td>
    <td><div align="right"><strong>{$lang.label_pay_time}</strong></div></td>
    <td>{$order.pay_time}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_shipping}</strong></div></td>
    <td>{if $exist_real_goods}{if $order.shipping_id > 0}<span id="shipping_name">{$order.shipping_name}</span>{else}{$lang.require_field}{/if}<a href="order.php?act=edit&order_id={$order.order_id}&step=shipping" class="special">{$lang.edit}</a>&nbsp;&nbsp;<input type="button" onclick="window.open('order.php?act=info&order_id={$order.order_id}&shipping_print=1')" class="button" value="{$lang.print_shipping}"> {if $order.insure_fee > 0}（{$lang.label_insure_fee}{$order.formated_insure_fee}）{/if}{/if}</td>
    <td><div align="right"><strong>{$lang.label_shipping_time}</strong></div></td>
    <td>{$order.shipping_time}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_invoice_no}</strong></div></td>
    <td>{if $order.shipping_id>0 and $order.shipping_status>0}<span>{if $order.invoice_no}<span id="invoice_no">{$order.invoice_no}</span>{else}N/A{/if}</span><a href="order.php?act=edit&order_id={$order.order_id}&step=shipping" class="special">{$lang.edit}</a>{/if}</td>
    <td><div align="right"><strong>{$lang.from_order}</strong></div></td>
    <td>{$order.referer}</td>
  </tr>
{if $order.invoice_no && $order.shipping_name neq '上門取貨' && $order.shipping_name neq '城際快遞' && $order.shipping_name neq '市內快遞' && $order.shipping_name neq '運費到付' && $order.shipping_time neq '未發貨'}
<style>
/*==============物流信息================*/
.kd{ width:100%; overflow:hidden; background:#FFF;}
.detail_top{ width:100%; overflow:hidden; background:#FFF; padding-top:10px; border-bottom:1px solid #eeeeee; padding-bottom:10px;}
.detail_top dl{ width:98%; overflow:hidden; margin:auto;}
.detail_top dl dd{ float:left;margin:0;}
.detail_top dl dd span{ display:block; height:25px; width:100%;font-size:16px; line-height:25px; color:#333}
.detail_top dl dd em{ display:block;width:100%;font-size:12px; line-height:150%; color:#999}

.kd_wl{width:100%; overflow:hidden;background:#FFF;}
.kd_wl h2{ width:95%; margin:auto; height:50px; font-size:16px; line-height:50px; color:#666; border-bottom:1px solid #eeeeee; font-weight:normal}
.kd_wl{width:100%;margin:auto; margin-top:10px;}
.kd_wl dl{ width:95%;margin:auto; overflow:hidden; position:relative}
.kd_wl dl dt{ position:absolute; top:0px; float:left;width:15px; height:15px; margin-left:2px; background:#25AE5F;border-radius: 50%; }
.kd_wl dl dd{ width:98%; float:left; overflow:hidden; border-left:1px solid #dddddd; margin-left:9px;}
.kd_wl dl dd p{ width:95%;overflow:hidden; float:right; font-size:13px; line-height:150%; color:#52BF7F;margin:0;}
.kd_wl dl dd strong{ display:block; padding-bottom:10px; width:95%;float:right; font-size:12px; color:#f60; line-height:150%; font-weight:normal}
</style>
  <tr>
    <th colspan="4">物流信息跟蹤</th>
  </tr>
  <tr>
    <td colspan="4">
		<div class="kd">
		  <div class="detail_top">
		    <dl>
		      <dd>
			<span>{$kuaidi_list.shipping_name}</span>
			<em>運單編碼：{$kuaidi_list.invoice_no}</em></dd>
		    </dl>
		  </div>
		  <div class="kd_wl">{foreach from=$kuaidi_list.data item=data key=i}
		    <dl {if $i eq '0'}style=" margin-top:10px;" {/if}>
		      <dt {if $i neq '0'}style=" background:#ccc;" {/if}></dt>
		      <dd>
			<p {if $i neq '0'}style=" color:#666" {/if}>{$data.context}</p>
			<strong>{if $data.ftime}{$data.ftime}{else}{$data.time}{/if}</strong></dd>
		    </dl>{/foreach}</div>
		</div>		
	</td>
  </tr>
{/if}
  <tr>
    <th colspan="4">{$lang.other_info}<a href="order.php?act=edit&order_id={$order.order_id}&step=other" class="special">{$lang.edit}</a></th>
    </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_inv_type}</strong></div></td>
    <td>{$order.inv_type}</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_inv_payee}</strong></div></td>
    <td>{$order.inv_payee}</td>
    <td><div align="right"><strong>{$lang.label_inv_content}</strong></div></td>
    <td>{$order.inv_content}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_postscript}</strong></div></td>
    <td colspan="3">{$order.postscript}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_how_oos}</strong></div></td>
    <td>{$order.how_oos}</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <!-- <tr>
    <td><div align="right"><strong>{$lang.label_pack}</strong></div></td>
    <td>{$order.pack_name}</td>
    <td><div align="right"><strong>{$lang.label_card}</strong></div></td>
    <td>{$order.card_name}</td>
  </tr> -->
  <!-- <tr>
    <td><div align="right"><strong>{$lang.label_card_message}</strong></div></td>
    <td colspan="3">{$order.card_message}</td>
  </tr> -->
  <tr>
    <td><div align="right"><strong>{$lang.label_to_buyer}</strong></div></td>
    <td colspan="3">{$order.to_buyer}</td>
  </tr>
  <tr>
    <th colspan="4">{$lang.consignee_info}<a href="order.php?act=edit&order_id={$order.order_id}&step=consignee" class="special">{$lang.edit}</a></th>
    </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_consignee}</strong></div></td>
    <td>{$order.consignee|escape}</td>
    <td><div align="right"><strong>{$lang.label_email}</strong></div></td>
    <td>{$order.email}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_address}</strong></div></td>
    <td>[{$order.region}] </td>
    <td><div align="right"><strong>{$lang.label_zipcode}</strong></div></td>
    <td>{$order.zipcode|escape}</td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_tel}</strong></div></td>
    <td>{$order.tel}</td>
    <td><div align="right"><strong>{$lang.label_mobile}</strong></div></td>
    <td><a href="sms.php?act=display_send_ui&mobile={$order.mobile} "><font color="red">{$order.mobile|escape}</font></a></td>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_sign_building}</strong></div></td>
    <td>{$order.sign_building|escape}</td>
    <td><div align="right"><strong>{$lang.label_best_time}</strong></div></td>
    <td>{$order.best_time|escape}</td>
  </tr>
</table>
</div>

<!-- 費用訊息 -->
<div class="list-div" style="margin-bottom: 5px">
<table class="table table-bordered">  <tr>
    <th>{$lang.fee_info}<a href="order.php?act=edit&order_id={$order.order_id}&step=money" class="special">{$lang.edit}</a></th>
  </tr>
  <tr>
    <td><div align="right">{$lang.label_goods_amount}<strong>{$order.formated_goods_amount}</strong>
- {$lang.label_discount}<strong>{$order.formated_discount}</strong>     + {$lang.label_tax}<strong>{$order.formated_tax}</strong>
      + {$lang.label_shipping_fee}<strong>{$order.formated_shipping_fee}</strong>
      + {$lang.label_insure_fee}<strong>{$order.formated_insure_fee}</strong>
      + {$lang.label_pay_fee}<strong>{$order.formated_pay_fee}</strong>
      + {$lang.label_pack_fee}<strong>{$order.formated_pack_fee}</strong>
      + {$lang.label_card_fee}<strong>{$order.formated_card_fee}</strong></div></td>
  <tr>
    <td><div align="right"> = {$lang.label_order_amount}<strong>{$order.formated_total_fee}</strong></div></td>
  </tr>
  <tr>
    <td><div align="right">
      - {$lang.label_money_paid}<strong>{$order.formated_money_paid}</strong> - {$lang.label_surplus} <strong>{$order.formated_surplus}</strong>
      - {$lang.label_integral} <strong>{$order.formated_integral_money}</strong>
      - {$lang.label_bonus} <strong>{$order.formated_bonus}</strong>
    </div></td>
  <tr>
    <td><div align="right"> = {if $order.order_amount >= 0}{$lang.label_money_dues}<strong>{$order.formated_order_amount}</strong>
      {else}{$lang.label_money_refund}<strong>{$order.formated_money_refund}</strong>
      <input name="refund" type="button" value="{$lang.refund}" onclick="location.href='order.php?act=process&func=load_refund&anonymous={if $order.user_id <= 0}1{else}0{/if}&order_id={$order.order_id}&refund_amount={$order.money_refund}'" />
      {/if}{if $order.extension_code eq "group_buy"}<br />{$lang.notice_gb_order_amount}{/if}</div></td>
  </tr>
</table>
</div>
<!-- 訂單操作 -->
<div class="list-div" style="margin-bottom: 5px">
<table class="table table-bordered">  <tr>
    <th colspan="6">{$lang.action_info}</th>
  </tr>
  <tr>
    <td><div align="right"><strong>{$lang.label_action_note}</strong></div></td>
  <td colspan="5"><textarea name="action_note" cols="80" rows="3"></textarea></td>
    </tr>
  <tr>
    <td><div align="right"></div>
      <div align="right"><strong>{$lang.label_operable_act}</strong> </div></td>
	<!-- 一鍵發貨begin 修改 by www.mb5.com.cn  -->  
    {if $order.pay_status == 2 && $order.shipping_status != 1 && $order.order_status == 1 }
    <td colspan="2">
    <input name="invoice_no" type="text" value="" placeholder="請輸入快遞單號" />
    <input name="to_shipping" type="submit" value="一鍵發貨" class="button" />
    </td>
    <td><div align="right"><strong style="color:#c00">若一鍵發貨請忽略此操作</strong></div></td><td colspan="2">
    {else}
    <td colspan="5">
    {/if}
    <!-- 一鍵發貨end 修改 by www.mb5.com.cn -->  
	      {if $operable_list.confirm}
        <input name="confirm" type="submit" value="{$lang.op_confirm}" class="button" />
        {/if} 
        {if $operable_list.pay}
        <input name="pay" type="submit" value="{$lang.op_pay}" class="button" />
        {/if} {if $operable_list.unpay}
        <input name="unpay" type="submit" class="button" value="{$lang.op_unpay}" />
        {/if} {if $operable_list.prepare}
        <input name="prepare" type="submit" value="{$lang.op_prepare}" class="button" />
        {/if} {if $operable_list.split}
        <input name="ship" type="submit" value="{$lang.op_split}" class="button" />
        {/if} {if $operable_list.unship}
        <input name="unship" type="submit" value="{$lang.op_unship}" class="button" />
        {/if} {if $operable_list.receive}
        <input name="receive" type="submit" value="{$lang.op_receive}" class="button" />
        {/if} {if $operable_list.cancel}
        <input name="cancel" type="submit" value="{$lang.op_cancel}" class="button" />
        {/if} {if $operable_list.invalid}
        <input name="invalid" type="submit" value="{$lang.op_invalid}" class="button" />
        {/if} {if $operable_list.return}
        <input name="return" type="submit" value="{$lang.op_return}" class="button" />
        {/if} {if $operable_list.to_delivery}
        <input name="to_delivery" type="submit" value="{$lang.op_to_delivery}" class="button"/>
        <input name="order_sn" type="hidden" value="{$order.order_sn}" />
        {/if} 
        <input name="after_service" type="submit" value="{$lang.op_after_service}" class="button" />
        {if $operable_list.remove}
        <input name="remove" type="submit" value="{$lang.remove}" class="button" onClick="return window.confirm('{$lang.js_languages.remove_confirm}');" />
        {/if}
        {if $order.extension_code eq "group_buy"}{$lang.notice_gb_ship}{/if}
        {if $agency_list}
        <input name="assign" type="submit" value="{$lang.op_assign}" class="button" onclick="return assignTo(document.forms['theForm'].elements['agency_id'].value)" />
        <select name="agency_id"><option value="0">{$lang.select_please}</option>
        {foreach from=$agency_list item=agency}
        <option value="{$agency.agency_id}" {if $agency.agency_id eq $order.agency_id}selected{/if}>{$agency.agency_name}</option>
        {/foreach}
        </select>
        {/if}
        <input name="order_id" type="hidden" value="{$smarty.request.order_id}"></td>
    </tr>
  <tr>
    <th>{$lang.action_user}</th>
    <th>{$lang.action_time}</th>
    <th>{$lang.order_status}</th>
    <th>{$lang.pay_status}</th>
    <th>{$lang.shipping_status}</th>
    <th>{$lang.action_note}</th>
  </tr>
  {foreach from=$action_list item=action}
  <tr>
    <td><div align="center">{$action.action_user}</div></td>
    <td><div align="center">{$action.action_time}</div></td>
    <td><div align="center">{$action.order_status}</div></td>
    <td><div align="center">{$action.pay_status}</div></td>
    <td><div align="center">{$action.shipping_status}</div></td>
    <td>{$action.action_note|nl2br}</td>
  </tr>
  {/foreach}
</table>
</div>
</form>
{literal}
<script language="JavaScript">
{/literal}
  var oldAgencyId = {$order.agency_id|default:0};
{literal}
  onload = function()
  {
    // 開始檢查訂單
    startCheckOrder();
  }

  /**
   * 把訂單指派給某辦事處
   * @param int agencyId
   */
  function assignTo(agencyId)
  {
    if (agencyId == 0)
    {
      alert(pls_select_agency);
      return false;
    }
    if (oldAgencyId != 0 && agencyId == oldAgencyId)
    {
      alert(pls_select_other_agency);
      return false;
    }
    return true;
  }
</script>
{/literal}

{include file="pagefooter.htm"}