index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 cross-center main-center">
  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 100rpx;
  75. overflow: hidden;
  76. .logo{
  77. margin: 30rpx auto;
  78. }
  79. .product-list{
  80. margin-top: 40rpx;
  81. .product-item{
  82. width: 690rpx;
  83. margin-bottom: 10rpx;
  84. &:last-child{
  85. margin-bottom: 0;
  86. }
  87. .detail{
  88. font-size: 24rpx;
  89. color: #333333;
  90. background: #F2F2F2;
  91. flex: 1;
  92. text{
  93. color: #b4936d;
  94. }
  95. .name{
  96. font-size: 32rpx;
  97. }
  98. }
  99. .cover-img{
  100. width: 410rpx;
  101. height: 235rpx;
  102. image{
  103. width: 100%;
  104. height: 100%;
  105. }
  106. }
  107. }
  108. }
  109. }
  110. </style>