index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: {type: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. v.balance = CNY(v.balance);
  49. v.creditquota = CNY(v.creditquota);
  50. return v
  51. })
  52. this.setData({
  53. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  54. "content.pageNumber": res.pageNumber + 1,
  55. "content.pageSize": res.pageSize,
  56. "content.pageTotal": res.pageTotal,
  57. "content.total": res.total,
  58. sys_enterpriseid: id
  59. })
  60. })
  61. }
  62. }
  63. })