detail.js 2.4 KB

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