wallet-withdraw.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. var sourceType = getQueryString("sourceType");
  82. var sourceId = getQueryString("sourceId");
  83. var openId = getQueryString("openId")
  84. var payBankTransFee = false;// 提现到银行卡需要收取转账手续费
  85. // 所有可用余额
  86. function allAmount() {
  87. $("#amount").val(balance).trigger("input")
  88. }
  89. // 实际到账说明
  90. function actualPayTip() {
  91. var amount = $("#amount").val();
  92. var preName = '';
  93. if (withdrawFeeRatio > 6) {
  94. preName = '代理商收取'
  95. } else {
  96. preName = '微信收取'
  97. }
  98. var text = preName + "¥" + parseFloat(amount * (withdrawFeeRatio / 1000)).toFixed(2) + ' (' + (withdrawFeeRatio / 10).toFixed(2) + "%) 手续费";
  99. if (payBankTransFee && nowPayType === 'bank') {
  100. var fee = 0
  101. if (amount > 0) {
  102. fee = parseFloat(amount * (1 / 1000))
  103. if (fee <= 0.1) {
  104. fee = 0.1
  105. }
  106. if (fee >= 25) {
  107. fee = 25
  108. }
  109. }
  110. text = preName + "¥" + parseFloat(amount * (withdrawFeeRatio / 1000) + fee).toFixed(2) + ',包含:支付平台单笔交易服务费率' + (withdrawFeeRatio / 10).toFixed(2) +
  111. '% + 转账到到银行卡交易费率' + (1 / 10).toFixed(2) + "%。"
  112. }
  113. mui.alert(text, '手续费说明')
  114. }
  115. var nowPayType = 'wechat';
  116. var nowPayName = null;
  117. var nowPayId = null;
  118. // 选择提现方式
  119. function changePayType(type, name, id) {
  120. var html = $(event.target).closest('.mui-table-view-cell').html();
  121. $("#payType").html(html).find('.pull-right').remove();
  122. mui('#payTypeMenu').popover('toggle');
  123. // 当前选中的数据
  124. nowPayType = type
  125. nowPayName = name
  126. nowPayId = id
  127. if (type === 'wechat') {
  128. $('.help-title').text('小提示:提现到微信可快速到账').parent().removeClass('top-tip-style')
  129. } else if (type === 'alipay') {
  130. } else {
  131. $('.help-title').text('小提示:提现到银行卡一般需要1-3个工作日' + (payBankTransFee ? ';微信额外收取0.1%转账到银行卡手续费,最低0.1元,最高25元。' : '')).parent().addClass('top-tip-style')
  132. }
  133. computeFee()
  134. }
  135. // 展示可用提现方式
  136. function showPayType() {
  137. mui('#payTypeMenu').popover('toggle');
  138. }
  139. // 没有银行卡的情况去添加银行卡
  140. function goAddCard() {
  141. goPage("/dealer/index.html?#/wallet/banks")
  142. }
  143. // 去绑定支付宝
  144. function goBindAlipay() {
  145. goPage("./wallet-bind-alipay.html", {realName: supportAlipay.realName, loginId: supportAlipay.loginId})
  146. }
  147. //help
  148. function help() {
  149. $('.help-tip').removeClass('mui-hidden');
  150. $('body').on('touchmove', function (e) {
  151. e.preventDefault();
  152. })
  153. $(".help-close").tap(function () {
  154. $('.help-tip').addClass('mui-hidden');
  155. $('body').off('touchmove');
  156. return false;
  157. });
  158. }
  159. var sendBtn = document.getElementById('sendBtn');
  160. function sendCode() {
  161. $('.help-title').text('小提示:验证码的获取次数一天不能超过10次').parent().addClass('top-tip-style')
  162. var url = "/dealer/getWithdrawCode";
  163. var data = {};
  164. var t = 60;
  165. sendBtn.innerHTML = t + " s";
  166. sendBtn.disabled = true;
  167. sendRequest(url, "GET", data, function (res) {
  168. if (res.result == 1) {
  169. mui.toast("发送成功 <br>小提示:验证码的获取次数一天不能超过10次");
  170. var interval = setInterval(function () {
  171. if (t == 0) {
  172. sendBtn.innerHTML = "重新获取";
  173. sendBtn.disabled = false;
  174. clearInterval(interval);
  175. } else {
  176. t -= 1;
  177. sendBtn.innerHTML = t + " s";
  178. sendBtn.disabled = true;
  179. }
  180. }, 1000);
  181. } else {
  182. mui.toast(res.description);
  183. }
  184. });
  185. }
  186. var balance = 0;
  187. var withdrawFeeRatio = 6;
  188. var support = {};
  189. var supportAlipay = {};
  190. $(function () {
  191. var url = "/dealer/getWalletWithdrawInfo";
  192. sendRequest(url, "GET", {sourceType: sourceType, sourceId: sourceId}, function (res) {
  193. if (res.result == 1) {
  194. var payload = res.payload
  195. support = payload.support || {}
  196. supportAlipay = support.alipay || {}
  197. $("#amount").attr('placeholder', "余额" + payload.balance);
  198. balance = payload.balance
  199. payBankTransFee = payload.payBankTransFee;
  200. withdrawFeeRatio = payload.withdrawFeeRatio;
  201. if (withdrawFeeRatio > 6) {
  202. $(".serviceFeeName").text('代理商收取')
  203. } else {
  204. $(".serviceFeeName").text('微信收取')
  205. }
  206. $(".withdrawFeeRatio").text(withdrawFeeRatio);
  207. //把注册的手机号码展示给用户
  208. var phone = payload.phone;
  209. $("#phone").text(phone);
  210. var payTypeMenu = $('#payTypeMenu .mui-table-view')
  211. var wechatText = '<i class="iconfont icon-wechat c-wechat"></i> <span>微信</span>'
  212. //默认是微信提现
  213. $("#payType").html(wechatText)
  214. var hasWe = support.wechat && support.wechat.realName
  215. var weInfo = hasWe ? ('<span class="font-b-12-8 pull-right padding-r-10">' + support.wechat.realName) : ''
  216. var wechatDom = '<li class="mui-table-view-cell" onclick="changePayType(\'wechat\')">' + wechatText + weInfo + '</li>';
  217. payTypeMenu.append(wechatDom);
  218. // ---------如果支持支付宝,则显示支付宝--------------
  219. if (support.alipay && support.alipay.support) {
  220. var ali = support.alipay
  221. var has = ali.realName && ali.loginId
  222. var fun = has ? "changePayType(\'alipay\')" : "goBindAlipay()";
  223. var dom = '<li class="mui-table-view-cell" onclick="' + fun + '"><i class="iconfont icon-alipay c-alipay"></i> <span>支付宝</span> ' +
  224. ('<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>') +
  225. '</li>';
  226. payTypeMenu.append(dom);
  227. }
  228. var cardDom = '';
  229. var len = payload.merchants.length;
  230. if (len === 0) {
  231. cardDom = ('<li class="mui-table-view-cell " onclick="goAddCard()">' +
  232. "<div class='mui-navigate-right '><i class='iconfont icon-bank-card c-blue'></i> <span>添加银行卡</span></div>" +
  233. '</li>')
  234. } else {
  235. for (var i=0; i<len; i++) {
  236. var item = payload.merchants[i]
  237. var bankStyle = findBankStyle(item.bankName);
  238. var iconName = bankStyle.icon;
  239. cardDom += ('<li class="mui-table-view-cell" onclick="changePayType(\'bank\',\'' + item.bankName + '\',\'' + item.bankAccount + '\')">' +
  240. '<svg class="" aria-hidden="true"><use xlink:href="#' + iconName + '"></use></svg> <span>' + item.bankName + "(" + item.bankAccount.substr(-4) + ")</span>" +
  241. '</li>')
  242. }
  243. }
  244. if (payBankTransFee) {
  245. $('.bankFeeText').text('微信额外收取0.1%转账银行卡手续费,最低0.1元,最高25元。')
  246. }
  247. payTypeMenu.append($(cardDom));
  248. } else {
  249. mui.toast(res.description);
  250. }
  251. });
  252. $("#amount").on('input', function () {
  253. var amount = $("#amount").val();
  254. if (amount === '') {
  255. $("#withDrawBtn").addClass('disabled').attr('disabled', true);
  256. $("#amount").removeClass('active')
  257. } else {
  258. $("#withDrawBtn").removeClass('disabled').attr('disabled', false);
  259. $("#amount").addClass('active')
  260. }
  261. computeFee()
  262. });
  263. var submitFlag = false;
  264. $("#withDrawBtn").click(function () {
  265. if (!nowPayType) {
  266. mui.toast("请选择要提现的账户");
  267. return;
  268. }
  269. if ($("#amount").val() < 10) {
  270. mui.toast("最低提现金额10元");
  271. return;
  272. }
  273. if ($("#amount").val() > 20000) {
  274. mui.toast("最高提现金额2万元");
  275. return;
  276. }
  277. var code = $("#code").val();
  278. //检查验证码
  279. var codeReg = /^\d{4}$/;
  280. if (!codeReg.test(code)) {
  281. mui.toast("请输入正确的验证码");
  282. return;
  283. }
  284. if (!submitFlag) {
  285. showLoading('提现中...');
  286. submitFlag = true;
  287. var data = {
  288. code: code,
  289. sourceType: sourceType,
  290. sourceId: sourceId,
  291. payType: nowPayType,
  292. amount: parseFloat($("#amount").val()).toFixed(2),
  293. bankName: nowPayName,
  294. bankAccount: nowPayId,
  295. openId: openId
  296. };
  297. var url = "/dealer/withdraw";
  298. sendRequest(url, "POST", data, function (res) {
  299. hideLoading();
  300. if (res.result == 1) {
  301. var url = "wallet-transactions-details.html?back=2&paymentId=" + res.para.paymentId;
  302. goPage(url);
  303. } else if (res.result == 2) {
  304. submitFlag = false;
  305. mui.confirm('您的姓名和微信实名认证不匹配,是否去修改?', '温馨提示', ['取消', '确认'], function (e) {
  306. if (e.index == 1) {
  307. var url = "new-info.html";
  308. goPage(url);
  309. }
  310. });
  311. } else if (res.result == 3) {
  312. // 余额不足?
  313. submitFlag = false;
  314. mui.toast(res.description || '余额不足');
  315. } else if (res.result == 4) {
  316. submitFlag = false;
  317. mui.alert("您的微信尚未实名认证,请去微信绑定银行卡或身份证完成实名认证", '温馨提示', '确定');
  318. } else {
  319. submitFlag = false;
  320. mui.toast(res.description);
  321. }
  322. }, "json");
  323. }
  324. });
  325. });
  326. function computeFee() {
  327. var amount = $("#amount").val();
  328. if (amount < 10) {
  329. return
  330. }
  331. var actualPay = parseFloat(amount - amount * (withdrawFeeRatio / 1000)).toFixed(2)
  332. if (payBankTransFee && nowPayType === 'bank') {
  333. var fee = parseFloat(amount * (1 / 1000))
  334. if (fee <= 0.1) {
  335. fee = 0.1
  336. }
  337. if (fee >= 25) {
  338. fee = 25
  339. }
  340. actualPay = parseFloat(amount - amount * (withdrawFeeRatio / 1000) - fee).toFixed(2)
  341. }
  342. $("#actualPay").html("&yen;&nbsp;" + actualPay);
  343. }
  344. </script>
  345. </body>
  346. </html>