index.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. let _Http = getApp().globalData.http,
  2. content = {
  3. pageNumber: 1,
  4. pageTotal: 1,
  5. pageSize: 10,
  6. "where": {
  7. "condition": "",
  8. "status": "",
  9. isnotxinjian: 1
  10. }
  11. },
  12. currency = require("../../../../../utils/currency"),
  13. CNY = value => currency(value, {
  14. symbol: "",
  15. precision: 2
  16. }).format();
  17. Component({
  18. lifetimes: {
  19. attached: function () {
  20. this.getList(true)
  21. },
  22. },
  23. data: {
  24. list: []
  25. },
  26. methods: {
  27. getList(init = false) {
  28. if (init) {
  29. content.pageNumber = 1;
  30. content.pageTotal = 1;
  31. }
  32. if (content.pageNumber > content.pageTotal) return;
  33. _Http.basic({
  34. "id": 20231025160203,
  35. content
  36. }).then(res => {
  37. console.log("获取最新订单", res)
  38. if (res.msg != '成功') return;
  39. let list = res.data.map(v => {
  40. return {
  41. agentnum: v.agentnum,
  42. amount: CNY(v.amount),
  43. billdate: v.billdate,
  44. sonum: v.sonum,
  45. status: v.status,
  46. qty: v.qty
  47. }
  48. });
  49. this.setData({
  50. list: res.pageNumber == 1 ? list : this.data.list.concat(list)
  51. });
  52. content.pageNumber = res.pageNumber + 1;
  53. content.pageTotal = res.pageTotal;
  54. })
  55. }
  56. }
  57. })