国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

352 строки
13KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  6. <title>支付接口设置</title>
  7. <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
  8. <link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="../static/web/css/admin.css">
  10. <script src="../static/web/js/jquery.min.js"></script>
  11. <script src="../static/web/js/bootstrap.min.js"></script>
  12. </head>
  13. <body>
  14. <table cellpadding="3" cellspacing="1" align="center" class="table maintable my-3">
  15. <tr>
  16. <td bgcolor="#f5f5f5" colspan="4">
  17. <table cellspacing="0" cellpadding="0" class="table table-borderless w-100">
  18. <tr>
  19. <td>支付接口设置</td>
  20. <td align="right"><span><a href="https://www.dedebiz.com/help" target="_blank"
  21. class="btn btn-success btn-sm">更多接口</a></span></td>
  22. </tr>
  23. </table>
  24. </td>
  25. </tr>
  26. <tr>
  27. <td colspan="4">
  28. <ul class="nav nav-tabs" id="myTab" role="tablist">
  29. <li class="nav-item" role="presentation">
  30. <button type="button" id="wechat-tab" class="nav-link active" data-toggle="tab"
  31. data-target="#wechat" role="tab" aria-controls="wechat" aria-selected="true">微信支付</button>
  32. </li>
  33. <li class="nav-item" role="presentation">
  34. <button type="button" id="alipay-tab" class="nav-link" data-toggle="tab" data-target="#alipay"
  35. role="tab" aria-controls="alipay" aria-selected="false">支付宝</button>
  36. </li>
  37. <li class="nav-item" role="presentation">
  38. <button type="button" id="bank-tab" class="nav-link" data-toggle="tab" data-target="#bank"
  39. role="tab" aria-controls="bank" aria-selected="false">银行转帐</button>
  40. </li>
  41. <li class="nav-item" role="presentation">
  42. <button type="button" id="balance-tab" class="nav-link" data-toggle="tab" data-target="#balance"
  43. role="tab" aria-controls="balance" aria-selected="false">余额支付</button>
  44. </li>
  45. <li class="nav-item" role="presentation">
  46. <button type="button" id="cod-tab" class="nav-link" data-toggle="tab" data-target="#cod"
  47. role="tab" aria-controls="cod" aria-selected="false">货到付款</button>
  48. </li>
  49. </ul>
  50. <div class="tab-content py-3" id="myTabContent">
  51. <div class="tab-pane fade show active" id="wechat" role="tabpanel" aria-labelledby="wechat-tab">
  52. <form>
  53. <div class="form-group">
  54. <label>描述</label>
  55. <p>微信支付是腾讯公司的支付业务品牌,微信支付商户平台支持线下场所、公众号、小程序、PC网站、APP、企业微信等经营场景快速接入微信支付。微信支付全面打通O2O生活消费领域,提供专业的互联网+行业解决方案,微信支付支持微信红包和微信理财通,是移动支付的首选。
  56. </p>
  57. </div>
  58. <div class="form-group">
  59. <label for="iptWechatAppID">AppID</label>
  60. <input type="text" class="form-control" id="iptWechatAppID">
  61. </div>
  62. <div class="form-group">
  63. <label for="iptWechatAppSecret">AppSecret</label>
  64. <input type="text" class="form-control" id="iptWechatAppSecret">
  65. </div>
  66. <div class="form-group">
  67. <label for="iptWechatMchID">商户号</label>
  68. <input type="text" class="form-control" id="iptWechatMchID">
  69. </div>
  70. <div class="form-group">
  71. <label for="iptWechatAPIV3Key">APIv3秘钥</label>
  72. <input type="text" class="form-control" id="iptWechatAPIV3Key">
  73. </div>
  74. <div class="form-group">
  75. <label for="iptWechatSerialNo">商户证书序列号</label>
  76. <input type="text" class="form-control" id="iptWechatSerialNo">
  77. </div>
  78. <div class="form-group">
  79. <label>商户证书文件</label>
  80. <div class="custom-file">
  81. <input type="file" class="custom-file-input" id="iptWechatPrivateKey">
  82. <label class="custom-file-label" data-browse="选择"
  83. for="iptWechatPrivateKey">选择商户证书文件...</label>
  84. </div>
  85. </div>
  86. <div class="form-group">
  87. <label for="iptWechatSortrank">排序(越小越靠前)</label>
  88. <input type="text" class="form-control" id="iptWechatSortrank" value="0">
  89. </div>
  90. <div class="form-group form-check">
  91. <input type="checkbox" class="form-check-input" id="iptWechatEnabled">
  92. <label class="form-check-label" for="iptWechatEnabled"> 是否启用</label>
  93. </div>
  94. </form>
  95. </div>
  96. <div class="tab-pane fade" id="alipay" role="tabpanel" aria-labelledby="alipay-tab">
  97. <form>
  98. <div class="form-group">
  99. <label for="iptAppID">描述</label>
  100. <p>支付宝,全球领先的独立第三方支付平台,致力于为广大用户提供安全快速的电子支付/网上支付/安全支付/手机支付体验,及转账收款/水电煤缴费/信用卡还款/AA收款等生活服务应用。
  101. </p>
  102. </div>
  103. <div class="form-group">
  104. <label for="iptAlipayAPPID">APPID</label>
  105. <input type="text" class="form-control" id="iptAlipayAPPID">
  106. </div>
  107. <div class="form-group">
  108. <label for="iptAlipayPrivateKey">应用私钥</label>
  109. <input type="text" class="form-control" id="iptAlipayPrivateKey">
  110. </div>
  111. <div class="form-group">
  112. <label>应用公钥证书</label>
  113. <div class="custom-file">
  114. <input type="file" class="custom-file-input" id="iptAlipayAppCertPublicKey">
  115. <label class="custom-file-label" data-browse="选择"
  116. for="iptAlipayAppCertPublicKey">选择应用公钥证书文件...</label>
  117. </div>
  118. </div>
  119. <div class="form-group">
  120. <label>支付宝公钥证书</label>
  121. <div class="custom-file">
  122. <input type="file" class="custom-file-input" id="iptAlipayCertPublicKey">
  123. <label class="custom-file-label" data-browse="选择"
  124. for="iptAlipayCertPublicKey">选择支付宝公钥证书文件...</label>
  125. </div>
  126. </div>
  127. <div class="form-group">
  128. <label>支付宝根证书</label>
  129. <div class="custom-file">
  130. <input type="file" class="custom-file-input" id="iptAlipayRootCert">
  131. <label class="custom-file-label" data-browse="选择"
  132. for="iptAlipayRootCert">选择支付宝根证书文件...</label>
  133. </div>
  134. </div>
  135. <div class="form-group">
  136. <label for="iptAlipaySignType">签名类型</label>
  137. <input type="text" class="form-control" id="iptAlipaySignType" value="RSA2" disabled>
  138. </div>
  139. <div class="form-group">
  140. <label for="iptAlipaySortrank">排序(越小越靠前)</label>
  141. <input type="text" class="form-control" id="iptAlipaySortrank" value="0">
  142. </div>
  143. <div class="form-group form-check">
  144. <input type="checkbox" class="form-check-input" id="iptAlipayEnabled">
  145. <label class="form-check-label" for="iptAlipayEnabled"> 是否启用</label>
  146. </div>
  147. </form>
  148. </div>
  149. <div class="tab-pane fade" id="bank" role="tabpanel" aria-labelledby="bank-tab">
  150. <form>
  151. <div class="form-group">
  152. <label>描述</label>
  153. <p>用户支付到商户指定银行卡账号,手动确认订单收款。</p>
  154. </div>
  155. <div class="form-group">
  156. <label for="iptBankAccountName">账户名</label>
  157. <input type="text" class="form-control" id="iptBankAccountName">
  158. </div>
  159. <div class="form-group">
  160. <label for="iptBankAccountNO">账号</label>
  161. <input type="text" class="form-control" id="iptBankAccountNO">
  162. </div>
  163. <div class="form-group">
  164. <label for="iptBankName">开户行</label>
  165. <input type="text" class="form-control" id="iptBankName">
  166. </div>
  167. <div class="form-group">
  168. <label for="iptBankSortrank">排序(越小越靠前)</label>
  169. <input type="text" class="form-control" id="iptBankSortrank" value="0">
  170. </div>
  171. <div class="form-group form-check">
  172. <input type="checkbox" class="form-check-input" id="iptBankEnabled">
  173. <label class="form-check-label" for="iptBankEnabled"> 是否启用</label>
  174. </div>
  175. </form>
  176. </div>
  177. <div class="tab-pane fade" id="balance" role="tabpanel" aria-labelledby="balance-tab">
  178. <form>
  179. <div class="form-group">
  180. <label>描述</label>
  181. <p>支持采用积分进行支付。</p>
  182. </div>
  183. <div class="form-group">
  184. <label for="iptBalanceSortrank">排序(越小越靠前)</label>
  185. <input type="text" class="form-control" id="iptBalanceSortrank" value="0">
  186. </div>
  187. <div class="form-group form-check">
  188. <input type="checkbox" class="form-check-input" id="iptBalanceEnabled">
  189. <label class="form-check-label" for="iptBalanceEnabled">是否启用</label>
  190. </div>
  191. </form>
  192. </div>
  193. <div class="tab-pane fade" id="cod" role="tabpanel" aria-labelledby="cod-tab">
  194. <form>
  195. <div class="form-group">
  196. <label>描述</label>
  197. <p>购买后直接发货,到货后再进行支付。</p>
  198. </div>
  199. <div class="form-group">
  200. <label for="iptCodSortrank">排序(越小越靠前)</label>
  201. <input type="text" class="form-control" id="iptCodSortrank" value="0">
  202. </div>
  203. <div class="form-group form-check">
  204. <input type="checkbox" class="form-check-input" id="iptCodEnabled">
  205. <label class="form-check-label" for="iptCodEnabled"> 是否启用</label>
  206. </div>
  207. </form>
  208. </div>
  209. <div class="text-center"><button id="btnSave" type="submit" class="btn btn-success">保存</button>
  210. </div>
  211. </div>
  212. </td>
  213. </tr>
  214. </table>
  215. <script>
  216. $('.custom-file-input').on('change', function () {
  217. let fileName = $(this).val().split('\\').pop();
  218. $(this).siblings('.custom-file-label').addClass("selected").html(fileName);
  219. });
  220. let config = {
  221. Wechat: {
  222. AppID: '',
  223. AppSecret: '',
  224. MchID: '',
  225. APIV3Key: '',
  226. SerialNo: '',
  227. PrivateKey: '',
  228. Sortrank: 0,
  229. Enabled: true,
  230. },
  231. Alipay: {
  232. APPID: '',
  233. PrivateKey: '',
  234. AppCertPublicKey: '',
  235. CertPublicKey: '',
  236. RootCert: '',
  237. SignType: 'RSA2',
  238. Sortrank: 0,
  239. Enabled: false,
  240. },
  241. Bank: {
  242. AccountName: '',
  243. AccountNO: '',
  244. Name: '',
  245. Sortrank: 0,
  246. Enabled: true,
  247. },
  248. Balance: {
  249. Sortrank: 0,
  250. Enabled: false,
  251. },
  252. Cod: {
  253. Sortrank: 0,
  254. Enabled: true,
  255. }
  256. }
  257. //加载系统config
  258. function getPayments() {
  259. $.get("sys_payment.php?dopost=get_payments", function (data) {
  260. if (data.code === 0) {
  261. for (const key in data.data) {
  262. if (Object.hasOwnProperty.call(data.data, key)) {
  263. const element = data.data[key];
  264. let itemConfig = {};
  265. try {
  266. itemConfig = JSON.parse(element.config);
  267. } catch (error) {
  268. itemConfig = config[key]
  269. }
  270. itemConfig.Sortrank = element.sortrank;
  271. itemConfig.Enabled = element.status === 0? false : true;
  272. console.log("itemConfig=", itemConfig);
  273. for (const k1 in config[key]) {
  274. if (Object.hasOwnProperty.call(config[key], k1)) {
  275. const ee = config[key][k1];
  276. if (typeof itemConfig[k1] === "undefined") {
  277. itemConfig[k1] = ee;
  278. }
  279. }
  280. }
  281. for (const k2 in itemConfig) {
  282. if (Object.hasOwnProperty.call(itemConfig, k2)) {
  283. const element = itemConfig[k2];
  284. if ($(`#ipt${key}${k2}`).attr('type') === 'text') {
  285. $(`#ipt${key}${k2}`).val(element);
  286. } else if ($(`#ipt${key}${k2}`).attr('type') === 'checkbox') {
  287. $(`#ipt${key}${k2}`).prop('checked', element);
  288. }
  289. }
  290. }
  291. config[key] = itemConfig;
  292. }
  293. }
  294. }
  295. })
  296. }
  297. //更新config
  298. function updateConfig() {
  299. for (const key in config) {
  300. if (Object.hasOwnProperty.call(config, key)) {
  301. const element = config[key];
  302. for (const kk in element) {
  303. if (Object.hasOwnProperty.call(element, kk)) {
  304. const itemConfig = element[kk];
  305. console.log(`#ipt${key}${kk}`, itemConfig);
  306. if ($(`#ipt${key}${kk}`).attr('type') === 'text') {
  307. let val = $(`#ipt${key}${kk}`).val();
  308. if (kk === "Sortrank") {
  309. val = parseInt(val);
  310. }
  311. config[key][kk] = val;
  312. } else if ($(`#ipt${key}${kk}`).attr('type') === 'checkbox') {
  313. config[key][kk] = $(`#ipt${key}${kk}`).prop('checked');
  314. }
  315. }
  316. }
  317. }
  318. }
  319. }
  320. //保存配置信息
  321. function saveConfig() {
  322. $.ajax({
  323. type: "post",
  324. url: 'sys_payment.php?dopost=save_config',
  325. data: JSON.stringify(config),
  326. contentType: "application/json; charset=utf-8",
  327. dataType: "json",
  328. success: function (data) {
  329. console.log(data);
  330. }
  331. })
  332. }
  333. $(document).ready(function () {
  334. getPayments();
  335. $("#btnSave").click(() => {
  336. updateConfig()
  337. saveConfig();
  338. console.log(config)
  339. })
  340. })
  341. </script>
  342. </body>
  343. </html>