Commit 1d7f7c5b authored by yanzg's avatar yanzg

自助机程序修改

parent 1f667a0c
$(function(){
let $body = $.find(".lhgjGetSuccess");
let $guojiCode = $body.find(".guojiCode");
let hard = Base.getHard();
let url = {
pay: Base.getOrderUrl("order/wait")
};
let flag = 0;
var orderId = "";
var hisCodeNoPd = "";
/**
* 查询是否支付,会调用next一直查询,直到离开页面
*/
function queryPay() {
Base.run(function () {
let cache = getCache();
let orderId = window.guojiOrderId;
Base.Request(url.pay, {
order: {
companyId: Base.config.companyId,
orderId: orderId
}
}, function (res) {
showRes(res);
}, {
error: function (res) {
showStatus(res.msg || res.message);
next();
}
});
}, function (res) {
showError(res);
});
}
function showRes(res){
let data = res.data || {};
let order = res.order || {};
orderId = order.orderId || "";
let extend = data.extend || {};
let codeNoPd = extend.codeNoPd||"";
let codeNoPdShow = parseInt(extend.codeNoPdShow||"");
if (!codeNoPdShow) {
showStatus("正在等待扫描...");
next();
} else {
endEvent();
showWelcome(res);
}
}, {
error: function (res) {
showStatus(res.msg || res.message);
next();
if(hisCodeNoPd != codeNoPd){
// 调用C#方法,生成二维码返回路径,根据路径进行操作
hard.__execute("ReleaseQR", {
Code: codeNoPd
}, function (res) {
if (!res) {
showError({msg: "生成二维码错误,返回路径为空"});
return;
}
});
hisCodeNoPd = codeNoPd;
$guojiCode.attr("src",res);
}, function (res) {
showError(res);
});
}
} else {
endEvent();
showWelcome(res);
}
}
/**
* 间隔1秒后查询是否支付
......@@ -57,10 +82,8 @@ $(function(){
showError(res);
return;
} else {
document.querySelector(".guojiCode").setAttribute("src",window.guojiSuccessImg)
window.guojiSuccessImg=""
// 加载订单产品信息
queryPay();
showRes(res);
}
});
......
......@@ -9,12 +9,12 @@ $(function(){
sortSave: Base.getOrderUrl("sort/save"),
getRangeList: Base.getStoreUrl("sort/time/batchQuery")
};
let hard = Base.getHard();
//返回首页
$scGuojiReturn.click(function(){
showResPage(null,"/page/home/base_welcome.html");
})
});
// 获取设备中心
var hardEvent = {
on: function (res) {
......@@ -73,25 +73,7 @@ $(function(){
visitor.visitorMobile = order.mobile;
// 请求地址
Base.Request(url.sortSave, req, function (res) {
let data = res.data || {};
let extend = data.extend || {};
let codeNoPd = extend.codeNoPd||"";
// 调用C#方法,生成二维码返回路径,根据路径进行操作
hard.__execute("ReleaseQR", {
Code: codeNoPd
}, function (res) {
if (!res) {
showError({msg: "生成二维码错误,返回路径为空"});
return;
}
showWaitWelcome(null,"/page/lhgj/getSuccess.html");
window.guojiSuccessImg=""
window.guojiSuccessImg=res
// pay.PayCodeUrl = res;
}, function (res) {
showError(res);
});
showWaitWelcome(res,"/page/lhgj/getSuccess.html");
}, {
error: function (res) {
showWaitWelcome(null,"/page/lhgj/getFailure.html");
......@@ -131,7 +113,7 @@ $(function(){
// 返回根据缓存加载数据的方法
setPageLoad(function (cache, $page) {
showSortRange();
var res = Base.getRes(cache.data);
let res = Base.getRes(cache.data);
if (res.error) {
showError(res);
}
......
......@@ -64,33 +64,12 @@ $(function(){
]
}
// 请求地址
Base.Request(url.order, req, function (res) {//下单接口
let data = res.data || {};
let extend = data.extend || {};
let codeNoPd = extend.codeNoPd||"";
window.guojiOrderId=""
window.guojiOrderId=data.order.orderId||""
// 调用C#方法,生成二维码返回路径,根据路径进行操作
hard.__execute("ReleaseQR", {
Code: codeNoPd
}, function (res) {
if (!res) {
showError({msg: "生成二维码错误,返回路径为空"});
return;
}
showWaitWelcome(null,"/page/lhgj/getSuccess.html");
window.guojiSuccessImg=""
window.guojiSuccessImg=res
// pay.PayCodeUrl = res;
}, function (res) {
showError(res);
});
Base.Request(url.order, req, function (res) {
// 下单接口
showWaitWelcome(res,"/page/lhgj/getSuccess.html");
}, {
error: function (res) {
showError(res);
}
});
}
......
<div class="guojiBigbox">
<div class="guojiBigbox lhgjGetSuccess">
<div class="guojiTop">
<img src="../../img/lhgj/lhgjIcon.png" class="guojiTopImg">
</div>
......@@ -16,7 +15,6 @@
<span>(支持微信/支付宝)</span>
</div>
<img class="guojiCode" />
<div>
<!-- <span style="color: #FF0000;font-size: 40px;" class="IndexTime"></span>s -->
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment