cash_log.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. mui.init({
  2. pullRefresh: {
  3. container: '#pullrefresh',
  4. down: {},
  5. up: {contentrefresh: '正在加载...', callback: pullupRefresh}
  6. }
  7. });
  8. var count = 0, pageNumber = 0, pageSize = 15;
  9. function pullupRefresh() {
  10. pageNumber += 1;
  11. $.ajax(base_path + '/cashLog/list?dates=' + new Date().getTime(), {
  12. data: {
  13. "pageNO": pageNumber,
  14. "pageSize": pageSize
  15. },
  16. dataType: 'json',
  17. type: 'post',
  18. timeout: 15000,
  19. xhrFields: {
  20. withCredentials: true
  21. },
  22. crossDomain: true,
  23. success: function (dt) {
  24. if (dt.isRedirect) {
  25. location.href = dt.redirectURL;
  26. } else {
  27. if (dt.status) {
  28. var cash_log_list = [];
  29. var dataObj = dt.data;
  30. cash_log_list = dataObj.cashlist;
  31. pagecount = dataObj.cashlist.length;
  32. if (dataObj.userIncome != null && typeof(dataObj.userIncome) != "undefined" && dataObj.userIncome != '') {
  33. var income = accDiv(dataObj.userIncome, 100);
  34. $("#userIncome").html(income)
  35. }
  36. mui('#pullrefresh').pullRefresh().endPullupToRefresh(cash_log_list.length < pageSize);
  37. var table = document.body.querySelector('.my-tab-view-pull');
  38. var resType = "";
  39. var mark = "";
  40. mui(cash_log_list).each(function (index) {
  41. var li = document.createElement('li');
  42. li.className = 'mui-table-view-cell';
  43. switch (this.cashLogsResType) {
  44. case 1:
  45. resType = "订单收入";
  46. mark = "+";
  47. break;
  48. case 2:
  49. resType = "提现支出";
  50. mark = "-";
  51. break;
  52. case 3:
  53. resType = "订单支出";
  54. mark = "-";
  55. break;
  56. case 4:
  57. resType = "线下返利";
  58. mark = "+";
  59. break;
  60. case 5:
  61. resType = "退订返还";
  62. mark = "+";
  63. break;
  64. case 6:
  65. resType = "任务奖励";
  66. mark = "+";
  67. break;
  68. default:
  69. resType = ""
  70. }
  71. li.innerHTML = '<span>' + this.cashLogsCreateDate + '</span><span>' + mark + accDiv(this.cashLogsNum, 100) + '元</span><font class="mui-badge mui-badge-inverted">' + resType + '</font>';
  72. table.appendChild(li)
  73. })
  74. }
  75. }
  76. }, error: function (xhr, type, errorThrown) {
  77. errorfn(xhr)
  78. }
  79. })
  80. };mui.ready(function () {
  81. getCartNum();
  82. mui('#pullrefresh').pullRefresh().pullupLoading();
  83. document.querySelector('.loading-bg').style.display = 'none'
  84. });