<%@ page language="C#" autoeventwireup="true" inherits="Web_ShopBuy, mallz" title="购买订单" viewstateencryptionmode="Never" enableviewstatemac="false" enableeventvalidation="false" %>
<html runat="server" visible="false" xmlns="http://www.w3.org/1999/xhtml">
<head><title></title></head>
<body>
<form id="aspnetForm" runat="server" >
<script type="text/javascript" src="/Js/Function.js"></script>

<div id="TextContent" class="TextContent" style="left: 0px; top: 0px"> 
   <div id="step">
      <table align="center">
         <tr>
            <td><img alt="" src="/Images/buystep1.gif" /></td>
         </tr>
      </table>
   </div>
   <div class="trade" style="padding-left:4px; text-align:left;">
        
   </div>
   <div id="trade" class="trade">
     <div class="HackBox"></div>
     <div id="title1" class="tradeTitle"><span>交易明细及交易条件</span></div>
        <table align="center" width="760px">
          <tr>
             <td width="150px" rowspan="6" valign="top">
               <script language="javascript">function MyResizeImage(obj){return ResizeImage(obj,120,120);}</script>
               <a href="ShowProduct.aspx?ProductID=<%=m_ProductID %>" target="_blank"><asp:Image ID="ProductImage"  onerror="this.src='/Images/nopicture.gif'" runat="server" /></a>
               </td>
             <td>商品名称：<asp:HyperLink ID="ProductName" runat="server" Target="_blank" /></td>
          </tr> 
          <tr>
             <td>当前价格：￥<asp:Literal ID="ProductPrice" runat="server" /></td>
          </tr> 
          <tr>
             <td>所 在 地：<asp:Literal ID="ProductPlace" runat="server" /></td>
          </tr>
        </table>       
   </div>
   <div id="Div1" class="trade">
     <div class="HackBox"></div>
     <div id="Div2" class="tradeTitle"><span>确认交易价格</span></div>
        <table align="center" width="760px">
          <tr>
             <td>
                <asp:PlaceHolder ID="TeamBuyPanel" runat="server" Visible="false">
                   <div style="float:left; width:200px; text-align:right;">团购选择：</div>
                    <div style="float:left">
                    <asp:DropDownlist ID="otherChoice" onchange="SelectMyChoice(this.value)" runat="server" >
                        <asp:ListItem Text="非团购最低价不可" Value="0"  Selected="True"/>
                        <asp:ListItem Text="选择你愿意乘坐的巴士" Value="1" />                   
                    </asp:DropDownlist>
                    
                        <asp:Repeater runat="server"  ID="repotherBus">
                            <HeaderTemplate><div id="otherBus" style="display:none;"></HeaderTemplate>
                            <ItemTemplate>
                                <div><input type="checkbox" id="<%#"TeamBuyLeavel_"+Eval("ID") %>" name="TeamBuyLeavel" value="<%#Eval("ID") %>" onclick="SelectBus(this.id,this.value)" /> <%#Eval("TeamName") %> ￥<%#Eval("Price") %> 最低<%#Eval("MemberNum") %> 还差<%#Eval("DiffNum") %></div>
                            </ItemTemplate>
                            <FooterTemplate></div></FooterTemplate>
                        </asp:Repeater>
                    </div>
                </asp:PlaceHolder>
                <asp:PlaceHolder ID="ShowAuction" runat="server" Visible="false" >
                     <div style="float:left; width:200px; text-align:right;">出价金额：</div>
                     <div  style="float:left">
                        <asp:TextBox ID="AuctionEndPrice" runat="server" Width="50px"  CausesValidation="True" />元&nbsp;
                        （请输入您的出价，至少<asp:Literal ID="AuctionCurrentPrice" runat="server" />元）
                         <asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate="AuctionEndPrice" runat="server" ErrorMessage="请输入出价"/><br />
                         如果您输入的金额高于<asp:Literal ID="AuctionCurrentPrice2" runat="server" />元，则系统会启动代理出价功能。一旦有人出价，系统会帮您逐渐增加出价金额，直到您输入的金额为止。  
                     </div>         
               </asp:PlaceHolder>
               <asp:PlaceHolder ID="ShowPrice" runat="server" Visible="false" >
                     <div style="float:left; width:200px; text-align:right;">一口价：</div>
                     <div  style="float:left;">
                        <asp:TextBox ID="TxtStardPrice" runat="server" Enabled="false" Width="50px" CausesValidation="True" />元
                     </div>         
               </asp:PlaceHolder>
             </td>
          </tr>
        </table>       
   </div>
   <div id="configmbuy" class="trade">
       <div class="HackBox"></div>
       <div id="title2" class="tradeTitle"><span>确认购买数量</span></div>
       <table align="center" width="760px">
         <tr>
           <td width="150" valign="middle">
              </td>
           <td valign="middle">
              <table>
                <tr>
                   <td width="100px">购买数量：</td>
                   <td>
                     <asp:TextBox ID="Amount" runat="server" Width="50px" Text="1"/>（库存<asp:Label ID="CanBuy" runat="server" />件）
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="Amount" runat="server" ErrorMessage="请输入件数"/>
                     <asp:RangeValidator ID="rav_2" runat="server" ErrorMessage="输入数量必须为大于0整数" Type="Integer" ControlToValidate="Amount" MaximumValue="99999" MinimumValue="1" Display="Dynamic"/>
                   </td>
                </tr>
               <tr>
                   <td valign="middle">运费负担：</td>
                   <td>
                     <asp:Literal ID="DroDeliverPayType" runat="server" />
                   </td>
                </tr>
                <tr>
                   <td>验证码：</td>
                   <td>
                      <asp:TextBox ID="CheckCode" runat="server" MaxLength="5" Width="50px" />&nbsp;
                      <div id="ImgCheckCode" style="display:inline;"></div>&nbsp;
                      <a id="hlRefreshCheckcode" class="ColorMetalBlue" href="javascript:refreshCode();">看不到图片？点击这里。</a>
                   </td>
                </tr>   
              </table>
           </td>  
         </tr> 
       </table>
    </div>
     <div id="confirDeliver" class="trade" runat="server">
       <div class="HackBox"></div>
       <div class="tradeTitle"><span>确认配送方式</span></div>
       <div id="deliver_pay_list" style="text-align:left; padding-left:250px;">
         <asp:Repeater ID="deliver_pay_type_select" runat="server">
            <ItemTemplate>
                <div>
                    <input id="Radio1" name="DeliverName" type="radio" value="<%#Eval("Name") %>" />
                <%#Eval("Name") %> 基本价￥<%#Eval("default")%> 加一件加收￥<%#Eval("defIncrement")%> 至</div>
            </ItemTemplate>
         </asp:Repeater>
       </div>
    </div>
    <div id="configmpay" class="trade">
       <div class="HackBox"></div>
       <div class="tradeTitle"><span>支持的支付方式</span></div>   
          <asp:Repeater ID="PayType" runat="server">
                <HeaderTemplate><table width="80%" class="listtable" style="margin-top:10px; border:1px #EEEEEE solid;"><tr style="background-color:#EEEEEE; text-align:center;"><td style="width:30%; text-align:center;">支付名称</td><td style="width:30%; text-align:center;">支付类型</td><td style="text-align:center;">描述</td></tr><tr><td>商城帐户支付</td><td>商场帐户</td><td>&nbsp;</td></tr></HeaderTemplate>
            <ItemTemplate>
                <tr><td><%#Eval("TypeName") %> </td><td><%#MallZ.Web.Shop.TextFormat.GetPayType(Eval("PayType").ToString())%></td><td><%#Eval("Intro") %></td></tr>
            </ItemTemplate>
            <FooterTemplate></table></FooterTemplate>
         </asp:Repeater>
    </div>
    <div id="ContactAddress" class="trade">
       <div class="HackBox"></div>
       <div class="tradeTitle"><span>确认收货地址</span></div>
       <div style="width:758px; padding-top:2px; border:solid 1px #F1F1F1; margin-top:10px;">
            <table style="width:100%;" id="manage_address_tr" runat="server">
                 <tr id="add_new_address" >
                     <th width="150px">选择收货地址：</th>
                     <td><img src="Images/new_address.gif" onclick="show_new_address()"  style="cursor:pointer;" />&nbsp;&nbsp;<a href="../Member/Shop_ReceiveAddress.aspx" target="_blank">管理我的收货地址</a></td>
                 </tr>
                 <tr id="my_receive_address_list">
                     <th>收货地址：</th>
                     <td><asp:RadioButtonList ID="my_receive_address" runat="server" RepeatLayout="Flow"/>
                     </td>
                 </tr>
            </table>
            <table id="show_new_address" runat="server">
                <tr>
                    <th width="150px"><font color="red">*</font>收货人姓名：</th>
                    <td><asp:TextBox id="ContacterName" runat="server" MaxLength="50"/>必须为中文<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ErrorMessage="请填写收货人姓名" ControlToValidate="ContacterName"/>
               
                    </td>
                </tr>
                 <tr>
                    <th><font color="red">*</font>联系电话：</th>
                    <td><asp:TextBox id="mobilePhone" runat="server" MaxLength="11"/> (手机)<br />
                        <asp:TextBox id="homePhone" runat="server" MaxLength="20"/> (固定电话) 区号-电话号码-分机号 若没分机号则留空</td>
                </tr>
                <tr>
                   <th>所在地：</th>
                   <td><MZ:ProvinceCity ID="ProvinceCity" runat="server" SelectedProvince='<%# user.UserInforRes["Province"] %>' SelectedCity='<%# user.UserInforRes["City"] %>' />
                   </td>
                </tr>
                 <tr>
                    <th><font color="red">*</font>街道地址：</th>
                    <td><asp:TextBox id="Address" runat="server" Width="200px" MaxLength="50"/>
                        <asp:RequiredFieldValidator id="RequiredFieldValidator4" runat="server" ErrorMessage="请填写送货地址" ControlToValidate="Address" Display="Dynamic"/>
                    </td>
                </tr>
                 <tr>
                    <th>Email地址：</th>
                    <td><asp:TextBox id="Email" runat="server" Width="200px" MaxLength="50"/>
                        <asp:RegularExpressionValidator id="RegularExpressionValidator2" runat="server"  ErrorMessage="Email地址格式不正确" ControlToValidate="Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"/>
                    </td>
                </tr>
                 <tr>
                    <th>邮编：</th>
                    <td><asp:TextBox id="zipCode" runat="server" MaxLength="6" Width="80px" />
                       <asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="邮政编码不能为空" ControlToValidate="zipCode" Display="Dynamic"/>
                       <asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ErrorMessage="邮政编码格式不对" ControlToValidate="zipCode" ValidationExpression="\d{6}" Display="Dynamic"/>
                    </td>
                </tr>
                 <tr>
                    <th>是否保存地址：</th>
                    <td><asp:CheckBox id="SaveAddress" runat="server"/>是</td>
                </tr>
            </table>
            <asp:PlaceHolder ID="Product_Need_Invoice" runat="server" Visible="false">
                  <table style="width:100%;">
                     <tr>
                        <th width="150px">发票信息：</th>
                        <td><asp:TextBox ID="Invoice_Content" runat="server" Text="" TextMode="MultiLine" Width="250px" Height="60px" onfocus="clearTax();" onblur="fillTax();"/>
                        <asp:CheckBox ID="Invoice_Need" runat="server"  Text="是否需要发票,发票税率{0}%"/></td>
                     </tr>
                  </table>                
            </asp:PlaceHolder>
            <table style="width:100%;">
                 <tr >
                    <th width="150px">备注：</th>
                    <td><asp:TextBox ID="Remark" runat="server"  TextMode="MultiLine" Height="70" Width="250" onfocus="clearMemo();" onblur="fillMemo();"/></td>
               </tr>   
             </table>
        </div> 
    </div>
    <div class="trade">
        <div class="HackBox"></div>
        <div class="tradeTitle"><span>交易服务条款：</span></div> 
        <div style="width:95%; font-size:12px; padding-top:1px;">
            <asp:TextBox ID="TradeProtocal" runat="server" TextMode="MultiLine" Width="754px" ReadOnly="true" Height="101px" Text="点击确定，就意味着您同意了我们的购物条款。订单总额 = 商品价格 × 数量 × （１＋税率）% ＋ 运费。订单一但生成不允许修改。" />
        </div>
    </div>
    <asp:Label ID="err_tips"  runat="server"  Width="733px"/>
    <div id="submitButton" style="clear:both; text-align:center; margin-top:10px;">    
        <asp:ImageButton ImageUrl="Images/ConfirmBuyButton1.gif" Visible="false" runat="server" ID="LaterBuy" CommandName="later_pay" OnCommand="ImageButton1_Click" OnClientClick="return checkSubmit()"/>
        <asp:ImageButton ImageUrl="Images/ConfirmBuyButton2.gif" runat="server" ID="ImageButton1" CommandName="now_pay"  OnCommand="ImageButton1_Click" OnClientClick="return checkSubmit()"/>
    </div>
 </div>  

