detail.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../utils/currency"),
  3. CNY = value => currency(value, {
  4. symbol: "¥",
  5. precision: 2
  6. }).format();
  7. Page({
  8. data: {
  9. detail: {},
  10. list: [],
  11. "content": {
  12. "where": {
  13. "condition": ""
  14. },
  15. "pageNumber": 1,
  16. "pageTotal": 1,
  17. "pageSize": 20
  18. }
  19. },
  20. onLoad(options) {
  21. let item = JSON.parse(options.item);
  22. this.setData({
  23. detail: item
  24. })
  25. this.getList(true);
  26. getApp().globalData.Language.getLanguagePackage(this, '明细');
  27. },
  28. getList(init = false) {
  29. if (init.detail != undefined) init = init.detail;
  30. let content = this.data.content;
  31. if (init) content.pageNumber = 1;
  32. if (content.pageNumber > content.pageTotal) return;
  33. content.sa_hrcashbillid = this.data.detail.sa_hrcashbillid;
  34. _Http.basic({
  35. "id": 20240111131304,
  36. content
  37. }).then(res => {
  38. console.log("凭证明细列表", res)
  39. this.selectComponent('#ListBox').RefreshToComplete();
  40. res.data = res.data.map(v => {
  41. v.showOrderprice = CNY(v.orderprice) //订单单价
  42. v.showPrice = CNY(v.price) //提成单价
  43. v.showAmount = CNY(v.amount) // 支出的“调整金额”;收入的“提成金额”
  44. v.showCashbilldetailamount = CNY(v.cashbilldetailamount) // 支出的“提成金额”
  45. v.showOrderExpectedamount = CNY(v.orderExpectedamount) //预计提成金额
  46. v.showRewardamount = CNY(v.rewardamount) //已提成金额
  47. v.showPayapplyamount = CNY(v.payapplyamount) //已发放金额
  48. v.showUnpayapplyamount = CNY(v.unpayapplyamount) //未发放金额
  49. v.showOrderamount = CNY(v.orderamount)
  50. return v
  51. })
  52. this.setData({
  53. list: res.pageNumber == 1 ? res.data : this.data.list.concat(this.data.list),
  54. "content.pageNumber": res.pageNumber + 1,
  55. "content.pageTotal": res.pageTotal,
  56. "content.sort": res.sort
  57. })
  58. })
  59. },
  60. startSearch({
  61. detail
  62. }) {
  63. console.log(detail)
  64. this.setData({
  65. 'content.where.condition': detail
  66. })
  67. this.getList(true);
  68. },
  69. onReady() {
  70. this.setListHeight()
  71. },
  72. /* 设置页面高度 */
  73. setListHeight() {
  74. this.selectComponent("#ListBox").setHeight(".search", this);
  75. },
  76. })