123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <meta name="author" content=""/>
- <meta name="description" content=""/>
- <meta name="keywords" content="扫码支付,线上投币,运营数据,物联网"/>
- <meta name="format-detection" content="telephone=no,email=no"/>
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <title>提现</title>
- <link rel="stylesheet" href="/components/lib/mui.min.css"/>
- <link rel="stylesheet" href="/components/custom/css/common.css"/>
- <link rel="stylesheet" href="/app/css/xyf.common.min.css">
- <style>
- </style>
- </head>
- <body class="wallet-withdraw-page">
- <h5 class="padding-10 margin-0 " onclick="help()"><span class="help-title">小提示:提现到微信可快速到账</span> <i
- class="iconfont icon-help-info mui-pull-right"></i></h5>
- <div class="mui-input-group wallet-withdraw">
- <div class="mui-input-row autoheight">
- <p class="outway mui-navigate-right padding-l-r-15" id="payType" onclick="showPayType()"></p>
- </div>
- <div class="mui-input-row padding-l-r-15 autoheight">
- <p class="outmoney"><span class="amountUnit">¥</span>
- <input type="number" class="" id="amount" maxlength="12" placeholder="" autocomplete="off"
- autocapitalize="off"
- autocorrect="off" spellcheck="false"
- onkeypress="return myNumberic(event)">
- </p>
- <div class="amount-all c-blue" onclick="allAmount()">全部</div>
- </div>
- <div class="mui-input-row" onclick="actualPayTip()">
- <p class="font-13 padding-l-r-15" style="width: 100% !important;">
- 实际到账 <span id="actualPay">¥0.00</span>
- <i class="c-blue mui-pull-right font-14">查看原因</i>
- </p>
- </div>
- </div>
- <div class="mui-input-group wallet-withdraw custom-top">
- <div class="mui-input-row">
- <p class="padding-l-r-15">验证手机
- <i class="mui-pull-right font-b-16" id="phone"></i>
- </p>
- </div>
- <div class="input-row code input-clear">
- <input id="code" type="tel" maxlength="4" placeholder="验证码">
- <button id="sendBtn" type="button" onclick="sendCode()">获取验证码</button>
- </div>
- </div>
- <div class="custom-subt">
- <input class="mui-btn-block disabled" type="button" id="withDrawBtn" value="提现">
- </div>
- <!-- help tips -->
- <div class="help-tip mui-hidden">
- <div class="help-card autoheight">
- <div class="help-bd">
- <h4>温馨提示</h4>
- <ol>
- <li>支付平台单笔交易服务费<span class="withdrawFeeRatio c-red">6</span> ‰;</li>
- <li>转账到银行卡到账需要1-3个工作日,请耐心等待;<span class="bankFeeText"></span></li>
- <li>转账最低金额为10元;单笔转账限额和单日转账限额由支付平台配置决定,默认单笔5000元,每日最高限额20,000元;</li>
- </ol>
- </div>
- <div class="help-close">我知道了</div>
- </div>
- </div>
- <div id="payTypeMenu" class="mui-popover mui-popover-action mui-popover-bottom">
- <ul class="mui-table-view">
- </ul>
- </div>
- <script src="/components/lib/jquery.min.js"></script>
- <script src="/components/lib/mui.min.js"></script>
- <script src="/components/custom/js/common.js"></script>
- <script src="/components/custom/js/iconfont.js"></script>
- <script src="/app/js/xyf.common.js"></script>
- <script>
- (function () {
- //ios返回刷新
- var isPageHide = false;
- window.addEventListener('pageshow', function () {
- if (isPageHide) {
- window.location.reload();
- }
- });
- window.addEventListener('pagehide', function () {
- isPageHide = true;
- });
- })();
- var sourceType = getQueryString("sourceType");
- var sourceId = getQueryString("sourceId");
- var openId = getQueryString("openId")
- var payBankTransFee = false;// 提现到银行卡需要收取转账手续费
- // 所有可用余额
- function allAmount() {
- $("#amount").val(balance).trigger("input")
- }
- // 实际到账说明
- function actualPayTip() {
- var amount = $("#amount").val();
- var feeRatio = withdrawFeeRatio;
- if (sourceType === 'withdraw') {
- feeRatio = 0;
- }
- var preName = '';
- if (feeRatio > 6) {
- preName = '代理商收取'
- } else {
- preName = '微信收取'
- }
- var text = preName + "¥" + parseFloat(amount * (feeRatio / 1000)).toFixed(2) + ' (' + (feeRatio / 10).toFixed(2) + "%) 手续费";
- if (payBankTransFee && nowPayType === 'bank') {
- var fee = 0
- if (amount > 0) {
- fee = parseFloat(amount * (1 / 1000))
- if (fee <= 0.1) {
- fee = 0.1
- }
- if (fee >= 25) {
- fee = 25
- }
- }
- text = preName + "¥" + parseFloat(amount * (feeRatio / 1000) + fee).toFixed(2) + ',包含:支付平台单笔交易服务费率' + (feeRatio / 10).toFixed(2) +
- '% + 转账到银行卡交易费率' + (1 / 10).toFixed(2) + "%。"
- }
- mui.alert(text, '手续费说明')
- }
- var nowPayType = 'wechat';
- var nowPayName = null;
- var nowPayId = null;
- // 选择提现方式
- function changePayType(type, name, id) {
- var html = $(event.target).closest('.mui-table-view-cell').html();
- $("#payType").html(html).find('.pull-right').remove();
- mui('#payTypeMenu').popover('toggle');
- // 当前选中的数据
- nowPayType = type
- nowPayName = name
- nowPayId = id
- if (type === 'wechat') {
- $('.help-title').text('小提示:提现到微信可快速到账').parent().removeClass('top-tip-style')
- } else if (type === 'alipay') {
- } else {
- $('.help-title').text('小提示:提现到银行一般需要1-3个工作日').parent().addClass('top-tip-style')
- }
- }
- // 展示可用提现方式
- function showPayType() {
- mui('#payTypeMenu').popover('toggle');
- }
- // 没有银行卡的情况去添加银行卡
- function goAddCard() {
- var url = "/agent/index.html?#/wallet/banks";
- goPage(url);
- }
- // 去绑定支付宝
- function goBindAlipay() {
- goPage("./wallet-bind-alipay.html", {realName: supportAlipay.realName, loginId: supportAlipay.loginId})
- }
- //help
- function help() {
- $('.help-tip').removeClass('mui-hidden');
- $('body').on('touchmove', function (e) {
- e.preventDefault();
- })
- $(".help-close").tap(function () {
- $('.help-tip').addClass('mui-hidden');
- $('body').off('touchmove');
- return false;
- });
- }
- var sendBtn = document.getElementById('sendBtn');
- function sendCode() {
- $('.help-title').text('小提示:验证码的获取次数一天不能超过10次').parent().addClass('top-tip-style')
- var url = "/agent/getWithdrawCode";
- var data = {};
- var t = 60;
- sendBtn.innerHTML = t + " s";
- sendBtn.disabled = true;
- sendRequest(url, "GET", data, function (res) {
- if (res.result == 1) {
- mui.toast("发送成功 <br>小提示:验证码的获取次数一天不能超过10次");
- var interval = setInterval(function () {
- if (t == 0) {
- sendBtn.innerHTML = "重新获取";
- sendBtn.disabled = false;
- clearInterval(interval);
- } else {
- t -= 1;
- sendBtn.innerHTML = t + " s";
- sendBtn.disabled = true;
- }
- }, 1000);
- } else {
- mui.toast(res.description);
- }
- });
- }
- var balance = 0;
- var withdrawFeeRatio = 6;
- var support = {};
- var supportAlipay = {};
- $(function () {
- var url = "/agent/getWalletWithdrawInfo";
- sendRequest(url, "GET", {sourceType: sourceType, sourceId: sourceId}, function (res) {
- if (res.result == 1) {
- var payload = res.payload
- support = payload.support || {}
- supportAlipay = support.alipay || {}
- $("#amount").attr('placeholder', "余额" + payload.balance);
- balance = payload.balance
- withdrawFeeRatio = payload.withdrawFeeRatio;
- if (withdrawFeeRatio > 6) {
- $(".serviceFeeName").text('代理商收取')
- } else {
- $(".serviceFeeName").text('微信收取')
- }
- $(".withdrawFeeRatio").text(withdrawFeeRatio);
- //把注册的手机号码展示给用户
- var phone = payload.phone;
- $("#phone").text(phone);
- var payTypeMenu = $('#payTypeMenu .mui-table-view')
- var wechatText = '<i class="iconfont icon-wechat c-wechat"></i> <span>微信</span>'
- //默认是微信提现
- $("#payType").html(wechatText)
- var hasWe = support.wechat && support.wechat.realName
- var weInfo = hasWe ? ('<span class="font-b-12-8 pull-right padding-r-10">' + support.wechat.realName) : ''
- var wechatDom = '<li class="mui-table-view-cell" onclick="changePayType(\'wechat\')">' + wechatText + weInfo + '</li>';
- payTypeMenu.append(wechatDom);
- // ---------如果支持支付宝,则显示支付宝--------------
- if (support.alipay && support.alipay.support) {
- var ali = support.alipay
- var has = ali.realName && ali.loginId
- var fun = has ? "changePayType(\'alipay\')" : "goBindAlipay()";
- var dom = '<li class="mui-table-view-cell" onclick="' + fun + '"><i class="iconfont icon-alipay c-alipay"></i> <span>支付宝</span> ' +
- ('<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>') +
- '</li>';
- payTypeMenu.append(dom);
- }
- if (support.bank && support.bank.support) {
- payBankTransFee = support.bank.transFee;
- var cardDom = '';
- var len = support.bank.cards.length;
- if (len === 0) {
- cardDom = ('<li class="mui-table-view-cell " onclick="goAddCard()">' +
- "<div class='mui-navigate-right '><i class='iconfont icon-bank-card c-blue'></i> <span>添加银行卡</span></div>" +
- '</li>')
- } else {
- for (var i = 0; i < len; i++) {
- var item = support.bank.cards[i]
- var bankStyle = findBankStyle(item.bankName);
- var iconName = bankStyle.icon;
- cardDom += ('<li class="mui-table-view-cell" onclick="changePayType(\'bank\',\'' + item.bankName + '\',\'' + item.accountCode + '\')">' +
- '<svg class="" aria-hidden="true"><use xlink:href="#' + iconName + '"></use></svg> <span>' + item.bankName + "(" + item.accountCode.substr(-4) + ")</span>" +
- '</li>')
- }
- }
- if (payBankTransFee) {
- $('.bankFeeText').text('转账到银行卡,微信额外收取0.1%手续费,最低0.1元,最高25元。')
- }
- payTypeMenu.append(cardDom);
- }
- } else {
- mui.toast(res.description);
- }
- });
- $("#amount").on('input', function () {
- var amount = $("#amount").val();
- if (amount === '') {
- $("#withDrawBtn").addClass('disabled').attr('disabled', true);
- $("#amount").removeClass('active')
- } else {
- $("#withDrawBtn").removeClass('disabled').attr('disabled', false);
- $("#amount").addClass('active')
- }
- computeFee()
- });
- var submitFlag = false;
- $("#withDrawBtn").click(function () {
- if (!nowPayType) {
- mui.toast("请选择要提现的账户");
- return;
- }
- if ($("#amount").val() < 10) {
- mui.toast("最低提现金额10元");
- return;
- }
- if ($("#amount").val() > 20000) {
- mui.toast("最高提现金额2万元");
- return;
- }
- var code = $("#code").val();
- //检查验证码
- var codeReg = /^\d{4}$/;
- if (!codeReg.test(code)) {
- mui.toast("请输入正确的验证码");
- return;
- }
- if (!submitFlag) {
- showLoading('提现中...');
- submitFlag = true;
- var data = {
- code: code,
- sourceType: sourceType,
- sourceId: sourceId,
- openId: openId,
- payType: nowPayType,
- amount: parseFloat($("#amount").val()).toFixed(2),
- bankName: nowPayName,
- bankAccount: nowPayId
- };
- var url = "/agent/withdraw";
- sendRequest(url, "POST", data, function (res) {
- hideLoading();
- if (res.result == 1) {
- var url = "wallet-transactions-details.html?back=2&paymentId=" + res.para.paymentId;
- goPage(url);
- }
- else if (res.result == 2) {
- submitFlag = false;
- mui.confirm('您的姓名和微信实名认证不匹配,是否去修改?', '温馨提示', ['取消', '确认'], function (e) {
- if (e.index == 1) {
- var url = "new-info.html";
- goPage(url);
- }
- });
- }
- else if (res.result == 3) {
- // 余额不足?
- submitFlag = false;
- mui.toast(res.description || '余额不足');
- }
- else if (res.result == 4) {
- submitFlag = false;
- mui.alert("您的微信尚未实名认证,请去微信绑定银行卡或身份证完成实名认证", '温馨提示', '确定');
- } else {
- submitFlag = false;
- mui.toast(res.description);
- }
- }, "json");
- }
- });
- });
- function computeFee() {
- var amount = $("#amount").val();
- if (amount < 10) {
- return
- }
- var feeRatio = withdrawFeeRatio;
- if (sourceType === 'withdraw') {
- feeRatio = 0;
- }
- var actualPay = parseFloat(amount - amount * (feeRatio / 1000)).toFixed(2)
- if (payBankTransFee && nowPayType === 'bank') {
- var fee = 0
- if (amount > 0) {
- fee = parseFloat(amount * (1 / 1000))
- if (fee <= 0.1) {
- fee = 0.1
- }
- if (fee >= 25) {
- fee = 25
- }
- }
- actualPay = parseFloat(amount - amount * (feeRatio / 1000) - fee).toFixed(2)
- }
- $("#actualPay").html("¥ " + actualPay);
- }
- </script>
- </body>
- </html>
|