<!--
<?php
print <<<EOT
-->
<SCRIPT LANGUAGE="JavaScript">
<!--
function postbuy(t){
	if(t=='shopping'){
		window.self.close();return false;
	}
	document.form_buy.action='buy.php?step='+t+'#write';
	document.form_buy.submit();
}

function setpay(t){
	if(t=='1'){
		document.getElementById("olpaytypediv").style.display='';
	}else{
		document.getElementById("olpaytypediv").style.display='none';
	}
	
}
//-->
</SCRIPT>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="MainTable">
  <tr> 
    <td height="100" valign="top" class="Main"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="dragTable" >
        <tr> 
          <td class="head">
            <h3 class="L"></h3>
            <span class="TAG">購物車</span>
            <h3 class="R"></h3>
          </td>
        </tr>
        <tr> 
          <td class="middle"> 
            <table width="100%" cellspacing="5" cellpadding="5" >
              <tr> 
                <td align="left"> 
                  
                  <form name="form_buy" method="post" action="?">
                    <table width="100%" border="0" cellspacing="4" cellpadding="5" style="border:1px dotted #ccc;">
                      <tr align="center" > 
                        <td colspan="7"><b>購物清單</b></td>
                      </tr>
                      <tr align="center" bgcolor="#F0F0F0"> 
                        <td width="21%" bgcolor="#F0F0F0"><b><font color="#FF0000">商品名稱</font></b></td>
                        <td width="15%"><b><font color="#FF0000">商品型號</font></b></td>
                        <td width="18%"><b><font color="#FF0000">商品編號</font></b></td>
                        <td width="9%"><b><font color="#FF0000">數 量</font></b> 
                        </td>
                        <td width="14%"><b><font color="#FF0000">單 價 </font></b></td>
                        <td width="15%"><b><font color="#FF0000">總價</font></b></td>
                        <td width="8%"><b><font color="#FF0000">扔棄</font></b></td>
                      </tr>
                      <!--
EOT;
foreach($listdb AS  $key=>$rs){
print <<<EOT
-->
                      <tr > 
                        <td width="21%" ><a href="$webdb[www_url]/bencandy.php?fid=$rs[fid]&id=$rs[aid]" target="_blank">$rs[title]</a></td>
                        <td width="15%" align="center" >$rs[shoptype]</td>
                        <td width="18%" align="center" >$rs[shop_id]</td>
                        <td width="9%" align="center" > 
                          <input type="text" size="4" value="$rs[num]" name="product[{$rs[aid]}]">
                           
                        </td>
                        <td align="center" width="14%" ><font color="#FF0000">{$rs[nowprice]}</font>元</td>
                        <td align="center" width="15%" ><font color="#FF0000">{$rs[totalprice]}</font>元</td>
                        <td align="center" width="8%" ><a href="?job=del&did=$rs[aid]">清除</a></td>
                      </tr>
                      <!--
EOT;
}
print <<<EOT
-->
                      <tr align="left"> 
                        <td colspan="7" style="border-top:1px dotted #ccc;"><b><font color="#0000FF">總共需要支付:</font></b><font color="#FF0000">{$totalmoney}</font>元</td>
                      </tr>
                      <tr align="center"> 
                        <td colspan="7"> 
                          <input type="button" name="Submit3" value="調整數量" onClick="postbuy('updateNum')">
                          <input type="button" name="Submit2" value="繼續購物" onClick="postbuy('shopping')">
                          <input type="button" name="Submit4" value="結帳" onClick="postbuy('write')">
                        </td>
                      </tr>
                    </table>
                  </form>
                  <!--
