config.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <form id="config-form" class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2. <div class="panel panel-default panel-intro">
  3. <div class="panel-heading">
  4. <ul class="nav nav-tabs nav-group">
  5. <li class="active"><a href="#wechat" data-toggle="tab">微信支付</a></li>
  6. <li><a href="#alipay" data-toggle="tab">支付宝</a></li>
  7. </ul>
  8. </div>
  9. <div class="panel-body">
  10. <div id="myTabContent" class="tab-content">
  11. {foreach $addon.config as $item}
  12. {if $item.name=='wechat'}
  13. <div class="tab-pane fade active in" id="wechat">
  14. <table class="table table-striped table-config">
  15. <tbody>
  16. <tr>
  17. <td width="15%">APP appid</td>
  18. <td>
  19. <div class="row">
  20. <div class="col-sm-8 col-xs-12">
  21. <input type="text" name="row[wechat][appid]" value="{$item.value.appid|default=''}" class="form-control" data-rule="" data-tip="APP应用中支付时使用"/>
  22. </div>
  23. <div class="col-sm-4"></div>
  24. </div>
  25. </td>
  26. </tr>
  27. <tr>
  28. <td>公众号的app_id</td>
  29. <td>
  30. <div class="row">
  31. <div class="col-sm-8 col-xs-12">
  32. <input type="text" name="row[wechat][app_id]" value="{$item.value.app_id|default=''}" class="form-control" data-rule="" data-tip="公众号支付必须"/>
  33. </div>
  34. <div class="col-sm-4"></div>
  35. </div>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td>公众号的app_secret</td>
  40. <td>
  41. <div class="row">
  42. <div class="col-sm-8 col-xs-12">
  43. <input type="text" name="row[wechat][app_secret]" value="{$item.value.app_secret|default=''}" class="form-control" data-rule="" data-tip="仅在需要获取Openid时使用,一般情况下为空"/>
  44. </div>
  45. <div class="col-sm-4"></div>
  46. </div>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td>小程序的app_id</td>
  51. <td>
  52. <div class="row">
  53. <div class="col-sm-8 col-xs-12">
  54. <input type="text" name="row[wechat][miniapp_id]" value="{$item.value.miniapp_id|default=''}" class="form-control" data-rule="" data-tip="仅在小程序支付时使用"/>
  55. </div>
  56. <div class="col-sm-4"></div>
  57. </div>
  58. </td>
  59. </tr>
  60. <tr>
  61. <td>微信支付商户号ID</td>
  62. <td>
  63. <div class="row">
  64. <div class="col-sm-8 col-xs-12">
  65. <input type="text" name="row[wechat][mch_id]" value="{$item.value.mch_id|default=''}" class="form-control" data-rule="" data-tip=""/>
  66. </div>
  67. <div class="col-sm-4"></div>
  68. </div>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td>微信支付商户的密钥</td>
  73. <td>
  74. <div class="row">
  75. <div class="col-sm-8 col-xs-12">
  76. <input type="text" name="row[wechat][key]" value="{$item.value.key|default=''}" class="form-control" data-rule="" data-tip=""/>
  77. </div>
  78. <div class="col-sm-4"></div>
  79. </div>
  80. </td>
  81. </tr>
  82. <tr>
  83. <td>支付模式</td>
  84. <td>
  85. <div class="row">
  86. <div class="col-sm-8 col-xs-12">
  87. {:Form::radios('row[wechat][mode]',['normal'=>'正式环境','dev'=>'沙箱环境','service'=>'服务商模式'],$item.value.mode??'normal')}
  88. </div>
  89. <div class="col-sm-4"></div>
  90. </div>
  91. </td>
  92. </tr>
  93. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  94. <td>子商户商户号ID</td>
  95. <td>
  96. <div class="row">
  97. <div class="col-sm-8 col-xs-12">
  98. <input type="text" name="row[wechat][sub_mch_id]" value="{$item.value.sub_mch_id|default=''}" class="form-control" data-rule="" data-tip="如果未用到子商户,请勿填写"/>
  99. </div>
  100. <div class="col-sm-4"></div>
  101. </div>
  102. </td>
  103. </tr>
  104. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  105. <td>子商户 APP appid</td>
  106. <td>
  107. <div class="row">
  108. <div class="col-sm-8 col-xs-12">
  109. <input type="text" name="row[wechat][sub_appid]" value="{$item.value.sub_appid|default=''}" class="form-control" data-rule="" data-tip="如果未用到子商户,请勿填写"/>
  110. </div>
  111. <div class="col-sm-4"></div>
  112. </div>
  113. </td>
  114. </tr>
  115. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  116. <td>子商户公众号的appid</td>
  117. <td>
  118. <div class="row">
  119. <div class="col-sm-8 col-xs-12">
  120. <input type="text" name="row[wechat][sub_app_id]" value="{$item.value.sub_app_id|default=''}" class="form-control" data-rule="" data-tip="如果未用到子商户,请勿填写"/>
  121. </div>
  122. <div class="col-sm-4"></div>
  123. </div>
  124. </td>
  125. </tr>
  126. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  127. <td>子商户小程序的appid</td>
  128. <td>
  129. <div class="row">
  130. <div class="col-sm-8 col-xs-12">
  131. <input type="text" name="row[wechat][sub_miniapp_id]" value="{$item.value.sub_miniapp_id|default=''}" class="form-control" data-rule="" data-tip="如果未用到子商户,请勿填写"/>
  132. </div>
  133. <div class="col-sm-4"></div>
  134. </div>
  135. </td>
  136. </tr>
  137. <tr>
  138. <td>回调通知地址</td>
  139. <td>
  140. <div class="row">
  141. <div class="col-sm-8 col-xs-12">
  142. <input type="text" name="row[wechat][notify_url]" value="{$item.value.notify_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  143. </div>
  144. <div class="col-sm-4"></div>
  145. </div>
  146. </td>
  147. </tr>
  148. <tr>
  149. <td>微信支付API证书cert</td>
  150. <td>
  151. <div class="row">
  152. <div class="col-sm-8 col-xs-12">
  153. <div class="input-group">
  154. <input id="c-cert_client" class="form-control" size="50" name="row[wechat][cert_client]" type="text" value="{$item.value.cert_client|htmlentities}" data-tip="可选, 仅在退款、红包等情况时需要用到">
  155. <div class="input-group-addon no-border no-padding">
  156. <span><button type="button" id="faupload-cert_client" class="btn btn-danger faupload" data-url="epay/upload" data-multipart='{"certname":"cert_client"}' data-mimetype="pem" data-input-id="c-cert_client" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  157. </div>
  158. <span class="msg-box n-right" for="c-cert_client"></span>
  159. </div>
  160. <div style="margin-top:5px;"><a href="https://pay.weixin.qq.com" target="_blank"><i class="fa fa-question-circle"></i> 如何获取微信支付API证书?</a></div>
  161. </div>
  162. <div class="col-sm-4"></div>
  163. </div>
  164. </td>
  165. </tr>
  166. <tr>
  167. <td>微信支付API证书key</td>
  168. <td>
  169. <div class="row">
  170. <div class="col-sm-8 col-xs-12">
  171. <div class="input-group">
  172. <input id="c-cert_key" class="form-control" size="50" name="row[wechat][cert_key]" type="text" value="{$item.value.cert_key|htmlentities}" data-tip="可选, 仅在退款、红包等情况时需要用到">
  173. <div class="input-group-addon no-border no-padding">
  174. <span><button type="button" id="faupload-cert_key" class="btn btn-danger faupload" data-url="epay/upload" data-multipart='{"certname":"cert_key"}' data-mimetype="pem" data-input-id="c-cert_key" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  175. </div>
  176. <span class="msg-box n-right" for="c-cert_key"></span>
  177. </div>
  178. <div style="margin-top:5px;"><a href="https://pay.weixin.qq.com" target="_blank"><i class="fa fa-question-circle"></i> 如何获取微信支付API证书?</a></div>
  179. </div>
  180. <div class="col-sm-4"></div>
  181. </div>
  182. </td>
  183. </tr>
  184. <tr>
  185. <td>记录日志</td>
  186. <td>
  187. <div class="row">
  188. <div class="col-sm-8 col-xs-12">
  189. {:Form::radios('row[wechat][log]',['1'=>'开启','0'=>'关闭'],$item.value.log)}
  190. </div>
  191. <div class="col-sm-4"></div>
  192. </div>
  193. </td>
  194. </tr>
  195. </tbody>
  196. </table>
  197. </div>
  198. {elseif $item.name=='alipay'}
  199. <div class="tab-pane fade" id="alipay">
  200. <table class="table table-striped table-config">
  201. <tbody>
  202. <tr>
  203. <td width="15%">应用ID(app_id)</td>
  204. <td>
  205. <div class="row">
  206. <div class="col-sm-8 col-xs-12">
  207. <input type="text" name="row[alipay][app_id]" value="{$item.value.app_id|default=''}" class="form-control" data-rule="" data-tip=""/>
  208. </div>
  209. <div class="col-sm-4"></div>
  210. </div>
  211. </td>
  212. </tr>
  213. <tr>
  214. <td>支付模式</td>
  215. <td>
  216. <div class="row">
  217. <div class="col-sm-8 col-xs-12">
  218. {:Form::radios('row[alipay][mode]',['normal'=>'正式环境','dev'=>'沙箱环境'],$item.value.mode??'normal')}
  219. </div>
  220. <div class="col-sm-4"></div>
  221. </div>
  222. </td>
  223. </tr>
  224. <tr>
  225. <td>回调通知地址</td>
  226. <td>
  227. <div class="row">
  228. <div class="col-sm-8 col-xs-12">
  229. <input type="text" name="row[alipay][notify_url]" value="{$item.value.notify_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  230. </div>
  231. <div class="col-sm-4"></div>
  232. </div>
  233. </td>
  234. </tr>
  235. <tr>
  236. <td>支付跳转地址</td>
  237. <td>
  238. <div class="row">
  239. <div class="col-sm-8 col-xs-12">
  240. <input type="text" name="row[alipay][return_url]" value="{$item.value.return_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  241. </div>
  242. <div class="col-sm-4"></div>
  243. </div>
  244. </td>
  245. </tr>
  246. <tr>
  247. <td>应用私钥(private_key)</td>
  248. <td>
  249. <div class="row">
  250. <div class="col-sm-8 col-xs-12">
  251. <input type="text" name="row[alipay][private_key]" value="{$item.value.private_key|default=''}" class="form-control" data-rule="" />
  252. <div style="margin-top:5px;"><a href="https://opensupport.alipay.com/support/helpcenter/207/201602469554" target="_blank"><i class="fa fa-question-circle"></i> 如何获取应用私钥?</a></div>
  253. </div>
  254. <div class="col-sm-4"></div>
  255. </div>
  256. </td>
  257. </tr>
  258. <tr>
  259. <td>支付宝公钥路径(ali_public_key)</td>
  260. <td>
  261. <div class="row">
  262. <div class="col-sm-8 col-xs-12">
  263. <div class="input-group">
  264. <input id="c-ali_public_key" class="form-control" size="50" name="row[alipay][ali_public_key]" type="text" value="{$item.value.ali_public_key|default=''|htmlentities}" placeholder="公钥请直接粘贴,公钥证书请点击右侧的上传">
  265. <div class="input-group-addon no-border no-padding">
  266. <span><button type="button" id="faupload-ali_public_key" class="btn btn-danger faupload" data-url="epay/upload" data-multipart='{"certname":"ali_public_key"}' data-mimetype="crt" data-input-id="c-ali_public_key" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  267. </div>
  268. <span class="msg-box n-right" for="c-ali_public_key"></span>
  269. </div>
  270. <div style="margin-top:5px;"><a href="javascript:" data-toggle="tooltip" data-title="如果要使用转账、提现功能,则必须使用公钥证书"> <i class="fa fa-info-circle"></i> 公钥和公钥证书说明</a> <a href="https://opensupport.alipay.com/support/helpcenter/207/201602471154" target="_blank"><i class="fa fa-question-circle"></i> 如何获取支付宝公钥证书?</a></div>
  271. </div>
  272. <div class="col-sm-4"></div>
  273. </div>
  274. </td>
  275. </tr>
  276. <tr>
  277. <td>应用公钥证书路径(app_cert_public_key)</td>
  278. <td>
  279. <div class="row">
  280. <div class="col-sm-8 col-xs-12">
  281. <div class="input-group">
  282. <input id="c-app_cert_public_key" class="form-control" size="50" name="row[alipay][app_cert_public_key]" type="text" value="{$item.value.app_cert_public_key|default=''|htmlentities}">
  283. <div class="input-group-addon no-border no-padding">
  284. <span><button type="button" id="faupload-app_cert_public_key" class="btn btn-danger faupload" data-url="epay/upload" data-multipart='{"certname":"app_cert_public_key"}' data-mimetype="crt" data-input-id="c-app_cert_public_key" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  285. </div>
  286. <span class="msg-box n-right" for="c-app_cert_public_key"></span>
  287. </div>
  288. <div style="margin-top:5px;"><a href="https://opensupport.alipay.com/support/helpcenter/207/201602469554" target="_blank"><i class="fa fa-question-circle"></i> 如何获取应用公钥证书?</a></div>
  289. </div>
  290. <div class="col-sm-4"></div>
  291. </div>
  292. </td>
  293. </tr>
  294. <tr>
  295. <td>支付宝根证书路径(alipay_root_cert)</td>
  296. <td>
  297. <div class="row">
  298. <div class="col-sm-8 col-xs-12">
  299. <div class="input-group">
  300. <input id="c-alipay_root_cert" class="form-control" size="50" name="row[alipay][alipay_root_cert]" type="text" value="{$item.value.alipay_root_cert|default=''|htmlentities}">
  301. <div class="input-group-addon no-border no-padding">
  302. <span><button type="button" id="faupload-alipay_root_cert" class="btn btn-danger faupload" data-url="epay/upload" data-multipart='{"certname":"alipay_root_cert"}' data-mimetype="crt" data-input-id="c-alipay_root_cert" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  303. </div>
  304. <span class="msg-box n-right" for="c-alipay_root_cert"></span>
  305. </div>
  306. <div style="margin-top:5px;"><a href="https://opensupport.alipay.com/support/helpcenter/207/201602469554" target="_blank"><i class="fa fa-question-circle"></i> 如何获取支付宝证书?</a></div>
  307. </div>
  308. <div class="col-sm-4"></div>
  309. </div>
  310. </td>
  311. </tr>
  312. <tr>
  313. <td>记录日志</td>
  314. <td>
  315. <div class="row">
  316. <div class="col-sm-8 col-xs-12">
  317. {:Form::radios('row[alipay][log]',['1'=>'开启','0'=>'关闭'],$item.value.log)}
  318. </div>
  319. <div class="col-sm-4"></div>
  320. </div>
  321. </td>
  322. </tr>
  323. <tr>
  324. <td>PC端使用扫码支付</td>
  325. <td>
  326. <div class="row">
  327. <div class="col-sm-8 col-xs-12">
  328. {:Form::radios('row[alipay][scanpay]',['1'=>'开启','0'=>'关闭'],$item.value.scanpay??0)}
  329. </div>
  330. <div class="col-sm-4"></div>
  331. </div>
  332. </td>
  333. </tr>
  334. </tbody>
  335. </table>
  336. </div>
  337. {/if}
  338. {/foreach}
  339. <div class="form-group layer-footer">
  340. <label class="control-label col-xs-12 col-sm-2"></label>
  341. <div class="col-xs-12 col-sm-8">
  342. <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  343. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  344. </div>
  345. </div>
  346. </div>
  347. </div>
  348. </div>
  349. </form>
  350. <script>
  351. document.querySelectorAll("input[name='row[wechat][mode]']").forEach(function (i, j) {
  352. i.addEventListener("click", function () {
  353. document.querySelectorAll("#wechat table tr[data-type]").forEach(function (m, n) {
  354. m.classList.add("hidden");
  355. });
  356. document.querySelectorAll("#wechat table tr[data-type='" + this.value + "']").forEach(function (m, n) {
  357. m.classList.remove("hidden");
  358. });
  359. });
  360. });
  361. </script>