国内流行的内容管理系统(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.

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