detail.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. },
  27. getList(init = false) {
  28. if (init.detail != undefined) init = init.detail;
  29. let content = this.data.content;
  30. if (init) content.pageNumber = 1;
  31. if (content.pageNumber > content.pageTotal) return;
  32. content.sa_hrcashbillid = this.data.detail.sa_hrcashbillid;
  33. _Http.basic({
  34. "id": 20240111131304,
  35. content
  36. }).then(res => {
  37. console.log("凭证明细列表", res)
  38. this.selectComponent('#ListBox').RefreshToComplete();
  39. res.data = res.data.map(v => {
  40. v.showOrderprice = CNY(v.orderprice) //订单单价
  41. v.showPrice = CNY(v.price) //提成单价
  42. v.showAmount = CNY(v.amount) // 支出的“调整金额”;收入的“提成金额”
  43. v.showCashbilldetailamount = CNY(v.cashbilldetailamount) // 支出的“提成金额”
  44. v.showOrderExpectedamount = CNY(v.orderExpectedamount) //预计提成金额
  45. v.showRewardamount = CNY(v.rewardamount) //已提成金额
  46. v.showPayapplyamount = CNY(v.payapplyamount) //已发放金额
  47. v.showUnpayapplyamount = CNY(v.unpayapplyamount) //未发放金额
  48. return v
  49. })
  50. this.setData({
  51. list: res.pageNumber == 1 ? res.data : this.data.list.concat(this.data.list),
  52. "content.pageNumber": res.pageNumber + 1,
  53. "content.pageTotal": res.pageTotal,
  54. "content.sort": res.sort
  55. })
  56. })
  57. },
  58. startSearch({
  59. detail
  60. }) {
  61. console.log(detail)
  62. this.setData({
  63. 'content.where.condition': detail
  64. })
  65. this.getList(true);
  66. },
  67. onReady() {
  68. this.setListHeight()
  69. },
  70. /* 设置页面高度 */
  71. setListHeight() {
  72. this.selectComponent("#ListBox").setHeight(".search", this);
  73. },
  74. })