金诚优选前端代码
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.

277 lines
8.7 KiB

  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="true" :showIcon="true" title="收藏"></lf-nav>
  4. <view v-if="title_tab.length">
  5. <u-tabs :list="title_tab" active-color="#15716E" inactive-color='#777777' :is-scroll="true" :current="title_current" @change="titletabChange"></u-tabs>
  6. </view>
  7. <view v-if="title_current==0">
  8. <view class="lf-p-30 lf-flex" v-for="i of 4">
  9. <image class="collect-img" src="https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png" mode="aspectFill"></image>
  10. <view class="lf-flex-column lf-m-l-20" style="min-height: 160rpx;justify-content: space-between;">
  11. <view class="lf-font-36 lf-color-black lf-line-1" style="width: 500rpx;">luckin coffee 瑞幸瑞幸咖啡瑞幸咖啡瑞幸咖啡瑞幸咖啡咖啡</view>
  12. <view class="lf-font-24 lf-color-777">餐饮·美食18件在售</view>
  13. <view class="lf-font-24 lf-color-777"><u-icon name="map" class="lf-m-r-10"></u-icon>L2</view>
  14. </view>
  15. <view class="lf-iconfont icon-shoucang lf-font-38" style="color: #FF9D9D;"></view>
  16. </view>
  17. </view>
  18. <view class="lf-p-b-30 lf-m-t-30" v-else>
  19. <lf-waterfall :list="list" :ifsale="false" ref="uWaterfall"></lf-waterfall>
  20. <!-- <u-loadmore v-if="recomm_list.length" status="已加载全部数据~" @loadmore="addRandomData"></u-loadmore> -->
  21. <view class="loading-more">
  22. <text :class="{'loading-more-text': loading_class}" v-if="list.length">{{ loading_text }}</text>
  23. <lf-nocontent v-else></lf-nocontent>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import lfWaterfall from '@/components/lf-waterfall-shopdetails/lf-waterfall.vue';
  30. export default {
  31. data() {
  32. return {
  33. title_tab: [
  34. {name:'推荐'},
  35. {name:'商品'}
  36. ],
  37. title_current:0,
  38. list: [
  39. {
  40. id: 10,
  41. original_price: "4111.00",
  42. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  43. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  44. price: "2412.00",
  45. product_id: 1008,
  46. sale: 0,
  47. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  48. },
  49. {
  50. id: 10,
  51. original_price: "4111.00",
  52. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  53. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  54. price: "2412.00",
  55. product_id: 1008,
  56. sale: 0,
  57. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  58. },
  59. {
  60. id: 10,
  61. original_price: "4111.00",
  62. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  63. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  64. price: "2412.00",
  65. product_id: 1008,
  66. sale: 0,
  67. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  68. },
  69. {
  70. id: 10,
  71. original_price: "4111.00",
  72. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  73. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  74. price: "2412.00",
  75. product_id: 1008,
  76. sale: 0,
  77. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  78. }
  79. ],
  80. show_count: 0,
  81. windowHeight: 0,
  82. loading_text: '没有更多数据啦~',
  83. loading_class: false
  84. }
  85. },
  86. components: {
  87. lfWaterfall
  88. },
  89. onShow(){
  90. this.windowHeight = getApp().globalData.windowHeight;
  91. },
  92. methods: {
  93. titletabChange(index){
  94. this.title_current = index;
  95. },
  96. getData() {
  97. let tab_item = this.tab_list[this.current];
  98. let isPage = false;
  99. tab_item.isPage = isPage;
  100. if(!isPage){
  101. tab_item.loadingClass = false;
  102. tab_item.loadingText = '没有更多数据啦~';
  103. }
  104. tab_item.isRefresher = false;
  105. },
  106. // 滑块下标值变化
  107. swiperChange(event){
  108. this.current = event.detail.current;
  109. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  110. },
  111. // 页面触底,加载下一页
  112. onScrolltolower(){
  113. let tab_item = this.tab_list[this.current];
  114. if(tab_item.isPage){
  115. tab_item.page = tab_item.page + 1;
  116. this.getData();
  117. }
  118. },
  119. // scroll-view 下拉刷新
  120. onRefresherrefresh(){
  121. this.$u.throttle(() => {
  122. this.clearTabItem();
  123. this.getData();
  124. }, 200);
  125. },
  126. clearTabItem(){
  127. let tab_item = this.tab_list[this.current];
  128. tab_item.page = 1;
  129. tab_item.isPage = true;
  130. tab_item.isRefresher = true;
  131. tab_item.loadingClass = true;
  132. tab_item.loadingText = '正在加载中';
  133. tab_item.list = [];
  134. this.$set(this.tab_list, this.current, tab_item);
  135. // this.$refs.uWaterfallFather[this.current].clear();
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .collect-img {
  142. width: 150rpx;
  143. height: 150rpx;
  144. border-radius: 5rpx;
  145. }
  146. /deep/.u-scroll-box {
  147. display: flex;
  148. justify-content: center;
  149. align-items: center;
  150. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  151. }
  152. /deep/.u-scroll-box .u-tab-bar {
  153. background-color: #15716E!important;
  154. width: 80rpx!important;
  155. position: absolute;
  156. left: 0;
  157. bottom: -12rpx;
  158. }
  159. /deep/ .u-tab-item {
  160. font-size: 28rpx!important;
  161. }
  162. // loading加载
  163. .loading-more {
  164. align-items: center;
  165. justify-content: center;
  166. padding-top: 10px;
  167. padding-bottom: 10px;
  168. text-align: center;
  169. font-size: 28rpx;
  170. color: #999;
  171. }
  172. .loading-more-text::before {
  173. content: '';
  174. width: 20px;
  175. height: 20px;
  176. display: inline-block;
  177. vertical-align: middle;
  178. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  179. animation: weuiLoading 1s steps(12, end) infinite;
  180. background-repeat: no-repeat;
  181. background-image: url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E");
  182. background-size: 100%;
  183. }
  184. @keyframes weuiLoading {
  185. 0% {
  186. transform: rotate3d(0, 0, 1, 0deg);
  187. }
  188. 100% {
  189. transform: rotate3d(0, 0, 1, 360deg);
  190. }
  191. }
  192. .list-warter {
  193. border-radius: 20rpx;
  194. margin: 10px 5px;
  195. margin-top: 0px;
  196. background-color: #ffffff;
  197. // padding: 8px;
  198. position: relative;
  199. overflow: hidden;
  200. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  201. }
  202. .u-close {
  203. position: absolute;
  204. top: 32rpx;
  205. right: 32rpx;
  206. }
  207. .list-image {
  208. width: 100%;
  209. border-radius: 4px;
  210. }
  211. .list-title {
  212. font-size: 28rpx;
  213. font-weight: bold;
  214. color: $u-main-color;
  215. }
  216. .list-label{
  217. position: absolute;
  218. bottom: 0;
  219. right: 0;
  220. background-color: rgba(0,0,0,0.5);
  221. width: 140rpx;
  222. height: 48rpx;
  223. border-radius: 20rpx 0rpx 0rpx 0rpx;
  224. font-size: 22rpx;
  225. color: #FFFFFF;
  226. line-height: 48rpx;
  227. text-align: center;
  228. }
  229. .list-tag {
  230. display: flex;
  231. margin-top: 5px;
  232. }
  233. .list-tag-owner {
  234. background-color: $u-type-error;
  235. color: #FFFFFF;
  236. display: flex;
  237. align-items: center;
  238. padding: 4rpx 14rpx;
  239. border-radius: 50rpx;
  240. font-size: 20rpx;
  241. line-height: 1;
  242. }
  243. .list-tag-text {
  244. border: 1px solid $u-type-primary;
  245. color: $u-type-primary;
  246. margin-left: 10px;
  247. border-radius: 50rpx;
  248. line-height: 1;
  249. padding: 4rpx 14rpx;
  250. display: flex;
  251. align-items: center;
  252. border-radius: 50rpx;
  253. font-size: 20rpx;
  254. }
  255. .list-price {
  256. font-size: 30rpx;
  257. color: $u-type-error;
  258. margin-top: 5px;
  259. display: flex;
  260. align-items: center;
  261. }
  262. </style>