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

331 lines
10 KiB

  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="true" :showIcon="true" bgColor="#fff" title="收藏"></lf-nav>
  4. <view v-if="tab_list.length">
  5. <u-tabs :list="tab_list" 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="tab_list[0].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. let _public = {
  37. page: 1,
  38. isPage: true,
  39. loadingClass: true,
  40. loadingText: '正在加载中'
  41. }
  42. return {
  43. tab_list: [
  44. {
  45. name:'品牌',
  46. type: 'jc_brand',
  47. ..._public
  48. },
  49. {
  50. name:'商品',
  51. type: 'jc_goods',
  52. ..._public
  53. }
  54. ],
  55. title_current:0,
  56. list: [
  57. {
  58. id: 10,
  59. original_price: "4111.00",
  60. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  61. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  62. price: "2412.00",
  63. product_id: 1008,
  64. sale: 0,
  65. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  66. },
  67. {
  68. id: 10,
  69. original_price: "4111.00",
  70. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  71. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  72. price: "2412.00",
  73. product_id: 1008,
  74. sale: 0,
  75. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  76. },
  77. {
  78. id: 10,
  79. original_price: "4111.00",
  80. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  81. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  82. price: "2412.00",
  83. product_id: 1008,
  84. sale: 0,
  85. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  86. },
  87. {
  88. id: 10,
  89. original_price: "4111.00",
  90. picture: "https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png",
  91. pictures: ["https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png"],
  92. price: "2412.00",
  93. product_id: 1008,
  94. sale: 0,
  95. title: "三亚悦榕庄(Banyan Tree Sanya Resort and Spa)"
  96. }
  97. ],
  98. show_count: 0,
  99. windowHeight: 0,
  100. scrollH: 0,
  101. nav_height: 0,
  102. isRefresher: true
  103. }
  104. },
  105. components: {
  106. lfWaterfall
  107. },
  108. onShow(){
  109. this.windowHeight = getApp().globalData.windowHeight;
  110. this.getData();
  111. },
  112. methods: {
  113. titletabChange(index){
  114. this.title_current = index;
  115. },
  116. getData(options = {}) {
  117. let tab_item = this.tab_list[this.title_current];
  118. this.$http
  119. .get({
  120. api: 'api/collect',
  121. data: {
  122. type: 'jc_goods'
  123. },
  124. header: {
  125. Authorization: this.$cookieStorage.get('user_token')
  126. },
  127. })
  128. .then(res => {
  129. console.log(res.data)
  130. if (res.data.code == 200) {
  131. let isPage = res.data.data.next_page_url == null?false:true;
  132. tab_item.isPage = isPage;
  133. if(!isPage) {
  134. tab_item.loadingClass = false;
  135. tab_item.loadingText = '没有更多数据啦~';
  136. }
  137. if(options.type == 'pageRefresh') {
  138. uni.stopPullDownRefresh();
  139. }else if(options.type == 'scrollRefresh') {
  140. this.isRefresher = false;
  141. }
  142. if(tab_item.page == 1) {
  143. tab_item.list = res.data.data.data;
  144. }else {
  145. tab_item.list.push(...res.data.data.data);
  146. }
  147. console.log('当前列表数据',tab_item.list)
  148. } else {
  149. wx.showModal({
  150. content: '请下拉页面刷新重试',
  151. showCancel: false
  152. });
  153. }
  154. wx.hideLoading();
  155. })
  156. .catch(() => {
  157. wx.hideLoading();
  158. });
  159. },
  160. // 滑块下标值变化
  161. swiperChange(event){
  162. this.current = event.detail.current;
  163. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  164. },
  165. // 页面触底,加载下一页
  166. onScrolltolower(){
  167. let tab_item = this.tab_list[this.current];
  168. if(tab_item.isPage){
  169. tab_item.page = tab_item.page + 1;
  170. this.getData();
  171. }
  172. },
  173. // scroll-view 下拉刷新
  174. onRefresherrefresh(){
  175. this.$u.throttle(() => {
  176. this.clearTabItem();
  177. this.getData();
  178. }, 200);
  179. },
  180. clearTabItem(){
  181. let tab_item = this.tab_list[this.current];
  182. tab_item.page = 1;
  183. tab_item.isPage = true;
  184. tab_item.isRefresher = true;
  185. tab_item.loadingClass = true;
  186. tab_item.loadingText = '正在加载中';
  187. tab_item.list = [];
  188. this.$set(this.tab_list, this.current, tab_item);
  189. // this.$refs.uWaterfallFather[this.current].clear();
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .collect-img {
  196. width: 150rpx;
  197. height: 150rpx;
  198. border-radius: 5rpx;
  199. }
  200. /deep/.u-scroll-box {
  201. display: flex;
  202. justify-content: center;
  203. align-items: center;
  204. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  205. }
  206. /deep/.u-scroll-box .u-tab-bar {
  207. background-color: #15716E!important;
  208. width: 80rpx!important;
  209. position: absolute;
  210. left: 0;
  211. bottom: -12rpx;
  212. }
  213. /deep/ .u-tab-item {
  214. font-size: 28rpx!important;
  215. }
  216. // loading加载
  217. .loading-more {
  218. align-items: center;
  219. justify-content: center;
  220. padding-top: 10px;
  221. padding-bottom: 10px;
  222. text-align: center;
  223. font-size: 28rpx;
  224. color: #999;
  225. }
  226. .loading-more-text::before {
  227. content: '';
  228. width: 20px;
  229. height: 20px;
  230. display: inline-block;
  231. vertical-align: middle;
  232. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  233. animation: weuiLoading 1s steps(12, end) infinite;
  234. background-repeat: no-repeat;
  235. 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");
  236. background-size: 100%;
  237. }
  238. @keyframes weuiLoading {
  239. 0% {
  240. transform: rotate3d(0, 0, 1, 0deg);
  241. }
  242. 100% {
  243. transform: rotate3d(0, 0, 1, 360deg);
  244. }
  245. }
  246. .list-warter {
  247. border-radius: 20rpx;
  248. margin: 10px 5px;
  249. margin-top: 0px;
  250. background-color: #ffffff;
  251. // padding: 8px;
  252. position: relative;
  253. overflow: hidden;
  254. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  255. }
  256. .u-close {
  257. position: absolute;
  258. top: 32rpx;
  259. right: 32rpx;
  260. }
  261. .list-image {
  262. width: 100%;
  263. border-radius: 4px;
  264. }
  265. .list-title {
  266. font-size: 28rpx;
  267. font-weight: bold;
  268. color: $u-main-color;
  269. }
  270. .list-label{
  271. position: absolute;
  272. bottom: 0;
  273. right: 0;
  274. background-color: rgba(0,0,0,0.5);
  275. width: 140rpx;
  276. height: 48rpx;
  277. border-radius: 20rpx 0rpx 0rpx 0rpx;
  278. font-size: 22rpx;
  279. color: #FFFFFF;
  280. line-height: 48rpx;
  281. text-align: center;
  282. }
  283. .list-tag {
  284. display: flex;
  285. margin-top: 5px;
  286. }
  287. .list-tag-owner {
  288. background-color: $u-type-error;
  289. color: #FFFFFF;
  290. display: flex;
  291. align-items: center;
  292. padding: 4rpx 14rpx;
  293. border-radius: 50rpx;
  294. font-size: 20rpx;
  295. line-height: 1;
  296. }
  297. .list-tag-text {
  298. border: 1px solid $u-type-primary;
  299. color: $u-type-primary;
  300. margin-left: 10px;
  301. border-radius: 50rpx;
  302. line-height: 1;
  303. padding: 4rpx 14rpx;
  304. display: flex;
  305. align-items: center;
  306. border-radius: 50rpx;
  307. font-size: 20rpx;
  308. }
  309. .list-price {
  310. font-size: 30rpx;
  311. color: $u-type-error;
  312. margin-top: 5px;
  313. display: flex;
  314. align-items: center;
  315. }
  316. </style>