floors.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template name="floors">
  2. <view>
  3. <view class="floors-content clearfix">
  4. <view class="tui-block__box tui-mtop__20" v-for="(floor,index) in list" :key="index">
  5. <view class="tui-group-name" >
  6. <view>
  7. <text class="tui-sub__desc tui-color__pink">{{ floor.topic }}</text>
  8. </view>
  9. <view class="tui-more__box" @click="handleFloor(floor)">
  10. <text>更多</text>
  11. <text class="iconfont icon-xiangyou"></text>
  12. </view>
  13. </view>
  14. <scroll-view scroll-x>
  15. <view class="tui-goods__list">
  16. <view class="tui-goods__item" @click="productDetail(pros.productId)" v-for="pros in floor.products">
  17. <view class="tui-goods__imgbox">
  18. <image :src="pros.mainImage" mode="" class="tui-goods__img"></image>
  19. </view>
  20. <view class="tui-goods__namebox">
  21. <text>{{ pros.name }}</text>
  22. </view>
  23. <view class="tui-pri__box">
  24. <view class="tui-sale-pri" v-if="hasLogin">
  25. ¥{{ pros.price | NumFormat }}
  26. </view>
  27. <view v-else class="tui-no-price">
  28. <view class="p-stars">
  29. <!-- <text class="p-no">¥</text> -->
  30. <uni-grader
  31. :grade="pros.priceGrade"
  32. :margin="14"
  33. ></uni-grader>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </scroll-view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import { mapState, mapMutations } from 'vuex'
  46. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  47. export default{
  48. name:'floors',
  49. components: {
  50. uniGrader
  51. },
  52. props:{
  53. list:{
  54. type:Array
  55. }
  56. },
  57. filters: {
  58. NumFormat: function(text) {
  59. //处理金额
  60. return Number(text).toFixed(2)
  61. }
  62. },
  63. data() {
  64. return{
  65. }
  66. },
  67. created(){
  68. },
  69. computed: {
  70. ...mapState(['hasLogin'])
  71. },
  72. methods:{
  73. handleFloor(floor){
  74. this.$api.navigateTo(`/pages/goods/good-floor?id=${floor.id}`)
  75. },
  76. productDetail(productId) {
  77. // 跳转商品详情
  78. this.$api.navigateTo(`/pages/goods/product?id=${productId}`)
  79. },
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .floors-content{
  85. width: 100%;
  86. height: auto;
  87. box-sizing: border-box;
  88. background: #FFFFFF;
  89. .tui-block__box {
  90. width: 100%;
  91. padding: 0 25rpx 25rpx;
  92. box-sizing: border-box;
  93. background-color: #ffffff;
  94. border-radius: 20rpx;
  95. overflow: hidden;
  96. }
  97. .tui-mtop__20 {
  98. margin-top: 20rpx;
  99. }
  100. .tui-group-name {
  101. width: 100%;
  102. line-height: 50rpx;
  103. font-weight: bold;
  104. text-align: center;
  105. padding: 24rpx 0 0 0;
  106. display: flex;
  107. align-items: center;
  108. justify-content: space-between;
  109. color: #333;
  110. }
  111. .tui-sub__desc {
  112. color: #333;
  113. font-size: 36rpx;
  114. font-weight: 400;
  115. }
  116. .tui-more__box {
  117. display: flex;
  118. align-items: center;
  119. font-weight: 400;
  120. color: #999;
  121. line-height: 50rpx;
  122. .iconfont{
  123. font-size: 28rpx;
  124. margin-left: 10rpx;
  125. }
  126. }
  127. .tui-more__box text{
  128. font-size: 24rpx;
  129. }
  130. .tui-goods__list {
  131. display: flex;
  132. align-items: center;
  133. }
  134. .tui-goods__item {
  135. background-color: #fff;
  136. width: 210rpx;
  137. height: 390rpx;
  138. border-radius: 6rpx;
  139. box-sizing: border-box;
  140. display: flex;
  141. align-items: center;
  142. justify-content: center;
  143. flex-direction: column;
  144. flex-shrink: 0;
  145. margin-right: 18rpx;
  146. }
  147. .tui-goods__imgbox {
  148. width: 210rpx;
  149. height: 210rpx;
  150. display: flex;
  151. align-items: center;
  152. justify-content: center;
  153. box-sizing: border-box;
  154. border-radius: 8rpx;
  155. }
  156. .tui-goods__img {
  157. width: 210rpx;
  158. height: 210rpx;
  159. display: block;
  160. border-radius: 8rpx;
  161. }
  162. .tui-goods__namebox{
  163. width: 210rpx;
  164. height: 80rpx;
  165. margin-top: 16rpx;
  166. line-height: 40rpx;
  167. text-overflow: ellipsis;
  168. display: -webkit-box;
  169. word-break: break-all;
  170. -webkit-box-orient: vertical;
  171. -webkit-line-clamp: 2;
  172. overflow: hidden;
  173. font-size: 26rpx;
  174. color: #333333;
  175. }
  176. .tui-pri__box {
  177. width: 210rpx;
  178. display: flex;
  179. justify-content: center;
  180. align-items: center;
  181. }
  182. .tui-sale-pri {
  183. width: 210rpx;
  184. display: flex;
  185. align-items: flex-end;
  186. padding: 10rpx 0 8rpx;
  187. box-sizing: border-box;
  188. font-size: 28rpx;
  189. line-height: 40rpx;
  190. color: #EE2727;
  191. white-space: nowrap;
  192. text-overflow: ellipsis;
  193. overflow: hidden;
  194. text-align: left;
  195. }
  196. .tui-no-price {
  197. width: 210rpx;
  198. height: 40rpx;
  199. line-height: 40rpx;
  200. display: flex;
  201. box-sizing: border-box;
  202. .p-no {
  203. line-height: 40rpx;
  204. font-size: $font-size-28;
  205. color: $text-color;
  206. display: inline-block;
  207. float: left;
  208. }
  209. .p-stars {
  210. float: left;
  211. }
  212. }
  213. .tui-size-sm {
  214. font-size: 24rpx;
  215. line-height: 24rpx;
  216. transform: scale(0.8);
  217. transform-origin: 0 50%;
  218. }
  219. .tui-original__pri {
  220. font-size: 24rpx;
  221. line-height: 24rpx;
  222. color: #999999;
  223. transform-origin: center 10%;
  224. transform: scale(0.8);
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. text-decoration: line-through;
  229. }
  230. }
  231. </style>