admin.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. content: {
  10. baseonproject: 1, //1项目预测,0出货开票预测
  11. pageNumber: 1,
  12. pageTotal: 1,
  13. pagesize: 20,
  14. sort: [],
  15. where: {
  16. condition: ""
  17. }
  18. },
  19. navList: [{
  20. label: "排序",
  21. icon: "icon-jiangxu1",
  22. color: "",
  23. width: "",
  24. id: "sort"
  25. }, {
  26. label: "筛选",
  27. icon: "icon-shaixuan",
  28. color: "",
  29. width: "",
  30. id: "2"
  31. }]
  32. },
  33. onLoad(options) {
  34. this.getList();
  35. },
  36. /* 获取列表 */
  37. getList(init = false) {
  38. if (init.detail != undefined) init = init.detail;
  39. let content = this.data.content;
  40. if (init) content.pageNumber = 1;
  41. if (content.pageNumber > content.pageTotal) return;
  42. _Http.basic({
  43. "id": 20230706092304,
  44. content
  45. }).then(res => {
  46. console.log("项目成交预测", res)
  47. this.selectComponent('#ListBox').RefreshToComplete();
  48. if (res.msg != '成功') return wx.showToast({
  49. title: res.data,
  50. icon: "none"
  51. })
  52. res.data = res.data.map(v => {
  53. v.showAmount = CNY(v.projectamount)
  54. return v
  55. })
  56. this.setData({
  57. 'content.pageNumber': res.pageNumber + 1,
  58. 'content.pageTotal': res.pageTotal,
  59. 'content.total': res.total,
  60. 'content.sort': res.sort,
  61. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  62. });
  63. this.setListHeight();
  64. })
  65. },
  66. /* 处理搜索 */
  67. onSearch({
  68. detail
  69. }) {
  70. this.setData({
  71. "content.where.condition": detail
  72. });
  73. this.getList(true);
  74. },
  75. onReady() {
  76. this.setListHeight();
  77. },
  78. setListHeight() {
  79. this.selectComponent("#ListBox").setHeight(".head", this);
  80. },
  81. /* 顶部条件导航回调 */
  82. navClick({
  83. detail
  84. }) {
  85. console.log(detail)
  86. },
  87. })