国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

273 lines
11KB

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