detail.js 2.4 KB

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