detail.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. Page({
  8. data: {
  9. id: "20231017110204",
  10. searchShow: false,
  11. searchValue: "",
  12. },
  13. onLoad(options) {
  14. getApp().globalData.Language.getLanguagePackage('订单未回款明细')
  15. this.setData({
  16. content: JSON.parse(options.content),
  17. siteid: wx.getStorageSync('userMsg').siteid
  18. })
  19. this.getList()
  20. },
  21. changeSearchShow() {
  22. this.setData({
  23. searchShow: !this.data.searchShow
  24. })
  25. this.selectComponent('#ListBox').automaticSetHei();
  26. },
  27. getList(init = false) {
  28. _Http.init(this.data.content, init).then(content => {
  29. _Http.basic({
  30. "id": this.data.id,
  31. content
  32. }).then(res => {
  33. console.log( "明细列表", res)
  34. this.selectComponent('#ListBox').automaticSetHei();
  35. this.selectComponent('#ListBox').RefreshToComplete();
  36. if (res.code != '1') return wx.showToast({
  37. title: res.data,
  38. icon: "none"
  39. })
  40. res.data = res.data.map(v => {
  41. v.price = CNY(v.price)
  42. v.amount = CNY(v.amount)
  43. v.outOrderamount = CNY(v.outOrderamount)
  44. v.invoiceamount = CNY(v.invoiceamount)
  45. v.unwriteoffamount = CNY(v.unwriteoffamount)
  46. v.expanded = false;
  47. return v
  48. })
  49. this.setData({
  50. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  51. "content.pageNumber": res.pageNumber + 1,
  52. "content.pageSize": res.pageSize,
  53. "content.pageTotal": res.pageTotal,
  54. "total": res.total,
  55. })
  56. })
  57. })
  58. },
  59. changeExpanded(e) {
  60. const {
  61. index
  62. } = e.currentTarget.dataset;
  63. this.setData({
  64. [`list[${index}].expanded`]: !this.data.list[index].expanded
  65. })
  66. },
  67. onSearch() {
  68. this.data.content.where.condition = this.data.searchValue;
  69. this.getList(true);
  70. },
  71. onChange(event) {
  72. this.setData({
  73. searchValue: event.detail
  74. })
  75. },
  76. onClear() {
  77. this.setData({
  78. searchValue: "",
  79. "content.where.condition": ""
  80. })
  81. this.getList(true);
  82. }
  83. })