config.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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的app_id</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的app_id</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>子商户公众号的app_id</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>子商户小程序的app_id</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>支付模式</td>
  204. <td>
  205. <div class="row">
  206. <div class="col-sm-12 col-xs-12">
  207. {:Form::radios('row[alipay][mode]',['normal'=>'正式环境','dev'=>'沙箱环境'],$item.value.mode??'normal')}
  208. <div style="margin-top:5px;" data-mode="dev" class="text-muted {if ($item.value.mode??'')==='normal'}hidden{/if}">
  209. <i class="fa fa-info-circle"></i> 如果使用沙箱环境,务必使用沙箱的app_id和沙箱证书,以及使用沙箱账号进行测试。<br>
  210. 沙箱环境:<a href="https://openhome.alipay.com/develop/sandbox/app" target="_blank">https://openhome.alipay.com/develop/sandbox/app</a>
  211. </div>
  212. </div>
  213. </div>
  214. </td>
  215. </tr>
  216. <tr>
  217. <td width="15%">应用ID(app_id)</td>
  218. <td>
  219. <div class="row">
  220. <div class="col-sm-8 col-xs-12">
  221. <input type="text" name="row[alipay][app_id]" value="{$item.value.app_id|default=''}" class="form-control" data-rule="" data-tip=""/>
  222. </div>
  223. <div class="col-sm-4"></div>
  224. </div>
  225. </td>
  226. </tr>
  227. <tr>
  228. <td>回调通知地址</td>
  229. <td>
  230. <div class="row">
  231. <div class="col-sm-8 col-xs-12">
  232. <input type="text" name="row[alipay][notify_url]" value="{$item.value.notify_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  233. </div>
  234. <div class="col-sm-4"></div>
  235. </div>
  236. </td>
  237. </tr>
  238. <tr>
  239. <td>支付跳转地址</td>
  240. <td>
  241. <div class="row">
  242. <div class="col-sm-8 col-xs-12">
  243. <input type="text" name="row[alipay][return_url]" value="{$item.value.return_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  244. </div>
  245. <div class="col-sm-4"></div>
  246. </div>
  247. </td>
  248. </tr>
  249. <tr>
  250. <td>应用私钥(private_key)</td>
  251. <td>
  252. <div class="row">
  253. <div class="col-sm-8 col-xs-12">
  254. <input type="text" name="row[alipay][private_key]" value="{$item.value.private_key|default=''}" class="form-control" data-rule=""/>
  255. <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>
  256. </div>
  257. <div class="col-sm-4"></div>
  258. </div>
  259. </td>
  260. </tr>
  261. <tr>
  262. <td>签名方式</td>
  263. <td>
  264. <div>
  265. <div class="radio">
  266. <label for="row[alipay][signtype]-publickey"><input id="row[alipay][signtype]-publickey" name="row[alipay][signtype]" {if isset($item.value.signtype)&&$item.value.signtype=='publickey'}checked{/if} type="radio" value="publickey"> 公钥</label>
  267. <label for="row[alipay][signtype]-cert"><input id="row[alipay][signtype]-cert" {if isset($item.value.signtype)&&$item.value.signtype=='cert'}checked{/if} name="row[alipay][signtype]" type="radio" value="cert"> 公钥证书</label>
  268. </div>
  269. </div>
  270. <div style="margin-top:5px;" class="text-muted">
  271. <i class="fa fa-info-circle"></i> 如果要使用转账、提现功能,则必须使用公钥证书
  272. </div>
  273. </td>
  274. </tr>
  275. <tr>
  276. <td>支付宝公钥路径(alipay_public_key)</td>
  277. <td>
  278. <div class="row">
  279. <div class="col-sm-8 col-xs-12">
  280. <div class="input-group">
  281. <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="公钥请直接粘贴,公钥证书请点击右侧的上传">
  282. <div class="input-group-addon no-border no-padding">
  283. <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>
  284. </div>
  285. <span class="msg-box n-right" for="c-ali_public_key"></span>
  286. </div>
  287. <div style="margin-top:5px;"><a href="https://opensupport.alipay.com/support/helpcenter/271/201602474998" target="_blank"><i class="fa fa-question-circle"></i> 如何获取支付宝公钥证书?</a></div>
  288. </div>
  289. <div class="col-sm-4"></div>
  290. </div>
  291. </td>
  292. </tr>
  293. <tr>
  294. <td>应用公钥证书路径(app_cert_public_key)</td>
  295. <td>
  296. <div class="row">
  297. <div class="col-sm-8 col-xs-12">
  298. <div class="input-group">
  299. <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}">
  300. <div class="input-group-addon no-border no-padding">
  301. <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>
  302. </div>
  303. <span class="msg-box n-right" for="c-app_cert_public_key"></span>
  304. </div>
  305. <div style="margin-top:5px;"><a href="https://opensupport.alipay.com/support/helpcenter/271/201602474998" target="_blank"><i class="fa fa-question-circle"></i> 如何获取应用公钥证书?</a></div>
  306. </div>
  307. <div class="col-sm-4"></div>
  308. </div>
  309. </td>
  310. </tr>
  311. <tr>
  312. <td>支付宝根证书路径(alipay_root_cert)</td>
  313. <td>
  314. <div class="row">
  315. <div class="col-sm-8 col-xs-12">
  316. <div class="input-group">
  317. <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}">
  318. <div class="input-group-addon no-border no-padding">
  319. <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>
  320. </div>
  321. <span class="msg-box n-right" for="c-alipay_root_cert"></span>
  322. </div>
  323. <div style="margin-top:5px;"><a href="https://opensupport.alipay.com/support/helpcenter/271/201602474998" target="_blank"><i class="fa fa-question-circle"></i> 如何获取支付宝证书?</a></div>
  324. </div>
  325. <div class="col-sm-4"></div>
  326. </div>
  327. </td>
  328. </tr>
  329. <tr>
  330. <td>记录日志</td>
  331. <td>
  332. <div class="row">
  333. <div class="col-sm-8 col-xs-12">
  334. {:Form::radios('row[alipay][log]',['1'=>'开启','0'=>'关闭'],$item.value.log)}
  335. </div>
  336. <div class="col-sm-4"></div>
  337. </div>
  338. </td>
  339. </tr>
  340. <tr>
  341. <td>PC端使用扫码支付</td>
  342. <td>
  343. <div class="row">
  344. <div class="col-sm-8 col-xs-12">
  345. {:Form::radios('row[alipay][scanpay]',['1'=>'开启','0'=>'关闭'],$item.value.scanpay??0)}
  346. </div>
  347. <div class="col-sm-4"></div>
  348. </div>
  349. </td>
  350. </tr>
  351. </tbody>
  352. </table>
  353. </div>
  354. {/if}
  355. {/foreach}
  356. <div class="form-group layer-footer">
  357. <label class="control-label col-xs-12 col-sm-2"></label>
  358. <div class="col-xs-12 col-sm-8">
  359. <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
  360. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  361. </div>
  362. </div>
  363. </div>
  364. </div>
  365. </div>
  366. </form>
  367. <script>
  368. document.querySelectorAll("input[name='row[wechat][mode]']").forEach(function (i, j) {
  369. i.addEventListener("click", function () {
  370. document.querySelectorAll("#wechat table tr[data-type]").forEach(function (m, n) {
  371. m.classList.add("hidden");
  372. });
  373. document.querySelectorAll("#wechat table tr[data-type='" + this.value + "']").forEach(function (m, n) {
  374. m.classList.remove("hidden");
  375. });
  376. });
  377. });
  378. document.querySelectorAll("input[name='row[alipay][mode]']").forEach(function (i, j) {
  379. i.addEventListener("click", function () {
  380. document.querySelectorAll("#alipay [data-mode]").forEach(function (m, n) {
  381. m.classList.add("hidden");
  382. });
  383. document.querySelectorAll("#alipay [data-mode='" + this.value + "']").forEach(function (m, n) {
  384. m.classList.remove("hidden");
  385. });
  386. });
  387. });
  388. </script>