index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../utils/currency");
  3. let downCount = null;
  4. Page({
  5. data: {
  6. "content": {
  7. "nocache": true,
  8. "pageNumber": 1,
  9. "pageSize": 20,
  10. "pageTotal": 1,
  11. containssub: true,
  12. sa_saleareaids: [],
  13. where: {
  14. status: ""
  15. },
  16. list: [],
  17. },
  18. navList: [{
  19. label: "排序",
  20. icon: "icon-jiangxu1",
  21. color: "",
  22. width: "",
  23. id: "sort"
  24. }, {
  25. label: "筛选",
  26. icon: "icon-shaixuan",
  27. color: "",
  28. width: "",
  29. id: "2"
  30. }],
  31. filtratelist: [{
  32. label: "状态",
  33. index: 0,
  34. showName: "name", //显示字段
  35. valueKey: "status", //返回Key
  36. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  37. value: "", //选中值
  38. required: true,
  39. list: [{
  40. name: "全部",
  41. value: ""
  42. }, {
  43. name: "启用",
  44. value: "ACTIVE"
  45. }, {
  46. name: "停用",
  47. value: "INACTIVE"
  48. }]
  49. }]
  50. },
  51. onLoad(options) {
  52. _Http.basic({
  53. "classname": "webmanage.sale.salearea.salearea",
  54. "method": "query_area_qyjl",
  55. content: {
  56. "nocache": true,
  57. "pageNumber": 1,
  58. "pageSize": 9999,
  59. }
  60. }).then(res => {
  61. console.log("获取区域列表", res)
  62. if (res.msg == '成功' && res.data.length) {
  63. this.setData({
  64. "filtratelist[1]": {
  65. label: "区域",
  66. index: 0,
  67. showName: "areaname", //显示字段
  68. valueKey: "sa_saleareaids", //返回Key
  69. selectKey: "sa_saleareaid", //传参 代表选着字段 不传参返回整个选择对象
  70. value: res.data[0].sa_saleareaid, //选中值
  71. required: true,
  72. list: res.data
  73. }
  74. });
  75. this.data.content.sa_saleareaids = [res.data[0].sa_saleareaid];
  76. this.getList()
  77. }
  78. })
  79. },
  80. getList(init = false) {
  81. if (init.detail != undefined) init = init.detail;
  82. let content = this.data.content;
  83. if (init) content.pageNumber = 1;
  84. if (content.pageNumber > content.pageTotal) return;
  85. _Http.basic({
  86. id: 20221011144903,
  87. content
  88. }).then(res => {
  89. console.log("经销商", res)
  90. this.selectComponent('#ListBox').RefreshToComplete();
  91. this.setData({
  92. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  93. "content.pageNumber": res.pageNumber + 1,
  94. "content.pageTotal": res.pageTotal,
  95. "content.sort": res.sort,
  96. "content.total": res.total,
  97. loading: false
  98. })
  99. })
  100. },
  101. /* 搜索 */
  102. onSearch({
  103. detail
  104. }) {
  105. this.setData({
  106. "content.where.condition": detail
  107. });
  108. this.getList(true)
  109. },
  110. onReady() {
  111. this.selectComponent("#ListBox").setHeight(".total", this);
  112. },
  113. showModal(e) {
  114. this.setData({
  115. modalName: e.currentTarget.dataset.target
  116. })
  117. },
  118. hideModal(e) {
  119. this.setData({
  120. modalName: null
  121. })
  122. },
  123. handleFiltrate({
  124. detail
  125. }) {
  126. this.data.content.where.status = detail.status;
  127. this.data.content.sa_saleareaids = detail.sa_saleareaids ? [detail.sa_saleareaids] : [];
  128. downCount = setTimeout(() => {
  129. this.getList(true);
  130. }, 300);
  131. },
  132. })