log.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. var indexPage = new Vue({
  5. el: "#indexPage",
  6. data() {
  7. return {
  8. searchForm: {
  9. form_1_key: "agent_id",
  10. form_1_value: "",
  11. form_2_key: "oper_id",
  12. form_2_value: "",
  13. oper_type: 'all',
  14. event: "all",
  15. createtime: [],
  16. },
  17. searchFormInit: {
  18. form_1_key: "agent_id",
  19. form_1_value: "",
  20. form_2_key: "oper_id",
  21. form_2_value: "",
  22. oper_type: 'all',
  23. event: "all",
  24. createtime: [],
  25. },
  26. searchOp: {
  27. event: "=",
  28. createtime: "range",
  29. },
  30. listData: [],
  31. multipleSelection: [],
  32. currentPage: 1,
  33. totalPage: 0,
  34. offset: 0,
  35. limit: 10,
  36. isAjax: true,
  37. logOptions: [],
  38. operTypeOptions: [{
  39. label: '全部',
  40. value: 'all'
  41. }, {
  42. label: '用户',
  43. value: 'user'
  44. }, {
  45. label: '管理员',
  46. value: 'admin'
  47. }, {
  48. label: '系统',
  49. value: 'system'
  50. }],
  51. really_status: '',
  52. reallyTimer: null
  53. }
  54. },
  55. mounted() {
  56. this.getListData();
  57. this.getLogStatus()
  58. },
  59. methods: {
  60. getLogStatus() {
  61. let that = this;
  62. Fast.api.ajax({
  63. url: 'shopro/commission/log/getEventAll',
  64. loading: false,
  65. type: 'GET',
  66. }, function (ret, res) {
  67. that.logOptions = res.data;
  68. return false;
  69. })
  70. },
  71. getListData() {
  72. let that = this;
  73. that.isAjax = true;
  74. let filter = {}
  75. let op = {}
  76. for (key in that.searchForm) {
  77. if (key == 'form_1_value' || key == 'form_2_value') {
  78. if (that.searchForm[key] != '') {
  79. filter[that.searchForm.form_1_key] = that.searchForm[key];
  80. }
  81. } else if (key == 'createtime') {
  82. if (that.searchForm[key]) {
  83. if (that.searchForm[key].length > 0) {
  84. filter[key] = that.searchForm[key].join(' - ');
  85. }
  86. }
  87. } else if (key == 'event' || key == 'oper_type') {
  88. if (that.searchForm[key] != '' && that.searchForm[key] != 'all') {
  89. filter[key] = that.searchForm[key];
  90. }
  91. }
  92. }
  93. for (key in filter) {
  94. op[key] = that.searchOp[key]
  95. }
  96. Fast.api.ajax({
  97. url: 'shopro/commission/log/index',
  98. loading: false,
  99. type: 'GET',
  100. data: {
  101. limit: that.limit,
  102. offset: that.offset,
  103. filter: JSON.stringify(filter),
  104. op: JSON.stringify(op)
  105. }
  106. }, function (ret, res) {
  107. that.listData = res.data.rows;
  108. that.totalPage = res.data.total;
  109. that.isAjax = false;
  110. return false
  111. }, function (ret, res) {
  112. that.isAjax = false;
  113. })
  114. },
  115. screenEmpty() {
  116. this.searchForm = JSON.parse(JSON.stringify(this.searchFormInit))
  117. },
  118. operation(opttype, row) {
  119. let that = this;
  120. switch (opttype) {
  121. case 'order':
  122. Fast.api.open(`shopro/commission/order/index?id=${row.event_id}`, '详情', {
  123. callback(data) {
  124. that.getListData()
  125. }
  126. })
  127. break;
  128. case 'reward':
  129. Fast.api.open(`shopro/commission/reward/index?id=${row.event_id}`, '详情', {
  130. callback(data) {
  131. that.getListData()
  132. }
  133. })
  134. break;
  135. case 'share':
  136. case 'agent':
  137. case 'level':
  138. that.openAgentProfile(row.event_id)
  139. break;
  140. }
  141. },
  142. openAgentProfile(agent_id) {
  143. let that = this;
  144. Fast.api.open(`shopro/commission/agent/profile?id=${agent_id}`, '详情', {
  145. callback(data) {
  146. that.getListData()
  147. }
  148. })
  149. },
  150. changeReallyStatus(val) {
  151. clearInterval(this.reallyTimer)
  152. if (val == 1) {
  153. this.reallyTimer = setInterval(() => {
  154. this.getListData()
  155. }, 3000);
  156. }
  157. },
  158. tableCellClassName({
  159. columnIndex
  160. }) {
  161. if (columnIndex == 2 || columnIndex == 5 || columnIndex == 7) {
  162. return 'cell-left';
  163. }
  164. return '';
  165. },
  166. pageSizeChange(val) {
  167. this.offset = 0;
  168. this.limit = val;
  169. this.currentPage = 1;
  170. this.getListData();
  171. },
  172. pageCurrentChange(val) {
  173. this.offset = (val - 1) * this.limit;
  174. this.currentPage = val;
  175. this.getListData();
  176. },
  177. },
  178. })
  179. },
  180. api: {
  181. bindevent: function () {
  182. Form.api.bindevent($("form[role=form]"));
  183. }
  184. }
  185. };
  186. return Controller;
  187. });