mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-10-22 02:13:44 +08:00
支持微信支付宝收款功能
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收款平台</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="platform">
|
||||
<select name="platform" lay-filter="select-platform">
|
||||
<option value="">收款平台</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -40,7 +40,7 @@
|
||||
<label class="layui-form-label">监听模式</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="pattern">
|
||||
<option value="请选择"></option>
|
||||
<option value="">请选择</option>
|
||||
<?php include_once '../view/tpl/pattern.html'; ?>
|
||||
</select>
|
||||
</div>
|
||||
@@ -78,9 +78,22 @@
|
||||
select.innerHTML = option_str;
|
||||
form.render('select');
|
||||
})()
|
||||
|
||||
// select 事件
|
||||
form.on('select(select-platform)', function (data) {
|
||||
const value = data.value; // 获得被选中的值
|
||||
const field1 = document.querySelector('input[name="password"]').parentNode.parentNode;
|
||||
const field2 = document.querySelector('select[name="pattern"]').parentNode.parentNode;
|
||||
if (value === 'wxpay' || value === 'alipay') {
|
||||
field1.style.display = 'none';
|
||||
field2.style.display = 'none';
|
||||
} else {
|
||||
field1.style.display = 'block';
|
||||
field2.style.display = 'block';
|
||||
}
|
||||
});
|
||||
form.on('submit(add-account)', function (obj) {
|
||||
const field = obj.field;
|
||||
let field = obj.field;
|
||||
field.pattern = field.pattern === '' ? 1 : field.pattern;
|
||||
(async () => {
|
||||
const url = '/api/PayManage/addAccount';
|
||||
const info = field;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>添加收款终端</title>
|
||||
<title>添加二维码</title>
|
||||
<link rel="stylesheet" href="/component/pear/css/pear.css" />
|
||||
<style>
|
||||
.inputTxt {
|
||||
|
108
view/pay_manage/add_channel_code.html
Normal file
108
view/pay_manage/add_channel_code.html
Normal file
@@ -0,0 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>添加二维码</title>
|
||||
<link rel="stylesheet" href="/component/pear/css/pear.css" />
|
||||
<style>
|
||||
.inputTxt {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form id="set-channel" class="layui-form layui-form-pane" action="" lay-filter="channel-edit">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">终端编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="channel" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收款通道</label>
|
||||
<div class="layui-input-block">
|
||||
<select class="type" lay-filter="select-type">
|
||||
<option value="">请选择</option>
|
||||
<!-- <?php if ($platform == 'wxpay') { ?> -->
|
||||
<option value="wx1">个人码</option>
|
||||
<option value="wx2">赞赏码</option>
|
||||
<option value="wx3">经营码</option>
|
||||
<option value="wx4">商家码</option>
|
||||
<!-- <?php } ?> -->
|
||||
<!-- <?php if ($platform == 'alipay') { ?> -->
|
||||
<option value="ali1">个人码</option>
|
||||
<option value="ali2">经营码</option>
|
||||
<!-- <?php } ?> -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收款码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qrcode" autocomplete="off" lay-affix="upload-drag"
|
||||
lay-filter="scanning" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="button-container">
|
||||
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="save">
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
提交
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-sm">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script src="/component/layui/layui.js"></script>
|
||||
<script src="/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['form'], function () {
|
||||
let form = layui.form;
|
||||
|
||||
form.on('input-affix(scanning)', function () {
|
||||
window.open('https://cli.im/deqr', '_blank');
|
||||
});
|
||||
// select 事件
|
||||
form.on('select(select-type)', function (data) {
|
||||
const value = data.value; // 获得被选中的值
|
||||
const channel = document.querySelector('input[name="channel"]');
|
||||
channel.value = '<?php echo $account ?>' + value;
|
||||
});
|
||||
form.on('submit(save)', function (obj) {
|
||||
let field = obj.field;
|
||||
field.account_id = '<?php echo $aid ?>';
|
||||
(async () => {
|
||||
const url = '/api/PayManage/addChannel';
|
||||
const info = field;
|
||||
const res = await fetch(url, { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(info) });
|
||||
if (res.status !== 200) {
|
||||
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
||||
return false;
|
||||
}
|
||||
const rec_info = await res.json();
|
||||
if (rec_info.code === 0) {
|
||||
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
|
||||
parent.window.location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
||||
}
|
||||
})()
|
||||
return false;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
100
view/pay_manage/add_code.html
Normal file
100
view/pay_manage/add_code.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>添加收款通道</title>
|
||||
<link rel="stylesheet" href="/component/pear/css/pear.css" />
|
||||
<style>
|
||||
.inputTxt {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form id="add-account" class="layui-form layui-form-pane" action="" lay-filter="add-account">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收款平台</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="platform">
|
||||
<option value="">收款平台</option>
|
||||
<option value="wxpay">微信支付</option>
|
||||
<option value="alipay">支付宝</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收款通道</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="password">
|
||||
<option value="">请选择</option>
|
||||
<optgroup label="微信支付">
|
||||
<option value="wx1">个人码</option>
|
||||
<option value="wx2">赞赏码</option>
|
||||
<option value="wx3">经营码</option>
|
||||
<option value="wx4">商家码</option>
|
||||
</optgroup>
|
||||
<optgroup label="支付宝">
|
||||
<option value="al1">个人码</option>
|
||||
<option value="al2">经营码</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收款账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="account" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="button-container">
|
||||
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
|
||||
lay-filter="add-account">
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
提交
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-sm">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script src="/component/layui/layui.js"></script>
|
||||
<script src="/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['form'], function () {
|
||||
let form = layui.form;
|
||||
form.on('submit(add-account)', function (obj) {
|
||||
const field = obj.field;
|
||||
(async () => {
|
||||
const url = '/api/PayManage/addCode';
|
||||
const info = field;
|
||||
const res = await fetch(url, { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(info) });
|
||||
if (res.status !== 200) {
|
||||
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
|
||||
return false;
|
||||
}
|
||||
const rec_info = await res.json();
|
||||
if (rec_info.code === 0) {
|
||||
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
|
||||
parent.layui.table.reload("account-table");
|
||||
});
|
||||
} else {
|
||||
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
|
||||
}
|
||||
})()
|
||||
return false;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>终端列表</title>
|
||||
<title>收款码</title>
|
||||
<link rel="stylesheet" href="/component/pear/css/pear.css" />
|
||||
<style>
|
||||
.edit {
|
||||
@@ -68,7 +68,7 @@
|
||||
layer.open({
|
||||
id: 'iframe-channel-add',
|
||||
type: 2,
|
||||
title: '添加收款终端',
|
||||
title: '添加收款码',
|
||||
shade: 0.1,
|
||||
area: [common.isModile() ? '80%' : '400px', common.isModile() ? '70%' : '300px'],
|
||||
content: `/PayManage/addChannel?aid=${aid}`,
|
||||
@@ -138,7 +138,7 @@
|
||||
channel.addBtn = function (mainbox, aid) {
|
||||
let btn = document.createElement('div');
|
||||
btn.className = 'layui-card';
|
||||
btn.innerHTML = `<button type="button" lay-on="add" data-aid="${aid}" class="layui-btn layui-btn-fluid">添加收款终端</button>`;
|
||||
btn.innerHTML = `<button type="button" lay-on="add" data-aid="${aid}" class="layui-btn layui-btn-fluid">添加收款码</button>`;
|
||||
mainbox.appendChild(btn);
|
||||
}
|
||||
// 生成二维码
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收款平台</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="platform">
|
||||
<select name="platform" lay-filter="select-platform">
|
||||
<option value="">收款平台</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -60,8 +60,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">查询参数
|
||||
<a href="https://www.jyshare.com/front-end/53/" class="layui-font-blue" style="float: right;" target="_blank">
|
||||
<label class="layui-form-label">查询参数
|
||||
<a href="https://www.jyshare.com/front-end/53/" class="layui-font-blue" style="float: right;"
|
||||
target="_blank">
|
||||
<span class="layui-font-gray">JSON工具 </span><span class="icon pear-icon"></span>
|
||||
</a>
|
||||
</label>
|
||||
@@ -112,6 +113,20 @@
|
||||
"params": `<?php echo $params ?>`,
|
||||
});
|
||||
})()
|
||||
// select 事件
|
||||
const platform = "<?php echo $platform ?>";
|
||||
if (platform === 'wxpay' || platform === 'alipay') {
|
||||
changePat(false);
|
||||
}
|
||||
form.on('select(select-platform)', function (data) {
|
||||
const value = data.value; // 获得被选中的值
|
||||
if (value === 'wxpay' || value === 'alipay') {
|
||||
changePat(false);
|
||||
} else {
|
||||
changePat(true);
|
||||
}
|
||||
});
|
||||
// 提交
|
||||
form.on('submit(save-account)', function (obj) {
|
||||
let field = obj.field;
|
||||
field.state = 'state' in field ? 1 : 0;
|
||||
@@ -137,6 +152,21 @@
|
||||
})()
|
||||
return false;
|
||||
});
|
||||
// 操作元素显示
|
||||
function changePat(is_show = true) {
|
||||
const field1 = document.querySelector('input[name="password"]').parentNode.parentNode;
|
||||
const field2 = document.querySelector('select[name="pattern"]').parentNode.parentNode;
|
||||
const field3 = document.querySelector('textarea[name="params"]').parentNode.parentNode;
|
||||
if (is_show) {
|
||||
field1.style.display = 'block';
|
||||
field2.style.display = 'block';
|
||||
field3.style.display = 'block';
|
||||
} else {
|
||||
field1.style.display = 'none';
|
||||
field2.style.display = 'none';
|
||||
field3.style.display = 'none';
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
@@ -66,7 +66,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/html" id="account-toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="addAccount">
|
||||
<button class="pear-btn pear-btn-success pear-btn-md" lay-event="addAccount">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
添加
|
||||
</button>
|
||||
@@ -82,6 +82,17 @@
|
||||
<script type="text/html" id="account-state">
|
||||
<input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="accountEnable" {{ d.state == 1 ? 'checked' : '' }} />
|
||||
</script>
|
||||
<script type="text/html" id="account-checkUrl">
|
||||
{{#
|
||||
if (d.platform == '微信支付') {
|
||||
return `{"payway":"wxpay","pid":"${d.pid}","aid":"${d.id}","uid":"\{\{UID\}\}","title":"\{\{TITLE\}\}","msg":"\{\{MSG\}\}","time":"\{\{RECEIVE_TIME\}\}","divice":"\{\{DEVICE_NAME\}\}"}`;
|
||||
} else if (d.platform == '支付宝') {
|
||||
return `{"payway":"alipay","pid":"${d.pid}","aid":"${d.id}","uid":"\{\{UID\}\}","title":"\{\{TITLE\}\}","msg":"\{\{MSG\}\}","time":"\{\{RECEIVE_TIME\}\}","divice":"\{\{DEVICE_NAME\}\}"}`;
|
||||
} else {
|
||||
return '<?php echo $domain ?>/checkPayResult?pid=' + d.pid + '&aid=' + d.id;
|
||||
}
|
||||
}}
|
||||
</script>
|
||||
<script src="/component/layui/layui.js"></script>
|
||||
<script src="/component/pear/pear.js"></script>
|
||||
<script>
|
||||
@@ -107,11 +118,10 @@
|
||||
{ type: 'checkbox' },
|
||||
{ title: '平 台', field: 'platform', align: 'center', templet: '' },
|
||||
{ title: '账 号', field: 'account', align: 'center' },
|
||||
{ title: '密 码', field: 'password', align: 'center' },
|
||||
{ title: '启用状态', field: 'state', align: 'center', templet: '#account-state' },
|
||||
{ title: '监听模式', field: 'pattern', align: 'center' },
|
||||
{ title: '监听地址', field: 'payurl', align: 'center', templet: `<div>{{# return '<?php echo $domain ?>/checkPayResult?pid='+d.pid+'&aid='+d.id }}</div>` },
|
||||
{ title: '终端数量', field: 'channel', align: 'center', templet: '<div><a href="javascript:;" lay-event="channelList"><span class="layui-badge layui-bg-green">{{= d.channel }}</span></a></div>' },
|
||||
{ title: '监听地址 / 自定义模版', field: 'checkUrl', align: 'center', minWidth: 300, event: 'copy', templet: '#account-checkUrl' },
|
||||
{ title: '收款码数量', field: 'channel', align: 'center', templet: '<div><a href="javascript:;" lay-event="channelList"><span class="layui-badge layui-bg-green">{{= d.channel }}</span></a></div>' },
|
||||
{ title: '操作', align: 'center', fixed: 'right', templet: '<div><a href="javascript:;" class="layui-font-green" lay-event="edit"><strong>编辑</strong></a></div>' }
|
||||
]]
|
||||
|
||||
@@ -139,6 +149,8 @@
|
||||
account.editAccount(id);
|
||||
} else if (obj.event === 'channelList') {
|
||||
account.channelList(id);
|
||||
} else if (obj.event === 'copy') {
|
||||
console.log(obj.getCol());
|
||||
}
|
||||
});
|
||||
// 表格头部按钮事件
|
||||
@@ -212,7 +224,7 @@
|
||||
layer.open({
|
||||
id: 'iframe-channel-list',
|
||||
type: 2,
|
||||
title: '收款终端',
|
||||
title: '收款码',
|
||||
shade: 0.1,
|
||||
area: [common.isModile() ? '100%' : '500px', common.isModile() ? '100%' : '700px'],
|
||||
content: `/PayManage/channelList?id=${id}`,
|
||||
|
Reference in New Issue
Block a user