withdrawal_list.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. layui.use(['table', 'jquery', 'madmin', 'mhttp', 'layer', 'form', 'common', 'laydate'], function () {
  2. let table = layui.table;
  3. let $ = layui.jquery;
  4. let admin = layui.madmin;
  5. let layer = layui.layer;
  6. let form = layui.form;
  7. let common = layui.common;
  8. let mhttp = layui.mhttp;
  9. let laydate = layui.laydate;
  10. admin.getConfig();
  11. laydate.render({
  12. type: 'datetime',
  13. elem: '#start_date'
  14. });
  15. laydate.render({
  16. type: 'datetime',
  17. elem: '#end_date'
  18. });
  19. let beginTime = null;
  20. if (GetQueryString('start_date')){
  21. beginTime = GetQueryString('start_date');
  22. }
  23. let endTime = null;
  24. if (GetQueryString('end_date')){
  25. endTime = GetQueryString('end_date');
  26. }
  27. //搜索条件
  28. form.on('submit(search)', function (data) {
  29. if (data.field.start_date !== '' || data.field.end_date !== '') {
  30. if (!data.field.start_date || !data.field.end_date) {
  31. layer.msg('请核对开始时间与结束时间!');
  32. return false;
  33. }
  34. let beginTime = new Date(data.field.start_date);
  35. let endTime = new Date(data.field.end_date);
  36. if (beginTime > endTime) {
  37. layer.msg('开始时间不能大于结束时间!');
  38. return false;
  39. }
  40. }
  41. // return false;
  42. });
  43. if (beginTime) {
  44. beginTime = beginTime.replace('+', ' ');
  45. }
  46. if (endTime) {
  47. endTime = endTime.replace('+', ' ');
  48. }
  49. $('#start_date').val(beginTime);
  50. $('#end_date').val(endTime);
  51. form.render();
  52. let search = httpRequestPostData({
  53. start_date: beginTime,
  54. end_date: endTime,
  55. });
  56. let cols = [
  57. [
  58. {
  59. title: 'UID',
  60. field: 'uid',
  61. align: 'center'
  62. },
  63. {
  64. title: '提现时间',
  65. field: 'created_at',
  66. align: 'center'
  67. },
  68. {
  69. title: '提现方式',
  70. field: 'type_name',
  71. align: 'center'
  72. },
  73. {
  74. title: '提现金额',
  75. field: 'pay_amount',
  76. align: 'center',
  77. },
  78. {
  79. title: '状态',
  80. templet: function (d) {
  81. switch (d.status) {
  82. case 1:
  83. return '<span class="status-type" style="color:#d30d3d;font-weight: 900">拒绝</span>';
  84. case 2:
  85. return '<span class="status-type" style="color:#de8e17;font-weight: 900">申请中</span>';
  86. case 3:
  87. return '<span class="status-type" style="color:#3f9f05;font-weight: 900">已打款</span>';
  88. case 4:
  89. return '<span class="status-type" style="color:#0ea88c;font-weight: 900">拒接并扣除</span>';
  90. }
  91. },
  92. align: 'center'
  93. }
  94. ]
  95. ];
  96. table.render({
  97. elem: '#withdraw-table',
  98. method: 'POST',
  99. request: {
  100. pageName: 'page',
  101. limitName: 'page_size'
  102. },
  103. where: search,
  104. async: false,
  105. headers: {
  106. "AUTH-TOKEN": localStorage.getItem('XSRF-TOKEN')
  107. },
  108. contentType: 'application/json',
  109. url: getMyApiUrl('/withdraw/lists'),
  110. limit: 20,
  111. limits: [20, 30, 40, 50, 80, 100],
  112. parseData: function (res) {
  113. if (res.data.announce.length > 0) {
  114. html = '<p>提现公告:</p>';
  115. for (let i in res.data.announce) {
  116. let item = res.data.announce[i];
  117. html += '<p>(' + (parseInt(i) + 1) + ') ' + item.content + '</p>';
  118. }
  119. $('.announce').html(html);
  120. $('.announce').css('display','block');
  121. }
  122. $('.content-info span').text(res.data.account_info.balance);
  123. $('.money-info span').text(res.data.account_info.withdraw_balance);
  124. return httpRequestPagesParseData(res);
  125. },
  126. response: {
  127. "statusCode": 200,
  128. },
  129. done: function (data, page, total) {
  130. var intCode = parseInt(data.code);
  131. if (intCode === 403) {
  132. cbRespnseRedirectLogin(data);
  133. } else if (intCode === 401) {
  134. cbRespnse401(data);
  135. }
  136. onloadRender();
  137. },
  138. error: function (obj, message) {
  139. cbRespnseReloadPage(obj, message);
  140. },
  141. page: true,
  142. cols: cols,
  143. skin: 'line'
  144. });
  145. $('#create').click(function () {
  146. window.create();
  147. });
  148. window.create = function () {
  149. layer.open({
  150. id: 'withdraw_create',
  151. type: 2,
  152. title: '提现',
  153. shade: 0.1,
  154. offset: '20px',
  155. area: ['410px', '400px'],
  156. maxWidth: 500,
  157. maxHeight: 600,
  158. scrollbar: true,
  159. content: 'withdrawal_create.html',
  160. });
  161. }
  162. });