coupon-admin/public/static/manager/js/business/recharge_behalf.js

66 lines
2.2 KiB
JavaScript

layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function () {
let $ = layui.jquery,
form = layui.form,
table = layui.table,
layer = layui.layer,
xmSelect = layui.xmSelect,
miniTab = layui.miniTab;
/**** index begin ***/
//index页面
if ($('.location-index-page').length > 0) {
// 监听搜索操作
form.on('submit(saveBtn)', function (data) {
var money = $("#money").val();
let url = $(data.elem).data('url');
let index = layer.load(2);
$.post(url, data.field, function (res) {
layer.close(index);
if (res.code === 0) {
//页面层
var pay_open = layer.open({
type: 1,
title:"请微信扫码支付",
skin: 'layui-layer-rim', //加上边框
area: ['720px', '500px'], //宽高
content: '<div id="yqcode" style="margin: 20px auto"></div><div class="layui-btn" id="qrlabel">我已支付完成</div> '
});
var link = res.data.code_url;
var order_num = res.data.order_num;
var qrcode = new QRCode("yqcode", {
text: link,
width: 300,
height: 300,
colorDark: "#44b549",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
$("#qrlabel").on("click",function () {
$.post("/api/recharge/query",{"order_num":order_num}, function (res) {
if (res.code === 0) {
layer.alert("支付成功");
layer.close(pay_open)
}else{
layer.alert(res.msg);
}
});
})
}else{
layer.msg(res.msg);
}
});
return false;
});
}
/*** index end ***/
});