<script type="text/javascript">
function refreshCode(){
    document.getElementById("ImgCheckCode").innerHTML="<img src='/CheckCode.aspx'/>";
}
refreshCode();
function SelectMyChoice(objvalue)
{
    if(objvalue == "1")
        document.getElementById("otherBus").style.display = "";
    else
        document.getElementById("otherBus").style.display = "none";
}
function SelectBus(id,choice)
{
  choice = parseInt(choice);
  var _teamNums=<%=row["TeamNum"] %>;
  var _busID="TeamBuyLeavel_";
  if(document.getElementById(id).checked)
  {
        for(var j=choice+1;j<=_teamNums;j++)
        {
           document.getElementById(_busID+j).checked=true; 
           document.getElementById(_busID+j).disabled=true;
        }
  }
  else
  {
        for(var j=choice+1;j<=_teamNums;j++)
        {
           document.getElementById(_busID+j).checked=false; 
           document.getElementById(_busID+j).disabled=false;
        } 
       
  }
}
function show_new_address(){
  var new_address_table=document.getElementById("show_new_address");
  var add_new_addressHidenField=document.getElementById("add_new_address");
  var my_receive_address_listTable=document.getElementById("my_receive_address_list");
  var my_receive_address_listObjs=document.getElementsByName("my_receive_address");
  if(new_address_table.style.display=="none"){
     new_address_table.style.display="block"; 
     add_new_addressHidenField.value="true"; 
     my_receive_address_listTable.style.display="none";
     
     if(my_receive_address_listObjs!=null && my_receive_address_listObjs.length>0){
        for(var i=0;i<my_receive_address_listObjs.length;i++)
            my_receive_address_listObjs[i].checked=false;
     }
  }
  else{
     new_address_table.style.display="none";
     my_receive_address_listTable.style.display="block";
  }
}  
 function checkSubmit(){
   //设置地区值
   var h_provObj=document.getElementById("h_prov");
   var h_cityObj=document.getElementById("h_city");
   var h_areaObj=document.getElementById("h_area");
   var d_prov_select=document.getElementById("d_prov");
   var d_city_select=document.getElementById("d_city");
   var d_area_select=document.getElementById("d_area");
   var add_new_addressHiden=document.getElementById("add_new_address");
   if(add_new_addressHiden.value == "true" ){
       
        if((d_prov_select.value !="" && d_city_select.value !="")){
            h_provObj.value=d_prov_select.options[d_prov_select.selectedIndex].text;
            h_cityObj.value=d_city_select.options[d_city_select.selectedIndex].text;
            if(d_area_select.length > 0 && d_area_select.value!=""){
                h_areaObj.value=d_area_select.options[d_area_select.selectedIndex].text;        
            }
            else{
               alert('收货地址设置不正确');
               return false;   
            }
        }
        else{
           alert('收货地址设置不正确');
           return false;
        }
   
   }
 
   //判断验证码是否正确
   var checkcodeObj=document.getElementById("CheckCode");
   if(checkcodeObj.value.length!=5){
      alert('验证码不正确');
      checkcodeObj.focus();
      return false;
   }
   clearMemo();
   
   return true;
  
 
 }
  var DEFAULT_MEMO_TEXT = '请将说明文字限制在100字以内';
  var DEFAULT_MEMO_CLASS = 'Gray';
  var DEFAULT_TAX_TEXT='发票抬头：xx 商品名称：xx 发票金额： xx元'
  var memoObj = document.getElementById('Remark');
  var taxObj = document.getElementById("Invoice_Content");
  fillMemo();
  fillTax();
		  function fillMemo() {
			if(0 == memoObj.value.length) {
				memoObj.value = DEFAULT_MEMO_TEXT;
				memoObj.className = DEFAULT_MEMO_CLASS;
			}
			
		  }
		  function fillTax(){
		    if(taxObj !=null && 0 == taxObj.value.length) {
				taxObj.value = DEFAULT_TAX_TEXT;
				taxObj.className = DEFAULT_MEMO_CLASS;
			}
		  }
		  function clearTax(){
		     if(taxObj!=null && DEFAULT_TAX_TEXT == taxObj.value) {
				taxObj.value = '';
				taxObj.className = '';
			}
		  
		  }

		  function clearMemo() {
			if(DEFAULT_MEMO_TEXT == memoObj.value) {
				memoObj.value = '';
				memoObj.className = '';
			}
			
		  }

</script> 

</form>
</body>  
</html>
 
