inventory.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Component({
  2. properties: {
  3. },
  4. data: {
  5. open: false
  6. },
  7. methods: {
  8. show(e) {
  9. if (e.length == 0) return wx.showToast({
  10. title: '该版本数据为空',
  11. icon: "none",
  12. mask: true
  13. })
  14. let list = [];
  15. e.forEach(v => {
  16. let index = list.findIndex(s => s.systemclient == v.systemclient)
  17. if (index == -1) {
  18. if (v.systemclient == "wechatsaletool") {
  19. list.push({
  20. name: "小程序",
  21. systemclient: "wechatsaletool",
  22. list: [v]
  23. })
  24. } else if (v.systemclient == "web") {
  25. list.push({
  26. name: "Web",
  27. systemclient: "web",
  28. list: [v]
  29. })
  30. } else {
  31. list.push({
  32. name: v.systemclient,
  33. systemclient: v.systemclient,
  34. list: [v]
  35. })
  36. }
  37. } else {
  38. list[index].list.push(v)
  39. }
  40. })
  41. this.setData({
  42. open: true,
  43. activeKey: 0,
  44. list
  45. })
  46. },
  47. onChange({
  48. detail
  49. }) {
  50. this.setData({
  51. activeKey: detail
  52. })
  53. },
  54. onClose() {
  55. this.setData({
  56. open: false,
  57. list: [],
  58. activeKey: 0,
  59. })
  60. }
  61. }
  62. })