index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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: Boolean
  10. },
  11. data: {
  12. sys_enterpriseid: 0,
  13. content: {
  14. "nacache": true,
  15. "pageNumber": 1,
  16. "pageSize": 20,
  17. "pageTotal": 1,
  18. "total": null,
  19. "where": {
  20. "condition": ""
  21. }
  22. },
  23. list: []
  24. },
  25. methods: {
  26. changeTotal() {
  27. this.setData({
  28. "content.total": this.data.content.total - 1
  29. })
  30. },
  31. getList(id, init) {
  32. let content = this.data.content;
  33. content.sys_enterpriseid = 0;
  34. if (init) {
  35. content.pageNumber = 1
  36. content.pageTotal = 1
  37. }
  38. _Http.basic({
  39. "id": "20221009160003",
  40. content
  41. }).then(res => {
  42. console.log("客户账户信息", res)
  43. if (res.msg != '成功') return wx.showToast({
  44. title: res.data,
  45. icon: "none"
  46. })
  47. if (res.data.length) res.data = res.data.map(v => {
  48. console.log(v.balance)
  49. console.log(CNY(v.balance))
  50. v.balance = CNY(v.balance);
  51. v.creditquota = CNY(v.creditquota);
  52. return v
  53. })
  54. this.setData({
  55. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  56. "content.pageNumber": res.pageNumber + 1,
  57. "content.pageSize": res.pageSize,
  58. "content.pageTotal": res.pageTotal,
  59. "content.total": res.total,
  60. sys_enterpriseid: id
  61. })
  62. })
  63. }
  64. }
  65. })