project.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../utils/currency"),
  3. CNY = (value, symbol = "¥", precision = 2) => currency(value, {
  4. symbol,
  5. precision
  6. }).format();
  7. Component({
  8. options: {
  9. addGlobalClass: true
  10. },
  11. lifetimes: {
  12. attached: function () {
  13. getApp().globalData.Language.getLanguagePackage(this)
  14. }
  15. },
  16. properties: {
  17. },
  18. data: {
  19. dateTypes: ["全部", "本年"],
  20. dateType: "本年",
  21. showList: false,
  22. list: [],
  23. "isAll": 0, //1全部 0本年
  24. "content": {
  25. "nocache": true,
  26. "pageNumber": 1,
  27. "pageTotal": 1,
  28. "total": null,
  29. "where": {
  30. begdate: "",
  31. enddate: "",
  32. }
  33. }
  34. },
  35. methods: {
  36. getList(id, init) {
  37. let content = this.data.content;
  38. content.sa_projectid = id;
  39. content.isAll = this.data.isAll;
  40. if (init) {
  41. content.pageNumber = 1;
  42. content.total = null;
  43. }
  44. if (!this.data.showList && content.total != null) return;
  45. if (content.pageNumber > content.pageTotal) return;
  46. _Http.basic({
  47. "id": 20230715112404,
  48. content
  49. }).then(res => {
  50. console.log("项目订单", res)
  51. if (res.code != '1') return wx.showToast({
  52. title: res.data,
  53. icon: "none"
  54. })
  55. content.pageNumber = res.pageNumber + 1;
  56. content.pageSize = res.pageSize;
  57. content.pageTotal = res.pageTotal;
  58. content.total = res.total;
  59. res.data = res.data.map(v => {
  60. v.allAmount = CNY(v.allAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  61. v.cashbillAmount = CNY(v.cashbillAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  62. v.allunAmount = CNY(v.allunAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  63. v.alluninvoicamount = CNY(v.alluninvoicamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  64. v.allunwriteoffamount = CNY(v.allunwriteoffamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  65. v.amount = CNY(v.amount)
  66. v.writeoffamount = CNY(v.writeoffamount)
  67. v.returnamount = CNY(v.returnamount)
  68. v.unoutOrderamount = CNY(v.unoutOrderamount)
  69. v.uninvoicamount = CNY(v.uninvoicamount)
  70. v.unwriteoffamount = CNY(v.unwriteoffamount)
  71. return v
  72. })
  73. this.setData({
  74. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  75. content,
  76. id: id,
  77. });
  78. this.selectComponent("#TimeRange").onCancel()
  79. })
  80. },
  81. changeDate({
  82. detail
  83. }) {
  84. this.setData({
  85. dateType: detail.dateType,
  86. isAll: detail.isAll === "" ? 99 : detail.isAll,
  87. "content.where.begdate": detail.begdate || "",
  88. "content.where.enddate": detail.enddate || ""
  89. })
  90. this.getList(this.data.id, true)
  91. },
  92. shrinkChange({
  93. detail
  94. }) {
  95. this.setData({
  96. showList: detail
  97. })
  98. },
  99. viewInstructions() {
  100. getApp().globalData.Language.modeBoxPrompts('参与项日订单金额:项目参与的项目的订单金额')
  101. }
  102. }
  103. })