sales.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. dateType: "本年",
  41. showList: false,
  42. list: [],
  43. "isAll": 1,
  44. "content": {
  45. "nocache": true,
  46. "pageNumber": 1,
  47. "pageTotal": 1,
  48. "total": null,
  49. "where": {
  50. type: "",
  51. begdate: "",
  52. enddate: "",
  53. }
  54. }
  55. },
  56. methods: {
  57. getList(id, init) {
  58. let content = this.data.content;
  59. content.hrid = id;
  60. content.type = this.data.isAll;
  61. if (init) {
  62. content.pageNumber = 1;
  63. content.total = null;
  64. }
  65. if (!this.data.showList && content.total != null) return;
  66. if (content.pageNumber > content.pageTotal) return;
  67. _Http.basic({
  68. "id": 20230717100504,
  69. content
  70. }).then(res => {
  71. console.log("业务员订单", res)
  72. if (res.code != '1') return wx.showToast({
  73. title: res.data,
  74. icon: "none"
  75. })
  76. content.pageNumber = res.pageNumber + 1;
  77. content.pageSize = res.pageSize;
  78. content.pageTotal = res.pageTotal;
  79. content.total = res.total;
  80. res.data = res.data.map(v => {
  81. v.allAmount = CNY(v.allAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  82. v.cashbillAmount = CNY(v.cashbillAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  83. v.allunAmount = CNY(v.allunAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  84. v.alluninvoicamount = CNY(v.alluninvoicamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  85. v.allunwriteoffamount = CNY(v.allunwriteoffamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  86. v.sumamount = CNY(v.sumamount)
  87. v.writeoffamount = CNY(v.writeoffamount)
  88. v.returnamount = CNY(v.returnamount)
  89. v.unoutOrderamount = CNY(v.unoutOrderamount)
  90. v.uninvoicamount = CNY(v.uninvoicamount)
  91. v.unwriteoffamount = CNY(v.unwriteoffamount)
  92. return v
  93. })
  94. this.setData({
  95. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  96. content,
  97. id: id,
  98. });
  99. try {
  100. this.selectComponent("#TimeRange").onCancel()
  101. } catch (error) {
  102. }
  103. try {
  104. this.selectComponent("#Filtrate").onCancel()
  105. } catch (error) {
  106. }
  107. })
  108. },
  109. changeType({
  110. detail
  111. }) {
  112. this.setData({
  113. "content.where.type": detail,
  114. })
  115. this.getList(this.data.id, true)
  116. },
  117. changeDate({
  118. detail
  119. }) {
  120. let isAll = 99;
  121. switch (detail.dateType) {
  122. case '全部':
  123. isAll = 0
  124. break;
  125. case '本年':
  126. isAll = 1
  127. break;
  128. case '本季':
  129. isAll = 2
  130. break;
  131. case '本月':
  132. isAll = 3
  133. break;
  134. }
  135. this.setData({
  136. dateType: detail.dateType,
  137. isAll,
  138. "content.where.begdate": detail.begdate || "",
  139. "content.where.enddate": detail.enddate || ""
  140. })
  141. this.getList(this.data.id, true)
  142. },
  143. shrinkChange({
  144. detail
  145. }) {
  146. this.setData({
  147. showList: detail
  148. })
  149. },
  150. viewInstructions() {
  151. getApp().globalData.Language.modeBoxPrompts('参与项日订单金额:业务员参与的业务员的订单金额')
  152. }
  153. }
  154. })