style-ten.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="style-ten dir-left-nowrap">
  3. <app-category-list
  4. @click="active"
  5. :list="list"
  6. v-if="list.length>0"
  7. :noSetHeight="setHeight+'rpx'"
  8. ></app-category-list>
  9. <scroll-view scroll-y
  10. v-if="list.length !== 0"
  11. :class="goods_list.length > 0 && list.length === 0 ? 'goods-list-right' : 'right'"
  12. @scrolltolower="lower"
  13. :style="{height: `${setHeight}rpx`}"
  14. >
  15. <image class="advert_pic"
  16. :src="list[activeIndex].advert_pic"
  17. v-if="list[activeIndex].advert_pic"
  18. @click="route_advert(list[activeIndex])"
  19. ></image>
  20. <second-class
  21. v-if="list.length !== 0 && list[activeIndex].child.length !== 0"
  22. @setNav="setNav"
  23. :list="list[activeIndex].child"
  24. :activeIndexTwo="activeIndexTwo"
  25. ></second-class>
  26. <product-list
  27. v-if="goods_list.length > 0 && list.length > 0"
  28. :goods_list="goods_list"
  29. @attr="attr"
  30. ></product-list>
  31. <template v-if="goods_list.length === 0 && list.length !== 0">
  32. <app-no-goods title="该分类下无相关内容哦~"></app-no-goods>
  33. </template>
  34. </scroll-view>
  35. <goods-list
  36. v-if="goods_list.length > 0 && list.length === 0"
  37. :goods_list="goods_list"
  38. @attr="attr"
  39. ></goods-list>
  40. <view class="no-empty main-center" v-if="list.length === 0 && goods_list.length === 0">
  41. <app-no-goods title="该分类下无相关内容哦~" background="#f7f7f7"></app-no-goods>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import appCategoryList from '../../components/page-component/app-category-list/app-category-list.vue';
  47. import productList from './product-list.vue';
  48. import goodsList from './goods-list.vue';
  49. import secondClass from './second-class.vue';
  50. import appNoGoods from '../../components/page-component/app-no-goods/app-no-goods.vue';
  51. export default {
  52. name: "style-ten",
  53. components: {
  54. 'app-category-list': appCategoryList,
  55. 'product-list': productList,
  56. 'app-no-goods': appNoGoods,
  57. 'goods-list': goodsList,
  58. 'second-class': secondClass,
  59. },
  60. props: [`list`, `activeIndex`, `setHeight`, `goods_list`, `activeIndexTwo`],
  61. methods: {
  62. active(item, index) {
  63. console.log(item);
  64. this.$emit('requestGoods', item, index);
  65. this.$emit('active', item);
  66. this.$emit('page');
  67. },
  68. lower() {
  69. if (this.list[this.activeIndex].child.length > 0) {
  70. this.$emit('lower', this.list[this.activeIndex].child[this.activeIndexTwo]);
  71. } else {
  72. this.$emit('lower', this.list[this.activeIndex]);
  73. }
  74. },
  75. setNav(it, key) {
  76. this.$emit('setNav',it, key);
  77. },
  78. attr(previewUrl, submitUrl, attr_groups, goods) {
  79. this.$emit('attr', previewUrl, submitUrl, attr_groups, goods);
  80. },
  81. route_advert(data) {
  82. this.$emit('route_advert', data);
  83. }
  84. },
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. .right {
  89. width: #{546upx};
  90. background-color: white;
  91. padding-left: #{24upx};
  92. }
  93. .goods-list-right {
  94. width: #{750upx};
  95. background-color: white;
  96. }
  97. .advert_pic {
  98. width: #{500rpx};
  99. height: #{184rpx};
  100. margin: #{20rpx} #{24rpx} #{20rpx} 0;
  101. }
  102. .item {
  103. padding: #{20upx 0};
  104. }
  105. .no-empty {
  106. width: 100%;
  107. margin-top: #{150upx};
  108. }
  109. </style>