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

118 lines
2.3 KiB

3 months ago
3 months ago
3 months ago
  1. <!-- 更多商品 -->
  2. <template>
  3. <view class="more-commodity">
  4. <!-- 导航栏 -->
  5. <navbar title="商品" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" />
  6. <view class="more-commodity-header">
  7. <!-- 搜索栏 -->
  8. <view class="search">
  9. <uv-search placeholder="搜你喜欢的产品" bgColor="#fff" @search="getData" @custom="getData"
  10. v-model="queryParams.title"></uv-search>
  11. </view>
  12. <!-- 筛选过滤 -->
  13. <view class="filtration">
  14. <view v-for="(item,index) in filtrationList" :key="index"
  15. :class="{ 'filtration-acitve-item' : activeFiltration == index }" @click="changeFiltration(index)"
  16. class="filtration-item">
  17. {{ item }}
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 商品列表 -->
  22. <view class="product-list">
  23. <productList :list="commodiryList" />
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import productList from '@/components/user/productList.vue'
  29. export default {
  30. name: "MoreCommodity",
  31. components: {
  32. productList
  33. },
  34. data() {
  35. return {
  36. filtrationList: ['综合', '销量', '价格', '上新'],
  37. activeFiltration: 0,
  38. commodiryList: []
  39. }
  40. },
  41. onShow() {
  42. this.getRiceCommonProductList();
  43. },
  44. methods: {
  45. //修改过滤条件
  46. changeFiltration(index) {
  47. this.activeFiltration = index;
  48. //重新获取数据逻辑
  49. },
  50. // 获取常规产品
  51. getRiceCommonProductList() {
  52. this.$api('getRiceCommonProductList', res => {
  53. uni.stopPullDownRefresh()
  54. if (res.code == 200) {
  55. this.commodiryList = res.result
  56. }
  57. })
  58. },
  59. //搜索
  60. getData() {
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .more-commodity {
  67. .more-commodity-header {
  68. background: white;
  69. padding: 20rpx;
  70. // 搜索栏
  71. .search {
  72. border: 1px solid #F0F0F0;
  73. border-radius: 41rpx;
  74. padding: 10rpx 20rpx;
  75. display: flex;
  76. align-items: center;
  77. /deep/ .uv-search__action {
  78. background-color: $uni-color;
  79. color: #FFFFFF;
  80. padding: 10rpx 20rpx;
  81. border-radius: 30rpx;
  82. }
  83. }
  84. // 筛选过滤
  85. .filtration {
  86. display: flex;
  87. justify-content: space-between;
  88. padding: 30rpx 20rpx;
  89. .filtration-item {
  90. font-size: 36rpx;
  91. }
  92. .filtration-acitve-item {
  93. color: $uni-color;
  94. }
  95. }
  96. }
  97. // 商品列表
  98. .product-list {
  99. padding-top: 20rpx;
  100. }
  101. }
  102. </style>