admin.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. getApp().globalData.Language.getLanguagePackage(this, '项目成交预测管理');
  39. this.getList();
  40. },
  41. /* 获取列表 */
  42. getList(init = false) {
  43. if (init.detail != undefined) init = init.detail;
  44. let content = this.data.content;
  45. if (init) content.pageNumber = 1;
  46. if (content.pageNumber > content.pageTotal) return;
  47. _Http.basic({
  48. "id": 20230705144604,
  49. content
  50. }).then(res => {
  51. console.log("项目成交预测", res)
  52. this.selectComponent('#ListBox').RefreshToComplete();
  53. if (res.code != '1') return wx.showToast({
  54. title: res.data,
  55. icon: "none"
  56. })
  57. res.data = res.data.map(v => {
  58. v.showAmount = CNY(v.projectamount)
  59. return v
  60. })
  61. this.setData({
  62. 'content.pageNumber': res.pageNumber + 1,
  63. 'content.pageTotal': res.pageTotal,
  64. 'content.total': res.total,
  65. 'content.sort': res.sort,
  66. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  67. });
  68. })
  69. },
  70. /* 处理搜索 */
  71. onSearch({
  72. detail
  73. }) {
  74. this.setData({
  75. "content.where.condition": detail
  76. });
  77. this.getList(true);
  78. },
  79. /* 顶部条件导航回调 */
  80. navClick({
  81. detail
  82. }) {
  83. this.setData({
  84. showFiltrate: true
  85. })
  86. },
  87. handleFilter({
  88. detail
  89. }) {
  90. if (detail.startdate) {
  91. this.setData({
  92. 'content.where.begindate': detail.startdate || "",
  93. 'content.where.enddate': detail.enddate || "",
  94. });
  95. } else {
  96. this.setData({
  97. 'content.where.begindate': "",
  98. 'content.where.enddate': "",
  99. });
  100. }
  101. this.getList(true)
  102. }
  103. })