index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <page-loading :loading="loading">
  3. <view class="product-page">
  4. <view class="logo logo-black" />
  5. <u-search
  6. v-model="keywords"
  7. placeholder="搜索产品"
  8. :show-action="false"
  9. shape="square"
  10. bg-color="#fff"
  11. border-color="#ccc"
  12. height="84rpx"
  13. @search="handleSearch"
  14. />
  15. <view
  16. class="product-list dir-left-wrap"
  17. >
  18. <view
  19. v-for="(item,index) in lists"
  20. :key="index"
  21. class="product-item main-left"
  22. @click="$u.route({url: `/pages/product/list?cate_id=${item.id}`})"
  23. >
  24. <view class="detail dir-top-wrap">
  25. <text>热销品类排名</text>
  26. <view class="name"> {{ item.name }}</view>
  27. </view>
  28. <view class="cover-img">
  29. <image :src="item.cover_img" mode="aspectFill" />
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </page-loading>
  35. </template>
  36. <script>
  37. import PageLoading from '../../components/PageLoading'
  38. export default {
  39. name: 'Product',
  40. components: { PageLoading },
  41. data() {
  42. return {
  43. loading: false,
  44. keywords: '',
  45. limit: 3,
  46. lists: []
  47. }
  48. },
  49. computed: {},
  50. methods: {
  51. handleSearch() {
  52. this.$u.route({ url: `/pages/product/list?keywords=${this.keywords}` })
  53. },
  54. getLists() {
  55. this.$api.product.cate({
  56. limit: this.limit,
  57. page: this.page
  58. }).then(res => {
  59. this.loading = false
  60. this.lists = res.data
  61. })
  62. }
  63. },
  64. onLoad() {
  65. this.loading = true
  66. },
  67. onShow() {
  68. this.getLists()
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .product-page {
  74. padding: 0 30rpx;
  75. overflow: hidden;
  76. height: 100vh;
  77. .logo{
  78. margin: 30rpx auto;
  79. }
  80. .product-list{
  81. margin-top: 40rpx;
  82. .product-item{
  83. width: 690rpx;
  84. margin-bottom: 10rpx;
  85. &:last-child{
  86. margin-bottom: 0;
  87. }
  88. .detail{
  89. padding: 50rpx 0 20rpx 50rpx;
  90. font-size: 24rpx;
  91. color: #333333;
  92. background: #F2F2F2;
  93. flex: 1;
  94. text{
  95. color: #b4936d;
  96. }
  97. .name{
  98. margin-top: 16rpx;
  99. font-size: 42rpx;
  100. }
  101. }
  102. .cover-img{
  103. width: 355rpx;
  104. height: 250rpx;
  105. image{
  106. width: 100%;
  107. height: 100%;
  108. }
  109. }
  110. }
  111. }
  112. }
  113. </style>