index.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const _Http = getApp().globalData.http,
  2. currency = require("../../../../utils/currency");
  3. let CNY = num => currency(num, {
  4. symbol: "¥",
  5. precision: 2
  6. }).format();
  7. Component({
  8. data: {
  9. content: {
  10. nocache: true,
  11. pageNumber: 1,
  12. pageTotal: 1,
  13. total: null
  14. }
  15. },
  16. methods: {
  17. /* 获取产品列表 */
  18. getList(id, init) {
  19. let content = this.data.content;
  20. this.data.st_stockbillid = id;
  21. content.st_stockbillid = id || this.data.st_stockbillid;
  22. if (init) content.pageNumber = 1;
  23. _Http.basic({
  24. "id": "20230719154303",
  25. content
  26. }).then(res => {
  27. console.log("产品信息列表", res)
  28. if (res.msg != '成功') return wx.showToast({
  29. title: res.msg,
  30. icon: "none"
  31. })
  32. res.data = res.data.map(v => {
  33. v.sum = CNY(v.sum)
  34. v.amount = CNY(v.amount)
  35. v.price = CNY(v.price)
  36. return v
  37. })
  38. this.setData({
  39. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  40. "content.pageNumber": res.pageNumber + 1,
  41. "content.pageSize": res.pageSize,
  42. "content.pageTotal": res.pageTotal,
  43. "content.total": res.total,
  44. })
  45. })
  46. },
  47. }
  48. })