contacts.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. "content": {
  44. "nocache": true,
  45. "pageNumber": 1,
  46. "pageTotal": 1,
  47. "total": null,
  48. "where": {
  49. type: "",
  50. begdate: "",
  51. enddate: "",
  52. }
  53. }
  54. },
  55. methods: {
  56. getList(id, init) {
  57. let content = this.data.content;
  58. content.sys_phonebookid = id;
  59. content.dateType = this.data.dateType;
  60. if (init) {
  61. content.pageNumber = 1;
  62. content.total = null;
  63. }
  64. if (!this.data.showList && content.total != null) return;
  65. if (content.pageNumber > content.pageTotal) return;
  66. _Http.basic({
  67. "id": 20240605135904,
  68. content
  69. }).then(res => {
  70. console.log("联系人订单", res)
  71. if (res.code != '1') return wx.showToast({
  72. title: res.data,
  73. icon: "none"
  74. })
  75. content.pageNumber = res.pageNumber + 1;
  76. content.pageSize = res.pageSize;
  77. content.pageTotal = res.pageTotal;
  78. content.total = res.total;
  79. res.data = res.data.map(v => {
  80. v.allAmount = CNY(v.allAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  81. v.cashbillAmount = CNY(v.cashbillAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  82. v.allunAmount = CNY(v.allunAmount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  83. v.alluninvoicamount = CNY(v.alluninvoicamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  84. v.allunwriteoffamount = CNY(v.allunwriteoffamount / (wx.getStorageSync('languagecode') == 'ZH' ? 10000 : 1000));
  85. v.amount = CNY(v.amount)
  86. v.writeoffamount = CNY(v.writeoffamount)
  87. v.returnamount = CNY(v.returnamount)
  88. v.unoutOrderamount = CNY(v.unoutOrderamount)
  89. v.uninvoicamount = CNY(v.uninvoicamount)
  90. v.unwriteoffamount = CNY(v.unwriteoffamount)
  91. return v
  92. })
  93. this.setData({
  94. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  95. content,
  96. id: id,
  97. });
  98. try {
  99. this.selectComponent("#TimeRange").onCancel()
  100. } catch (error) {
  101. }
  102. try {
  103. this.selectComponent("#Filtrate").onCancel()
  104. } catch (error) {
  105. }
  106. })
  107. },
  108. changeType({
  109. detail
  110. }) {
  111. this.setData({
  112. "content.where.type": detail,
  113. })
  114. this.getList(this.data.id, true)
  115. },
  116. changeDate({
  117. detail
  118. }) {
  119. this.setData({
  120. dateType: detail.dateType || '自定义',
  121. "content.where.begdate": detail.begdate || "",
  122. "content.where.enddate": detail.enddate || ""
  123. })
  124. this.getList(this.data.id, true)
  125. },
  126. shrinkChange({
  127. detail
  128. }) {
  129. this.setData({
  130. showList: detail
  131. })
  132. },
  133. viewInstructions() {
  134. getApp().globalData.Language.modeBoxPrompts('参与项日订单金额:联系人参与的联系人的订单金额')
  135. }
  136. }
  137. })