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

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