瑶都万能墙
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.

195 lines
4.4 KiB

3 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="商城"/>
  4. <!-- <view>
  5. <uv-swiper
  6. :list="bannerList"
  7. indicator
  8. height="320rpx"
  9. keyName="image"></uv-swiper>
  10. </view> -->
  11. <view class="swipe">
  12. <uv-swiper
  13. :list="bannerList"
  14. indicator
  15. height="320rpx"
  16. keyName="image"></uv-swiper>
  17. </view>
  18. <view class="productList">
  19. <productList :productList="list"/>
  20. </view>
  21. <!-- <view class="waterfall">
  22. <uv-waterfall ref="waterfall" v-model="list"
  23. :add-time="10"
  24. :left-gap="leftGap"
  25. :right-gap="rightGap"
  26. :column-gap="columnGap"
  27. @changeList="changeList">
  28. <template v-slot:list1>
  29. <view>
  30. <view v-for="(item, index) in list1" :key="item.id" class="waterfall-item"
  31. @click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)">
  32. <view class="waterfall-item__image" :style="[imageStyle(item)]">
  33. <image :src="item.image" mode="widthFix" :style="{width:item.width+'px'}"></image>
  34. </view>
  35. <view class="waterfall-item__ft">
  36. <view class="waterfall-item__ft__title">
  37. <text class="title">{{item.name}}</text>
  38. </view>
  39. <view class="waterfall-item__ft__desc uv-line-2">
  40. <text class="price">现价{{item.price}}</text>
  41. <text class="oldPrice">原价{{item.oldPrice}}</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <template v-slot:list2>
  48. <view>
  49. <view v-for="(item, index) in list2" :key="item.id" class="waterfall-item"
  50. @click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)">
  51. <view class="waterfall-item__image" :style="[imageStyle(item)]">
  52. <image :src="item.image" mode="widthFix" :style="{width:item.width+'px'}"></image>
  53. </view>
  54. <view class="waterfall-item__ft">
  55. <view class="waterfall-item__ft__title">
  56. <text class="title">{{item.name}}</text>
  57. </view>
  58. <view class="waterfall-item__ft__desc uv-line-2">
  59. <text class="price">现价{{item.price}}</text>
  60. <text class="oldPrice">原价{{item.oldPrice}}</text>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. </uv-waterfall>
  67. </view> -->
  68. <tabber select="1" />
  69. </view>
  70. </template>
  71. <script>
  72. import mixinsList from '@/mixins/list.js'
  73. import tabber from '@/components/base/tabbar.vue'
  74. import productList from '@/components/user/productList.vue'
  75. export default {
  76. mixins: [mixinsList],
  77. components : {
  78. tabber,
  79. productList,
  80. },
  81. computed: {
  82. // imageStyle(item) {
  83. // return item => {
  84. // const v = uni.upx2px(750) - this.leftGap - this.rightGap - this.columnGap;
  85. // const w = v / 2;
  86. // const rate = w / item.w;
  87. // const h = rate * item.h;
  88. // return {
  89. // width: w + 'px',
  90. // height: h + 'px'
  91. // }
  92. // }
  93. // }
  94. },
  95. data() {
  96. return {
  97. mixinsListApi: 'getShopPingPage',
  98. // list1: [], // 瀑布流第一列数据
  99. // list2: [], // 瀑布流第二列数据
  100. // leftGap: 10,
  101. // rightGap: 10,
  102. // columnGap: 10,
  103. bannerList : [],
  104. }
  105. },
  106. onShow() {
  107. this.getBannerList()
  108. },
  109. methods: {
  110. // 这点非常重要:e.name在这里返回是list1或list2,要手动将数据追加到相应列
  111. // changeList(e) {
  112. // this[e.name].push(e.value);
  113. // },
  114. // 获取banner
  115. getBannerList(){
  116. this.$api('getBannerList', res =>{
  117. if(res.code == 200){
  118. this.bannerList = res.result
  119. }
  120. })
  121. },
  122. }
  123. }
  124. </script>
  125. <style scoped lang="scss">
  126. .page{
  127. .swipe{
  128. overflow: hidden;
  129. border-radius: 20rpx;
  130. margin: 20rpx;
  131. }
  132. .productList{
  133. padding: 0 20rpx;
  134. }
  135. }
  136. // $show-lines: 1;
  137. // @import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
  138. // .waterfall-item {
  139. // overflow: hidden;
  140. // margin-top: 10px;
  141. // border-radius: 6px;
  142. // }
  143. // .waterfall-item__ft {
  144. // padding: 20rpx;
  145. // background: #fff;
  146. // &__title {
  147. // margin-bottom: 10rpx;
  148. // line-height: 48rpx;
  149. // font-weight: 700;
  150. // .value {
  151. // font-size: 32rpx;
  152. // color: #303133;
  153. // }
  154. // }
  155. // &__desc .value {
  156. // font-size: 28rpx;
  157. // color: #606266;
  158. // }
  159. // &__btn {
  160. // padding: 10px 0;
  161. // }
  162. // }
  163. // .waterfall-item__ft__title{
  164. // font-size: 28rpx;
  165. // }
  166. // .price{
  167. // color: #f40;
  168. // }
  169. // .oldPrice{
  170. // color: #777;
  171. // font-size: 22rpx;
  172. // text-decoration: underline;
  173. // }
  174. </style>