client.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. _Http.basic({
  15. "classname": "sysmanage.develop.optiontype.optiontype",
  16. "method": "optiontypeselect",
  17. "content": {
  18. "pageNumber": 1,
  19. "pageSize": 1000,
  20. "typename": "ordertype",
  21. "parameter": {}
  22. },
  23. }).then(res => {
  24. console.log("订单类型", res)
  25. if (res.code == 1) {
  26. res.data.unshift({
  27. remarks: "全部",
  28. value: ""
  29. })
  30. this.setData({
  31. typeList: res.data
  32. })
  33. }
  34. })
  35. }
  36. },
  37. properties: {
  38. },
  39. data: {
  40. dateTypes: ["全部", "本年"],
  41. dateType: "本年",
  42. showList: false,
  43. list: [],
  44. "isAll": 0, //1全部 0本年
  45. "content": {
  46. "nocache": true,
  47. "pageNumber": 1,
  48. "pageTotal": 1,
  49. "total": null,
  50. "where": {
  51. type: "",
  52. begdate: "",
  53. enddate: "",
  54. }
  55. }
  56. },
  57. methods: {
  58. getList(id, init) {
  59. let content = this.data.content;
  60. content.sa_customersid = id;
  61. content.isAll = this.data.isAll;
  62. if (init) {
  63. content.pageNumber = 1;
  64. content.total = null;
  65. }
  66. if (!this.data.showList && content.total != null) return;
  67. if (content.pageNumber > content.pageTotal) return;
  68. _Http.basic({
  69. "id": 20230713104304,
  70. content
  71. }).then(res => {
  72. console.log("客户订单", res)
  73. if (res.code != '1') return wx.showToast({
  74. title: res.data,
  75. icon: "none"
  76. })
  77. content.pageNumber = res.pageNumber + 1;
  78. content.pageSize = res.pageSize;
  79. content.pageTotal = res.pageTotal;
  80. content.total = res.total;
  81. res.data = res.data.map(v => {
  82. v.allAmount = CNY(v.allAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  83. v.cashbillAmount = CNY(v.cashbillAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  84. v.allunAmount = CNY(v.allunAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  85. v.alluninvoicamount = CNY(v.alluninvoicamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  86. v.allunwriteoffamount = CNY(v.allunwriteoffamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  87. v.joinOrderAmount = CNY(v.joinOrderAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000))
  88. v.sumamount = CNY(v.sumamount);
  89. v.unoutOrderamount = CNY(v.unoutOrderamount);
  90. v.uninvoicamount = CNY(v.uninvoicamount);
  91. v.unwriteoffamount = CNY(v.unwriteoffamount);
  92. v.writeoffamount = CNY(v.writeoffamount);
  93. v.returnamount = CNY(v.returnamount);
  94. return v
  95. })
  96. this.setData({
  97. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  98. content,
  99. id: id,
  100. });
  101. try {
  102. this.selectComponent("#TimeRange").onCancel()
  103. } catch (error) {
  104. }
  105. try {
  106. this.selectComponent("#Filtrate").onCancel()
  107. } catch (error) {
  108. }
  109. })
  110. },
  111. changeType({
  112. detail
  113. }) {
  114. this.setData({
  115. "content.where.type": detail,
  116. })
  117. this.getList(this.data.id, true)
  118. },
  119. changeDate({
  120. detail
  121. }) {
  122. this.setData({
  123. dateType: detail.dateType,
  124. isAll: detail.isAll === "" ? 99 : detail.isAll,
  125. "content.where.begdate": detail.begdate || "",
  126. "content.where.enddate": detail.enddate || ""
  127. })
  128. this.getList(this.data.id, true)
  129. },
  130. shrinkChange({
  131. detail
  132. }) {
  133. this.setData({
  134. showList: detail
  135. })
  136. },
  137. viewInstructions() {
  138. getApp().globalData.Language.modeBoxPrompts('参与项日订单金额:客户参与的项目的订单金额')
  139. }
  140. }
  141. })