wallet-withdraw.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta name="author" content=""/>
  6. <meta name="description" content=""/>
  7. <meta name="keywords" content="扫码支付,线上投币,运营数据,物联网"/>
  8. <meta name="format-detection" content="telephone=no,email=no"/>
  9. <meta name="viewport"
  10. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
  11. <meta http-equiv="pragma" content="no-cache">
  12. <meta http-equiv="cache-control" content="no-cache">
  13. <meta http-equiv="expires" content="0">
  14. <title>提现</title>
  15. <link rel="stylesheet" href="https://cdn.washpayer.com/components/lib/mui.min.css"/>
  16. <link rel="stylesheet" href="/components/custom/css/common.css"/>
  17. <link rel="stylesheet" href="/app/css/xyf.common.min.css">
  18. <style>
  19. </style>
  20. </head>
  21. <body class="wallet-withdraw-page">
  22. <h5 class="padding-10 margin-0 " onclick="help()"><span class="help-title" style="line-height: 1.4">小提示:提现到微信可快速到账</span></h5>
  23. <div class="mui-input-group wallet-withdraw">
  24. <div class="mui-input-row autoheight">
  25. <p class="outway mui-navigate-right padding-l-r-15" id="payType" onclick="showPayType()"></p>
  26. </div>
  27. <div class="mui-input-row padding-l-r-15 autoheight">
  28. <p class="outmoney"><span class="amountUnit">&yen;</span>
  29. <input type="number" class="" id="amount" maxlength="12" placeholder="" autocomplete="off"
  30. autocapitalize="off"
  31. autocorrect="off" spellcheck="false"
  32. onkeypress="return myNumberic(event)">
  33. </p>
  34. <div class="amount-all c-blue" onclick="allAmount()">全部</div>
  35. </div>
  36. <div class="mui-input-row" onclick="actualPayTip()">
  37. <p class="font-13 padding-l-r-15" style="width: 100% !important;">
  38. 实际到账 <span id="actualPay">&yen;0.00</span>
  39. <i class="c-blue mui-pull-right font-14">查看原因</i>
  40. </p>
  41. </div>
  42. </div>
  43. <div class="mui-input-group wallet-withdraw custom-top">
  44. <div class="mui-input-row">
  45. <p class="padding-l-r-15">验证手机
  46. <i class="mui-pull-right font-b-16" id="phone"></i>
  47. </p>
  48. </div>
  49. <div class="input-row code input-clear">
  50. <input id="code" type="tel" maxlength="4" placeholder="验证码">
  51. <button id="sendBtn" type="button" onclick="sendCode()">获取验证码</button>
  52. </div>
  53. </div>
  54. <div class="custom-subt">
  55. <input class="mui-btn-block disabled" type="button" id="withDrawBtn" value="提现">
  56. </div>
  57. <!-- help tips -->
  58. <div class="help-tip mui-hidden">
  59. <div class="help-card autoheight">
  60. <div class="help-bd">
  61. <h4>温馨提示</h4>
  62. <ol>
  63. <li>支付平台单笔交易服务费<span class="withdrawFeeRatio c-red">6</span> ‰;</li>
  64. <li>转账到银行卡到账需要1-3个工作日,请耐心等待;<span class="bankFeeText"></span></li>
  65. <li>转账最低金额为10元;单笔转账限额和单日转账限额由支付平台配置决定,默认单笔5000元,每日最高限额20,000元;</li>
  66. </ol>
  67. </div>
  68. <div class="help-close">我知道了</div>
  69. </div>
  70. </div>
  71. <div id="payTypeMenu" class="mui-popover mui-popover-action mui-popover-bottom">
  72. <ul class="mui-table-view">
  73. </ul>
  74. </div>
  75. <script src="https://cdn.washpayer.com/components/lib/jquery.min.js"></script>
  76. <script src="https://cdn.washpayer.com/components/lib/mui.min.js"></script>
  77. <script src="/components/custom/js/common.js"></script>
  78. <script src="/components/custom/js/iconfont.js"></script>
  79. <script src="/app/js/xyf.common.js"></script>
  80. <script>
  81. (function () {
  82. //ios返回刷新
  83. var isPageHide = false;
  84. window.addEventListener('pageshow', function () {
  85. if (isPageHide) {
  86. window.location.reload();
  87. }
  88. });
  89. window.addEventListener('pagehide', function () {
  90. isPageHide = true;
  91. });
  92. })();
  93. var sourceType = getQueryString("sourceType");
  94. var sourceId = getQueryString("sourceId");
  95. var openId = getQueryString("openId")
  96. var payBankTransFee = false;// 提现到银行卡需要收取转账手续费
  97. // 所有可用余额
  98. function allAmount() {
  99. $("#amount").val(balance).trigger("input")
  100. }
  101. // 实际到账说明
  102. function actualPayTip() {
  103. var amount = $("#amount").val();
  104. var preName = '';
  105. if (withdrawFeeRatio > 6) {
  106. preName = '代理商收取'
  107. } else {
  108. preName = '微信收取'
  109. }
  110. var text = preName + "¥" + parseFloat(amount * (withdrawFeeRatio / 1000)).toFixed(2) + ' (' + (withdrawFeeRatio / 10).toFixed(2) + "%) 手续费";
  111. if (payBankTransFee && nowPayType === 'bank') {
  112. var fee = 0
  113. if (amount > 0) {
  114. fee = parseFloat(amount * (1 / 1000))
  115. if (fee <= 0.1) {
  116. fee = 0.1
  117. }
  118. if (fee >= 25) {
  119. fee = 25
  120. }
  121. }
  122. text = preName + "¥" + parseFloat(amount * (withdrawFeeRatio / 1000) + fee).toFixed(2) + ',包含:支付平台单笔交易服务费率' + (withdrawFeeRatio / 10).toFixed(2) +
  123. '% + 转账到到银行卡交易费率' + (1 / 10).toFixed(2) + "%。"
  124. }
  125. mui.alert(text, '手续费说明')
  126. }
  127. var nowPayType = 'wechat';
  128. var nowPayName = null;
  129. var nowPayId = null;
  130. // 选择提现方式
  131. function changePayType(type, name, id) {
  132. var html = $(event.target).closest('.mui-table-view-cell').html();
  133. $("#payType").html(html).find('.pull-right').remove();
  134. mui('#payTypeMenu').popover('toggle');
  135. // 当前选中的数据
  136. nowPayType = type
  137. nowPayName = name
  138. nowPayId = id
  139. if (type === 'wechat') {
  140. $('.help-title').text('小提示:提现到微信可快速到账').parent().removeClass('top-tip-style')
  141. } else if (type === 'alipay') {
  142. } else {
  143. $('.help-title').text('小提示:提现到银行卡一般需要1-3个工作日' + (payBankTransFee ? ';微信额外收取0.1%转账到银行卡手续费,最低0.1元,最高25元。' : '')).parent().addClass('top-tip-style')
  144. }
  145. computeFee()
  146. }
  147. // 展示可用提现方式
  148. function showPayType() {
  149. mui('#payTypeMenu').popover('toggle');
  150. }
  151. // 没有银行卡的情况去添加银行卡
  152. function goAddCard() {
  153. goPage("/dealer/index.html?#/wallet/banks")
  154. }
  155. // 去绑定支付宝
  156. function goBindAlipay() {
  157. goPage("./wallet-bind-alipay.html", {realName: supportAlipay.realName, loginId: supportAlipay.loginId})
  158. }
  159. //help
  160. function help() {
  161. $('.help-tip').removeClass('mui-hidden');
  162. $('body').on('touchmove', function (e) {
  163. e.preventDefault();
  164. })
  165. $(".help-close").tap(function () {
  166. $('.help-tip').addClass('mui-hidden');
  167. $('body').off('touchmove');
  168. return false;
  169. });
  170. }
  171. var sendBtn = document.getElementById('sendBtn');
  172. function sendCode() {
  173. $('.help-title').text('小提示:验证码的获取次数一天不能超过10次').parent().addClass('top-tip-style')
  174. var url = "/dealer/getWithdrawCode";
  175. var data = {};
  176. var t = 60;
  177. sendBtn.innerHTML = t + " s";
  178. sendBtn.disabled = true;
  179. sendRequest(url, "GET", data, function (res) {
  180. if (res.result == 1) {
  181. mui.toast("发送成功 <br>小提示:验证码的获取次数一天不能超过10次");
  182. var interval = setInterval(function () {
  183. if (t == 0) {
  184. sendBtn.innerHTML = "重新获取";
  185. sendBtn.disabled = false;
  186. clearInterval(interval);
  187. } else {
  188. t -= 1;
  189. sendBtn.innerHTML = t + " s";
  190. sendBtn.disabled = true;
  191. }
  192. }, 1000);
  193. } else {
  194. mui.toast(res.description);
  195. }
  196. });
  197. }
  198. var balance = 0;
  199. var withdrawFeeRatio = 6;
  200. var support = {};
  201. var supportAlipay = {};
  202. $(function () {
  203. var url = "/dealer/getWalletWithdrawInfo";
  204. sendRequest(url, "GET", {sourceType: sourceType, sourceId: sourceId}, function (res) {
  205. if (res.result == 1) {
  206. var payload = res.payload
  207. support = payload.support || {}
  208. supportAlipay = support.alipay || {}
  209. $("#amount").attr('placeholder', "余额" + payload.balance);
  210. balance = payload.balance
  211. withdrawFeeRatio = payload.withdrawFeeRatio;
  212. if (withdrawFeeRatio > 6) {
  213. $(".serviceFeeName").text('代理商收取')
  214. } else {
  215. $(".serviceFeeName").text('微信收取')
  216. }
  217. $(".withdrawFeeRatio").text(withdrawFeeRatio);
  218. //把注册的手机号码展示给用户
  219. var phone = payload.phone;
  220. $("#phone").text(phone);
  221. var payTypeMenu = $('#payTypeMenu .mui-table-view')
  222. var wechatText = '<i class="iconfont icon-wechat c-wechat"></i> <span>微信</span>'
  223. //默认是微信提现
  224. $("#payType").html(wechatText)
  225. var hasWe = support.wechat && support.wechat.realName
  226. var weInfo = hasWe ? ('<span class="font-b-12-8 pull-right padding-r-10">' + support.wechat.realName) : ''
  227. var wechatDom = '<li class="mui-table-view-cell" onclick="changePayType(\'wechat\')">' + wechatText + weInfo + '</li>';
  228. payTypeMenu.append(wechatDom);
  229. // ---------如果支持支付宝,则显示支付宝--------------
  230. if (support.alipay && support.alipay.support) {
  231. var ali = support.alipay
  232. var has = ali.realName && ali.loginId
  233. var fun = has ? "changePayType(\'alipay\')" : "goBindAlipay()";
  234. var dom = '<li class="mui-table-view-cell" onclick="' + fun + '"><i class="iconfont icon-alipay c-alipay"></i> <span>支付宝</span> ' +
  235. ('<div class="pull-right padding-r-10 font-b-12-8 mui-navigate-right">' + (has ? (ali.loginId + ' (' + ali.realName + ')') : '') + ' <span class="font-b-8 c-blue" onclick="goBindAlipay()">' + (has ? '去修改' : '去配置') + '</span></div>') +
  236. '</li>';
  237. payTypeMenu.append(dom);
  238. }
  239. if (support.bank && support.bank.support) {
  240. payBankTransFee = support.bank.transFee;
  241. var cardDom = '';
  242. var len = support.bank.cards.length;
  243. if (len === 0) {
  244. cardDom = ('<li class="mui-table-view-cell " onclick="goAddCard()">' +
  245. "<div class='mui-navigate-right '><i class='iconfont icon-bank-card c-blue'></i> <span>添加银行卡</span></div>" +
  246. '</li>')
  247. } else {
  248. for (var i = 0; i < len; i++) {
  249. var item = support.bank.cards[i]
  250. var bankStyle = findBankStyle(item.bankName);
  251. var iconName = bankStyle.icon;
  252. cardDom += ('<li class="mui-table-view-cell" onclick="changePayType(\'bank\',\'' + item.bankName + '\',\'' + item.accountCode + '\')">' +
  253. '<svg class="" aria-hidden="true"><use xlink:href="#' + iconName + '"></use></svg> <span>' + item.bankName + "(" + item.accountCode.substr(-4) + ")</span>" +
  254. '</li>')
  255. }
  256. }
  257. if (payBankTransFee) {
  258. $('.bankFeeText').text('微信额外收取0.1%转账银行卡手续费,最低0.1元,最高25元。')
  259. }
  260. payTypeMenu.append($(cardDom));
  261. }
  262. } else {
  263. mui.toast(res.description);
  264. }
  265. });
  266. $("#amount").on('input', function () {
  267. var amount = $("#amount").val();
  268. if (amount === '') {
  269. $("#withDrawBtn").addClass('disabled').attr('disabled', true);
  270. $("#amount").removeClass('active')
  271. } else {
  272. $("#withDrawBtn").removeClass('disabled').attr('disabled', false);
  273. $("#amount").addClass('active')
  274. }
  275. computeFee()
  276. });
  277. var submitFlag = false;
  278. $("#withDrawBtn").click(function () {
  279. if (!nowPayType) {
  280. mui.toast("请选择要提现的账户");
  281. return;
  282. }
  283. if ($("#amount").val() < 10) {
  284. mui.toast("最低提现金额10元");
  285. return;
  286. }
  287. if ($("#amount").val() > 20000) {
  288. mui.toast("最高提现金额2万元");
  289. return;
  290. }
  291. var code = $("#code").val();
  292. //检查验证码
  293. var codeReg = /^\d{4}$/;
  294. if (!codeReg.test(code)) {
  295. mui.toast("请输入正确的验证码");
  296. return;
  297. }
  298. if (!submitFlag) {
  299. showLoading('提现中...');
  300. submitFlag = true;
  301. var data = {
  302. code: code,
  303. sourceType: sourceType,
  304. sourceId: sourceId,
  305. payType: nowPayType,
  306. amount: parseFloat($("#amount").val()).toFixed(2),
  307. bankName: nowPayName,
  308. bankAccount: nowPayId,
  309. openId: openId
  310. };
  311. var url = "/dealer/withdraw";
  312. sendRequest(url, "POST", data, function (res) {
  313. hideLoading();
  314. if (res.result == 1) {
  315. var url = "wallet-transactions-details.html?back=2&paymentId=" + res.para.paymentId;
  316. goPage(url);
  317. } else if (res.result == 2) {
  318. submitFlag = false;
  319. mui.confirm('您的姓名和微信实名认证不匹配,是否去修改?', '温馨提示', ['取消', '确认'], function (e) {
  320. if (e.index == 1) {
  321. var url = "new-info.html";
  322. goPage(url);
  323. }
  324. });
  325. } else if (res.result == 3) {
  326. // 余额不足?
  327. submitFlag = false;
  328. mui.toast(res.description || '余额不足');
  329. } else if (res.result == 4) {
  330. submitFlag = false;
  331. mui.alert("您的微信尚未实名认证,请去微信绑定银行卡或身份证完成实名认证", '温馨提示', '确定');
  332. } else {
  333. submitFlag = false;
  334. mui.toast(res.description);
  335. }
  336. }, "json");
  337. }
  338. });
  339. });
  340. function computeFee() {
  341. var amount = $("#amount").val();
  342. if (amount < 10) {
  343. return
  344. }
  345. var actualPay = parseFloat(amount - amount * (withdrawFeeRatio / 1000)).toFixed(2)
  346. if (payBankTransFee && nowPayType === 'bank') {
  347. var fee = parseFloat(amount * (1 / 1000))
  348. if (fee <= 0.1) {
  349. fee = 0.1
  350. }
  351. if (fee >= 25) {
  352. fee = 25
  353. }
  354. actualPay = parseFloat(amount - amount * (withdrawFeeRatio / 1000) - fee).toFixed(2)
  355. }
  356. $("#actualPay").html("&yen;&nbsp;" + actualPay);
  357. }
  358. </script>
  359. </body>
  360. </html>