wallet.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
  10. <meta http-equiv="pragma" content="no-cache">
  11. <meta http-equiv="cache-control" content="no-cache">
  12. <meta http-equiv="expires" content="0">
  13. <title>钱包</title>
  14. <link rel="stylesheet" href="https://cdn.washpayer.com/components/lib/mui.min.css">
  15. <link rel="stylesheet" href="/components/custom/css/common.css">
  16. <link rel="stylesheet" href="/app/css/xyf.common.min.css">
  17. </head>
  18. <style>
  19. .mui-popup-text {
  20. text-align: left !important;
  21. }
  22. .mui-popup-title + .mui-popup-text {
  23. margin: 10px 0 0 !important;
  24. }
  25. </style>
  26. <body>
  27. <header class="wallet-hd mui-hidden" id="balanceMod">
  28. <p class="wallet-hd-title relative">账号余额
  29. </p>
  30. <p class="wallet-hd-content"><i id="balance">0.00</i>
  31. <small>元</small>
  32. </p>
  33. </header>
  34. <div id="walletMod">
  35. </div>
  36. <main class="margin-t-b-10">
  37. <ul class="mui-table-view navigate-after account-bd">
  38. <li class="mui-table-view-cell">
  39. <a class="mui-navigate-right" href="/dealer/index.html#/merchant/settle">
  40. <i class="iconfont icon-formfill c-green"></i>结算记录
  41. </a>
  42. </li>
  43. <li class="mui-table-view-cell">
  44. <a class="mui-navigate-right" href="wallet-transactions.html">
  45. <i class="iconfont icon-formfill c-blue"></i>提现记录
  46. </a>
  47. </li>
  48. </ul>
  49. <ul class="mui-table-view navigate-after account-bd custom-top">
  50. <li class="mui-table-view-cell">
  51. <a class="mui-navigate-right" href="wallet-config.html">
  52. <i class="iconfont icon-bank-card c-orange"></i>提现配置
  53. </a>
  54. </li>
  55. <li class="mui-table-view-cell">
  56. <a class="mui-navigate-right" href="wallet-approval.html">
  57. <i class="iconfont icon-duoren c-blue"></i>提现审批配置
  58. </a>
  59. </li>
  60. </ul>
  61. </main>
  62. <script src="https://cdn.washpayer.com/components/lib/jquery.min.js"></script>
  63. <script src="https://cdn.washpayer.com/components/lib/mui.min.js"></script>
  64. <script src="/components/custom/js/common.js"></script>
  65. <script src="/app/js/xyf.common.js"></script>
  66. <script>
  67. function renderBalance(key, bg, text) {
  68. var list = walletData[key]
  69. var length = list.length
  70. for (var index in list) {
  71. var item = list[index]
  72. var dom = $(' <header class="wallet-hd ">' +
  73. ' <p class="wallet-hd-title relative">' +
  74. ' </p>' +
  75. ' <p class="wallet-hd-content"><i></i>' +
  76. ' <small>元</small>\n' +
  77. ' </p>' +
  78. ' <span class="wallet-hd-right">提现</span>' +
  79. ' </header>')
  80. dom.addClass(bg).attr({'sourceType': key || '', 'sourceId': item.id || ''})
  81. if (length === 1) {
  82. item.name = ''
  83. }
  84. dom.find('.wallet-hd-title').html(text + (item.name ? ('<em>' + item.name + '</em>') : ''))
  85. dom.find('i').text(item.balance)
  86. $('#walletMod').append(dom)
  87. }
  88. }
  89. var walletData = null
  90. var merchantTip = false
  91. //获取账号余额相关信息
  92. var urlBalance = "/dealer/walletData?random=" + Math.random() * 1000;
  93. sendRequest({
  94. url: urlBalance,
  95. type: "GET",
  96. mask: "正在加载...",//这个接口有点慢
  97. success: function (res) {
  98. if (res.result == 1) {
  99. var payload = walletData = res.payload;
  100. merchantTip = payload.merchantTip;
  101. if (payload.device) {
  102. renderBalance("device", "bg-primary", "设备营收余额")
  103. }
  104. if (payload.ad) {
  105. renderBalance("ad", "bg-orange", "广告收入余额")
  106. }
  107. // 如果没有明细,则直接渲染总余额
  108. if (payload.device || payload.ad) {
  109. } else {
  110. $("#balanceMod").removeClass('mui-hidden')
  111. }
  112. } else {
  113. mui.toast(res.description);
  114. }
  115. }
  116. })
  117. $("body").on('tap', '.wallet-hd', function (e) {
  118. var item = merchantTip
  119. if (merchantTip && merchantTip.force) {
  120. mui.confirm(item.content, item.title, ["去处理", "我知道了"], function (e) {
  121. if (e.index === 0) {
  122. // 避免ios的弹窗不关闭
  123. setTimeout(function () {
  124. location.href = item.link
  125. }, 1)
  126. } else {
  127. }
  128. });
  129. return
  130. }
  131. var sourceType = $(this).attr('sourceType')
  132. var sourceId = $(this).attr('sourceId')
  133. if (sourceId) {
  134. var redirect = '/app/wallet/wallet-withdraw.html';
  135. var url = '/dealer/withdraw/entry?sourceType=' + sourceType + '&sourceId=' + sourceId + '&redirect=' + encodeURIComponent(redirect)
  136. goPage(url);
  137. }
  138. });
  139. </script>
  140. </body>
  141. </html>