index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../../../utils/currency"),
  3. CNY = value => currency(value, {
  4. symbol: "¥",
  5. precision: 2
  6. }).format();
  7. Component({
  8. properties: {
  9. disabled: {
  10. type: Boolean
  11. }
  12. },
  13. data: {
  14. sys_enterpriseid: 0,
  15. content: {
  16. "nacache": true,
  17. "pageNumber": 1,
  18. "pageSize": 20,
  19. "pageTotal": 1,
  20. "total": null,
  21. "where": {
  22. "condition": ""
  23. }
  24. },
  25. list: []
  26. },
  27. lifetimes: {
  28. attached: function () {
  29. getApp().globalData.Language.getLanguagePackage(this)
  30. }
  31. },
  32. methods: {
  33. changeTotal() {
  34. this.setData({
  35. "content.total": this.data.content.total - 1
  36. })
  37. },
  38. getList(id, init) {
  39. let content = this.data.content;
  40. content.sys_enterpriseid = 0;
  41. if (init) {
  42. content.pageNumber = 1
  43. content.pageTotal = 1
  44. }
  45. _Http.basic({
  46. "id": "20221009160003",
  47. content
  48. }).then(res => {
  49. console.log("客户账户信息", res)
  50. if (res.code != '1') return wx.showToast({
  51. title: res.data,
  52. icon: "none"
  53. })
  54. if (res.data.length) res.data = res.data.map(v => {
  55. v.balance = CNY(v.balance);
  56. v.creditquota = CNY(v.creditquota);
  57. return v
  58. })
  59. this.setData({
  60. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  61. "content.pageNumber": res.pageNumber + 1,
  62. "content.pageSize": res.pageSize,
  63. "content.pageTotal": res.pageTotal,
  64. "content.total": res.total,
  65. sys_enterpriseid: id
  66. })
  67. })
  68. }
  69. }
  70. })