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

278 lines
8.8 KiB

  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="true" :showIcon="true" bgColor="#fff" 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 8">
  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="width: 480rpx;min-height: 160rpx;justify-content: space-between;">
  11. <view class="lf-font-36 lf-color-black lf-line-1">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. <u-back-top :scrollTop="pageScrollTop"></u-back-top>
  27. </view>
  28. </template>
  29. <script>
  30. import lfWaterfall from '@/components/lf-waterfall-shopdetails/lf-waterfall.vue';
  31. export default {
  32. data() {
  33. return {
  34. title_tab: [
  35. {name:'推荐'},
  36. {name:'商品'}
  37. ],
  38. title_current:0,
  39. list: [
  40. {
  41. id: 10,
  42. original_price: "4111.00",
  43. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  44. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  45. price: "2412.00",
  46. product_id: 1008,
  47. sale: 0,
  48. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  49. },
  50. {
  51. id: 10,
  52. original_price: "4111.00",
  53. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  54. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  55. price: "2412.00",
  56. product_id: 1008,
  57. sale: 0,
  58. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  59. },
  60. {
  61. id: 10,
  62. original_price: "4111.00",
  63. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  64. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  65. price: "2412.00",
  66. product_id: 1008,
  67. sale: 0,
  68. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  69. },
  70. {
  71. id: 10,
  72. original_price: "4111.00",
  73. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  74. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  75. price: "2412.00",
  76. product_id: 1008,
  77. sale: 0,
  78. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  79. }
  80. ],
  81. show_count: 0,
  82. windowHeight: 0,
  83. loading_text: '没有更多数据啦~',
  84. loading_class: false
  85. }
  86. },
  87. components: {
  88. lfWaterfall
  89. },
  90. onShow(){
  91. this.windowHeight = getApp().globalData.windowHeight;
  92. },
  93. methods: {
  94. titletabChange(index){
  95. this.title_current = index;
  96. },
  97. getData() {
  98. let tab_item = this.tab_list[this.current];
  99. let isPage = false;
  100. tab_item.isPage = isPage;
  101. if(!isPage){
  102. tab_item.loadingClass = false;
  103. tab_item.loadingText = '没有更多数据啦~';
  104. }
  105. tab_item.isRefresher = false;
  106. },
  107. // 滑块下标值变化
  108. swiperChange(event){
  109. this.current = event.detail.current;
  110. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  111. },
  112. // 页面触底,加载下一页
  113. onScrolltolower(){
  114. let tab_item = this.tab_list[this.current];
  115. if(tab_item.isPage){
  116. tab_item.page = tab_item.page + 1;
  117. this.getData();
  118. }
  119. },
  120. // scroll-view 下拉刷新
  121. onRefresherrefresh(){
  122. this.$u.throttle(() => {
  123. this.clearTabItem();
  124. this.getData();
  125. }, 200);
  126. },
  127. clearTabItem(){
  128. let tab_item = this.tab_list[this.current];
  129. tab_item.page = 1;
  130. tab_item.isPage = true;
  131. tab_item.isRefresher = true;
  132. tab_item.loadingClass = true;
  133. tab_item.loadingText = '正在加载中';
  134. tab_item.list = [];
  135. this.$set(this.tab_list, this.current, tab_item);
  136. // this.$refs.uWaterfallFather[this.current].clear();
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .collect-img {
  143. width: 150rpx;
  144. height: 150rpx;
  145. border-radius: 5rpx;
  146. }
  147. /deep/.u-scroll-box {
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  152. }
  153. /deep/.u-scroll-box .u-tab-bar {
  154. background-color: #15716E!important;
  155. width: 80rpx!important;
  156. position: absolute;
  157. left: 0;
  158. bottom: -12rpx;
  159. }
  160. /deep/ .u-tab-item {
  161. font-size: 28rpx!important;
  162. }
  163. // loading加载
  164. .loading-more {
  165. align-items: center;
  166. justify-content: center;
  167. padding-top: 10px;
  168. padding-bottom: 10px;
  169. text-align: center;
  170. font-size: 28rpx;
  171. color: #999;
  172. }
  173. .loading-more-text::before {
  174. content: '';
  175. width: 20px;
  176. height: 20px;
  177. display: inline-block;
  178. vertical-align: middle;
  179. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  180. animation: weuiLoading 1s steps(12, end) infinite;
  181. background-repeat: no-repeat;
  182. 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");
  183. background-size: 100%;
  184. }
  185. @keyframes weuiLoading {
  186. 0% {
  187. transform: rotate3d(0, 0, 1, 0deg);
  188. }
  189. 100% {
  190. transform: rotate3d(0, 0, 1, 360deg);
  191. }
  192. }
  193. .list-warter {
  194. border-radius: 20rpx;
  195. margin: 10px 5px;
  196. margin-top: 0px;
  197. background-color: #ffffff;
  198. // padding: 8px;
  199. position: relative;
  200. overflow: hidden;
  201. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  202. }
  203. .u-close {
  204. position: absolute;
  205. top: 32rpx;
  206. right: 32rpx;
  207. }
  208. .list-image {
  209. width: 100%;
  210. border-radius: 4px;
  211. }
  212. .list-title {
  213. font-size: 28rpx;
  214. font-weight: bold;
  215. color: $u-main-color;
  216. }
  217. .list-label{
  218. position: absolute;
  219. bottom: 0;
  220. right: 0;
  221. background-color: rgba(0,0,0,0.5);
  222. width: 140rpx;
  223. height: 48rpx;
  224. border-radius: 20rpx 0rpx 0rpx 0rpx;
  225. font-size: 22rpx;
  226. color: #FFFFFF;
  227. line-height: 48rpx;
  228. text-align: center;
  229. }
  230. .list-tag {
  231. display: flex;
  232. margin-top: 5px;
  233. }
  234. .list-tag-owner {
  235. background-color: $u-type-error;
  236. color: #FFFFFF;
  237. display: flex;
  238. align-items: center;
  239. padding: 4rpx 14rpx;
  240. border-radius: 50rpx;
  241. font-size: 20rpx;
  242. line-height: 1;
  243. }
  244. .list-tag-text {
  245. border: 1px solid $u-type-primary;
  246. color: $u-type-primary;
  247. margin-left: 10px;
  248. border-radius: 50rpx;
  249. line-height: 1;
  250. padding: 4rpx 14rpx;
  251. display: flex;
  252. align-items: center;
  253. border-radius: 50rpx;
  254. font-size: 20rpx;
  255. }
  256. .list-price {
  257. font-size: 30rpx;
  258. color: $u-type-error;
  259. margin-top: 5px;
  260. display: flex;
  261. align-items: center;
  262. }
  263. </style>