log.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: () => {
  4. const { reactive, onMounted } = Vue
  5. const index = {
  6. setup() {
  7. const state = reactive({
  8. data: [],
  9. filter: {
  10. drawer: false,
  11. data: {
  12. event: '',
  13. },
  14. tools: {
  15. event: {
  16. type: 'tselect',
  17. label: '动态类型',
  18. value: '',
  19. options: {
  20. data: [{
  21. label: '分销商',
  22. value: 'agent',
  23. },
  24. {
  25. label: '佣金',
  26. value: 'reward',
  27. },
  28. {
  29. label: '推荐',
  30. value: 'share',
  31. },
  32. {
  33. label: '绑定',
  34. value: 'bind',
  35. }],
  36. },
  37. },
  38. },
  39. condition: {},
  40. },
  41. })
  42. function getData() {
  43. let tempSearch = JSON.parse(JSON.stringify(state.filter.data));
  44. let search = composeFilter(tempSearch);
  45. Fast.api.ajax({
  46. url: 'shopro/commission/log',
  47. type: 'GET',
  48. data: {
  49. page: pagination.page,
  50. list_rows: pagination.list_rows,
  51. ...search,
  52. },
  53. }, function (ret, res) {
  54. state.data = res.data.data
  55. pagination.total = res.data.total
  56. return false
  57. }, function (ret, res) { })
  58. }
  59. function onOpenFilter() {
  60. state.filter.drawer = true
  61. }
  62. function onChangeFilter() {
  63. pagination.page = 1
  64. getData()
  65. state.filter.drawer && (state.filter.drawer = false)
  66. }
  67. const pagination = reactive({
  68. page: 1,
  69. list_rows: 10,
  70. total: 0,
  71. })
  72. const really = reactive({
  73. reallyStatus: 0,
  74. reallyTimer: '',
  75. })
  76. function onChangeReallyStatus(val) {
  77. clearInterval(really.reallyTimer);
  78. if (val == 1) {
  79. really.reallyTimer = setInterval(() => {
  80. getData();
  81. }, 3000);
  82. }
  83. }
  84. onMounted(() => {
  85. getData()
  86. })
  87. return {
  88. state,
  89. getData,
  90. onOpenFilter,
  91. onChangeFilter,
  92. pagination,
  93. really,
  94. onChangeReallyStatus
  95. }
  96. }
  97. }
  98. createApp('index', index);
  99. },
  100. };
  101. return Controller;
  102. });