Files
g.hnyhua.cn/Mtxfw.shop/Sell/UserQRGM.aspx
2026-02-07 15:48:27 +08:00

431 lines
15 KiB
Plaintext

<%@ Page Title="" Language="C#" MasterPageFile="~/Telesa.Master" EnableViewStateMac="false"
AutoEventWireup="true" CodeBehind="UserQRGM.aspx.cs" Inherits="Mtxfw.shop.UserQRGM" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MyHead" runat="server">
<link href="/css/shop_cart.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var ifshow = 1;
var pid = '<%=pid %>';
var cid = '<%=cid %>';
var qid = '<%=qid %>';
$(document).ready(function () {
$('#select_p').change(function () {//获取城市
getCity();
});
$('#select_c').change(function () {//获取县区
getCounty();
});
$('#select_p').val(pid);
getCity();
var IFaddress = <%=IFaddress %>;
if(IFaddress==1){
addnewaddress();
}
var b=true;
var adds = $(".addresslist ul li .selectaddress");
for(var i=0; i<adds.length; i++){
if($(adds[i]).attr("checked")==true){
b=false;
}
}
if(b){
$(adds[0]).attr("checked",true);
}
})
function getCity() {
if ($('#select_p').val() != '-1') {
$.post("/Ajax.ashx", { action: 'GetCity', ProvinceID: $('#select_p').val(), cityIDs: cid }, function (data) {
if (data != 'false') {
$('#select_c').html(data);
getCounty();
}
});
}
}
function getCounty() {
if ($('#select_c').val() != '-1') {
$.post("/Ajax.ashx", { action: 'GetCounty', CityID: $('#select_c').val(), countyIDs: qid }, function (data) {
if (data != 'false')
$('#select_q').html(data);
});
}
}
function toaddress() {
if ($('#county').val() != 0) {
$("#Text_MailingAddress").val($("#select_p option:selected").text() + $("#select_c option:selected").text() + $("#select_q option:selected").text());
}
}
function changeTwoDecimal_f(x) {
var f_x = parseFloat(x);
if (isNaN(f_x)) {
alert('function:changeTwoDecimal->parameter error');
return false;
}
var f_x = Math.round(x * 100) / 100;
var s_x = f_x.toString();
var pos_decimal = s_x.indexOf('.');
if (pos_decimal < 0) {
pos_decimal = s_x.length;
s_x += '.';
}
while (s_x.length <= pos_decimal + 2) {
s_x += '0';
}
return s_x;
}
function IsNumber(what) {
var text1 = "1234567890";
for (i = 0; i <= what.length - 1; i++) {
char1 = what.charAt(i);
index = text1.indexOf(char1);
if (index == -1) {
return true;
}
}
return false;
}
function addnewaddress() {
if($("#addressid").val()!=""){
$("#addressid").val("");
$("#Text_Name").val("");
$("#Text_Phone").val("");
$("#Text_MailingAddress").val("");
$("#Text_PostalCode").val("");
$("#savebtn").val("添加新地址");
$(".address_table").show();
}else{
$(".address_table").show();
}
$(".selectaddress").removeAttr("checked");
}
function saveaddress()
{
if ($("#Text_Name").val() == "") {
alert('联系人不能为空');
$("#Text_Name").focus();
return false;
}
if ($("#Text_Phone").val() == "") {
alert('联系电话不能为空');
$("#Text_Phone").focus();
return false;
}
if ($("#select_p").val() == "-1") {
alert('所在省份必须选择');
$("#select_p").focus();
return false;
}
if ($("#select_c").val() == "-1") {
alert('所在城市必须选择');
$("#select_c").focus();
return false;
}
if ($("#Text_MailingAddress").val() == "") {
alert('邮寄地址不能为空');
$("#Text_MailingAddress").focus();
return false;
}
$.post("/Ajax.ashx", { action: 'saveaddress', name: escape($("#Text_Name").val()), phone: escape($("#Text_Phone").val()), province: escape($("#select_p").val()), city: escape($("#select_c").val()), county: escape($("#select_q").val()), address: escape($("#Text_MailingAddress").val()), postalcode: escape($("#Text_PostalCode").val()), addressid: escape($("#addressid").val()) }, function (data) {
if (data == 'true') {
alert('保存成功');
top.location = top.location.toString();
}else{
alert(data);
}
});
}
function deladdress(id)
{
$.post("/Ajax.ashx", { action: 'deladdress', addressid: escape(id) }, function (data) {
if (data == 'true') {
alert('删除成功');
top.location = top.location.toString();
}else{
alert(data);
}
});
}
function setaddress(id)
{
$.post("/Ajax.ashx", { action: 'setaddress', addressid: escape(id) }, function (data) {
if (data == 'true') {
alert('设置成功');
top.location = top.location.toString();
}else{
alert(data);
}
});
}
function editaddress(id,name,tel,province,city,county,address,zipcode){
$(".address_table").show();
$("#addressid").val(id);
$("#Text_Name").val(name);
$("#Text_Phone").val(tel);
$("#select_p").val(province);
$("#select_c").val(city);
$("#select_q").val(county);
$("#Text_MailingAddress").val(address);
$("#Text_PostalCode").val(zipcode);
$("#selectaddress" + id).attr("checked","true");
$("#savebtn").val("保存编辑");
}
function addjg(jg,id){
var jgTotal = $("#cart_Total").html();
var cejg = (parseFloat(jgTotal)-parseFloat(jg));
var cejg2 = (parseFloat(jgTotal)+parseFloat(jg));
if ($(id).attr("checked") == true) {
if(cejg>=0)
{
$(".cart_Total").html(changeTwoDecimal_f(cejg));
}else{
$(id).removeAttr("checked");
}
}else{
$(".cart_Total").html(changeTwoDecimal_f(cejg2));
}
}
function UserQRGM() {
var b=true;
var addressid=0;
var IFUseXFB=0,IFUseJF=0;
var sa = $("input.selectaddress");
if(sa.length>0){
var bb=true;
for(var i=0;i<sa.length;i++){
if ($(sa[i]).attr("checked") == true) {
addressid=$(sa[i]).val();
bb=false;
}
}
if(bb){
alert("请先选择配送地址");
$(sa[0]).focus();
b=false;
}
}else{
alert("请先添加配送地址");
$("#Text_MailingAddress").focus();
b=false;
}
if(b){
if($("#IFUseXFB").attr("checked")==true){
IFUseXFB=1;
if($("#txtXFB").val()==""){
alert("消费币不能为空");
$("#txtXFB").focus();
b=false;
}
if(parseFloat($("#txtXFB").val())>parseFloat($("#XFBYE").html())){
alert("您的消费币余额不足");
$("#txtXFB").focus();
b=false;
}
}
}
if(b){
if($("#IFUseJF").attr("checked")==true){
IFUseJF=1;
if($("#txtJF").val()==""){
alert("积分不能为空");
$("#txtJF").focus();
b=false;
}
if(parseFloat($("#txtJF").val())>parseFloat($("#JFYE").html())){
alert("您的积分余额不足");
$("#txtJF").focus();
b=false;
}
}
}
if(b){
if(parseFloat($("#cart_Total").html())<0.00){
alert("您的金额填写有误");
b=false;
}
}
if(b){
$.post("/Ajax.ashx", { action: "UserQRGM", addressid:escape(addressid), IFUseJF:escape(IFUseJF), UseJF:escape($("#txtJF").val()), OrdersIDs: escape($("#OrdersIDs").val()) }, function (data) {
if (data.indexOf("操作成功|") != -1) {
alert("操作成功");
location.replace(data.replace("操作成功|",""));
}else if (data.indexOf("支付成功|") != -1) {
alert("您已支付成功");
location.replace(data.replace("支付成功|",""));
}else if (data.indexOf("跳转支付|") != -1) {
location.replace(data.replace("跳转支付|",""));
}else{
alert(data);
}
});
}
}
function showxfb(){
if($("#IFUseXFB").attr("checked")==true){
$("#hidexfb").show();
}else{
$("#hidexfb").hide();
}
}
function showjf(){
if($("#IFUseJF").attr("checked")==true){
$("#hidejf").show();
}else{
$("#hidejf").hide();
}
}
function onXFB(){
if($("#txtXFB").val()!=""){
$("#cart_Total").html(parseFloat($("#hidTotal").val())-parseFloat($("#txtXFB").val()));
}
if($("#IFUseJF").attr("checked")==true){
if($("#txtJF").val()!=""){
$("#cart_Total").html(parseFloat($("#cart_Total").html())-parseFloat($("#txtJF").val()));
}
}
if(parseFloat($("#cart_Total").html())<0.00){
alert("消费币填写有误");
$("#txtXFB").focus();
}
}
function onJF(){
if($("#txtJF").val()!=""){
$("#cart_Total").html(parseFloat($("#hidTotal").val())-parseFloat($("#txtJF").val()));
}
if($("#IFUseXFB").attr("checked")==true){
if($("#txtXFB").val()!=""){
$("#cart_Total").html(parseFloat($("#cart_Total").html())-parseFloat($("#txtXFB").val()));
}
}
if(parseFloat($("#cart_Total").html())<0.00){
alert("积分填写有误");
$("#txtJF").focus();
}
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MyContent" runat="server">
<div class="contentWrapper">
<div id="container">
<div id="main">
<div id="Location"><div class="title">当前位置: <a href="/">首页</a> &gt; 确认购买信息</div></div>
<table style="BORDER-COLLAPSE: collapse" borderColor="#C0C0C0" height="30" cellSpacing="0"
cellPadding="0" width="100%" align="center" bgColor="#ffffff" border="0"><input name="checks" value="<%=Request.QueryString["CartID"] %>" type="hidden" />
<tr>
<td height="40" class="cart_table_title">配送地址</td>
</tr>
<tr>
<td align="left"><div class="addresslist"><!--h3>收货人信息&nbsp;&nbsp;<a href="javascript:void()" onclick="saveaddress" target="_self">保存收货人信息</a></h3--><ul><%=addresslist%></ul></div>
<table cellSpacing="0" class="address_table" style=" display:none;">
<tr>
<th>联&nbsp;系&nbsp;人</th>
<td><input id="Text_Name" name="Text_Name" value="<%=strName %>" type="text"/> <span id="span_Name">联系人不能为空</span>
</td>
</tr>
<tr>
<th>联系电话</th>
<td><input id="Text_Phone" name="Text_Phone" value="<%=strPhone %>" type="text"/> <span id="span_Phone">联系电话不能为空</span>
</td>
</tr>
<tr>
<th>所在城市</th>
<td>
<select name="select_p" id="select_p">
<option value="-1">--省--</option>
<%=GetProvince() %>
</select>
<select name="select_c" id="select_c">
<option value="-1">--市--</option>
</select>
<select name="select_q" id="select_q">
<option value="-1">--县区--</option>
</select> <span id="span_select">所在城市必须选择</span>
</td>
</tr>
<tr>
<th>邮寄地址</th>
<td><input id="Text_MailingAddress" name="Text_MailingAddress" value="<%=strMailingAddress %>" type="text"/> <span id="span_MailingAddress">邮寄地址不能为空,不用填写省,市,县</span></td>
</tr>
<tr>
<th>邮政编码</th>
<td><input id="Text_PostalCode" name="Text_PostalCode" value="<%=strPostalCode %>" type="text"/> <span id="span_PostalCode"></span></td>
</tr>
<tr>
<th></th>
<td><input type="button" id="savebtn" name="savebtn" onclick="saveaddress()" value="添加新地址"/>&nbsp;&nbsp;<input type="button" id="resetbtn" name="resetbtn" onclick="$('.address_table').hide();" value="取消"/><input type="hidden" id="addressid" value="" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="40" class="cart_table_title">优惠方式</td>
</tr>
<tr>
<td><div class="addresslist"><input type="checkbox" id="IFUseJF" name="IFUseJF" onclick="showjf()" />使用积分</div></td>
</tr>
<tr id="hidejf" style=" display:none;">
<td><div class="addresslist">积分:<input type="text" id="txtJF" name="txtJF" onblur="onJF()" />,积分余额为:<span class="red" id="JFYE"><%=JFYE %></span></div></td>
</tr>
<tr class="cart_table_title">
<td>订单信息</td>
</tr>
<tr>
<td align="left">
<input type="hidden" id="OrdersIDs" name="OrdersIDs" value="<%=OrdersID %>" />
<input type="hidden" id="hidTotal" name="hidTotal" value="<%=hidTotal %>" />
<table cellSpacing="0" class="cart_table" align="center">
<TR bgColor="#E2F2FF">
<TD align="center">商品名称</TD>
<TD align="center" class="hide300">商品<%=!String.IsNullOrEmpty(Request.QueryString["id"]) ? "运费" : "单价"%></TD>
<TD align="center">商品数量</TD>
<TD align="center">商品小计</TD>
</TR>
<%=ShowConent%>
</TABLE>
</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript" src="/Scripts/shop_global_site_top.js" charset="utf-8"></script>
<script type="text/javascript">
$("#ap_category").hide();
if (isIndex == 1) {
initProvince();
}
</script>
</div>
</asp:Content>