1143 lines
56 KiB
HTML
1143 lines
56 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?t=0"></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>
|
|
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.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, opentimes = null;
|
|
var xjjye = 0, xfjfye = 0, xfbye = 0, jfye = 0, yunfei = 0, jyjg = 0, agentid = 0, agenttype=0, ifapp = 0, ifwxapp = 0;
|
|
var ResultId = -1, ischeckpayed = 0;
|
|
var peitype = 0, paytype = 2, agentid = 0, addressId = 0, ttype = 0;
|
|
var zdaddress = "", code = "", ztpids = "", openid="";
|
|
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");
|
|
var tcode = $.getUrlParam("code");
|
|
if (tcode != null) {
|
|
code = tcode;
|
|
}
|
|
var aifapp = getlocalStorage("ifapp");
|
|
if (aifapp != null) {
|
|
ifapp = aifapp;
|
|
}
|
|
if (ifapp == 0) {
|
|
var tcode = $.getUrlParam("code");
|
|
if (tcode != null) {
|
|
code = tcode;
|
|
} else {
|
|
openid = getlocalStorage("payopenid");
|
|
if (openid == null) {
|
|
$(".ajaxLoader").removeClass("uhide");
|
|
|
|
var url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appId_weixin +"&redirect_uri=" + encodeURI(apiurl + "/mobile/smpay") + "&response_type=code&scope=snsapi_base&#wechat_redirect";//snsapi_base默认授权snsapi_userinfo手动授权
|
|
top.location.href = url;
|
|
}
|
|
}
|
|
}
|
|
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], aaddress[7], aaddress[8]);
|
|
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");
|
|
}
|
|
var selectqydatas = getlocalStorage("address_selectqy_datas");
|
|
if (selectqydatas != null) {
|
|
var adatas = selectqydatas.split(",");
|
|
showaddress(adatas[0], adatas[1], adatas[2], adatas[3], adatas[4])
|
|
clearlocalStorage("address_selectqy_datas");
|
|
}
|
|
}, 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=" + (ifapp == 1 ? 0 : 1) + "&code=" + code + "&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;
|
|
jyjg = data.jyjg;
|
|
if (ifapp == 0) {
|
|
var ua = navigator.userAgent;
|
|
if (ua.indexOf("MicroMessenger") > 0) {
|
|
if (data.openid != "") {
|
|
openid = data.openid;
|
|
setlocalStorage("payopenid", openid);
|
|
}
|
|
wx.config({
|
|
debug: false, // 是否开启调试模式
|
|
appId: appId_weixin, // 公众号的唯一标识
|
|
timestamp: data.timestamp, // 生成签名的时间戳
|
|
nonceStr: data.nonceStr, // 生成签名的随机字符串
|
|
signature: data.signature, // 签名
|
|
jsApiList: ['chooseWXPay'] // 需要使用的JS接口列表
|
|
});
|
|
//alert(data.timestamp + "|" + data.nonceStr + "|" + data.signature)
|
|
}
|
|
}
|
|
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 == 15) {
|
|
$("#openarea").removeClass("uhide");
|
|
} else {
|
|
$("#openarea").addClass("uhide");
|
|
}
|
|
if (ttype == 1) {
|
|
//$("#jzjf-2wm").addClass("uhide");
|
|
$("#peitype_box").addClass("uhide");
|
|
} else {
|
|
//$("#jzjf-2wm").removeClass("uhide");
|
|
$("#peitype_box").removeClass("uhide");
|
|
|
|
if (data.peitype == 0) {
|
|
$("#peitype0").addClass("uhide");
|
|
|
|
} else {
|
|
$("#peitype0").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].IFFill, data.address[0].Tradingarea) + data.address[0].detail;
|
|
showAdr(data.address[0].id, data.address[0].Province, data.address[0].City, data.address[0].County, data.address[0].IFFill, data.address[0].Tradingarea, data.address[0].contact, data.address[0].tel, detail);
|
|
}
|
|
}
|
|
if (data.peitype0 == 0) {
|
|
$("#peitype1").addClass("uhide");
|
|
} else {
|
|
$("#peitype1").removeClass("uhide");
|
|
if (data.peitype == 0) {
|
|
onpeitype(1);
|
|
}
|
|
if (data.addresss.length > 0) {
|
|
var detail = getname(data.addresss[0].province, data.addresss[0].city, data.addresss[0].county, data.addresss[0].IFFill, data.addresss[0].Tradingarea) + data.addresss[0].address;
|
|
showAdr0(data.addresss[0].addressId, data.addresss[0].contact, data.addresss[0].tel, detail);
|
|
}
|
|
|
|
}
|
|
|
|
//zdaddress = JSON.stringify(data.addresss);
|
|
}
|
|
ztpids = data.ztpids;
|
|
} 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");
|
|
$("#paytype6").css("display", "none");
|
|
$("#paytype5").css("display", "none");
|
|
$("#paytype6").css("display", "none");
|
|
$("#paytype7").css("display", "none");
|
|
if (ttype == 2) {
|
|
$("#paytype0").css("display", "block");
|
|
$("#paytype2").css("display", "block");
|
|
$("#paytype3").css("display", "block");
|
|
$("#cart_Total_title").html("总价:");
|
|
$("#save").val("确认购买");
|
|
}
|
|
else if (ttype == 1) {
|
|
$("#paytype5").css("display", "block");
|
|
paytype = 5;
|
|
$("#cart_Total_title").html("总价:");
|
|
$("#save").val("确认兑换");
|
|
} else if (ttype == 5) {
|
|
$("#paytype0").css("display", "block");
|
|
$("#paytype2").css("display", "block");
|
|
$("#paytype3").css("display", "block");
|
|
|
|
paytype = 0;
|
|
$("#cart_Total_title").html("总价(包含运费):");
|
|
$("#save").val("确认购买");
|
|
} else if (ttype == 11) {
|
|
$("#paytype0").css("display", "block");
|
|
$("#paytype2").css("display", "none");
|
|
$("#paytype3").css("display", "none");
|
|
|
|
paytype = 2;
|
|
$("#cart_Total_title").html("总价(包含运费):");
|
|
$("#save").val("确认购买");
|
|
} else if (ttype == 12) {
|
|
$("#paytype0").css("display", "block");
|
|
$("#paytype2").css("display", "none");
|
|
$("#paytype3").css("display", "none");
|
|
|
|
paytype = 2;
|
|
$("#cart_Total_title").html("总价(包含运费):");
|
|
$("#save").val("确认购买");
|
|
} else {
|
|
$("#paytype0").css("display", "block");
|
|
if (ttype == 0 || ttype == 8) {
|
|
$("#paytype2").css("display", "block");
|
|
$("#paytype3").css("display", "block");
|
|
}
|
|
|
|
paytype = 2;
|
|
$("#cart_Total_title").html("总价(包含运费):");
|
|
$("#save").val("确认购买");
|
|
}
|
|
if (ttype == 12 || ttype == 14) {
|
|
$("#lcpay_box").removeClass("uhide");
|
|
} else {
|
|
$("#lcpay_box").addClass("uhide");
|
|
}
|
|
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);
|
|
|
|
if ((peitype == 0 && ttype != 1)) {
|
|
if (ttype == 12 || ttype == 14) {
|
|
$("#lcpay_box").removeClass("uhide");
|
|
$("#jf_count").html(parseFloat(ZSubTotal2).toFixed(2));
|
|
$("#xj_count").html((parseFloat(ZSubTotal) - parseFloat(ZSubTotal2) + parseFloat(yunfei)).toFixed(2));
|
|
}
|
|
ZZSubTotal = (ZZSubTotal + parseFloat(yunfei));
|
|
}
|
|
if (paytype == 7) {
|
|
$("#cart_Total").html("" + changeTwoDecimal_f(ZZSubTotal / parseFloat(jyjg)) + "");
|
|
} else {
|
|
$("#cart_Total").html("¥" + changeTwoDecimal_f(ZZSubTotal) + "");
|
|
}
|
|
}
|
|
function openAddress() {
|
|
setlocalStorage("qygm", 1);
|
|
onlink("myaddress.html");
|
|
|
|
}
|
|
function openztaddress() {
|
|
//if (zdaddress != "") {
|
|
//setlocalStorage("ztaddress", zdaddress);
|
|
setlocalStorage("ztpids", ztpids);
|
|
setlocalStorage("ztaddress_type", 0);
|
|
layer.open({
|
|
type: 2,
|
|
title: false,
|
|
closeBtn: false,
|
|
content: "ztaddress.html",
|
|
area: ['100%', '100%']
|
|
|
|
});
|
|
// }
|
|
}
|
|
function openarea() {
|
|
var showqy = $("#hidprovince0").val() + "," + $("#hidcity0").val() + "," + $("#hidcounty0").val() + "," + $("#hidIFFill0").val() + "," + $("#hidTradingarea0").val();
|
|
setlocalStorage("showqy", showqy);
|
|
layer.open({
|
|
type: 2,
|
|
title: false,
|
|
closeBtn: false,
|
|
content: "address_selectqy.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, IFFill, Tradingarea, contact, tel, detail) {
|
|
addressId = Id;
|
|
$("#contact").html(contact);
|
|
$("#tel").html(tel);
|
|
$("#address").html(detail);
|
|
$("#hidprovince").val(province);
|
|
$("#hidcity").val(city);
|
|
$("#hidcounty").val(county);
|
|
$("#hidIFFill").val(IFFill);
|
|
$("#hidTradingarea").val(Tradingarea);
|
|
/*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();
|
|
}
|
|
}
|
|
}
|
|
}*/
|
|
var datas = {
|
|
"userId": userId,
|
|
"LoginId": LoginId,
|
|
"province": province,
|
|
"city": city,
|
|
"county": "county"
|
|
}
|
|
if ($(".ajaxLoader.uhide").length > 0) {
|
|
$(".ajaxLoader").removeClass("uhide");
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx?action=getyunfei&ifweb=" + (ifapp == 1 ? "0" : "1"),
|
|
data: datas,
|
|
dataType: "json",
|
|
error: function (xhr) {
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|
},
|
|
success: function (data) {
|
|
$(".ajaxLoader").addClass("uhide");
|
|
if (data.status == 1) {
|
|
yunfei = data.yunfei;
|
|
gettxtje();
|
|
} else {
|
|
tishi3(data.msg);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
function showAdr0(Id, contact, tel, address) {
|
|
agentid = Id;
|
|
$("#contact1").html(contact);
|
|
$("#tel1").html(tel);
|
|
$("#address1").html(address);
|
|
}
|
|
function showaddress(Province, City, County, IFFill, Tradingarea) {
|
|
$('#hidprovince0').val(Province);
|
|
$('#hidcity0').val(City);
|
|
$('#hidcounty0').val(County);
|
|
$('#hidIFFill0').val(IFFill);
|
|
$('#hidTradingarea0').val(Tradingarea);
|
|
$('#area0').html(getname(Province, City, County, IFFill, Tradingarea));
|
|
}
|
|
function showqygm() {
|
|
Shop_qygm();
|
|
}
|
|
function Shop_qygm() {
|
|
var name = "";
|
|
var tel = "";
|
|
var Guests = fTrim($('#explain').val());
|
|
var b = true;
|
|
if (ttype != 1) {
|
|
if (peitype == 1) {
|
|
name = fTrim($("#txtname").val());
|
|
tel = fTrim($("#txttel").val());
|
|
if (name == "") {
|
|
tishi3('联系人不能为空');
|
|
$("#txtname").focus();
|
|
b = false;
|
|
}
|
|
if (b) {
|
|
if (tel == "") {
|
|
tishi3('联系电话不能为空');
|
|
$("#txttel").focus();
|
|
b = false;
|
|
}
|
|
}
|
|
if (agentid == 0) {
|
|
tishi3("自提地址未选择!");
|
|
b = false;
|
|
}
|
|
}
|
|
else {
|
|
if (addressId == 0) {
|
|
tishi3("收货地址未选择!");
|
|
b = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
if (b) {
|
|
if (paytype == 0 || paytype == 1 || paytype == 4 || paytype == 5 || paytype == 6 || paytype == 7) {
|
|
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 = fTrim($('#explain').val());
|
|
var province = "";
|
|
var city = "";
|
|
var county = "";
|
|
var IFFill = "";
|
|
var Tradingarea = "";
|
|
if (ttype == 15) {
|
|
province = fTrim($('#hidprovince0').val());
|
|
city = fTrim($('#hidcity0').val());
|
|
county = fTrim($('#hidcounty0').val());
|
|
IFFill = fTrim($('#hidIFFill0').val());
|
|
Tradingarea = fTrim($('#hidTradingarea0').val());
|
|
}
|
|
var b = true;
|
|
if (ttype != 1) {
|
|
if (peitype == 1) {
|
|
name = fTrim($("#txtname").val());
|
|
tel = fTrim($("#txttel").val());
|
|
if (name == "") {
|
|
tishi3('联系人不能为空');
|
|
$("#txtname").focus();
|
|
b = false;
|
|
}
|
|
if (b) {
|
|
if (tel == "") {
|
|
tishi3('联系电话不能为空');
|
|
$("#txttel").focus();
|
|
b = false;
|
|
}
|
|
}
|
|
if (agentid == 0) {
|
|
tishi3("自提地址未选择!");
|
|
b = false;
|
|
}
|
|
}
|
|
else {
|
|
if (addressId == 0) {
|
|
tishi3("收货地址未选择!");
|
|
b = false;
|
|
}
|
|
|
|
}
|
|
}
|
|
if (b) {
|
|
|
|
if ($(".ajaxLoader.uhide").length > 0) {
|
|
$(".ajaxLoader").removeClass("uhide");
|
|
$("#save").attr("disabled", true);
|
|
$("#save").val("请稍候...");
|
|
var datas = {
|
|
"userId": userId,
|
|
"LoginId": LoginId,
|
|
"CartId": CartId,
|
|
"ifwxapp": ifwxapp,
|
|
"openid": (openid != null ? openid : ""),
|
|
"pwd": pwd,
|
|
"peitype": peitype,
|
|
"zftype": paytype,
|
|
"addressId": addressId,
|
|
"Guests": Guests,
|
|
"agentid": agentid,
|
|
"agenttype": agenttype,
|
|
"province": province,
|
|
"city": city,
|
|
"county": county,
|
|
"IFFill": IFFill,
|
|
"Tradingarea": Tradingarea,
|
|
"name": name,
|
|
"tel": tel
|
|
}
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx?action=qygm&ifweb=" + (ifapp == 1 ? "0" : "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) {
|
|
if (ifapp == 1) {
|
|
|
|
if (data.ifapppay == 0) {
|
|
var wxPayPlus = api.require('wxPayPlus');
|
|
wxPayPlus.getOrderId({
|
|
info: data.reResult
|
|
}, function (ret, err) {
|
|
if (ret.return_code == "SUCCESS") {
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx?action=car_pay_sign&ifweb=0",
|
|
data: {
|
|
userId: userId,
|
|
LoginId: LoginId,
|
|
ResultId: data.ResultId,
|
|
prepayid: ret.prepay_id,
|
|
package: "Sign=WXPay",
|
|
noncestr: data.nonceStr
|
|
},
|
|
dataType: "json",
|
|
error: function (xhr) {
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|
},
|
|
success: function (data2) {
|
|
|
|
|
|
if (data2.status == 1) {
|
|
wxPayPlus.payOrder({
|
|
apiKey: appId_weixin,
|
|
orderId: ret.prepay_id,
|
|
mchId: data2.partnerid,
|
|
nonceStr: data2.noncestr,
|
|
timeStamp: data2.timestamp,
|
|
package: 'Sign=WXPay',
|
|
sign: data2.sign
|
|
}, function (ret2, err2) {
|
|
if (ret2.status) {
|
|
rdata(1);
|
|
setlocalStorage("shop_view_refresh", 1);
|
|
var closeInterval = setInterval(function () {
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
clearInterval(closeInterval);
|
|
}, 500);
|
|
|
|
location.replace("myorders.html?pay=1");
|
|
|
|
} else {
|
|
if (err2.code == "-2") {
|
|
tishi3("用户取消");
|
|
} else if (err2.code == "-1") {
|
|
tishi3("未知错误");
|
|
} else if (err2.code == "1") {
|
|
tishi3("apiKey值非法");
|
|
}
|
|
rdata(1);
|
|
setlocalStorage("shop_view_refresh", 1);
|
|
var closeInterval = setInterval(function () {
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
clearInterval(closeInterval);
|
|
}, 500);
|
|
//location.replace("myorders.html?pay=1");
|
|
}
|
|
});
|
|
} else {
|
|
rdata(1);
|
|
tishi3(data.msg);
|
|
}
|
|
}
|
|
});
|
|
|
|
} else {
|
|
rdata(1);
|
|
tishi3(ret.return_msg);
|
|
|
|
|
|
}
|
|
});
|
|
} else {
|
|
try{
|
|
var wxPlus = api.require('wxPlus');
|
|
wxPlus.launchMiniProgram({
|
|
miniProgramType: 'release',
|
|
userName: 'gh_91d725ecd390',
|
|
apiKey: 'wxfa62471e8a5c0de1',
|
|
path: 'pages/pay/index?id=' + ResultId,
|
|
}, function (ret, err) {
|
|
|
|
$(".ajaxLoader").addClass("uhide");
|
|
sInterval0 = setInterval(function () {
|
|
oniswxpayed();
|
|
}, 1000);
|
|
if (ret.status) {
|
|
|
|
} else {
|
|
|
|
|
|
}
|
|
});
|
|
}catch(err)
|
|
{
|
|
alert(err)
|
|
}
|
|
}
|
|
} else {
|
|
|
|
wx.chooseWXPay({
|
|
timestamp: data.timeStamp,
|
|
nonceStr: data.nonceStr,
|
|
package: data.reResult,
|
|
signType: data.signType,
|
|
paySign: data.paySign,
|
|
success(res) {
|
|
$(".ajaxLoader").addClass("uhide");
|
|
// 支付成功后的回调
|
|
location.replace("myorders.html?pay=1");
|
|
},
|
|
cancel: function (res) {
|
|
$(".ajaxLoader").addClass("uhide");
|
|
// 用户取消支付
|
|
location.replace("myorders.html?pay=1");
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
} else if ((paytype == 1 && data.msg == "支付中..." || data.msg == "正在跳转支付中...") || paytype == 3) {
|
|
if (data.ifapppay == 1) {
|
|
location.replace("pay.html?ResultId=" + ResultId + "&payurl=" + data.reResult);
|
|
} else {
|
|
|
|
|
|
if (ifapp == 1) {
|
|
|
|
var aliPayPlus = api.require('aliPayPlus');
|
|
aliPayPlus.payOrder({
|
|
orderInfo: data.reResult
|
|
}, function (ret, err) {
|
|
if (ret.code == 9000) {
|
|
rdata(1);
|
|
setlocalStorage("shop_view_refresh", 1);
|
|
var closeInterval = setInterval(function () {
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
clearInterval(closeInterval);
|
|
}, 500);
|
|
|
|
location.replace("myorders.html?pay=1");
|
|
|
|
} else if (ret.code == 8000) {
|
|
tishi3("正在处理中");
|
|
} else if (ret.code == 4000) {
|
|
tishi3("订单支付失败");
|
|
} else if (ret.code == 5000) {
|
|
tishi3("重复请求");
|
|
} else if (ret.code == 6001) {
|
|
tishi3("用户中途取消支付操作");
|
|
} else if (ret.code == 6002) {
|
|
tishi3("网络连接出错");
|
|
} else if (ret.code == 6003) {
|
|
tishi3("支付结果未知,请查询订单");
|
|
//location.replace("myorders.html?pay=1");
|
|
}
|
|
});
|
|
|
|
} else {
|
|
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&ResultId=" + ResultId + "&PayID=" + data.PayID);
|
|
}
|
|
}
|
|
} 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);
|
|
|
|
|
|
location.replace("myorders.html?pay=1");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
tishi3(data.msg);
|
|
$("#save").removeAttr("disabled");
|
|
$("#save").val("确认购买");
|
|
$(".ajaxLoader").addClass("uhide");
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
function oniswxpayed() {
|
|
if (ischeckpayed == 0) {
|
|
ischeckpayed = 1;
|
|
var datas = {
|
|
"ResultId": ResultId
|
|
}
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx?action=getIFPayed",
|
|
data: datas,
|
|
dataType: "json",
|
|
error: function (xhr) {
|
|
tishi3("发生错误:" + JSON.stringify(xhr));
|
|
},
|
|
success: function (data) {
|
|
ischeckpayed = 0;
|
|
if (data.status == 1) {
|
|
clearInterval(sInterval0);
|
|
if (data.msg == "用户已取消!") {
|
|
//closeWin();
|
|
location.replace("myorders.html?pay=1");
|
|
} else {
|
|
location.replace("myorders.html?pay=1");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
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>
|
|
<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 class="ub uhide" id="peitype_box" style="padding: 0.8em;box-sizing: border-box;">
|
|
<div class="ub ub-ver" style="width:100%; box-sizing: border-box;background-color:#fff;border-radius: 0.4em;border: solid 1px #dfdfdf;">
|
|
<div class="pay_box" id="peitypebox" style="padding: 0.8em;">
|
|
<span class="pay_type">配送方式:</span>
|
|
<div class='hover' id="peitype0" onclick="onpeitype(0)" data-id="0"><img src="../image/kdps.png" />快递配送</div>
|
|
<div id="peitype1" class="rtype" onclick="onpeitype(1)" data-id="1"><img src="../image/smzq.png" />上门自取</div>
|
|
</div>
|
|
|
|
<div class="ub" style="padding: 0.8em;margin-bottom: 0.02em;box-sizing: border-box;" id="openAddress0" onclick="openAddress()">
|
|
<div class="ub ub-ver ub-f1">
|
|
<div class="ub ub-hor" style="line-height: 2em;margin:0;">
|
|
<div class="ub ">
|
|
收货人:
|
|
|
|
</div>
|
|
<div class="ub" id="contact" style="color: #848484;"></div>
|
|
<div class="ub " id="tel" style="color: #848484;"></div>
|
|
<input type="hidden" id="hidprovince" value="" />
|
|
<input type="hidden" id="hidcity" value="" />
|
|
<input type="hidden" id="hidcounty" value="" />
|
|
<input type="hidden" id="hidIFFill" value="" />
|
|
<input type="hidden" id="hidTradingarea" value="" />
|
|
</div>
|
|
|
|
<div class="ub ulev-1" style="line-height: 1.4em;margin-top: .5em;padding: 0 1em;box-sizing: border-box;">
|
|
<img class="" src="../image/Pin-Assistor.png" style="width:1.2em" />
|
|
<div id="address" style="width:80%;margin: 0 1em;color: #848484;"></div>
|
|
<div class="ub ub-ac ub-pc" style="margin-right:1.4em; margin-top:0em; width: 1.2em; height:1.2em;"><img style="width: 1.2em;" src="../image/faifeito.png" /></div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="ub ub-ver uhide" style="padding: 0.8em; box-sizing: border-box;" id="openAddress1">
|
|
<div class="address_box_qhr">
|
|
<input type="text" id="txtname" placeholder="请填写取货人" />
|
|
<input type="text" class="txttel" id="txttel" placeholder="请填写手机号" />
|
|
</div>
|
|
<div class="ub ub-ver ub-f1">
|
|
<div class="ub ub-hor" style="color:#000;line-height: 2em;margin:0;">
|
|
<div class="ub ">
|
|
自提地址:
|
|
|
|
</div>
|
|
<div class="ub" id="contact1" style="color: #848484;"></div>
|
|
<div class="ub " id="tel1" style="color: #848484;"></div>
|
|
</div>
|
|
|
|
<div class="ub ulev-1" style="line-height: 1.4em;margin-top: .5em;padding:0;box-sizing: border-box;" onclick="openztaddress()">
|
|
<div class="assistor">
|
|
<img class="" src="../image/Pin-Assistor.png" />
|
|
<span id="distance1"></span>
|
|
</div>
|
|
<div id="address1" class="ub ub-f1 address1"></div>
|
|
<div class="ub ub-ac ub-pc" style="margin-right:1.4em; margin-top:0em; width: 1.2em; height:1.2em;"><img style="width: 1.2em;" src="../image/faifeito.png" /></div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="ub uhide" style="padding: 0.8em; margin-bottom: 0.02em; box-sizing: border-box; border-top: solid 1px #f1f1f1;" id="openarea" onclick="openarea()">
|
|
<div class="ub ub-ver ub-f1">
|
|
<div class="ub ub-hor" style="line-height: 2em;margin:0;">
|
|
<div class="ub ">
|
|
选择服务商区域:
|
|
|
|
</div>
|
|
<input type="hidden" id="hidprovince0" value="" />
|
|
<input type="hidden" id="hidcity0" value="" />
|
|
<input type="hidden" id="hidcounty0" value="" />
|
|
<input type="hidden" id="hidIFFill0" value="" />
|
|
<input type="hidden" id="hidTradingarea0" value="" />
|
|
</div>
|
|
|
|
<div class="ub ulev-1" style="line-height: 1.4em;margin-top: .5em;padding: 0 1em;box-sizing: border-box;">
|
|
<img class="" src="../image/Pin-Assistor.png" style="width:1.2em" />
|
|
<div id="area0" style="width:80%;margin: 0 1em;color: #848484;"></div>
|
|
<div class="ub ub-ac ub-pc" style="margin-right:1.4em; margin-top:0em; width: 1.2em; height:1.2em;"><img style="width: 1.2em;" src="../image/faifeito.png" /></div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="ub ub-ac uhide" id="lcpay_box" style="padding: 0.8em 1em;box-sizing: border-box;">
|
|
<div class="zmjf_msg">
|
|
需要支付<span id="jf_count"></span>补贴券,剩下的<span id="xj_count"></span>由以下支付方式支付
|
|
</div>
|
|
</div>
|
|
<div class="ub ub-ac" style="padding: 0.8em; box-sizing: border-box;" id="zfbox">
|
|
|
|
<div class="pay_box0" id="paytypebox">
|
|
<span class="pay_type">支付方式:</span>
|
|
<div class="paytype_box">
|
|
|
|
|
|
<div class='paytype_li' style="display:none" id="paytype2" onclick="onpaytype(2)" data-id="2"><img src="../image/weixinpay.png" />微信支付</div>
|
|
<div class='paytype_li' style="display:none" id="paytype3" onclick="onpaytype(3)" data-id="3"><img src="../image/alipay.png" />支付宝</div>
|
|
<div class='paytype_li hover' id="paytype0" onclick="onpaytype(0)" data-id="0"><img src="../image/jianjinpay.png" />余额支付</div>
|
|
<!--<div class='paytype_li' id="paytype1" onclick="onpaytype(1)" data-id="1"><img src="../image/jianjinpay.png" />混合支付、先积分</div>-->
|
|
<!--<div class='paytype_li' id="paytype6" onclick="onpaytype(6)" data-id="6" style="margin-top:0.8em"><img src="../image/jianjinpay.png" />消费券支付</div>-->
|
|
<!--<div class='paytype_li' id="paytype5" onclick="onpaytype(5)" data-id="5"><img src="../image/jianjinpay.png" />流量积分</div>-->
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="ub ub-ac uhide" id="jzjf-2wm" style="padding:0 0.8em;padding-top:0; box-sizing: border-box;">
|
|
<div class="tixin-item">
|
|
|
|
|
|
<div class="msg on" id="alipay_info">
|
|
|
|
<p class="flex-end ximage">
|
|
<span>支付宝收款码</span>
|
|
<a id="alipayimage" style="margin-top:0.4em;"></a>
|
|
</p>
|
|
</div>
|
|
<div class="msg on" id="weixin_info">
|
|
|
|
<p class="flex-end ximage">
|
|
<span>微信收款码</span>
|
|
<a id="weixinimage" style="margin-top:0.4em;"></a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="ub ub-ac" style="padding:0.8em;padding-bottom:0;box-sizing: border-box;">
|
|
<div class="ub" style="color:#000;">
|
|
备注留言:
|
|
</div>
|
|
<div class="ub ub-ac ub-pc input11 ub-f1" style="margin:0;padding:0;">
|
|
<textarea id="explain" style="margin:0;padding:0.2em; width:97%;height: 4em;border-radius:0.4em;color: #000;" placeholder="请留言告诉卖家您的要求" onfocus="placeholder='';" onblur="$api.val($api.dom('#explain'))==''?placeholder='请留言告诉卖家您的要求':placeholder=''"></textarea>
|
|
|
|
</div>
|
|
|
|
</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>
|