小程序端工程代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.0 KiB

  1. <template>
  2. <view class="quality-recommend">
  3. <view class="title acea-row row-center-wrapper">
  4. <view class="line"></view>
  5. <view class="name">
  6. <text class="iconfont" :class="icon"></text>{{ name }}
  7. </view>
  8. <view class="line"></view>
  9. </view>
  10. <GoodList :good-list="goodsList" :is-sort="false"></GoodList>
  11. </view>
  12. </template>
  13. <script>
  14. import GoodList from "@/components/GoodList";
  15. import { getGroomList } from "@/api/store";
  16. export default {
  17. name: "HotNewGoods",
  18. components: {
  19. GoodList
  20. },
  21. props: {},
  22. data: function() {
  23. return {
  24. imgUrls: [],
  25. goodsList: [],
  26. name: "",
  27. icon: "",
  28. RecommendSwiper: {
  29. pagination: {
  30. el: ".swiper-pagination",
  31. clickable: true
  32. },
  33. autoplay: {
  34. disableOnInteraction: false,
  35. delay: 2000
  36. },
  37. loop: true,
  38. speed: 1000,
  39. observer: true,
  40. observeParents: true
  41. }
  42. };
  43. },
  44. mounted: function() {
  45. this.titleInfo();
  46. this.getIndexGroomList();
  47. },
  48. methods: {
  49. titleInfo: function() {
  50. let type = this.$yroute.query.type;
  51. if (type === "1") {
  52. this.name = "精品推荐";
  53. this.icon = "icon-jingpintuijian";
  54. // document.title = "精品推荐";
  55. } else if (type === "2") {
  56. this.name = "热门榜单";
  57. this.icon = "icon-remen";
  58. // document.title = "热门榜单";
  59. } else if (type === "3") {
  60. this.name = "首发新品";
  61. this.icon = "icon-xinpin";
  62. // document.title = "首发新品";
  63. }
  64. },
  65. getIndexGroomList: function() {
  66. let that = this;
  67. let type = this.$yroute.query.type;
  68. getGroomList(type)
  69. .then(res => {
  70. that.imgUrls = res.data.banner;
  71. that.goodsList = res.data.list;
  72. })
  73. .catch((err)=> {
  74. uni.showToast({
  75. title: err.msg || err.response.data.msg|| err.response.data.message,
  76. icon: 'none',
  77. duration: 2000
  78. });
  79. });
  80. }
  81. }
  82. };
  83. </script>