Commit ce1fee66 authored by yanzg's avatar yanzg

自助机版本

parent a9f12447
$(function(){ $(function(){
let $body = $.find(".lhgjGetSuccess"); let $body = $(".lhgjGetSuccess");
let $guojiCode = $body.find(".guojiCode");
let hard = Base.getHard(); 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 orderId = "";
var hisCodeNoPd = ""; var hisCodeNoPd = "";
/** /**
* 查询是否支付,会调用next一直查询,直到离开页面 * 查询是否支付,会调用next一直查询,直到离开页面
*/ */
function queryPay() { function queryPay() {
Base.run(function () { Base.run(function () {
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) {
showRes(res); showRes(res);
}, { }, {
error: function (res) { error: function (res) {
showStatus(res.msg || res.message); showStatus(res.msg || res.message);
next(); next();
} }
}); });
}, function (res) { }, function (res) {
showError(res); showError(res);
}); });
} }
function showRes(res){ function showRes(res){
let data = res.data || {}; let data = res.data || {};
let order = res.order || {}; let order = data.order || {};
orderId = order.orderId || "";
let extend = data.extend || {}; let extend = data.extend || {};
orderId = order.orderId || "";
let codeNoPd = extend.codeNoPd||""; let codeNoPd = extend.codeNoPd||"";
let codeNoPdShow = parseInt(extend.codeNoPdShow||""); let codeNoPdShow = parseInt(extend.codeNoPdShow||"");
if (!codeNoPdShow) { if (!codeNoPdShow) {
...@@ -47,12 +46,13 @@ $(function(){ ...@@ -47,12 +46,13 @@ $(function(){
hard.__execute("ReleaseQR", { hard.__execute("ReleaseQR", {
Code: codeNoPd Code: codeNoPd
}, function (res) { }, function (res) {
debugger;
if (!res) { if (!res) {
showError({msg: "生成二维码错误,返回路径为空"}); showError({msg: "生成二维码错误,返回路径为空"});
return; return;
} }
hisCodeNoPd = codeNoPd; hisCodeNoPd = codeNoPd;
$guojiCode.attr("src",res); $("#lhgjGetSuccessImg").attr("src","").attr("src",res);
}, function (res) { }, function (res) {
showError(res); showError(res);
}); });
...@@ -63,31 +63,32 @@ $(function(){ ...@@ -63,31 +63,32 @@ $(function(){
} }
} }
/** /**
* 间隔1秒后查询是否支付 * 间隔1秒后查询是否支付
*/ */
function next() { function next() {
clearTimeout(flag); clearTimeout(flag);
flag = setTimeout(queryPay, 1000); flag = setTimeout(queryPay, 1000);
} }
function endEvent() {
clearTimeout(flag);
}
function endEvent() {
clearTimeout(flag);
}
// 返回根据缓存加载数据的方法 // 返回根据缓存加载数据的方法
setPageLoad(function (cache, $page) { setPageLoad(function (cache, $page) {
let res = Base.getRes(cache.data); debugger;
if (res.error) { let res = Base.getRes(cache.data);
showError(res); if (res.error) {
return; showError(res);
} else { return;
// 加载订单产品信息 } else {
showRes(res); // 加载订单产品信息
} showRes(res);
}
}); });
setPageClose(function () { setPageClose(function () {
endEvent(); endEvent();
}); });
}); });
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div style="font-size: 40px;color: #FF0000;margin-bottom: 29px;"> <div style="font-size: 40px;color: #FF0000;margin-bottom: 29px;">
<span>(支持微信/支付宝)</span> <span>(支持微信/支付宝)</span>
</div> </div>
<img class="guojiCode" /> <img id="lhgjGetSuccessImg" 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