<%@ page language="C#" autoeventwireup="true" inherits="Web_ShopBuy, WebApp_deploy" title="购买订单" viewstateencryptionmode="Never" enableviewstatemac="false" enableeventvalidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="Html1" runat="server" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>立即购买商品</title>
    <link href="Skin/TopStyle/Basic.css" rel="stylesheet" type="text/css" />
    <%--   <link href="Skin/Default/Product/ShopBuy.css" rel="stylesheet" type="text/css" />--%>
    <link href="Skin/ProductClassStyle/Style.css" rel="stylesheet" type="text/css" />
    <script src="Skin/CommStyle/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <style type="text/css">
        .font12
        {
            font-size: 12px;
        }
        .Gray
        {
            font-size: 12px;
        }
    </style>
</head>
<body>
    <form id="aspnetForm" runat="server">
    <hl:Top ID="Top1" runat="server" />
    <script type="text/javascript" src="/Js/Howave_ShopBuyProduct.js"></script>
    <script type="text/javascript" src="/Js/Function.js"></script>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div class="wp">
        <div class="item-publish">
            <div class="goods-attribute">
                <dl class="tit">
                    <h3>
                        交易明细及交易条件</h3>
                </dl>
                <dl>
                    <dt>商品名称：</dt>
                    <dd>
                        <asp:HyperLink ID="ProductName" runat="server" Target="_blank" />
                    </dd>
                </dl>
                <dl>
                    <dt>当前价格：</dt>
                    <dd>
                        ￥<asp:Literal ID="ProductPrice" runat="server" />
                    </dd>
                </dl>
                <%--  <dl>
                    <dt>所 在 地：</dt>
                    <dd>
                        <asp:Literal ID="ProductPlace" runat="server" />
                    </dd>
                </dl>--%>
                <dl>
                    <dt>商品图片：</dt><dd>
                        <script language="javascript">                            function MyResizeImage(obj) { return ResizeImage(obj, 120, 120); }</script>
                        <asp:Image ID="ProductImage" runat="server" Width="100" Height="100" onerror="this.onerror=null;this.src='Skin/CommStyle/images/noneimg.jpg'" /></dd></dl>
                <asp:HiddenField ID="HiddenField1" runat="server" />
                <dl class="tit">
                    <h3>
                        确认交易价格</h3>
                </dl>
                <dl>
                    <asp:PlaceHolder ID="TeamBuyPanel" runat="server" Visible="false">
                        <dt>团购选择：</dt>
                        <dd>
                            <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>
                        </dd>
                    </asp:PlaceHolder>
                    <asp:PlaceHolder ID="ShowAuction" runat="server" Visible="false">
                        <dt>出价金额：</dt>
                        <dd>
                            <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" />元，则系统会启动代理出价功能。一旦有人出价，系统会帮您逐渐增加出价金额，直到您输入的金额为止。
                        </dd>
                    </asp:PlaceHolder>
                    <asp:PlaceHolder ID="ShowPrice" runat="server" Visible="false">
                        <dt>一口价：</dt>
                        <dd>
                            <asp:TextBox ID="TxtStardPrice" runat="server" Enabled="false" Width="50px" CausesValidation="True" />元
                        </dd>
                    </asp:PlaceHolder>
                    <asp:PlaceHolder ID="ShowPromote" runat="server" Visible="false">
                        <dt>秒杀价：</dt>
                        <dd>
                            <asp:TextBox ID="TextBox_Promote" runat="server" Enabled="false" Width="50px" CausesValidation="True" />元
                        </dd>
                    </asp:PlaceHolder>
                    <asp:PlaceHolder ID="ShowNeedPresentExp" runat="server" Visible="false">
                        <dt>换购积分：</dt>
                        <dd>
                            <asp:Label ID="lblNeedPresentExp" runat="server" />分
                        </dd>
                    </asp:PlaceHolder>
                </dl>
                <dl class="tit">
                    <h3>
                        确认购买数量</h3>
                </dl>
                <dl>
                    <dt>购买数量：</dt>
                    <dd>
                        <asp:TextBox ID="Amount" onblur="WriteBuyNumber(this)" 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" />--%>
                    </dd>
                </dl>
                <dl id="configmpay">
                    <dt>支持的支付方式</dt>
                    <dd>
                        <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>
                                        <asp:Panel ID="TRMallPay" runat="server" Visible="false">
                                            <td>
                                                <input name="cbPayType" onclick="setSelectPayTypeCheck(this.value)" type="radio"
                                                    value="0" checked="checked" />商城帐户支付
                                            </td>
                                            <td>
                                                商场帐户
                                            </td>
                                            <td>
                                                &nbsp;
                                            </td>
                                        </asp:Panel>
                                    </tr>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <input onclick="setSelectPayTypeCheck(this.value)" value="<%#Eval("TypeID") %>" name="cbPayType"
                                            type="radio" /><%#Eval("TypeName") %>
                                    </td>
                                    <td>
                                        <%#HoWave.Web.Shop.TextFormat.GetPayType(Eval("PayType").ToString())%>
                                    </td>
                                    <td>
                                        <%#Eval("Intro") %>
                                    </td>
                                </tr>
                            </ItemTemplate>
                            <FooterTemplate>
                                </table></FooterTemplate>
                        </asp:Repeater>
                        <asp:HiddenField ID="hfSelectPayType" runat="Server" Value="0" />
                    </dd>
                </dl>
                <dl class="tit">
                    <h3>
                        配送方式</h3>
                </dl>
                <dl>
                    <dt>运费负担：</dt>
                    <dd>
                        <asp:Literal ID="DroDeliverPayType" runat="server" />
                        <asp:HiddenField ID="hfdeliverPayType" runat="server" />
                    </dd>
                </dl>
                <dl id="confirDeliver" runat="server">
                    <dt>确认配送方式</dt>
                    <dd>
                        <asp:UpdatePanel ID="upDeliverFashion" runat="server">
                            <ContentTemplate>
                                <asp:RadioButtonList ID="rblDeliverFashion" runat="server" AutoPostBack="true" RepeatDirection="Horizontal"
                                    CellSpacing="5" OnSelectedIndexChanged="rblDeliverFashion_SelectedIndexChanged">
                                </asp:RadioButtonList>
                                <asp:RadioButtonList ID="deliverType" runat="server" Enabled="false" />
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="rblDeliverFashion" EventName="SelectedIndexChanged" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </dd>
                </dl>
                <div id="ContactAddress" class="trade">
                    <dl class="tit">
                        <h3>
                            确认收货地址</h3>
                    </dl>
                    <div id="manage_address_tr" runat="server">
                        <dl id="add_new_address">
                            <dt>选择收货地址：</dt>
                            <dd>
                                <asp:UpdatePanel ID="upAddNewAddresss" runat="server">
                                    <ContentTemplate>
                                        <asp:ImageButton ID="imgbtnNewAddAddress" runat="server" ImageUrl="~/Images/new_address.gif"
                                            OnClick="imgbtnNewAddAddress_Click" />
                                        <%--<img src="Images/new_address.gif" onclick="show_new_address()" style="cursor: pointer;" />&nbsp;&nbsp;<a
                                    href="../Member/Shop_ReceiveAddress.aspx" target="_blank">管理我的收货地址</a>--%>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </dd>
                        </dl>
                        <dl>
                            <dt>收货地址：</dt>
                            <dd>
                                <asp:UpdatePanel ID="upAddress" runat="server">
                                    <ContentTemplate>
                                        <asp:RadioButtonList ID="my_receive_address" runat="server" AutoPostBack="true" RepeatLayout="Flow"
                                            OnSelectedIndexChanged="my_receive_address_SelectedIndexChanged" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </dd>
                        </dl>
                    </div>
                    <asp:UpdatePanel ID="upAddressDiv" runat="server">
                        <ContentTemplate>
                            <div id="show_new_address" runat="server">
                                <dl>
                                    <table class="show_new_address">
                                        <tr>
                                            <th>
                                                <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" />
                                                (手机)
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="mobilePhone"
                                                    ErrorMessage="格式不对！" ValidationExpression="\d{11}"></asp:RegularExpressionValidator>
                                                <br />
                                                <asp:TextBox ID="homePhone" runat="server" MaxLength="20" />
                                                (固定电话) 区号-电话号码-分机号 若没分机号则留空<asp:RegularExpressionValidator ID="RegularExpressionValidator4"
                                                    runat="server" ErrorMessage="格式不对！" ControlToValidate="homePhone" ValidationExpression="^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$"></asp:RegularExpressionValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>
                                                <font color="red">*</font> 所在地：
                                            </th>
                                            <td>
                                                <asp:UpdatePanel ID="upProvinceCityArea" runat="server">
                                                    <ContentTemplate>
                                                        <asp:DropDownList ID="ddlProvince" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
                                                            OnSelectedIndexChanged="ddlProvince_SelectedIndexChanged">
                                                        </asp:DropDownList>
                                                        <asp:DropDownList ID="ddlCity" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
                                                            OnSelectedIndexChanged="ddlCity_SelectedIndexChanged">
                                                        </asp:DropDownList>
                                                        <asp:DropDownList ID="ddlArea" runat="server" AppendDataBoundItems="True">
                                                        </asp:DropDownList>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </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>
                                                <font color="red">*</font>Email地址：
                                            </th>
                                            <td>
                                                <asp:TextBox ID="Email" runat="server" Width="200px" MaxLength="50" />
                                                <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ErrorMessage="请填写Email地址"
                                                    ControlToValidate="Email" Display="Dynamic" />
                                                <asp:RegularExpressionValidator ID="revEmail" runat="server" ErrorMessage="Email地址格式不正确"
                                                    ControlToValidate="Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                    Display="Dynamic" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <th>
                                                <font color="red">*</font>邮编：
                                            </th>
                                            <td>
                                                <asp:TextBox ID="zipCode" runat="server" MaxLength="6" Width="80px" />
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="邮政编码不能为空"
                                                    ControlToValidate="zipCode" />
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="邮政编码格式不对"
                                                    ControlToValidate="zipCode" ValidationExpression="\d{6}" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2" style="text-align: center">
                                                <asp:Button ID="CmdNewAddress" runat="server" Text="添加" OnClientClick="return checkAddressPass()"
                                                    OnClick="CmdNewAddress_Click" />
                                            </td>
                                        </tr>
                                    </table>
                                </dl>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <asp:PlaceHolder ID="Product_Need_Invoice" runat="server" Visible="false">
                        <dl class="tit">
                            <h3>
                                发票信息：</h3>
                        </dl>
                        <dl>
                            <dt>发票抬头：</dt><dd><asp:TextBox ID="txtInvoiceHead" Width="250px" runat="server" /></dd></dl>
                        <dl>
                            <dt>商品名称：</dt><dd>
                                <asp:TextBox ID="txtInvoiceName" Width="250px" runat="server" /></dd></dl>
                        <dl>
                            <dt>发票金额：</dt><dd><asp:TextBox ID="txtInvoiceMonery" Width="80px" runat="server"
                                Enabled="false" Text="0" /><span style="color: Red">注意：该金额仅仅是单件的发票金额，如果是多件就一直累加</span></dd></dl>
                        <dl>
                            <dt>是否需要发票：</dt><dd><asp:CheckBox Checked="true" ID="Invoice_Need" runat="server"
                                Text="是否需要发票,发票税率{0}%" /></dd></dl>
                        <dl style="display: none">
                            <dt>发票类型：</dt><dd><asp:RadioButtonList ID="RadioButtonList_InvoiceType" runat="server"
                                RepeatDirection="Horizontal" RepeatLayout="Flow">
                                <asp:ListItem Text="普通发票" Value="普通发票" Selected="True" />
                                <asp:ListItem Text="货凭证" Value="货凭证" />
                                <asp:ListItem Text="增值税专用发票" Value="增值税专用发票" />
                            </asp:RadioButtonList>
                            </dd>
                        </dl>
                    </asp:PlaceHolder>
                    <asp:Panel ID="Product_Need_Coupon" runat="server">
                        <dl class="tit">
                            <h3>
                                使用优惠券：</h3>
                        </dl>
                        <dl>
                            <dt>使用优惠券：</dt>
                            <dd>
                                <asp:DropDownList ID="ddlCoupon" runat="server">
                                </asp:DropDownList>
                            </dd>
                        </dl>
                    </asp:Panel>
                </div>
                <dl class="tit">
                    <h3>
                        说明</h3>
                </dl>
                <dl>
                    <dt>备注：</dt>
                    <dd>
                        <asp:TextBox ID="Remark" runat="server" TextMode="MultiLine" Height="70" Width="250"
                            CssClass="font12" onfocus="clearMemo();" onblur="fillMemo();" />
                    </dd>
                </dl>
                <dl>
                    <dt>交易服务条款：</dt>
                    <dd>
                        <asp:HiddenField ID="hfTotalMoney" runat="server" Value="" />
                        <%--订单总价--%>
                        <asp:TextBox ID="TradeProtocal" runat="server" TextMode="MultiLine" Width="754px"
                            CssClass="font12" ReadOnly="true" Height="101px" Text="点击确定，就意味着您同意了我们的购物条款。订单总额 = 商品价格 × 数量 × （１＋税率）% ＋ 运费。订单一但生成不允许修改。" />
                    </dd>
                </dl>
                <div class="clear">
                </div>
                <div class="issuance">
                    <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 ID="ImageButton1" ImageUrl="Images/ConfirmBuyButton2.gif" CommandName="now_pay"
                            OnCommand="ImageButton1_Click" OnClientClick="return checkSubmit()" runat="server"
                            CausesValidation="true" />
                    </div>
                </div>
            </div>
            <script type="text/javascript">
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++)
       // for(var j=1;j<=_teamNums;j++)
        {
//            if (j==choice) {
//                document.getElementById(_busID+j).disabled=false;
//            }else{
               document.getElementById(_busID+j).checked=true; 
               document.getElementById(_busID+j).disabled=true;
//            }
        }
  }
  else
  {
        for(var j=choice+1;j<=_teamNums;j++)
        //for(var j=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 setSelectPayTypeCheck(val){
    document.getElementById("<%=hfSelectPayType.ClientID %>").value=val;
}
 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 new_address_table=document.getElementById("show_new_address");//新的收货地址层  
      if(new_address_table.style.display!="none"){
      var Contacter_Name = $("#<%=ContacterName.ClientID %>");
            if (Contacter_Name.val().length != 0) {
                var Chinese = /^[\u4E00-\u9FA5]+$/;
                if (!Chinese.test(Contacter_Name.val())) {
                    Contacter_Name.focus();
                    alert('名字必须为中文！');
                    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 = '';
			}
			
		  }
		  
//		 function isChinese()
//{


//var Chinese = /^[\u4E00-\u9FA5]+$/;
//var name = document.getElementById("ContacterName").value;
//if(!Chinese.test(name))
//{
//   document.getElementById("ContacterName").value='';
//   alert('名字必须为中文！');
// }
//}
            </script>
        </div>
    </div>
    <asp:HiddenField ID="HiddenField2" runat="server" />
    <script type="text/javascript">
        //判断输入的商品数量
        function WriteBuyNumber(sen) {
            var shuLiang = $(sen);
            var quantityVal = shuLiang.val();
            if (quantityVal == null || quantityVal == "") {
                alert("请您输入购买的商品数量");
                shuLiang.focus();
                return;
            }
            if ((isNaN(quantityVal) == true)) {//判断输入的是否为数字
                alert("请您输入0~9之间的数字！");
                shuLiang.focus();
                return;
            }

            if (parseInt(quantityVal) < 1) {
                alert('您输入的商品数量不能小于0！');
                shuLiang.focus();
                return;
            }
            var allShuliang = $("#CanBuy").text(); //库存量
            if (parseInt(quantityVal) > parseInt(allShuliang)) {
                alert('您输入的商品数量不能超过当前库存的数量！');
                shuLiang.focus();
                shuLiang.attr("value", "1");
                return;
            }

            var showProType = "<%=ShowProType %>";
            if (showProType == "5") {
                //积分商品
                var needpresentExp = $("#lblNeedPresentExp").text(); //换购积分
                var currentExp = "<%=user.UserEP %>"; //当前积分
                var needpresentExpTotal = parseInt(needpresentExp) * parseInt(quantityVal); //所需积分
                var presentexp = parseInt(needpresentExpTotal) - parseInt(currentExp); //差值
                if (parseInt(needpresentExpTotal) > parseInt(currentExp)) {
                    alert("您的积分不足!您当前的积分为" + currentExp + "，所需积分是" + needpresentExpTotal + "，还差" + presentexp + "积分!");
                    return;
                }
            }
        }    
    </script>
    <script type="text/javascript">
        //姓名
        function checkContacter_Name() {
            var Contacter_Name = $("#<%=ContacterName.ClientID %>");
            if (Contacter_Name.val().length == 0) {
                alert("收货人姓名不能为空!");
                Contacter_Name.focus();
                return false;
            }

            var Chinese = /^[\u4E00-\u9FA5]+$/;
            if (!Chinese.test(Contacter_Name.val())) {
                Contacter_Name.focus();
                alert('名字必须为中文！');
                return false;
            }
            return true;
        }
        //联系电话
        function checkContacter_Phone() {
            var homePhone = $("#<%=homePhone.ClientID %>"); //电话
            var mobile = $("#<%=mobilePhone.ClientID %>"); //手机

            var word = /^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/; //电话号码格式
            var word1 = /\d{11}/; //手机号码格式/^1\d{10}$/;  

            if (mobile.val().length == 0 && homePhone.val().length == 0) {
                alert("电话号码和手机号码至少填写一个!");
                homePhone.focus();
                return false;
            } else {
                if (mobile.val().length != 0) {
                    if ((word1.test(mobile.val())) == false) {
                        alert('手机号码为数字或格式不对！');
                        mobile.focus();
                        return false;
                    }
                }
                if (homePhone.val().length != 0) {
                    if ((word.test(homePhone.val())) == false) {
                        alert('电话号码为数字或格式不对！');
                        homePhone.focus();
                        return false;
                    }
                }
            }
            return true;
        }

        function checkProvince() {
            //获取用户控件中的dropdownlist的选择值 
            var hpc_Province = document.getElementById('<%=ddlProvince.ClientID %>');
            var bojvalueProvince = "";
            for (i = 0; i < hpc_Province.options.length; i++) {
                if (hpc_Province.options[i].selected)
                    bojvalueProvince = hpc_Province.options[i].value;
            }
            if (bojvalueProvince.length == 0) {
                alert("请选择省份！");
                hpc_Province.focus();
                return false;
            }


            //获取用户控件中的dropdownlist的选择值
            var hpc_City = document.getElementById('<%=ddlCity.ClientID %>');
            if (hpc_City.options.length > 0) {
                var bojvalueCity = "";
                for (i = 0; i < hpc_City.options.length; i++) {
                    if (hpc_City.options[i].selected)
                        bojvalueCity = hpc_City.options[i].value;
                }
                if (bojvalueCity.length == 0) {
                    alert("请选择城市！");
                    hpc_City.focus();
                    return false;
                }

                //获取用户控件中的dropdownlist的选择值
                var hpc_ddlArea = document.getElementById('<%=ddlArea.ClientID %>');
                if (hpc_ddlArea.options.length > 0) {
                    var bojvalueArea = "";
                    if (hpc_ddlArea.options.length >= 2) {
                        if (hpc_ddlArea.options[1].value != "") {
                            for (i = 0; i < hpc_ddlArea.options.length; i++) {
                                if (hpc_ddlArea.options[i].selected) {
                                    bojvalueArea = hpc_ddlArea.options[i].value;
                                }
                            }
                            if (bojvalueArea.length == 0) {
                                alert("请选择县/区！");
                                hpc_ddlArea.focus();
                                return false;
                            }
                        }
                    }
                }
            }
            return true;
        }
        //详细地址
        function checkContacter_Address() {
            var Contacter_Address = $("#<%=Address.ClientID %>");
            if (Contacter_Address.val().length == 0) {
                alert("详细地址不能为空!");
                Contacter_Address.focus();
                return false;
            }
            return true;
        }
        //Email地址
        function checkContacter_Email() {
            var Contacter_Email = $("#<%=Email.ClientID %>");
            if (Contacter_Email.val().length == 0) {
                alert("Email不能为空!");
                Contacter_Email.focus();
                return false;
            }
            var word = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; //Email格式
            if ((word.test(Contacter_Email.val())) == false) {
                alert('Email格式不对！');
                Contacter_Email.focus();
                return false;
            }
            return true;
        }
        //邮政编码
        function checkContacter_ZipCode() {
            var Contacter_ZipCode = $("#<%=zipCode.ClientID %>");
            if (Contacter_ZipCode.val().length == 0) {
                alert('邮政编码不能为空！');
                Contacter_ZipCode.focus();
                return false;
            }
            if (Contacter_ZipCode.val().length != 0) {
                var word1 = /\d{6}/;
                if ((word1.test(Contacter_ZipCode.val())) == false) {
                    alert('邮政编码为数字或格式不对！');
                    Contacter_ZipCode.focus();
                    return false;
                }
            }
            return true;
        }

        function checkAddressPass() {
            if (checkContacter_Name() && checkContacter_Phone() && checkProvince() && checkContacter_Address() && checkContacter_Email() && checkContacter_ZipCode()) {
                return true;
            } else {
                return false;
            }
        }
    </script>
    <hl:Foot ID="Foot1" runat="server" />
    </form>
</body>
</html>