EOT;
if($step=='write'){print <<<EOT
--><a name='write'></a>
<SCRIPT LANGUAGE="JavaScript">
<!--
function postorder(){
	if(document.getElementById('buyer').value==''){
		alert("顧客姓名不能為空");
		document.getElementById('buyer').focus();
		return false;
	}
	if(document.getElementById('mobphone').value==''){
		alert("手機不能為空");
		document.getElementById('mobphone').focus();
		return false;
	}
	document.form_order.submit();
}
//-->
</SCRIPT>                  <table width="100%" border="0" cellspacing="4" cellpadding="4" style="border:1px dotted #ccc;margin-top:5px;">
                    <form name="form_order" method="post" action="?action=order">
                      <tr align="center" bgcolor="#F0F0F0" > 
                        <td colspan="2"><b>訂單資料</b></td>
                      </tr>
                      <tr> 
                        <td width="16%">顧客姓名:(<font color="#FF0000">*</font>)</td>
                        <td width="84%"> 
                          <input type="text" name="buyer" id="buyer">
                          <input type="radio" name="sex" value="先生" checked>
                          先生 
                          <input type="radio" name="sex" value="女士">
                          女士 
<SCRIPT LANGUAGE="JavaScript">
<!--
//document.getElementById('buyer').focus();
//-->
</SCRIPT>
						  </td>
                      </tr>
                      <tr> 
                        <td width="16%">聯系電話:</td>
                        <td width="84%"> 
                          <input type="text" name="telphone">
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">聯系手機:(<font color="#FF0000">*</font>)</td>
                        <td width="84%"> 
                          <input type="text" name="mobphone" id="mobphone">
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">聯系郵箱:</td>
                        <td width="84%"> 
                          <input type="text" name="email">
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">聯系QQ:</td>
                        <td width="84%"> 
                          <input type="text" name="oicq">
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">郵政編碼:</td>
                        <td width="84%"> 
                          <input type="text" name="postalcode">
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">配送方式:</td>
                        <td width="84%"> 
                          <input type="radio" name="sendType" value="送貨上門">
                          上門取貨 
                          <input type="radio" name="sendType" value="EMS快遞">
                          EMS快遞(加收<font color="#FF0000">{$webdb[ShopEmsSend]}元</font>郵費) 
                          <input type="radio" name="sendType" value="其他快遞" checked>
                          其他快遞(加收<font color="#FF0000">{$webdb[ShopOtherSend]}元</font>郵費) 
                          <input type="radio" name="sendType" value="平郵">
                          平郵(加收<font color="#FF0000">{$webdb[ShopNormalSend]}元</font>郵費) 
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">支付方式:(<font color="#FF0000">*</font>)</td>
                        <td width="84%"> 
                          <input type="radio" name="payType" value="貨到付款" onclick="setpay('0')">
                          貨到付款 
                          <input type="radio" name="payType" value="在線支付" checked  >
                          在線支付 
                          <input type="radio" name="payType" value="其他方式付款" onclick="setpay('0')">
                          其他方式付款(銀行電匯、ATM轉帳、郵局匯款等等)<br>
                         
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">聯系地址:</td>
                        <td width="84%"> 
                          <textarea name="address" cols="70" rows="5"></textarea>
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">附注留言:</td>
                        <td width="84%"> 
                          <textarea name="otherSay" cols="70" rows="5"></textarea>
                        </td>
                      </tr>
                      <tr> 
                        <td width="16%">相關說明:</td>
                        <td width="84%">1.收到訂單後,我們承諾三天內發貨,有任何問題請電話咨詢!<br>
                          2.下訂單後,請勞記你的訂單號,方便今後查詢.<br>
                          3.下訂單前,請最好電話聯系我們,是否還有現貨. </td>
                      </tr>
                      <tr> 
                        <td width="16%">&nbsp;</td>
                        <td width="84%"> 
                          <input type="button" name="Submit" value="提交訂單" onclick="postorder()">
                        </td>
                      </tr>
                    </form>
                  </table>
                  <!--
EOT;
}
print <<<EOT
-->
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td class="foot">
            <h3 class="L"></h3>
            <h3 class="R"></h3>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<!--
EOT;
?>
-->
