590 lines
24 KiB
HTML
590 lines
24 KiB
HTML
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
|
|
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
|
|
<title>确认兑换</title>
|
|
<link rel="stylesheet" type="text/css" href="/css/api.css" />
|
|
<link rel="stylesheet" type="text/css" href="/css/content.css" />
|
|
<script type="text/javascript" src="/scripts/jquery-2.0.2.min.js"></script>
|
|
<script type="text/javascript" src="/scripts/jquery.cookie.min.js"></script>
|
|
<!--<script type="text/javascript" src="/scripts/iscroll.js"></script>-->
|
|
<script type="text/javascript" src="/script/main.js?t=0"></script>
|
|
<script type="text/javascript" src="/layer/layer.js"></script>
|
|
<script type="text/javascript" src="/Scripts/long.js"></script>
|
|
<script type="text/javascript" src="/Script/area.js"></script>
|
|
<script type="text/javascript" src="/script/moment.js"></script>
|
|
<script type="text/javascript" src="/Scripts/TouchSlide.1.1.js"></script>
|
|
<script type="text/javascript" src="/script/api.js"></script>
|
|
<style type="text/css">
|
|
html, body {
|
|
overflow: hidden;
|
|
}
|
|
|
|
#wrapper {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
|
|
.pullDown {
|
|
position: absolute;
|
|
top: -1.25rem;
|
|
left: 0;
|
|
width: 100%;
|
|
z-index: 100;
|
|
text-align: center;
|
|
display: none;
|
|
}
|
|
|
|
.pullUp {
|
|
position: absolute;
|
|
bottom: -1.25rem;
|
|
left: 0;
|
|
width: 100%;
|
|
z-index: 100;
|
|
text-align: center;
|
|
display: none;
|
|
}
|
|
|
|
.pullDown.loading, .pullUp.loading, .pullDown.refresh, .pullUp.refresh {
|
|
display: block;
|
|
}
|
|
|
|
|
|
|
|
.address_box_qhr input::placeholder {
|
|
color: #9f9f9f;
|
|
}
|
|
.layer {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 100;
|
|
background: rgba(0, 0, 0, .5);
|
|
display: none;
|
|
}
|
|
|
|
.layer img {
|
|
width: auto;
|
|
max-width: 20em;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
}
|
|
|
|
</style>
|
|
<script type="text/javascript">
|
|
var userId = null;
|
|
var LoginId = null;
|
|
var CartId = null;
|
|
var ZSubTotal = 0, ZSubTotal2 = 0;
|
|
var yunfeis = null;
|
|
var sInterval0 = null;
|
|
var xjjye = 0, xfjfye = 0, xfbye = 0, jfye = 0, yunfei = 0, usdtjg = 0, jzjfbfb = 0, selztaddressId=0;
|
|
var ResultId = -1;
|
|
var peitype = 0, paytype = 0, agentid = 0, addressId = 0, ttype = 0, ttype0 = 0;
|
|
var zdaddress = "";
|
|
var pullDown = 1; // 下拉刷新避免多次执行
|
|
var pullUp = 1; // 上拉加载避免多次执行
|
|
var downHeight = 0;
|
|
var upHeight = 0;
|
|
var isload = true;//设置是否终止滚动加载
|
|
var curScrollHeight = 0;//当前滚动位置
|
|
var curCount = 1;//计数器,防止滚动时重复执行加载下一页
|
|
$(document).ready(function () {
|
|
userId = getlocalStorage("userId");
|
|
LoginId = getlocalStorage("LoginId");
|
|
CartId = getlocalStorage("CartId");
|
|
opentimes = setInterval(function () {
|
|
var selectaddress = getlocalStorage("shop_qygm_selectaddress")
|
|
if (selectaddress != null) {
|
|
var aaddress = selectaddress.split(",");
|
|
showAdr(aaddress[0], aaddress[1], aaddress[2], aaddress[3], aaddress[4], aaddress[5], aaddress[6]);
|
|
clearlocalStorage("shop_qygm_selectaddress");
|
|
}
|
|
selectaddress = getlocalStorage("zt_selectaddress0")
|
|
if (selectaddress != null) {
|
|
var aaddress = selectaddress.split(",");
|
|
showAdr0(aaddress[0], aaddress[1], aaddress[2], aaddress[3]);
|
|
clearlocalStorage("zt_selectaddress0");
|
|
}
|
|
}, 1000);
|
|
var userinfo = getlocalStorage("userinfo");
|
|
var userdata = JSON.parse(userinfo);
|
|
|
|
if (userdata.aliimage0 != "") {
|
|
$("#alipayimage").html("<img src='" + userdata.aliimage0 + "' onclick='onviewimage(0)'/>");
|
|
} else {
|
|
$("#alipayimage").html("暂无");
|
|
}
|
|
if (userdata.weixinimage0 != "") {
|
|
$("#weixinimage").html("<img src='" + userdata.weixinimage0 + "' onclick='onviewimage(1)'/>");
|
|
} else {
|
|
$("#weixinimage").html("暂无");
|
|
}
|
|
rdata(1);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
function onScroll0() {
|
|
isload = true;//设置是否终止滚动加载
|
|
curScrollHeight = 0;//当前滚动位置
|
|
curCount = 1;//计数器,防止滚动时重复执行加载下一页
|
|
$("#wrapper").scroll(function () {
|
|
var pageHeight = $("#sysnew").height();
|
|
var showHeight = $("#wrapper").height();
|
|
var scrollHeight = $("#wrapper").scrollTop();
|
|
|
|
if (curScrollHeight - scrollHeight < 10 && curScrollHeight > 0) {
|
|
if (curCount == 1 && isload) {
|
|
|
|
rdata(0);
|
|
}
|
|
curCount++; //加载下一页后计数器+1
|
|
}
|
|
if (curScrollHeight < scrollHeight) {
|
|
curScrollHeight = pageHeight - showHeight;//滚动到页面底部时,重设当前滚动位置
|
|
curCount = 1;
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function rdata(ag) {
|
|
|
|
$(".ajaxLoader").removeClass("uhide");
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: "/apiajax.ashx",
|
|
data: "&action=getshopcart2&ifweb=1&CartId=" + CartId + "&userId=" + (userId != null ? userId : "") + "&LoginId=" + (LoginId != null ? LoginId : ""),
|
|
dataType: "JSON",
|
|
error: function (xhr, type) {
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|
},
|
|
success: function (data) {
|
|
|
|
if (data.status == 1) {
|
|
var html = "";
|
|
ttype = data.ttype;
|
|
ttype0 = data.ttype0;
|
|
if (data.productlist.length > 0) {
|
|
html += "<div class=\"ub ub-ac productlist\"><ul class=\"ub ub-ac ub-ver\">";
|
|
var list = data.productlist;
|
|
|
|
for (j = 0; j < list.length; j++) {
|
|
|
|
html += "<li id=\"cartbox" + j + "\" color=\"" + list[j].selcolor + "\">";
|
|
html += "<span class=\"limg\"><img onclick=\"ondetail(" + list[j].prodid + ")\" src=\"" + list[j].prodimg + "\" /></span>";
|
|
html += "<span class=\"rname\"><span class=\"prodName\" onclick=\"ondetail(" + list[j].prodid + ")\">" + list[j].prodName + list[j].selcolor + "</span>";
|
|
html += "<span class=\"je ulev-4\">流量积分:<em id=\"Price" + j + "\">" + list[j].prodPrice + (ttype == 0 ? "" : "") + "</em> 数量:<em>" + list[j].prodNum + "</em></span>";
|
|
html += "<span class=\"tnum ulev-4\">小计:";
|
|
html += "<em id='SubTotal" + j + "'>" + list[j].SubTotal + "</em></span>";
|
|
html += "</span></li>";
|
|
}
|
|
html += "</ul></div>";
|
|
if (ttype == 1) {
|
|
//$("#jzjf-2wm").addClass("uhide");
|
|
$("#peitype_box").addClass("uhide");
|
|
} else {
|
|
//$("#jzjf-2wm").removeClass("uhide");
|
|
$("#peitype_box").removeClass("uhide");
|
|
if (data.address.length > 0) {
|
|
var detail = getname(data.address[0].Province, data.address[0].City, data.address[0].County) + data.address[0].detail;
|
|
showAdr(data.address[0].id, data.address[0].Province, data.address[0].City, data.address[0].County, data.address[0].contact, data.address[0].tel, detail);
|
|
}
|
|
/*if (data.addresss.length > 0) {
|
|
$("#contact1").html(data.addresss[0].contact);
|
|
$("#tel1").html(data.addresss[0].tel);
|
|
$("#address1").html(data.addresss[0].address);
|
|
}*/
|
|
zdaddress = JSON.stringify(data.addresss);
|
|
}
|
|
} else {
|
|
html += "<div class=\"ub ub-ac ub-pc ub-ver\" onclick='appcan.window.open(\"shop\", \"../shop.html\", 10)' >"
|
|
+ "<img src=\"../image/noon.png\" style=\"margin-top:10em\"/>"
|
|
+ "<div class=\"ub\" style=\"color:red;margin-top:0.8em\">"
|
|
+ "您的购物车中还没有商品哦,马上去选购吧!"
|
|
+ "</div>"
|
|
+ "</div>";
|
|
$("footer").css("display", "none;");
|
|
}
|
|
|
|
$(".floor-product").html(html);
|
|
|
|
html = "";
|
|
$("#paytype0").css("display", "none");
|
|
$("#paytype1").css("display", "none");
|
|
$("#paytype2").css("display", "none");
|
|
$("#paytype3").css("display", "none");
|
|
$("#paytype5").css("display", "none");
|
|
if (ttype == 2) {
|
|
$("#paytype1").css("display", "block");
|
|
paytype = 1;
|
|
$("#cart_Total_title").html("总价:");
|
|
$("#save").val("确认购买");
|
|
}
|
|
else if (ttype == 1) {
|
|
$("#paytype5").css("display", "block");
|
|
paytype = 5;
|
|
$("#cart_Total_title").html("流量积分:");
|
|
$("#save").val("确认兑换");
|
|
} else {
|
|
$("#paytype0").css("display", "block");
|
|
$("#paytype2").css("display", "block");
|
|
$("#paytype3").css("display", "block");
|
|
paytype = 0;
|
|
$("#cart_Total_title").html("总价(包含运费):");
|
|
$("#save").val("确认购买");
|
|
}
|
|
|
|
xjjye = data.xjjye;
|
|
xfjfye = data.xfjfye;
|
|
ZSubTotal = data.ZSubTotal;
|
|
ZSubTotal2 = data.ZSubTotal2;
|
|
yunfeis = data.yunfeis;
|
|
yunfei = data.yunfei;
|
|
onpaytype(paytype);
|
|
gettxtje();
|
|
|
|
|
|
$(".ajaxLoader").addClass("uhide");
|
|
} else {
|
|
|
|
tishi3(data.msg);
|
|
$(".ajaxLoader").addClass("uhide");
|
|
if (data.msg == "您未登录") {
|
|
clearlocalStorage("userId");
|
|
clearlocalStorage("LoginId");
|
|
onlink("/");
|
|
}
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
function onpeitype(id) {
|
|
$("#peitypebox div#peitype" + + (id == 1 ? 0 : 1)).removeClass("hover");
|
|
$("#openAddress" + (id == 1 ? 0 : 1)).addClass("uhide");
|
|
$("#peitypebox div#peitype" + id).addClass("hover");
|
|
$("#openAddress" + id).removeClass("uhide");
|
|
peitype = id;
|
|
gettxtje();
|
|
}
|
|
function onpaytype(id) {
|
|
paytype = id;
|
|
var apaytype = $("#paytypebox .paytype_li.hover");
|
|
for (var i = 0; i < apaytype.length; i++) {
|
|
$(apaytype[i]).removeClass("hover");
|
|
}
|
|
$("#paytypebox .paytype_li#paytype" + id).addClass("hover");
|
|
|
|
gettxtje();
|
|
}
|
|
function onzmjf() {
|
|
if ($("#zmjftype .current.on").length > 0) {
|
|
$("#zmjftype .current").removeClass('on');
|
|
} else {
|
|
$("#zmjftype .current").addClass('on');
|
|
}
|
|
gettxtje();
|
|
}
|
|
function gettxtje() {
|
|
|
|
var ZZSubTotal = parseFloat(ZSubTotal) + parseFloat(ZSubTotal2);
|
|
|
|
if ((peitype == 0)) {
|
|
$("#xj_count").html(ZSubTotal);
|
|
$("#jf_count").html(parseFloat(parseFloat(ZSubTotal2).toFixed(2)));
|
|
if (peitype == 0) {
|
|
$("#xj_count").html((parseFloat(ZSubTotal) + parseFloat(yunfei)).toFixed(2));
|
|
ZZSubTotal = (ZZSubTotal + parseFloat(yunfei));
|
|
}
|
|
$("#cart_Total").html(changeTwoDecimal_f(ZZSubTotal) + "");
|
|
} else {
|
|
$("#cart_Total").html(changeTwoDecimal_f(ZZSubTotal) + "");
|
|
}
|
|
|
|
}
|
|
function openAddress() {
|
|
setlocalStorage("qygm", 1);
|
|
onlink("myaddress.html");
|
|
|
|
}
|
|
function openztaddress() {
|
|
if (zdaddress != "") {
|
|
setlocalStorage("ztaddress", zdaddress);
|
|
setlocalStorage("ztaddress_type", 0);
|
|
layer.open({
|
|
type: 2,
|
|
title: false,
|
|
closeBtn: false,
|
|
content: "ztaddress.html",
|
|
area: ['100%', '100%']
|
|
|
|
});
|
|
}
|
|
}
|
|
function onshowzfzh(t) {
|
|
if (t == 0) {
|
|
$api.css($api.dom("#zfzh"), "display:block");
|
|
} else {
|
|
$api.css($api.dom("#zfzh"), "display:none");
|
|
}
|
|
}
|
|
function showAdr(Id, province, city, county, contact, tel, detail) {
|
|
addressId = Id;
|
|
$("#contact").html(contact);
|
|
$("#tel").html(tel);
|
|
$("#address").html(detail);
|
|
$("#hidprovince").val(province);
|
|
$("#hidcity").val(city);
|
|
$("#hidcounty").val(county);
|
|
if (yunfeis != null) {
|
|
if (yunfeis.length > 0) {
|
|
for (var j = 0; j < yunfeis.length; j++) {
|
|
if (province == yunfeis[j].ProvinceID) {
|
|
yunfei = yunfeis[j].yunfei;
|
|
gettxtje();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function showAdr0(Id, contact, tel, address) {
|
|
selztaddressId = Id;
|
|
$("#contact1").html(contact);
|
|
$("#tel1").html(tel);
|
|
$("#address1").html(address);
|
|
}
|
|
function showqygm() {
|
|
Shop_qygm();
|
|
}
|
|
function Shop_qygm() {
|
|
var name = "";
|
|
var tel = "";
|
|
|
|
var b = true;
|
|
|
|
if (b) {
|
|
if (paytype == 0 || paytype == 1 || paytype == 4 || paytype == 5) {
|
|
var _index = layer.prompt({ title: '请输入安全密码,并确定下单', formType: 1 }, function (pass) {
|
|
if (pass == "") {
|
|
tishi3("请输入您的安全密码");
|
|
return false;
|
|
}
|
|
layer.close(_index);
|
|
Shop_qygm0(pass);
|
|
|
|
})
|
|
} else {
|
|
Shop_qygm0("");
|
|
}
|
|
}
|
|
|
|
}
|
|
function Shop_qygm0(pwd) {
|
|
var name = "";
|
|
var tel = "";
|
|
var Guests = "";
|
|
var b = true;
|
|
|
|
if (b) {
|
|
|
|
if ($(".ajaxLoader.uhide").length > 0) {
|
|
|
|
$(".ajaxLoader").removeClass("uhide");
|
|
$("#save").attr("disabled", true);
|
|
$("#save").val("请稍候...");
|
|
var datas = {
|
|
"ifweb": 1,
|
|
"userId": userId,
|
|
"LoginId": LoginId,
|
|
"CartId": CartId,
|
|
"pwd": pwd,
|
|
"peitype": peitype,
|
|
"zftype": paytype,
|
|
"addressId": addressId,
|
|
"Guests": Guests,
|
|
"ztaddressId": selztaddressId,
|
|
"name": name,
|
|
"tel": tel
|
|
}
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx?action=qygm&ifweb=1",
|
|
data: datas,
|
|
dataType: "json",
|
|
error: function (xhr) {
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|
},
|
|
success: function (data) {
|
|
|
|
|
|
if (data.status == 1) {
|
|
|
|
ResultId = data.ResultId;
|
|
if (paytype == 2) {
|
|
tishi3(data.msg);
|
|
rdata(1);
|
|
setlocalStorage("shop_view_refresh", 1);
|
|
var closeInterval = setInterval(function () {
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
|
|
clearInterval(closeInterval);
|
|
}, 500);
|
|
|
|
location.replace("pay.html?t=1&PayID=" + ResultId);
|
|
|
|
} else if (paytype == 3) {
|
|
//tishi3(data.msg);
|
|
rdata(1);
|
|
setlocalStorage("shop_view_refresh", 1);
|
|
var closeInterval = setInterval(function () {
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
clearInterval(closeInterval);
|
|
}, 500);
|
|
location.replace("pay.html?t=0&PayID=" + ResultId);
|
|
|
|
|
|
} else {
|
|
tishi3(data.msg);
|
|
layer.closeAll();
|
|
if (paytype == 4 && data.msg == "正在跳转支付中...") {
|
|
rdata(1);
|
|
setlocalStorage("shop_view_refresh", 1);
|
|
var closeInterval = setInterval(function () {
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
clearInterval(closeInterval);
|
|
}, 500);
|
|
location.replace("pay.html?t=0&PayID=" + ResultId);
|
|
} else {
|
|
setlocalStorage("xjjye", data.xjjye);
|
|
setlocalStorage("cfxfye", data.cfxfye);
|
|
rdata(1);
|
|
setlocalStorage("shop_view_refresh", 1);
|
|
var closeInterval = setInterval(function () {
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
clearInterval(closeInterval);
|
|
}, 500);
|
|
if (ttype == 1) {
|
|
location.replace("dhggb.html?t=1");
|
|
}else {
|
|
onlink("myorders.html");
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
tishi3(data.msg);
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
function hideshowthjto() {
|
|
$("footer .rightbox").css("display", "block");
|
|
$(".showthjto").addClass("uhide");
|
|
}
|
|
function ondetail(id) {
|
|
onlink("shop_view.html?id=" + id);
|
|
}
|
|
function onviewimage(t) {
|
|
var _src = "";
|
|
if (t == 0) {
|
|
_src = $("#alipayimage img").attr("src");
|
|
} else if (t == 1) {
|
|
_src = $("#weixinimage img").attr("src");
|
|
} else if (t == 2) {
|
|
_src = $("#yedimage img").attr("src");
|
|
}
|
|
$(".layer img").attr("src", _src);
|
|
$(".layer").fadeIn();
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body class="wrap">
|
|
<header class="renwuheader">
|
|
<div class="ub">
|
|
<div class="nav-btn" id="nav-left" style=" margin:0; padding:0; padding-top:0.2em; min-width:3em" onclick="closeWin()">
|
|
|
|
<img src="../image/faifei.png" style="margin-left:0; margin-top:0em; height:1.2em;width:1.2em;" />
|
|
|
|
|
|
</div>
|
|
<h1 class="ub-f1">
|
|
确认兑换
|
|
</h1>
|
|
<div class="nav-btn blue" id="nav-right" style=" margin:0; padding:0; min-width:3em; ">
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<section class="ub-f1" id="wrapper">
|
|
<div id="wrapper_content">
|
|
<p class="pullDown">下拉刷新...</p>
|
|
<div class="clear"></div>
|
|
|
|
<div style="padding:0 0.8em;">
|
|
<div class="ub ub-ver floor-product">
|
|
|
|
</div>
|
|
</div>
|
|
<div class="clear"></div>
|
|
<div class="more_box"></div>
|
|
|
|
<div class="clear"></div>
|
|
<p class="pullUp">上拉加载...</p>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
<footer class="" style=" width:100%; padding:0;background-color:#fff;border:0;">
|
|
<div class="cartbox">
|
|
<div class="cartmbox">
|
|
<div class="leftbox">
|
|
<span id="cart_Total_title"></span>
|
|
<span class="cart_Total" id="cart_Total"></span>
|
|
</div>
|
|
<div class="rightbox">
|
|
<input id="save" type="button" onclick="showqygm();" value="确认购买" class="input_shopdh">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</footer>
|
|
<div class="ajaxLoader ub ub-ac uhide" onclick="reload()">
|
|
<div class="ub ub-ac ub-ver"><img src="image/load.gif" /><br>正在加载...</div>
|
|
</div>
|
|
<div class="layer" onclick='$(".layer").fadeOut();'>
|
|
<img src="/images/jt.png" alt="">
|
|
</div>
|
|
</body>
|
|
|
|
|
|
</html>
|