414 lines
19 KiB
HTML
414 lines
19 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
|
||
<head>
|
||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
||
<link href="/jscss/style.css" rel="stylesheet" type="text/css" />
|
||
<script type="text/javascript" charset="utf-8" src="/jscss/theme.js"></script>
|
||
</head>
|
||
|
||
<body>
|
||
<div class="container">
|
||
<form class="search" onsubmit="table.search(this,'btn');return false;">
|
||
<ul></ul>
|
||
<div>
|
||
<div class="sinps"></div>
|
||
<div class="sbtns">
|
||
<button class="lang btn" type="submit">查询</button>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<div class="topbtn">
|
||
<a class="lang btn" onclick="edit(0)">单笔转账</a>
|
||
<a class="lang btn" onclick="multiedit()">批量录入转账</a>
|
||
<a class="lang btn" onclick="multiin()">Excel导入转账</a>
|
||
<a class="lang btn succ" onclick="dopay()">开始转账操作</a>
|
||
</div>
|
||
<div class="table">
|
||
<div class="loading col-24">Loading...</div>
|
||
<div class="list"></div>
|
||
<div>
|
||
<div class="btmbtn">
|
||
<a class="lang btn def" onclick="ciyfn.select_all(table)">全选</a>
|
||
<a class="lang btn def" onclick="ciyfn.select_diff(table)">反选</a>
|
||
|
|
||
<a class="lang btn dag" onclick="ciyfn.select_callfunc(table, this, 'del','已选{n}条,是否批量删除?', {},function(json){table.delline(json)})">批量删除</a>
|
||
</div>
|
||
<div class="page"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="alert_multiin" style="display:none;">
|
||
<div style="display:flex;">
|
||
<div>
|
||
<ciy-upload com="file" />
|
||
</div>
|
||
<div style="margin-left:0.3em;">
|
||
<a class="lang btn btn-sm def" href="/ud/inpl/hf_merchantalipayorder2.xlsx" target="_blank">下载导入模板</a><br />
|
||
<div class="lang">每次导入建议不超过1000条</div>
|
||
<div class="lang">导入更新,首列为导出的行码</div>
|
||
<div class="lang">请按模版列填写</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="alert_edit" style="display:none;">
|
||
<div class="char4 row">
|
||
<div class="ciy-form col-24 col-sm-24">
|
||
<label class="lang imp">账号类型</label>
|
||
<div>
|
||
<ciy-radio com="accounttype" />
|
||
</div>
|
||
</div>
|
||
<div class="ciy-form col-24 col-sm-24">
|
||
<label class="lang imp">金额</label>
|
||
<div>
|
||
<ciy-inputbet com="amount" unit="元" bet="100" />
|
||
</div>
|
||
</div>
|
||
<div class="ciy-form col-24">
|
||
<label class="lang imp">账号</label>
|
||
<div>
|
||
<input type="text" name="tranaccount" style="width:13em;" />
|
||
</div>
|
||
</div>
|
||
<div class="ciy-form col-24">
|
||
<label class="lang imp">姓名</label>
|
||
<div>
|
||
<input type="text" name="tranname" style="width:8em;" />
|
||
</div>
|
||
</div>
|
||
<div class="ciy-form col-24">
|
||
<label class="lang">身份证号</label>
|
||
<div>
|
||
<input type="text" name="tranidid" style="width:12em;" />
|
||
</div>
|
||
</div>
|
||
<div class="ciy-form col-24">
|
||
<label class="lang">备注</label>
|
||
<div>
|
||
<input type="text" name="memo" style="width:100%;" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="alert_multiedit" style="display:none;">
|
||
<table class="edittab">
|
||
<tr>
|
||
<th>类型<span style="color:red;">*</span></th>
|
||
<th>金额<span style="color:red;">*</span></th>
|
||
<th>账户<span style="color:red;">*</span></th>
|
||
<th>姓名<span style="color:red;">*</span></th>
|
||
<th>身份证号</th>
|
||
<th>备注</th>
|
||
<th class="cursor-p" onclick="newline($5(this).parent('.edittab'));">➕</th>
|
||
</tr>
|
||
</table>
|
||
<style>
|
||
.edittab {
|
||
width: 100%;
|
||
}
|
||
|
||
.edittab th {
|
||
padding: 0.3em;
|
||
text-align: center;
|
||
font-weight: bold;
|
||
line-height: 1em;
|
||
}
|
||
|
||
.edittab td {
|
||
padding: 0.3em;
|
||
line-height: 1em;
|
||
}
|
||
</style>
|
||
</div>
|
||
|
||
<script type="text/javascript" src="/jscss/ciy.js"></script>
|
||
<script type="text/javascript" src="/jscss/ciycmp.js"></script>
|
||
<script type="text/javascript" src="/jscss/ciytable.js"></script>
|
||
<script type="text/javascript" src="/jscss/web3.min.js"></script>
|
||
<script type="text/javascript" src="../common.js"></script>
|
||
<script type="text/javascript">
|
||
'use strict';
|
||
var table;
|
||
var Glob = {};
|
||
ciyfn.pageload(function () {
|
||
//Glob.urlp = ciyfn.urlparam();
|
||
table = new ciyclass.table({
|
||
dom: '.table'
|
||
, url: 'list'
|
||
, pagecount: 10
|
||
, fn_beforedata: function (json) {
|
||
ciyfn.fillsearch({
|
||
searchdom: '.search'
|
||
, data: json
|
||
, liall: '全部'
|
||
, lidata: 'accounttype'
|
||
, liclick: function (dom) {
|
||
table.search(dom, 'li');
|
||
}
|
||
});
|
||
return json;
|
||
}
|
||
, fn_tdcontent: function (key, datashow, field, data) {
|
||
if (key == 'id') {
|
||
return 'P' + datashow;
|
||
}
|
||
if (key == 'apiuser') {
|
||
if (data['apiuser'] < 0)
|
||
return 'API:' + -data['apiuser'];
|
||
}
|
||
if (key == '_btn') {
|
||
var html = '';
|
||
html += `<a class="lang btn" onclick="menubtn(this, 'chksign')">验签</a>`;
|
||
html += `<a class="lang btn" onclick="menubtn(this, 'edit')">修改</a>`;
|
||
return html;
|
||
}
|
||
}
|
||
, fn_done: function (json) {
|
||
// table.mergecol('auditstatus');
|
||
// table.mergefix('总计', 'center', 6, 0, 8, 1);
|
||
// table.footertotal();
|
||
}
|
||
});
|
||
table.callpage(1);
|
||
});
|
||
function menubtn(dom, btn) {
|
||
var id = $5(dom).parent('tr').attr('data-id');
|
||
if (btn == 'edit') {
|
||
edit(id);
|
||
}
|
||
if (btn == 'sub') {
|
||
ciyfn.sendsignal(window.top, 'manage_ifropen', {
|
||
url: 'xxx.html?_xxxid=' + id
|
||
, name: '转账单<code>' + table.data[id].name + '</code>'
|
||
});
|
||
}
|
||
}
|
||
|
||
function getdata(id, act, cb) {
|
||
cb({ data: id == 0 ? { accounttype: 20 } : table.data[id] });
|
||
}
|
||
|
||
function edit(id) {
|
||
getdata(id, 'edit', function (jsndat) {
|
||
ciyfn.alert({
|
||
title: id == 0 ? '单笔转账' : '修改'
|
||
, width: 'mb'
|
||
, content: document.getElementById("alert_edit").innerHTML
|
||
//, noparent:true
|
||
, fn_showed: function (doc, dom) {
|
||
var dat = jsndat.data;
|
||
ciycmp({ dom: $5('[com=accounttype]', dom), value: dat.accounttype, range: 'accounttype' });
|
||
ciycmp({ dom: $5('[com=amount]', dom), value: dat.amount });
|
||
$5('[name=tranaccount]', dom).val(dat.tranaccount);
|
||
$5('[name=tranname]', dom).val(dat.tranname);
|
||
$5('[name=tranidid]', dom).val(dat.tranidid);
|
||
$5('[name=memo]', dom).val(dat.memo);
|
||
}
|
||
, cb: function (opn) {
|
||
if (opn.btn == "关闭")
|
||
return opn.close();
|
||
opn.inputs.id = id;
|
||
if (ciyfn.throttle(opn.dombtn)) return;
|
||
ciyfn.callfunc('update', opn.inputs, function (json) {
|
||
table.updateline(json);
|
||
opn.close();
|
||
ciyfn.toast('提交成功');
|
||
});
|
||
},
|
||
btns: id == 0 ? ["暂存转账", "*关闭"] : ["修改", "*关闭"],
|
||
});
|
||
});
|
||
}
|
||
function multiedit() {
|
||
var trhtml = `<tr data-idx="{idx}">
|
||
<td><ciy-switch com="accounttype_{idx}" y="支付宝" n="银行" /></td>
|
||
<td><ciy-inputbet com="amount_{idx}" unit="元" bet="100" /></td>
|
||
<td><input type="text" name="tranaccount_{idx}" style="width:13em;" /></td>
|
||
<td><input type="text" name="tranname_{idx}" style="width:8em;" /></td>
|
||
<td><input type="text" name="tranidid_{idx}" style="width:12em;" /></td>
|
||
<td><input type="text" name="memo_{idx}" style="width:5em;" /></td>
|
||
<td onclick="delline(this)" style="cursor: pointer;">➖</td>
|
||
</tr>`;
|
||
var trcount = 0;
|
||
ciyfn.alert({
|
||
title: '批量转账'
|
||
, width: 'pc'
|
||
, height: 'max'
|
||
, content: document.getElementById("alert_multiedit").innerHTML
|
||
//, noparent:true
|
||
, fn_showed: function (doc, dom) {
|
||
doc.newline = function (alertdom) {
|
||
var tr = $5('.edittab tr', alertdom);
|
||
$5(tr[tr.length - 1]).after(trhtml.replace(/\{idx\}/g, trcount));
|
||
ciycmp({ dom: $5('[com=accounttype_' + trcount + ']', alertdom), value: 1, range: 'accounttype' });
|
||
ciycmp({ dom: $5('[com=amount_' + trcount + ']', alertdom) });
|
||
trcount++;
|
||
}
|
||
doc.delline = function (alertdom) {
|
||
if ($5('tr[data-idx]', dom).length < 2)
|
||
return;
|
||
$5(alertdom).parent('tr').remove();
|
||
}
|
||
doc.newline(dom);
|
||
}
|
||
, cb: function (opn) {
|
||
if (opn.btn == "关闭")
|
||
return opn.close();
|
||
if (opn.btn == "新增一行") {
|
||
opn.doc.newline(opn.dom);
|
||
return;
|
||
}
|
||
if (ciyfn.throttle(opn.dombtn)) return;
|
||
opn.inputs.count = trcount;
|
||
ciyfn.callfunc('multiedit', opn.inputs, function (json) {
|
||
opn.close();
|
||
location.reload();
|
||
});
|
||
},
|
||
btns: ["*新增一行", "暂存转账", "*关闭"],
|
||
});
|
||
}
|
||
function dopay() {
|
||
ciyfn.callfunc("getdopay", {}, async function (json) {
|
||
var html = '';
|
||
if (json.total == 0)
|
||
return ciyfn.toast('请先录入待转账任务');
|
||
if (json.safecase == 10) {
|
||
html += '<div class="ciy-form">';
|
||
html += '<label class="lang" style="min-width:5em;">安全密码</label>';
|
||
html += '<div><input type="password" name="pass2" style="width:100%;" /></div>';
|
||
html += '</div>';
|
||
}
|
||
if (json.safecase == 20) {
|
||
var web3 = null;
|
||
if (!json.pubkey)
|
||
return ciyfn.alert('请先绑定用户钱包');
|
||
if (!window.ethereum)
|
||
return ciyfn.alert('MetaMask 没有安装');
|
||
try {
|
||
await window.ethereum.request({ method: 'eth_requestAccounts' });
|
||
web3 = new Web3(window.ethereum);
|
||
const accounts = await web3.eth.getAccounts();
|
||
if (accounts.length == 0)
|
||
return ciyfn.alert('MetaMask 请先建立钱包账户');
|
||
var account = accounts[0];
|
||
} catch (error) {
|
||
return ciyfn.alert('MetaMask 出现错误:' + error);
|
||
}
|
||
}
|
||
if (json.safecase == 30) {//安当
|
||
if (!json.pubkey)
|
||
return ciyfn.alert('请先绑定UKey设备');
|
||
var res = ciyfn.ajaxsync({
|
||
url: "http://127.0.0.1:2300/api/ExportECCPublicKey"
|
||
});
|
||
if (res.code != 1)
|
||
return ciyfn.alert('UKey设备未连接,请确认是否插入Ukey。<br/>需安装驱动');
|
||
if (json.pubkey != res.data.PublicKey)
|
||
return ciyfn.alert('UKey公钥不一致,请检查UKey设备是否插错');
|
||
var res = ciyfn.ajaxsync({
|
||
url: "http://127.0.0.1:2300/api/VerifyUserPIN"
|
||
, data: {
|
||
UserPIN: "12345678"
|
||
}
|
||
});
|
||
if (res.code != 1) {
|
||
html += '<div class="ciy-form">';
|
||
html += '<label class="lang" style="min-width:3em;">PIN码</label>';
|
||
html += '<div><input type="password" name="pin" style="width:100%;" /></div>';
|
||
html += '</div>';
|
||
}
|
||
}
|
||
html += '共计<span class="txt9 txt-lgg px2">' + json.total + '</span>笔转账,<span class="txt9 txt-lgg px1">' + (json.money / 100) + '</span>元';
|
||
html += '<br/>确认开始转账操作吗?';
|
||
ciyfn.alert({
|
||
content: html
|
||
, btns: ["开始转账", '*关闭']
|
||
, cb: async function (opn) {
|
||
if (opn.btn == '关闭')
|
||
return opn.close();
|
||
var post = {};
|
||
post.sign = [];
|
||
if (json.safecase == 10) {
|
||
post.auth = (new Date()).getTime();
|
||
post.pass = await ciyfn.sha512(await ciyfn.sha512(opn.inputs.pass2 + ciy_vars.tokensalt) + post.auth);
|
||
for (var i in json.datas)
|
||
post.sign.push({ id: json.datas[i].id });
|
||
}
|
||
if (json.safecase == 20) {
|
||
try {
|
||
for (var i in json.datas) {
|
||
//json.datas[i].hash = "H" + json.datas[i].hash;
|
||
const signature = await window.ethereum.request({
|
||
method: 'personal_sign',
|
||
params: ['CIY' + json.datas[i].hash, account],
|
||
});
|
||
post.sign.push({ id: json.datas[i].id, sign: signature, hash: json.datas[i].hash });
|
||
}
|
||
} catch (error) {
|
||
return ciyfn.alert('MetaMask 签名失败:' + error);
|
||
}
|
||
}
|
||
if (json.safecase == 30) {
|
||
if (opn.inputs.pin) {
|
||
var res = ciyfn.ajaxsync({
|
||
url: "http://127.0.0.1:2300/api/VerifyUserPIN"
|
||
, data: {
|
||
UserPIN: opn.inputs.pin
|
||
}
|
||
});
|
||
if (res.code != 1)
|
||
return ciyfn.alert('PIN码错误:' + res.errmsg);
|
||
}
|
||
for (var i in json.datas) {
|
||
var res = ciyfn.ajaxsync({
|
||
url: "http://127.0.0.1:2300/api/GetECCSignData"
|
||
, data: {
|
||
pbData: json.datas[i].hash
|
||
}
|
||
});
|
||
if (res.code != 1)
|
||
return ciyfn.alert('UKey签名失败:' + res.errmsg);
|
||
post.sign.push({ id: json.datas[i].id, sign: res.data.HashData, hash: json.datas[i].hash });
|
||
}
|
||
}
|
||
ciyfn.callfunc("dopay", post, function (json) {
|
||
opn.close();
|
||
ciyfn.alert({
|
||
content: '转账任务已提交,请前往转账记录中查看执行结果。'
|
||
, btns: ["打开转账记录", '*关闭']
|
||
, cb: async function (opn) {
|
||
opn.close();
|
||
if (opn.btn == '关闭') {
|
||
window.location.reload();
|
||
return;
|
||
}
|
||
setTimeout(function () {
|
||
window.location.reload();
|
||
}, 2000);
|
||
ciyfn.sendsignal(window.top, 'manage_ifropen', {
|
||
url: "mer/merchantalipayorder.html?_t=" + tostamp()
|
||
, name: "转账记录"
|
||
});
|
||
}
|
||
});
|
||
});
|
||
}
|
||
});
|
||
});
|
||
}
|
||
function multiin() {
|
||
ciyfn.table_multiin('importxls', document.getElementById("alert_multiin").innerHTML, function (json) {
|
||
ciyfn.toast('导入成功');
|
||
table.cachecount = -1;
|
||
table.callpage();
|
||
});
|
||
}
|
||
</script>
|
||
</body>
|
||
|
||
</html> |