admin.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. let _Http = getApp().globalData.http,
  2. currency = require("../../utils/currency"),
  3. CNY = value => currency(value, {
  4. symbol: "¥",
  5. precision: 2
  6. }).format();
  7. Page({
  8. data: {
  9. admin: true,
  10. showFiltrate: false,
  11. content: {
  12. baseonproject: 1, //1项目预测,0出货开票预测
  13. pageNumber: 1,
  14. pageTotal: 1,
  15. pagesize: 20,
  16. sort: [],
  17. where: {
  18. condition: "",
  19. begindate: "",
  20. enddate: ""
  21. }
  22. },
  23. navList: [{
  24. label: "排序",
  25. icon: "icon-jiangxu1",
  26. color: "",
  27. width: "",
  28. id: "sort"
  29. }, {
  30. label: "筛选",
  31. icon: "icon-shaixuan",
  32. color: "",
  33. width: "",
  34. id: "2"
  35. }]
  36. },
  37. onLoad(options) {
  38. this.getList();
  39. },
  40. /* 获取列表 */
  41. getList(init = false) {
  42. if (init.detail != undefined) init = init.detail;
  43. let content = this.data.content;
  44. if (init) content.pageNumber = 1;
  45. if (content.pageNumber > content.pageTotal) return;
  46. _Http.basic({
  47. "id": 20230705144604,
  48. content
  49. }).then(res => {
  50. console.log("项目成交预测", res)
  51. this.selectComponent('#ListBox').RefreshToComplete();
  52. if (res.msg != '成功') return wx.showToast({
  53. title: res.data,
  54. icon: "none"
  55. })
  56. res.data = res.data.map(v => {
  57. v.showAmount = CNY(v.projectamount)
  58. return v
  59. })
  60. this.setData({
  61. 'content.pageNumber': res.pageNumber + 1,
  62. 'content.pageTotal': res.pageTotal,
  63. 'content.total': res.total,
  64. 'content.sort': res.sort,
  65. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  66. });
  67. this.setListHeight();
  68. })
  69. },
  70. /* 处理搜索 */
  71. onSearch({
  72. detail
  73. }) {
  74. this.setData({
  75. "content.where.condition": detail
  76. });
  77. this.getList(true);
  78. },
  79. onReady() {
  80. this.setListHeight();
  81. },
  82. setListHeight() {
  83. this.selectComponent("#ListBox").setHeight(".head", this);
  84. },
  85. /* 顶部条件导航回调 */
  86. navClick({
  87. detail
  88. }) {
  89. this.setData({
  90. showFiltrate: true
  91. })
  92. },
  93. handleFilter({
  94. detail
  95. }) {
  96. if (detail.startdate) {
  97. this.setData({
  98. 'content.where.begindate': detail.startdate || "",
  99. 'content.where.enddate': detail.enddate || "",
  100. });
  101. } else {
  102. this.setData({
  103. 'content.where.begindate': "",
  104. 'content.where.enddate': "",
  105. });
  106. }
  107. this.getList(true)
  108. }
  109. })