config.html 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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=='version'}
  13. <input type="hidden" value="{$item.value}" name="row[version]"/>
  14. {elseif $item.name=='wechat'/}
  15. <div class="tab-pane fade active in" id="wechat">
  16. <table class="table table-striped table-config">
  17. <tbody>
  18. <tr>
  19. <td width="20%">APP的app_id</td>
  20. <td>
  21. <div class="row">
  22. <div class="col-sm-8 col-xs-12">
  23. <input type="text" name="row[wechat][appid]" value="{$item.value.appid|default=''}" class="form-control" data-rule="appid" data-tip="APP应用中支付时使用"/>
  24. </div>
  25. <div class="col-sm-4"></div>
  26. </div>
  27. </td>
  28. </tr>
  29. <tr>
  30. <td>公众号的app_id</td>
  31. <td>
  32. <div class="row">
  33. <div class="col-sm-8 col-xs-12">
  34. <input type="text" name="row[wechat][app_id]" value="{$item.value.app_id|default=''}" class="form-control" data-rule="appid" data-tip="公众号中支付时使用"/>
  35. </div>
  36. <div class="col-sm-4"></div>
  37. </div>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td>公众号的app_secret</td>
  42. <td>
  43. <div class="row">
  44. <div class="col-sm-8 col-xs-12">
  45. <input type="text" name="row[wechat][app_secret]" value="{$item.value.app_secret|default=''}" class="form-control" data-rule="keysecret" data-tip="公众号中支付时使用"/>
  46. </div>
  47. <div class="col-sm-4"></div>
  48. </div>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>小程序的app_id</td>
  53. <td>
  54. <div class="row">
  55. <div class="col-sm-8 col-xs-12">
  56. <input type="text" name="row[wechat][miniapp_id]" value="{$item.value.miniapp_id|default=''}" class="form-control" data-rule="appid" data-tip="仅在小程序支付时使用"/>
  57. </div>
  58. <div class="col-sm-4"></div>
  59. </div>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td>微信支付商户号</td>
  64. <td>
  65. <div class="row">
  66. <div class="col-sm-8 col-xs-12">
  67. <input type="number" name="row[wechat][mch_id]" value="{$item.value.mch_id|default=''}" class="form-control" data-rule="mchid" data-tip=""/>
  68. </div>
  69. <div class="col-sm-4"></div>
  70. </div>
  71. </td>
  72. </tr>
  73. <tr>
  74. <td>商户APIv2密钥</td>
  75. <td>
  76. <div class="row">
  77. <div class="col-sm-8 col-xs-12">
  78. <input type="text" name="row[wechat][key]" value="{$item.value.key|default=''}" class="form-control" data-rule="keysecret" data-tip="仅用于微信支付V2接口"/>
  79. </div>
  80. <div class="col-sm-4"></div>
  81. </div>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td>V3配置</td>
  86. <td>
  87. <table class="table table-config mb-0">
  88. <tbody>
  89. <!-- V3 特有字段 -->
  90. <tr>
  91. <td>商户APIv3密钥</td>
  92. <td>
  93. <div class="row">
  94. <div class="col-sm-7 col-xs-12">
  95. <input type="text" name="row[wechat][key_v3]" value="{$item.value.key_v3|default=''}" class="form-control" data-rule="keysecret" data-tip=""/>
  96. </div>
  97. <div class="col-sm-4"></div>
  98. </div>
  99. </td>
  100. </tr>
  101. <tr>
  102. <td>公钥ID</td>
  103. <td>
  104. <div class="row">
  105. <div class="col-sm-7 col-xs-12">
  106. <input type="text" name="row[wechat][public_key_id]" value="{$item.value.public_key_id|default=''}" class="form-control" data-rule="public_key_id" data-tip=""/>
  107. </div>
  108. <div class="col-sm-4"></div>
  109. </div>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td>公钥证书路径</td>
  114. <td>
  115. <div class="row">
  116. <div class="col-sm-7 col-xs-12">
  117. <div class="input-group">
  118. <input id="c-public_key" class="form-control" size="50" name="row[wechat][public_key]" type="text" value="{$item.value.public_key|htmlentities}" data-tip="可选, 仅在退款、红包等情况时需要用到">
  119. <div class="input-group-addon no-border no-padding">
  120. <span><button type="button" id="faupload-public_key" class="btn btn-danger faupload" data-url="epay/upload" data-multipart='{"certname":"public_key"}' data-mimetype="pem" data-input-id="c-public_key" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  121. </div>
  122. <span class="msg-box n-right" for="c-public_key"></span>
  123. </div>
  124. <div style="margin-top:5px;"><a href="https://pay.weixin.qq.com/doc/v3/partner/4012925323" target="_blank"><i class="fa fa-question-circle"></i> 如何获取微信支付公钥证书?</a></div>
  125. </div>
  126. <div class="col-sm-4"></div>
  127. </div>
  128. </td>
  129. </tr>
  130. </tbody>
  131. </table>
  132. </td>
  133. </tr>
  134. <tr>
  135. <td>商户API证书cert</td>
  136. <td>
  137. <div class="row">
  138. <div class="col-sm-8 col-xs-12">
  139. <div class="input-group">
  140. <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="可选, 仅在退款、红包等情况时需要用到">
  141. <div class="input-group-addon no-border no-padding">
  142. <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>
  143. </div>
  144. <span class="msg-box n-right" for="c-cert_client"></span>
  145. </div>
  146. <div style="margin-top:5px;"><a href="https://kf.qq.com/faq/161222NneAJf161222U7fARv.html" target="_blank"><i class="fa fa-question-circle"></i> 如何获取微信支付商户API证书?</a></div>
  147. </div>
  148. <div class="col-sm-4"></div>
  149. </div>
  150. </td>
  151. </tr>
  152. <tr>
  153. <td>商户API证书key</td>
  154. <td>
  155. <div class="row">
  156. <div class="col-sm-8 col-xs-12">
  157. <div class="input-group">
  158. <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="可选, 仅在退款、红包等情况时需要用到">
  159. <div class="input-group-addon no-border no-padding">
  160. <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>
  161. </div>
  162. <span class="msg-box n-right" for="c-cert_key"></span>
  163. </div>
  164. <div style="margin-top:5px;"><a href="https://kf.qq.com/faq/161222NneAJf161222U7fARv.html" target="_blank"><i class="fa fa-question-circle"></i> 如何获取微信支付商户API证书?</a></div>
  165. </div>
  166. <div class="col-sm-4"></div>
  167. </div>
  168. </td>
  169. </tr>
  170. <tr>
  171. <td>支付模式</td>
  172. <td>
  173. <div class="row">
  174. <div class="col-sm-8 col-xs-12">
  175. {:Form::radios('row[wechat][mode]',['normal'=>'正式环境','dev'=>'沙箱环境','service'=>'服务商模式'],$item.value.mode??'normal')}
  176. <div style="margin-top:5px;" data-type="dev" class="text-muted {if ($item.value.mode??'')!=='dev'}hidden{/if}">
  177. <i class="fa fa-info-circle"></i> 沙箱环境:<a href="https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=23_1&index=2" target="_blank">微信支付验收指引</a>
  178. </div>
  179. </div>
  180. <div class="col-sm-4"></div>
  181. </div>
  182. </td>
  183. </tr>
  184. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  185. <td>子商户商户号ID</td>
  186. <td>
  187. <div class="row">
  188. <div class="col-sm-8 col-xs-12">
  189. <input type="text" name="row[wechat][sub_mch_id]" value="{$item.value.sub_mch_id|default=''}" class="form-control" data-rule="mchid" data-tip="如果未用到子商户,请勿填写"/>
  190. </div>
  191. <div class="col-sm-4"></div>
  192. </div>
  193. </td>
  194. </tr>
  195. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  196. <td>子商户APP的app_id</td>
  197. <td>
  198. <div class="row">
  199. <div class="col-sm-8 col-xs-12">
  200. <input type="text" name="row[wechat][sub_appid]" value="{$item.value.sub_appid|default=''}" class="form-control" data-rule="appid" data-tip="如果未用到子商户,请勿填写"/>
  201. </div>
  202. <div class="col-sm-4"></div>
  203. </div>
  204. </td>
  205. </tr>
  206. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  207. <td>子商户公众号的app_id</td>
  208. <td>
  209. <div class="row">
  210. <div class="col-sm-8 col-xs-12">
  211. <input type="text" name="row[wechat][sub_app_id]" value="{$item.value.sub_app_id|default=''}" class="form-control" data-rule="appid" data-tip="如果未用到子商户,请勿填写"/>
  212. </div>
  213. <div class="col-sm-4"></div>
  214. </div>
  215. </td>
  216. </tr>
  217. <tr data-type="service" class="{:$item.value.mode!='service'?'hidden':''}">
  218. <td>子商户小程序的app_id</td>
  219. <td>
  220. <div class="row">
  221. <div class="col-sm-8 col-xs-12">
  222. <input type="text" name="row[wechat][sub_miniapp_id]" value="{$item.value.sub_miniapp_id|default=''}" class="form-control" data-rule="appid" data-tip="如果未用到子商户,请勿填写"/>
  223. </div>
  224. <div class="col-sm-4"></div>
  225. </div>
  226. </td>
  227. </tr>
  228. <tr>
  229. <td>回调通知地址</td>
  230. <td>
  231. <div class="row">
  232. <div class="col-sm-8 col-xs-12">
  233. <input type="text" name="row[wechat][notify_url]" value="{$item.value.notify_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  234. </div>
  235. <div class="col-sm-4"></div>
  236. </div>
  237. </td>
  238. </tr>
  239. <tr>
  240. <td>记录日志</td>
  241. <td>
  242. <div class="row">
  243. <div class="col-sm-8 col-xs-12">
  244. {:Form::radios('row[wechat][log]',['1'=>'开启','0'=>'关闭'],$item.value.log)}
  245. </div>
  246. <div class="col-sm-4"></div>
  247. </div>
  248. </td>
  249. </tr>
  250. </tbody>
  251. </table>
  252. </div>
  253. {elseif $item.name=='alipay'}
  254. <div class="tab-pane fade" id="alipay">
  255. <table class="table table-striped table-config">
  256. <tbody>
  257. <tr>
  258. <td>支付模式</td>
  259. <td>
  260. <div class="row">
  261. <div class="col-sm-12 col-xs-12">
  262. {:Form::radios('row[alipay][mode]',['normal'=>'正式环境','dev'=>'沙箱环境', 'service'=>'服务商模式'],$item.value.mode??'normal')}
  263. <div style="margin-top:5px;" data-mode="dev" class="text-muted {if ($item.value.mode??'')!=='dev'}hidden{/if}">
  264. <i class="fa fa-info-circle"></i> 如果使用沙箱环境,务必使用沙箱的app_id和沙箱配置,以及使用沙箱账号进行测试。<br>
  265. 沙箱环境:<a href="https://openhome.alipay.com/develop/sandbox/app" target="_blank">https://openhome.alipay.com/develop/sandbox/app</a>
  266. </div>
  267. </div>
  268. </div>
  269. </td>
  270. </tr>
  271. <tr class="text-muted {if ($item.value.mode??'')!=='service'}hidden{/if}" data-mode="service">
  272. <td width="20%">服务商ID(pid)</td>
  273. <td>
  274. <div class="row">
  275. <div class="col-sm-8 col-xs-12">
  276. <input type="number" name="row[alipay][pid]" value="{$item.value.pid|default=''}" class="form-control" data-rule="pid" data-tip=""/>
  277. </div>
  278. <div class="col-sm-4"></div>
  279. </div>
  280. </td>
  281. </tr>
  282. <tr>
  283. <td width="20%">应用ID(app_id)</td>
  284. <td>
  285. <div class="row">
  286. <div class="col-sm-8 col-xs-12">
  287. <input type="number" name="row[alipay][app_id]" value="{$item.value.app_id|default=''}" class="form-control" data-rule="pid" data-tip=""/>
  288. </div>
  289. <div class="col-sm-4"></div>
  290. </div>
  291. </td>
  292. </tr>
  293. <tr>
  294. <td>回调通知地址</td>
  295. <td>
  296. <div class="row">
  297. <div class="col-sm-8 col-xs-12">
  298. <input type="text" name="row[alipay][notify_url]" value="{$item.value.notify_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  299. </div>
  300. <div class="col-sm-4"></div>
  301. </div>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td>支付跳转地址</td>
  306. <td>
  307. <div class="row">
  308. <div class="col-sm-8 col-xs-12">
  309. <input type="text" name="row[alipay][return_url]" value="{$item.value.return_url|default=''}" class="form-control" data-rule="" data-tip="请勿随意修改,实际以逻辑代码中请求的为准"/>
  310. </div>
  311. <div class="col-sm-4"></div>
  312. </div>
  313. </td>
  314. </tr>
  315. <tr>
  316. <td>签名方式</td>
  317. <td>
  318. <div>
  319. <div class="radio">
  320. <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>
  321. <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>
  322. </div>
  323. </div>
  324. <div style="margin:5px 0;" class="text-muted">
  325. <i class="fa fa-info-circle"></i> 如果要使用转账、提现功能,则必须使用公钥证书
  326. </div>
  327. <div data-signtype="publickey" class="{if ($item.value.signtype??'')==='cert'}hidden{/if}">
  328. <a href="https://opensupport.alipay.com/support/FAQ/65b9c843a8e10e054512d07dprod" target="_blank"><i class="fa fa-info-circle"></i> 如何生成支付宝公钥、应用私钥?</a>
  329. </div>
  330. <div data-signtype="cert" class="{if ($item.value.signtype??'')==='publickey'}hidden{/if}">
  331. <a href="https://opensupport.alipay.com/support/FAQ/6718ab4563fae8044fe13dc7prod" target="_blank"><i class="fa fa-info-circle"></i> 支付宝公钥证书、应用公钥证书、支付宝根证书?</a>
  332. </div>
  333. </td>
  334. </tr>
  335. <tr>
  336. <td>
  337. <span data-signtype="publickey" class="{if ($item.value.signtype??'')==='cert'}hidden{/if}">支付宝公钥</span>
  338. <span data-signtype="cert" class="{if ($item.value.signtype??'')==='publickey' || ($item.value.signtype??'')==''}hidden{/if}">支付宝公钥证书路径</span>
  339. (alipay_public_key)
  340. </td>
  341. <td>
  342. <div class="row">
  343. <div class="col-sm-8 col-xs-12">
  344. <div class="input-group">
  345. <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="普通公钥请直接粘贴,公钥证书请点击上传">
  346. <div class="input-group-addon no-border no-padding {if ($item.value.signtype??'')==='publickey' || ($item.value.signtype??'')==''}hidden{/if}" data-signtype="cert">
  347. <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>
  348. </div>
  349. <span class="msg-box n-right" for="c-ali_public_key"></span>
  350. </div>
  351. </div>
  352. <div class="col-sm-4"></div>
  353. </div>
  354. </td>
  355. </tr>
  356. <tr class="{if ($item.value.signtype??'')==='publickey' || ($item.value.signtype??'')==''}hidden{/if}" data-signtype="cert">
  357. <td>
  358. <span data-signtype="publickey" class="{if ($item.value.signtype??'')==='cert'}hidden{/if}">应用公钥</span>
  359. <span data-signtype="cert" class="{if ($item.value.signtype??'')==='publickey' || ($item.value.signtype??'')==''}hidden{/if}">应用公钥证书路径</span>
  360. (app_cert_public_key)
  361. </td>
  362. <td>
  363. <div class="row">
  364. <div class="col-sm-8 col-xs-12">
  365. <div class="input-group">
  366. <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}">
  367. <div class="input-group-addon no-border no-padding {if ($item.value.signtype??'')==='publickey' || ($item.value.signtype??'')==''}hidden{/if}" data-signtype="cert">
  368. <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>
  369. </div>
  370. <span class="msg-box n-right" for="c-app_cert_public_key"></span>
  371. </div>
  372. </div>
  373. <div class="col-sm-4"></div>
  374. </div>
  375. </td>
  376. </tr>
  377. <tr class="{if ($item.value.signtype??'')==='publickey' || ($item.value.signtype??'')==''}hidden{/if}" data-signtype="cert">
  378. <td>支付宝根证书路径(alipay_root_cert)</td>
  379. <td>
  380. <div class="row">
  381. <div class="col-sm-8 col-xs-12">
  382. <div class="input-group">
  383. <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}">
  384. <div class="input-group-addon no-border no-padding">
  385. <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>
  386. </div>
  387. <span class="msg-box n-right" for="c-alipay_root_cert"></span>
  388. </div>
  389. </div>
  390. <div class="col-sm-4"></div>
  391. </div>
  392. </td>
  393. </tr>
  394. <tr>
  395. <td>应用私钥(private_key)</td>
  396. <td>
  397. <div class="row">
  398. <div class="col-sm-8 col-xs-12">
  399. <input type="text" name="row[alipay][private_key]" value="{$item.value.private_key|default=''}" class="form-control" data-rule=""/>
  400. <div style="margin-top:5px;">
  401. <span data-signtype="publickey" class="{if ($item.value.signtype??'')==='cert'}hidden{/if}">
  402. <a href="https://opensupport.alipay.com/support/FAQ/671860f40f6363044540b717prod" target="_blank"><i class="fa fa-question-circle"></i> 如何获取应用私钥?</a>
  403. </span>
  404. <span data-signtype="cert" class="{if ($item.value.signtype??'')==='publickey' || ($item.value.signtype??'')==''}hidden{/if}">
  405. <a href="https://opensupport.alipay.com/support/FAQ/6718ab4563fae8044fe13dc7prod" target="_blank"><i class="fa fa-question-circle"></i> 如何获取应用私钥?</a>
  406. </span>
  407. </div>
  408. </div>
  409. <div class="col-sm-4"></div>
  410. </div>
  411. </td>
  412. </tr>
  413. <tr>
  414. <td>记录日志</td>
  415. <td>
  416. <div class="row">
  417. <div class="col-sm-8 col-xs-12">
  418. {:Form::radios('row[alipay][log]',['1'=>'开启','0'=>'关闭'],$item.value.log)}
  419. </div>
  420. <div class="col-sm-4"></div>
  421. </div>
  422. </td>
  423. </tr>
  424. <tr>
  425. <td>PC端使用扫码支付</td>
  426. <td>
  427. <div class="row">
  428. <div class="col-sm-8 col-xs-12">
  429. {:Form::radios('row[alipay][scanpay]',['1'=>'开启','0'=>'关闭'],$item.value.scanpay??0)}
  430. </div>
  431. <div class="col-sm-4"></div>
  432. </div>
  433. </td>
  434. </tr>
  435. </tbody>
  436. </table>
  437. </div>
  438. {/if}
  439. {/foreach}
  440. <div class="form-group layer-footer">
  441. <label class="control-label col-xs-12 col-sm-2"></label>
  442. <div class="col-xs-12 col-sm-8">
  443. <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
  444. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  445. </div>
  446. </div>
  447. </div>
  448. </div>
  449. </div>
  450. </form>
  451. <script>
  452. require.callback = function () {
  453. define('backend/addon', ['backend', 'form'], function (Backend, Form) {
  454. var Controller = {
  455. config: function () {
  456. $.validator.config({
  457. rules: {
  458. appid: function (element) {
  459. if (!element.value.toString().match(/^wx[a-zA-Z0-9]{16}$/)) {
  460. return __('必须以wx开头,且长度为18位');
  461. }
  462. },
  463. keysecret: function (element) {
  464. if (!element.value.toString().match(/^[a-zA-Z0-9]{32}$/)) {
  465. return __('长度为32位,且为字母数字');
  466. }
  467. },
  468. public_key_id: function (element) {
  469. if (!element.value.toString().match(/^PUB_KEY_ID_[0-9]{34}$/)) {
  470. return __('必须以PUB_KEY_ID_开头,长度为45位');
  471. }
  472. },
  473. mchid: function (element) {
  474. if (!element.value.toString().match(/^[0-9]{8,32}$/)) {
  475. return __('长度为至少8位,且为数字');
  476. }
  477. },
  478. pid: function (element) {
  479. if (!element.value.toString().match(/^[0-9]{16}$/)) {
  480. return __('长度为16位,且为数字');
  481. }
  482. },
  483. }
  484. });
  485. $(document).on("click", ".nav-group li a[data-toggle='tab']", function () {
  486. if ($(this).attr("href") === "#all") {
  487. $(".tab-pane").addClass("active in");
  488. }
  489. return;
  490. });
  491. $(document).on("click", "input[name='row[wechat][mode]']", function () {
  492. $("#wechat [data-type]").addClass("hidden");
  493. $("#wechat [data-type='" + $(this).val() + "']").removeClass("hidden");
  494. });
  495. $(document).on("click", "input[name='row[alipay][mode]']", function () {
  496. $("#alipay [data-mode]").addClass("hidden");
  497. $("#alipay [data-mode='" + $(this).val() + "']").removeClass("hidden");
  498. });
  499. $(document).on("click", "input[name='row[alipay][signtype]']", function () {
  500. let value = $(this).val();
  501. $("#alipay [data-signtype]").addClass("hidden");
  502. $("#alipay [data-signtype='" + value + "']").removeClass("hidden");
  503. });
  504. Form.api.bindevent($("form[role=form]"), undefined, undefined, function () {
  505. let value = $("input[name='row[alipay][signtype]']:checked").val();
  506. // 如果选择了普通公钥,则需要清空未使用的应用公钥证书路径值和支付宝根证书路径值
  507. if (value === 'publickey') {
  508. $("#c-app_cert_public_key,#c-alipay_root_cert").val('');
  509. }
  510. });
  511. }
  512. };
  513. return Controller;
  514. });
  515. };
  516. </script>