Commit 1d7f7c5b authored by yanzg's avatar yanzg

自助机程序修改

parent 1f667a0c
$(function(){ $(function(){
let $body = $.find(".lhgjGetSuccess");
let $guojiCode = $body.find(".guojiCode");
let hard = Base.getHard();
let url = { let url = {
pay: Base.getOrderUrl("order/wait") pay: Base.getOrderUrl("order/wait")
}; };
let flag = 0; let flag = 0;
var orderId = "";
var hisCodeNoPd = "";
/** /**
* 查询是否支付,会调用next一直查询,直到离开页面 * 查询是否支付,会调用next一直查询,直到离开页面
*/ */
function queryPay() { function queryPay() {
Base.run(function () { Base.run(function () {
let cache = getCache();
let orderId = window.guojiOrderId;
Base.Request(url.pay, { Base.Request(url.pay, {
order: { order: {
companyId: Base.config.companyId, companyId: Base.config.companyId,
orderId: orderId orderId: orderId
} }
}, function (res) { }, function (res) {
let data = res.data || {}; showRes(res);
let extend = data.extend || {};
let codeNoPdShow = parseInt(extend.codeNoPdShow||"");
if (!codeNoPdShow) {
showStatus("正在等待扫描...");
next();
} else {
endEvent();
showWelcome(res);
}
}, { }, {
error: function (res) { error: function (res) {
showStatus(res.msg || res.message); showStatus(res.msg || res.message);
...@@ -38,6 +32,37 @@ $(function(){ ...@@ -38,6 +32,37 @@ $(function(){
}); });
} }
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();
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秒后查询是否支付 * 间隔1秒后查询是否支付
*/ */
...@@ -57,10 +82,8 @@ $(function(){ ...@@ -57,10 +82,8 @@ $(function(){
showError(res); showError(res);
return; return;
} else { } else {
document.querySelector(".guojiCode").setAttribute("src",window.guojiSuccessImg)
window.guojiSuccessImg=""
// 加载订单产品信息 // 加载订单产品信息
queryPay(); showRes(res);
} }
}); });
......
...@@ -9,12 +9,12 @@ $(function(){ ...@@ -9,12 +9,12 @@ $(function(){
sortSave: Base.getOrderUrl("sort/save"), sortSave: Base.getOrderUrl("sort/save"),
getRangeList: Base.getStoreUrl("sort/time/batchQuery") getRangeList: Base.getStoreUrl("sort/time/batchQuery")
}; };
let hard = Base.getHard();
//返回首页 //返回首页
$scGuojiReturn.click(function(){ $scGuojiReturn.click(function(){
showResPage(null,"/page/home/base_welcome.html"); showResPage(null,"/page/home/base_welcome.html");
}) });
// 获取设备中心 // 获取设备中心
var hardEvent = { var hardEvent = {
on: function (res) { on: function (res) {
...@@ -73,25 +73,7 @@ $(function(){ ...@@ -73,25 +73,7 @@ $(function(){
visitor.visitorMobile = order.mobile; visitor.visitorMobile = order.mobile;
// 请求地址 // 请求地址
Base.Request(url.sortSave, req, function (res) { Base.Request(url.sortSave, req, function (res) {
let data = res.data || {}; showWaitWelcome(res,"/page/lhgj/getSuccess.html");
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);
});
}, { }, {
error: function (res) { error: function (res) {
showWaitWelcome(null,"/page/lhgj/getFailure.html"); showWaitWelcome(null,"/page/lhgj/getFailure.html");
...@@ -131,7 +113,7 @@ $(function(){ ...@@ -131,7 +113,7 @@ $(function(){
// 返回根据缓存加载数据的方法 // 返回根据缓存加载数据的方法
setPageLoad(function (cache, $page) { setPageLoad(function (cache, $page) {
showSortRange(); showSortRange();
var res = Base.getRes(cache.data); let res = Base.getRes(cache.data);
if (res.error) { if (res.error) {
showError(res); showError(res);
} }
......
...@@ -64,33 +64,12 @@ $(function(){ ...@@ -64,33 +64,12 @@ $(function(){
] ]
} }
// 请求地址 // 请求地址
Base.Request(url.order, req, function (res) {//下单接口 Base.Request(url.order, req, function (res) {
let data = res.data || {}; // 下单接口
let extend = data.extend || {}; showWaitWelcome(res,"/page/lhgj/getSuccess.html");
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);
});
}, { }, {
error: function (res) { error: function (res) {
showError(res); showError(res);
} }
}); });
} }
......
<div class="guojiBigbox lhgjGetSuccess">
<div class="guojiBigbox">
<div class="guojiTop"> <div class="guojiTop">
<img src="../../img/lhgj/lhgjIcon.png" class="guojiTopImg"> <img src="../../img/lhgj/lhgjIcon.png" class="guojiTopImg">
</div> </div>
...@@ -16,7 +15,6 @@ ...@@ -16,7 +15,6 @@
<span>(支持微信/支付宝)</span> <span>(支持微信/支付宝)</span>
</div> </div>
<img class="guojiCode" /> <img class="guojiCode" />
<div> <div>
<!-- <span style="color: #FF0000;font-size: 40px;" class="IndexTime"></span>s --> <!-- <span style="color: #FF0000;font-size: 40px;" class="IndexTime"></span>s -->
</div> </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