detail.js 2.2 KB

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