Files
g.hnyhua.cn/Mtxfw.VipSite/mobile/myorders.html
2026-02-07 15:48:27 +08:00

577 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/moment.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;
}
.Orders_List ul.toptitle {
border-radius: 0.8em 0.8em 0 0;
}
.Orders_List ul.midtitle {
border-radius: 0 0 0.8em 0.8em;
margin-bottom: 0.8em;
}
</style>
<script type="text/javascript">
var userId = null;
var LoginId = null;
var CartId = null;
var opentimes = null;
var t = 0, t0 = 0, pay = 0, paytype = 0, ifapp = 0;
var code = "", openid = "";
var title = "商品发货订单";
var myScroll = null;
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 aifapp = getlocalStorage("ifapp");
if (aifapp != null) {
ifapp = aifapp;
}
var tt = $.getUrlParam("t0");
if (tt != null) {
t0 = tt;
}
var dpay = $.getUrlParam("pay");
if (dpay != null) {
pay = dpay;
}
if (t0 == -1) {
title = "核销订单列表";
}
if (ifapp == 0) {
var ua = navigator.userAgent;
if (ua.indexOf("MicroMessenger") > 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/myorders.html") + "&response_type=code&scope=snsapi_base&#wechat_redirect";//snsapi_base默认授权snsapi_userinfo手动授权
top.location.href = url;
}
}
}
}
/*tt = $.getUrlParam("t");
if (tt != null) {
t = tt;
}
if (t == 1) {
title = "新零售订单";
} else if (t == 2) {
title = "批发订单";
$(".tab").html("<a class=\"on\">全部</a><a>待确认</a><a>确认中</a><a>待发货</a><a>待收货</a><a>已完成</a>");
} else if (t == 3) {
title = "乡村订单";
}*/
$("header h1").html(title);
$(document).attr("title", title);
$("title").html(title);
if (t0 > -1) {
$(".tab").removeClass("uhide");
$($(".tab a")[t0]).addClass("on").siblings().removeClass("on");
$(".tab a").on("click", function () {
var num = $(this).index();
$(this).addClass("on").siblings().removeClass("on");
t0 = num;
rdata(1);
$("#wrapper").animate({ scrollTop: 0 }, 500);
});
} else {
$(".tab").removeClass("uhide");
$(".tab").html("<a class=\"on\">已核销</a><a>未核销</a>");
$(".tab a").on("click", function () {
var num = $(this).index();
$(this).addClass("on").siblings().removeClass("on");
if (num == 1) {
t0 = -2;
} else {
t0 = -1;
}
rdata(1);
$("#wrapper").animate({ scrollTop: 0 }, 500);
});
}
opentimes = setInterval(function () {
var myrefresh = getlocalStorage("myorders_refresh");
if (myrefresh != null) {
rdata(1);
clearlocalStorage("myorders_refresh");
}
}, 1000);
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) {
userId = getlocalStorage("userId");
LoginId = getlocalStorage("LoginId");
var Start = $("#sysnew .databox").length;
if (ag == 1) {
Start = 0;
}
if ($(".ajaxLoader.uhide").length > 0) {
$(".ajaxLoader").removeClass("uhide");
var dataindex = 10;
if (t0 == 1) {
dataindex = 0;
} else if (t0 == 2) {
dataindex = 1;
} else if (t0 == 3) {
dataindex = 2;
} else if (t0 == 3) {
dataindex = 3;
} else if (t0 == -1) {
dataindex = -1;
} else if (t0 == -2) {
dataindex = -2;
}
$.ajax({
type: 'GET',
url: "/apiajax.ashx",
data: "&action=getorderslist&ifweb=" + (ifapp == 1 ? 0 : 1) +"&t0=" + dataindex + "&code=" + code + "&Start=" + Start + "&userId=" + (userId != null ? userId : "") + "&LoginId=" + (LoginId != null ? LoginId : ""),
dataType: "JSON",
error: function (xhr, type) {
tishi3("发生错误:" + JSON.stringify(xhr));
},
success: function (data) {
if (data) {
if (data.status == 1) {
var html = "";
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接口列表
});
}
}
if (data.data.length > 0) {
var html = "";
for (i = 0; i < data.data.length; i++) {
var bifshow = 0;
if (ag == 0) {
if ($("#databox_" + data.data[i].id).length == 0) {
bifshow = 1;
}
} else {
bifshow = 1;
}
if (bifshow == 1) {
html += addMsg(data.data[i]);
}
}
if (ag == 1 || ag == 2) {
$("#sysnew").html(html);
if (ag == 1) {
onScroll0();
}
} else {
$("#sysnew").append(html);
}
$(".more_box").html("");
} else {
if (Start > 0) {
if (Start > 10) {
$(".more_box").html("亲!找不到更多了");
}
} else {
$('#sysnew').html("");
$(".more_box").html("亲,暂无信息!");
}
}
$(".ajaxLoader").addClass("uhide");
} else {
tishi3(data.msg);
$(".ajaxLoader").addClass("uhide");
if (data.msg == "您未登录") {
clearlocalStorage("userId");
clearlocalStorage("LoginId");
onlink("/");
}
}
} else {
tishi3("网络错误!");
$(".ajaxLoader").addClass("uhide");
}
}
});
}
}
function addMsg(param) {
var html = "<ul class=\"toptitle databox\"><li class=\"ddh\"><label>订单号:</label><span>" + param.orderid + "</span></li>";
html += "<li><label>数量:</label><span class=\"je\">" + param.Totalnum + "</span></li>";
html += "<li><label>金额:</label><span class=\"je\">" + param.Totalprice + "</span></li>";
html += "<li class=\"xdsj\"><label>下单时间:</label><span>" + param.SubmitDate + "</span></li>";
html += "<li><label>备注留言:</label><span>" + param.Guests + "</span></li>";
html += "<li class=\"zt\"><label>状态:</label><span id='status_" + param.O_Id + "'>" + param.status0 + "</span></li>";
html += "<li class=\"cz\"><span id='cz_" + param.O_Id + "'>" + param.status1 + "</span><span class=\"Order_botton2\" onclick=\"onorderdetail(" + param.O_Id + ")\">查看详情</span></li>";
html += "</ul>";
html += "<ul class=\"midtitle\">";
var pics = param.pics;
for (j = 0; j < pics.length; j++) {
html += "<li onclick=\"ondetail(" + pics[j].prodid + ")\"><span class='black' title=\"" + pics[j].prodName + pics[j].selcolor + "\"><img src='" + pics[j].prodimg + "'/></span></li>";
}
html += "</ul>";
return html;
}
function onorderdetail(orderid) {
onlink("myorders_info.html?orderid=" + orderid);
}
function ondetail(id) {
onlink("shop_view.html?id=" + id);
}
function acloseWin() {
if (pay == 1) {
onlink("shop.html");
} else {
closeWin();
}
}
function stopPropagation(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
}
function hideshowthjto(type) {
$("#showthjto" + type).addClass("uhide");
}
function showsel(type, orderid) {
$("#showthjto" + type).removeClass("uhide");
}
function showpay(id) {
orderid = id;
showsel(0);
}
function onpaytype(id) {
paytype = id;
if (id == 1) {
$("#paytype0 .current").removeClass('on');
$("#paytype1 .current").addClass('on');
} else if (id == 0) {
$("#paytype0 .current").addClass('on');
$("#paytype1 .current").removeClass('on');
}
}
function qypayorder() {
if ($("#btntj0").val() == "确认") {
$("#btntj0").val("请稍候...");
$.ajax({
type: 'POST',
url: "/apiajax.ashx?ifweb=" + (ifapp == 1 ? 0 : 1),
data: { "action": "payorder", "userId": userId, "LoginId": LoginId, "orderid": orderid, "zftype": paytype, "openid": openid },
dataType: "json",
error: function (xhr) {
tishi3("发生错误:" + JSON.stringify(xhr));
},
success: function (data) {
$("#btntj0").val("确认");
if (data.status == 1) {
ResultId = data.ResultId;
if (ifapp == 0) {
if (paytype == 0) {
wx.chooseWXPay({
timestamp: data.timeStamp,
nonceStr: data.nonceStr,
package: data.reResult,
signType: data.signType,
paySign: data.paySign,
success(res) {
$(".ajaxLoader").addClass("uhide");
// 支付成功后的回调
hideshowthjto(0);
rdata(1);
},
cancel: function (res) {
$(".ajaxLoader").addClass("uhide");
// 用户取消支付
hideshowthjto(0);
}
});
} else {
location.replace("pay.html?ResultId=" + ResultId + "&payurl=" + data.reResult);
}
} else {
if (paytype == 0) {
try {
var wxPlus = api.require('wxPlus');
wxPlus.launchMiniProgram({
miniProgramType: 'release',
userName: 'gh_91d725ecd390',
apiKey: 'wxfa62471e8a5c0de1',
path: 'pages/pay/index?id=' + ResultId,
}, function (ret, err) {
sInterval0 = setInterval(function () {
oniswxpayed();
}, 1000);
if (ret.status) {
} else {
}
});
} catch (err) {
alert(err)
}
} else {
location.replace("pay.html?ResultId=" + ResultId + "&payurl=" + data.reResult);
}
}
} else {
tishi3(data.msg);
}
layer.close(index_);
}
});
}
}
var ischeckpayed = 0;
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);
rdata(1);
}
}
});
}
}
function qxorder(orderid) {
var index_ = layer.confirm('此操作不可恢复,您确认要取消订单吗?', {
title: "确认选择",
btn: ['是的', '我点错了'] //按钮
}, function () {
var status = $("#status_" + orderid);
var cz = $("#cz_" + orderid);
$.ajax({
type: 'POST',
url: "/apiajax.ashx?ifweb=1",
data: { "action": "CancelOrder", "userId": userId, "LoginId": LoginId, "orderid": orderid },
dataType: "json",
error: function (xhr) {
tishi3("发生错误:" + JSON.stringify(xhr));
},
success: function (data) {
layer.close(index_);
if (data.status == 1) {
$(cz).html("取消成功");
setlocalStorage("myrefresh", 1);
setlocalStorage("myorders_refresh", 1);
rdata(1);
} else {
tishi3(data.msg);
}
}
});
}
);
}
</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" onclick="onloginlink('/mobile/');" style=" margin:0; padding:0; min-width:3em; ">
<img src="/image/home.png" style="margin-left:0; margin-top:1em; height:1.4em;width:1.4em;" />
</div>
</div>
</header>
<section class="ub-f1" id="wrapper">
<div style="background-color: #02323E;">
<div class="tab flex-around uhide">
<a class="on">全部</a><a>未付款</a><a>待发货</a><a>待收货</a><a>已完成</a>
</div>
</div>
<div class="clear"></div>
<div style="padding:0.8em;">
<div class="Orders_List" id="sysnew"> </div>
<div class="clear"></div>
<div class="more_box"></div>
</div>
</section>
<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="showthjto uhide" id="showthjto0" onclick='hideshowthjto(0);'>
<div class="showthjto_box" onclick="stopPropagation(event)">
<h3><span>确认支付</span><span class="close" onclick='hideshowthjto(0);'><img src="../image/close.png" /></span></h3>
<div class="ub ub-ac" style="">
<div class="tixin-item">
<ul class="account">
<li class="flex-end" onclick="onpaytype(0)" id="paytype0">
<p>
<i><img src="../image/weixin.png" /></i>
<span>微信支付</span>
</p>
<i class="current on"></i>
</li>
<li class="flex-end" onclick="onpaytype(1)" id="paytype1">
<p>
<i><img src="../image/alipay.png" /></i>
<span>支付宝</span>
</p>
<i class="current"></i>
</li>
</ul>
</div>
</div>
<div class="ub ub-ac ub-pc">
<input type="button" class="mybtn btntj" id="btntj0" value="确认" onclick='qypayorder()' />
<input type="button" class="mybtn hovered btnqx" id="btnqx0" value="取消" onclick='hideshowthjto(0);' />
</div>
</div>
</div>
</body>
</html>