tixian_log.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. mui.init({
  2. pullRefresh: {
  3. container: '#pullrefresh',
  4. down: {},
  5. up: {
  6. contentrefresh: '正在加载...',
  7. callback: pullupRefresh
  8. }
  9. }
  10. });
  11. var pageNumber = 0,
  12. pagesize = 10;
  13. function pullupRefresh() {
  14. pageNumber += 1;
  15. var btnArray = ['否', '是'];#.ajax(base_path + '/withdraw/selectUserLogs?dates=' + new Date().getTime(), {
  16. data: {
  17. "pageSize": pagesize,
  18. "pageNo": pageNumber
  19. },
  20. dataType: 'json',
  21. type: 'post',
  22. timeout: 15000,
  23. xhrFields: {
  24. withCredentials: true
  25. },
  26. crossDomain: true,
  27. success: function(dt) {
  28. if(dt.isRedirect) {
  29. location.href = dt.redirectURL;
  30. } else {
  31. if(dt.status) {
  32. var log_list = [];
  33. log_list = dt.data;
  34. mui('#pullrefresh').pullRefresh().endPullupToRefresh((log_list.lenght < pagesize));
  35. var table = document.body.querySelector('.my-tab-view-pull');
  36. mui(log_list).each(function(index) {
  37. var li = document.createElement('li');
  38. li.className = 'mui-table-view-cell';
  39. this.name == null ? this.name = "神仙哥哥" : this.name;
  40. var status = this.withdrawalsStatus;
  41. switch(status) {
  42. case 1:
  43. status = "提现成功";
  44. break;
  45. case 2:
  46. status = "提现申请中";
  47. break;
  48. default:
  49. status = "提现失败"
  50. };
  51. li.innerHTML = '<span>兑换:<span class="cl-red">¥' + accDiv(this.withdrawalsLogsAmount, 100) + '</span></span><span>-' + this.withdrawalsLogsAmount + '0积分</span><span class="mui-btn-link">' + status + '</span><font class="mui-badge mui-badge-inverted">' + this.withdrawalsLogsDate + '</font>';
  52. table.appendChild(li)
  53. })
  54. } else {
  55. mui.confirm(dt.message + '是否刷新页面?', '爱贝源-提示', btnArray, function(e) {
  56. if(e.index == 1) {
  57. location.reload(true)
  58. }
  59. })
  60. }
  61. }
  62. },
  63. error: function(xhr, type, errorThrown) {
  64. console.log(xhr)
  65. }
  66. })
  67. };
  68. mui.ready(function() {
  69. mui('#pullrefresh').pullRefresh().pullupLoading();
  70. getCartNum();
  71. document.querySelector('.loading-bg').style.display = 'none'
  72. });