detail.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. userrole:wx.getStorageSync('userrole')
  25. })
  26. this.getList(true);
  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. v.showsubhrcashbilldetailamount = CNY(v.subhrcashbilldetailamount)
  51. return v
  52. })
  53. this.setData({
  54. list: res.pageNumber == 1 ? res.data : this.data.list.concat(this.data.list),
  55. "content.pageNumber": res.pageNumber + 1,
  56. "content.pageTotal": res.pageTotal,
  57. "content.sort": res.sort
  58. })
  59. })
  60. },
  61. startSearch({
  62. detail
  63. }) {
  64. console.log(detail)
  65. this.setData({
  66. 'content.where.condition': detail
  67. })
  68. this.getList(true);
  69. },
  70. onReady() {
  71. this.setListHeight()
  72. },
  73. /* 设置页面高度 */
  74. setListHeight() {
  75. this.selectComponent("#ListBox").setHeight(".search", this);
  76. },
  77. })