index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. let _Http = getApp().globalData.http,
  2. currency = require("../../../../../utils/currency"),
  3. CNY = num => currency(num, {
  4. symbol: "¥",
  5. precision: 2
  6. }).format();
  7. Component({
  8. options: {
  9. addGlobalClass: true
  10. },
  11. properties: {
  12. },
  13. lifetimes: {
  14. attached: function () {
  15. this.getDetail()
  16. },
  17. },
  18. data: {
  19. },
  20. methods: {
  21. getDetail() {
  22. _Http.basic({
  23. id: "20230729103203",
  24. "content": {
  25. "datetype": "日",
  26. date: Date.now(),
  27. "where": {
  28. "begindate": "",
  29. "enddate": ""
  30. }
  31. },
  32. }).then(res => {
  33. console.log("获取本日回款信息", res)
  34. if (res.msg == '成功') {
  35. let sell = res.data.find(v => v.type == '订货额'),
  36. returnedMoney = res.data.find(v => v.type == '回款');
  37. sell.value = CNY(sell.currentData)
  38. sell.label = "今日销售"
  39. returnedMoney.value = CNY(returnedMoney.currentData)
  40. returnedMoney.label = "今日回款"
  41. this.setData({
  42. sell,
  43. returnedMoney
  44. })
  45. }
  46. })
  47. }
  48. }
  49. })