good-floor.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="container clearfix">
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. ></tui-skeleton>
  10. <view class="cm-member-main " v-else>
  11. <view class="cm-member-product clearfix">
  12. <view
  13. v-for="(pro, index) in productList"
  14. :key="index"
  15. :id="pro.productId"
  16. class="product-list"
  17. @click="productDetail(pro.productId)"
  18. >
  19. <view class="product-image"> <image :src="pro.mainImage" mode=""></image> </view>
  20. <view class="product-mains">
  21. <view class="product-name"> {{ pro.name }} </view>
  22. <view class="product-price" v-if="hasLogin">
  23. <!-- 价格 -->
  24. ¥{{ pro.price | NumFormat }}
  25. </view>
  26. <view v-else class="product-price-none">
  27. <uni-grader :grade="Number(pro.priceGrade)"></uni-grader>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <!--加载loadding-->
  33. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  34. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text="nomoreText"></tui-nomore>
  35. <!--加载loadding-->
  36. </view>
  37. <!-- 透明模态层 -->
  38. <modal-layer v-if="isModallayer"></modal-layer>
  39. </view>
  40. </template>
  41. <script>
  42. import { mapState, mapMutations } from 'vuex'
  43. import modalLayer from '@/components/modal-layer'
  44. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  45. export default {
  46. components: {
  47. modalLayer,
  48. uniGrader
  49. },
  50. data() {
  51. return {
  52. skeletonShow:true,
  53. isModallayer: false,
  54. productList: [],
  55. nomoreText: '上拉显示更多',
  56. hasNextPage: false,
  57. loadding: false,
  58. pullUpOn: true,
  59. pullFlag: true,
  60. }
  61. },
  62. onLoad(option) {
  63. this.mallOrganizeProducts(option.id)
  64. },
  65. filters: {
  66. NumFormat: function(text) {
  67. //处理金额
  68. return Number(text).toFixed(2)
  69. }
  70. },
  71. computed: {
  72. ...mapState(['hasLogin'])
  73. },
  74. methods: {
  75. async mallOrganizeProducts(floorId){
  76. //初始化首页数据
  77. try{
  78. const res = await this.CommonService.mallOrganizeProducts({ floorId: floorId })
  79. this.productList = res.data
  80. this.skeletonShow = false
  81. }catch(error){
  82. //TODO handle the exception
  83. console.log('error',error)
  84. }
  85. },
  86. productDetail(productId) {
  87. // 跳转商品详情
  88. this.isModallayer = true
  89. this.$api.navigateTo(`/pages/goods/product?id=${productId}`)
  90. this.isModallayer = false
  91. },
  92. },
  93. onPullDownRefresh() {
  94. setTimeout(() => {
  95. this.getSvipProductPage()
  96. uni.stopPullDownRefresh()
  97. }, 200)
  98. },
  99. onReachBottom() {
  100. if (this.hasNextPage) {
  101. this.loadding = true
  102. this.pullUpOn = true
  103. this.getOnReachBottomData()
  104. }
  105. },
  106. onShareAppMessage(res) {
  107. //分享转发
  108. if (res.from === 'button') {
  109. // 来自页面内转发按钮
  110. }
  111. return {
  112. title: '采美超级会员,巨量优惠享不停',
  113. path: '/pages/user/member/member-product',
  114. imageUrl: 'https://static.caimei365.com/app/img/icon/icon-member-share@2x.png'
  115. }
  116. },
  117. onShow() {}
  118. }
  119. </script>
  120. <style lang="scss">
  121. page {
  122. background-color: #f7f7f7;
  123. }
  124. .container {
  125. width: 100%;
  126. height: auto;
  127. }
  128. .cm-member-main {
  129. width: 100%;
  130. box-sizing: border-box;
  131. padding: 0 24rpx 24rpx 24rpx;
  132. background-color: #f7f7f7;
  133. .cm-member-product {
  134. width: 100%;
  135. margin-top: 24rpx;
  136. .product-list {
  137. width: 339rpx;
  138. height: 516rpx;
  139. border-radius: 16rpx;
  140. float: left;
  141. margin-right: 24rpx;
  142. margin-bottom: 24rpx;
  143. background-color: #ffffff;
  144. &:nth-child(2n) {
  145. margin-right: 0;
  146. }
  147. .product-image {
  148. width: 339rpx;
  149. height: 339rpx;
  150. image {
  151. width: 339rpx;
  152. height: 339rpx;
  153. display: block;
  154. border-radius: 16rpx 16rpx 0 0;
  155. }
  156. }
  157. .product-mains {
  158. width: 100%;
  159. height: auto;
  160. box-sizing: border-box;
  161. padding: 0 24rpx;
  162. margin-top: 16rpx;
  163. .product-name {
  164. height: 80rpx;
  165. line-height: 40rpx;
  166. text-overflow: ellipsis;
  167. overflow: hidden;
  168. display: -webkit-box;
  169. -webkit-line-clamp: 2;
  170. line-clamp: 2;
  171. -webkit-box-orient: vertical;
  172. font-size: $font-size-28;
  173. color: #333333;
  174. text-align: justify;
  175. }
  176. .product-price {
  177. width: 100%;
  178. line-height: 40rpx;
  179. font-size: $font-size-28;
  180. color: #F85050;
  181. margin-top: 16rpx;
  182. }
  183. .product-price-none {
  184. color: #f8c499;
  185. float: left;
  186. line-height: 54rpx;
  187. margin-top: 16rpx;
  188. .p-no {
  189. float: left;
  190. font-size: $font-size-24;
  191. color: $text-color;
  192. }
  193. }
  194. }
  195. }
  196. }
  197. }
  198. </style>