index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view>
  3. <view class='quality-recommend'>
  4. <swipers :imgUrls="imgUrls"></swipers>
  5. <view class='title acea-row row-center-wrapper'>
  6. <view class='line'></view>
  7. <view class='name'><text class='iconfont' :class="icon"></text>{{name}}</view>
  8. <view class='line'></view>
  9. </view>
  10. <goodList :bastList="bastList" :status="status"></goodList>
  11. </view>
  12. <home></home>
  13. </view>
  14. </template>
  15. <script>
  16. import goodList from '@/components/goodList';
  17. import home from '@/components/home';
  18. import swipers from '@/components/swipers';
  19. import { getGroomList } from '@/api/store.js';
  20. export default {
  21. components: {
  22. goodList,
  23. swipers,
  24. home
  25. },
  26. data() {
  27. return {
  28. imgUrls: [],
  29. bastList:[],
  30. name:'',
  31. icon:'',
  32. type:0,
  33. status:0
  34. };
  35. },
  36. onLoad: function (options) {
  37. this.type = options.type;
  38. },
  39. onShow: function () {
  40. let type = this.type;
  41. if (type == 1){
  42. uni.setNavigationBarTitle({
  43. title:"精品推荐"
  44. });
  45. this.name = '精品推荐';
  46. this.icon = 'icon-jingpintuijian';
  47. } else if (type == 2) {
  48. uni.setNavigationBarTitle({
  49. title:"热门榜单"
  50. });
  51. this.name = '热门榜单';
  52. this.icon = 'icon-remen';
  53. this.status = 1;
  54. } else if (type == 3) {
  55. uni.setNavigationBarTitle({
  56. title:"首发新品"
  57. });
  58. this.name = '首发新品';
  59. this.icon = 'icon-xinpin';
  60. } else if (type == 4) {
  61. uni.setNavigationBarTitle({
  62. title:"促销单品"
  63. });
  64. this.name = '促销单品';
  65. this.icon = 'icon-cuxiaoguanli';
  66. }else{
  67. uni.setNavigationBarTitle({
  68. title:"首发新品"
  69. });
  70. this.name = '首发新品';
  71. this.icon = 'icon-xinpin';
  72. }
  73. this.getIndexGroomList();
  74. },
  75. methods: {
  76. getIndexGroomList: function () {
  77. let that = this;
  78. getGroomList(that.type).then(res=>{
  79. that.imgUrls = res.data.banner;
  80. that.$set(that,'bastList',res.data.list)
  81. });
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. page{background-color:#fff;}
  88. .quality-recommend .title{height:120rpx;font-size:32rpx;color:#282828;background-color:#f5f5f5;}
  89. .quality-recommend .title .line{width:230rpx;height:2rpx;background-color:#e9e9e9;}
  90. .quality-recommend .title .name{margin:0 20rpx;}
  91. .quality-recommend .title .name .iconfont{margin-right:13rpx;font-size:38rpx;vertical-align:-4rpx;color:#343434;}
  92. </style>