敢为人鲜小程序前端代码仓库
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.

113 lines
2.2 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="商品列表" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="search">
  5. <uv-search
  6. placeholder="搜你喜欢的产品"
  7. bgColor="#fff"
  8. @search="getData"
  9. @custom="getData"
  10. v-model="queryParams.title"></uv-search>
  11. </view>
  12. <view class="category">
  13. <uv-vtabs
  14. :list="category"
  15. keyName="title"
  16. :barItemBadgeStyle="{right:'20px',top:'12px'}"
  17. @change="change">
  18. <uv-vtabs-item>
  19. <view class="list">
  20. <productItem
  21. v-for="(item, index) in list"
  22. :key="index"
  23. :item="item"
  24. width="350rpx"
  25. titleWidth="350rpx"
  26. @click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)"
  27. />
  28. </view>
  29. </uv-vtabs-item>
  30. </uv-vtabs>
  31. </view>
  32. <tabber select="category" />
  33. </view>
  34. </template>
  35. <script>
  36. import productItem from '@/components/product/productItem.vue';
  37. import mixinsList from '@/mixins/list.js'
  38. import { mapState } from 'vuex'
  39. import tabber from '@/components/base/tabbar.vue'
  40. export default {
  41. mixins : [mixinsList],
  42. components: {
  43. productItem,
  44. tabber,
  45. },
  46. data() {
  47. return {
  48. mixinsListApi : 'getClassShopPageList',
  49. }
  50. },
  51. computed: {
  52. ...mapState(['category'])
  53. },
  54. onLoad({search}) {
  55. if(search){
  56. this.queryParams.title = search
  57. }
  58. this.$store.commit('getCategoryList')
  59. if(this.category.length > 0){
  60. this.queryParams.classId = this.category[0].id
  61. }
  62. },
  63. methods: {
  64. change(e) {
  65. this.queryParams.classId = this.category[e].id
  66. this.getData()
  67. },
  68. }
  69. }
  70. </script>
  71. <style scoped lang="scss">
  72. .page{
  73. /deep/ .uv-vtabs{
  74. height: calc(100vh - 470rpx) !important;
  75. }
  76. /deep/ .uv-vtabs__bar{
  77. height: calc(100vh - 470rpx) !important;
  78. }
  79. /deep/ .uv-vtabs__content{
  80. height: calc(100vh - 470rpx) !important;
  81. }
  82. .search {
  83. position: relative;
  84. background: #FFFFFF;
  85. margin: 20rpx;
  86. border-radius: 41rpx;
  87. padding: 10rpx 20rpx;
  88. display: flex;
  89. align-items: center;
  90. /deep/ .uv-search__action {
  91. background-color: $uni-color;
  92. color: #FFFFFF;
  93. padding: 10rpx 20rpx;
  94. border-radius: 30rpx;
  95. }
  96. }
  97. }
  98. .category {
  99. font-size: 30rpx;
  100. color: #333;
  101. .list{
  102. margin: 0 auto;
  103. }
  104. }
  105. </style>