海南旅游项目 前端仓库
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.

493 lines
13 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view>
  3. <view class="lf-p-t-30 lf-p-b-30">
  4. <view class="lf-m-b-30 lf-flex lf-w-100" v-if="!start_place && !target_place">
  5. <u-icon name="search" class="search-icon"></u-icon>
  6. <input class="rom-search" type="text" placeholder="请输入商品名称" @confirm="startSearch()" v-model="search_content" />
  7. </view>
  8. <view class="special_tab">
  9. <u-tabs :list="tab_list" active-color="#1998FE" inactive-color='#777777' :is-scroll="true" @click="clicksort" :current="current" @change="tabChange"></u-tabs>
  10. <view :class="!start_place?'shop_search':'target_search'">
  11. <u-icon name="arrow-up" style="font-size: 20rpx;" :class="sort==0?'':'lf-color-blue'"></u-icon>
  12. <u-icon name="arrow-down" style="font-size: 20rpx;" :class="sort==0?'lf-color-blue':''"></u-icon>
  13. </view>
  14. </view>
  15. <swiper :style="{height: '1300rpx', width: '750rpx'}" :current="current" @change="swiperChange">
  16. <swiper-item v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex">
  17. <scroll-view class="com" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="tabItem.isRefresher" @scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
  18. <view class="lf-m-t-20"></view>
  19. <view>
  20. <!-- 活动列表 -->
  21. <view class="content">
  22. <view class="item" v-for="(item,index) of tabItem.list" :key="index" @click="$url('/pages/goodsDetail/index?goods_id='+item.id)">
  23. <view class="cover">
  24. <image :src="item.picture" class="lf-w-100 lf-h-100" mode="aspectFill"></image>
  25. </view>
  26. <view style="width: 420rpx;">
  27. <view class="lf-font-28 lf-color-333 lf-line-2">{{item.title}}</view>
  28. <view class="lf-font-24 lf-color-gray lf-line-2 lf-m-t-10" style="min-height: 64rpx;">本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩</view>
  29. <view class="lf-flex lf-m-t-25">
  30. <lf-price :price="item.price"></lf-price>
  31. <text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥{{item.original_price}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 加载 -->
  37. <view class="loading-more">
  38. <text v-if="tabItem.list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
  39. <lf-nocontent v-else></lf-nocontent>
  40. </view>
  41. <!-- 回到顶部 -->
  42. <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
  43. </view>
  44. </scroll-view>
  45. </swiper-item>
  46. </swiper>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. search_content: '',
  55. tab_list: [
  56. {
  57. id: 1,
  58. name: '综合',
  59. list: [],
  60. isRefresher: false,
  61. loadingClass: true,
  62. loadingText: '正在加载中',
  63. page: 1,
  64. isPage: true
  65. },
  66. {
  67. id: 2,
  68. name: '销量',
  69. list: [],
  70. isRefresher: false,
  71. loadingClass: true,
  72. loadingText: '正在加载中',
  73. page: 1,
  74. isPage: true
  75. },
  76. {
  77. id: 3,
  78. name: '上新',
  79. list: [],
  80. isRefresher: false,
  81. loadingClass: true,
  82. loadingText: '正在加载中',
  83. page: 1,
  84. isPage: true
  85. },
  86. {
  87. id: 4,
  88. name: '价格',
  89. list: [],
  90. isRefresher: false,
  91. loadingClass: true,
  92. loadingText: '正在加载中',
  93. page: 1,
  94. isPage: true
  95. },
  96. ],
  97. current: 0,
  98. windowHeight: 0,
  99. list: [],
  100. loadingClass: false,
  101. loadingText: '已加载全部数据~',
  102. page: 1,
  103. isPage: true,
  104. pageSize: 20,
  105. isRefresher: false,
  106. sort: 0,
  107. start_place: '',
  108. target_place: ''
  109. }
  110. },
  111. methods: {
  112. searchTarget() {
  113. let tab_item = this.tab_list[this.current];
  114. this.$http(this.API.API_SEARCHTARGET,{
  115. departure_place: this.start_place,
  116. destination: this.target_place,
  117. type:this.current,
  118. by: this.sort
  119. }).then(res => {
  120. console.log('==========',res.data.data)
  121. let isPage = res.data.prev_page_url == null?false:true;
  122. tab_item.isPage = isPage;
  123. if(!isPage){
  124. tab_item.loadingClass = false;
  125. tab_item.loadingText = '没有更多数据啦~';
  126. }
  127. tab_item.isRefresher = false;
  128. if(tab_item.page == 1){
  129. tab_item.list = res.data.data;
  130. }else{
  131. tab_item.list.push(...res.data.data);
  132. }
  133. console.log('==========',tab_item.list)
  134. }).catch(err => {
  135. })
  136. },
  137. changeSort(sort) {
  138. console.log('排序')
  139. this.sort != this.sort
  140. if(this.start_place && this.target_place) {
  141. this.searchTarget();
  142. }else {
  143. this.getActivityList()
  144. }
  145. },
  146. // scroll-view 下拉刷新
  147. onRefresherrefresh(){
  148. this.tab_list[this.current].isRefresher = true;
  149. this.$u.throttle(() => {
  150. if(this.start_place && this.target_place) {
  151. this.searchTarget();
  152. }else {
  153. this.getActivityList()
  154. }
  155. }, 200);
  156. },
  157. // 页面触底,加载下一页
  158. onScrolltolower(){
  159. let tab_item = this.tab_list[this.current];
  160. if(tab_item.isPage){
  161. tab_item.page = tab_item.page + 1;
  162. if(this.start_place && this.target_place) {
  163. this.searchTarget();
  164. }else {
  165. this.getActivityList()
  166. }
  167. }
  168. },
  169. getActivityList(){
  170. let tab_item = this.tab_list[this.current];
  171. this.$http(this.API.API_SEARCH_GOODS,{keywords:this.search_content,type:this.current,by: this.sort}).then(res => {
  172. let isPage = res.data.prev_page_url == null?false:true;
  173. tab_item.isPage = isPage;
  174. if(!isPage){
  175. tab_item.loadingClass = false;
  176. tab_item.loadingText = '没有更多数据啦~';
  177. }
  178. tab_item.isRefresher = false;
  179. if(tab_item.page == 1){
  180. tab_item.list = res.data.data;
  181. }else{
  182. tab_item.list.push(...res.data.data);
  183. }
  184. })
  185. },
  186. clicksort(index) {
  187. if(index == 3) {
  188. if(this.sort == 0) {
  189. this.sort = 1
  190. }else {
  191. this.sort = 0
  192. }
  193. if(this.start_place && this.target_place) {
  194. this.searchTarget();
  195. }else {
  196. this.getActivityList()
  197. }
  198. }else {
  199. return
  200. }
  201. },
  202. tabChange(index){
  203. this.current = index;
  204. console.log('重复只想')
  205. if(this.start_place && this.target_place) {
  206. this.searchTarget();
  207. }else {
  208. this.getActivityList()
  209. }
  210. },
  211. // 滑块下标值变化
  212. swiperChange(event){
  213. this.current = event.detail.current;
  214. if(event.detail.source == '') return; // 如果是被动出发,没有事件类型则不做处理
  215. },
  216. startSearch() {
  217. console.log('当前值',this.search_content)
  218. this.getActivityList()
  219. },
  220. },
  221. onShow(){
  222. this.windowHeight = getApp().globalData.windowHeight;
  223. },
  224. onLoad(e) {
  225. this.search_content = e.serach_content;
  226. this.start_place = e.start_place;
  227. this.target_place = e.target_place;
  228. if(this.search_content) {
  229. this.getActivityList();
  230. }
  231. if(this.start_place && this.target_place) {
  232. this.searchTarget();
  233. }
  234. console.log('传来的搜索',e)
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .shop_search {
  240. position: absolute;right: 30rpx;top: 140rpx;display: flex;flex-direction: column;
  241. }
  242. .target_search {
  243. position: absolute;right: 30rpx;top: 50rpx;display: flex;flex-direction: column;
  244. }
  245. .content{
  246. padding: 0;
  247. box-sizing: border-box;
  248. width: 750rpx;
  249. height: max-content;
  250. .item{
  251. width: 100%;
  252. height: auto;
  253. border-bottom: 1rpx solid #E5E5E5;
  254. padding: 30rpx 0;
  255. display: flex;
  256. &:last-child{
  257. border-bottom: none;
  258. }
  259. .cover{
  260. width: 250rpx;
  261. height: 210rpx;
  262. border-radius: 20rpx;
  263. overflow: hidden;
  264. margin-right: 15rpx;
  265. }
  266. }
  267. }
  268. .search-icon {
  269. position: relative;
  270. bottom: 0;
  271. left: 54rpx;
  272. }
  273. /deep/.input-placeholder{
  274. color: #777;
  275. font-size: 28rpx;
  276. }
  277. .rom-search {
  278. width: 686rpx;
  279. height: 60rpx;
  280. background: #f5f5f5;
  281. border-radius: 30rpx;
  282. padding-left: 74rpx;
  283. font-size: 28rpx;
  284. }
  285. .goods-rom {
  286. border-radius: 20rpx;
  287. width: 333rpx;
  288. height: 497rpx;
  289. background-color: white;
  290. box-shadow: 0px 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  291. &:nth-child(2n) {
  292. margin-right: 0;
  293. }
  294. &:nth-child(n + 3) {
  295. margin-top: 20rpx;
  296. }
  297. }
  298. .introduct {
  299. padding: 0 0 30rpx 32rpx;
  300. }
  301. .com{
  302. width: 100%;
  303. height: 100%;
  304. box-sizing: border-box;
  305. padding: 0rpx 28rpx;
  306. }
  307. .shop-head {
  308. width: 100%;
  309. height: 400rpx;
  310. position: relative;
  311. }
  312. .shop-flex {
  313. display: flex;
  314. padding: 30rpx;
  315. }
  316. .shop-title {
  317. width: 686rpx;
  318. height: 274rpx;
  319. border-radius: 20rpx;
  320. background-color: white;
  321. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  322. margin: 0 auto;
  323. position: relative;
  324. top: -32rpx;
  325. }
  326. .shop-img {
  327. width: 90rpx;
  328. height: 90rpx;
  329. margin-right: 15rpx;
  330. }
  331. .shop-function {
  332. width: 80rpx;
  333. height: 80rpx;
  334. border-radius: 50%;
  335. font-size: 40rpx;
  336. }
  337. .function-total {
  338. display: flex;
  339. justify-content: space-between;
  340. padding: 0 65rpx 0 65rpx;
  341. }
  342. /deep/.u-scroll-box {
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  347. }
  348. /deep/.u-scroll-box .u-tab-bar {
  349. background-color: #1998FE!important;
  350. width: 80rpx!important;
  351. position: absolute;
  352. left: 0;
  353. bottom: -12rpx;
  354. }
  355. /deep/.special_tab .u-tabs .u-scroll-box .u-tab-bar {
  356. background-color: #1998FE!important;
  357. width: 56rpx!important;
  358. position: absolute;
  359. height: 5rpx!important;
  360. left: 8rpx;
  361. bottom: -4rpx;
  362. }
  363. /deep/ .u-tab-item {
  364. font-size: 28rpx!important;
  365. }
  366. //价格筛选伪类
  367. // /deep/.special_tab .u-tab-item:nth-child(4n) ::after{
  368. // font-size: 48rpx!important;
  369. // content: '';
  370. // color: red;
  371. // }
  372. // loading加载
  373. .loading-more {
  374. align-items: center;
  375. justify-content: center;
  376. padding-top: 10px;
  377. padding-bottom: 10px;
  378. text-align: center;
  379. font-size: 28rpx;
  380. color: #999;
  381. }
  382. .loading-more-text::before {
  383. content: '';
  384. width: 20px;
  385. height: 20px;
  386. display: inline-block;
  387. vertical-align: middle;
  388. -webkit-animation: weuiLoading 1s steps(12, end) infinite;
  389. animation: weuiLoading 1s steps(12, end) infinite;
  390. background-repeat: no-repeat;
  391. 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");
  392. background-size: 100%;
  393. }
  394. @keyframes weuiLoading {
  395. 0% {
  396. transform: rotate3d(0, 0, 1, 0deg);
  397. }
  398. 100% {
  399. transform: rotate3d(0, 0, 1, 360deg);
  400. }
  401. }
  402. .list-warter {
  403. border-radius: 20rpx;
  404. margin: 10px 5px;
  405. margin-top: 0px;
  406. background-color: #ffffff;
  407. // padding: 8px;
  408. position: relative;
  409. overflow: hidden;
  410. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  411. }
  412. .u-close {
  413. position: absolute;
  414. top: 32rpx;
  415. right: 32rpx;
  416. }
  417. .list-image {
  418. width: 100%;
  419. border-radius: 4px;
  420. }
  421. .list-title {
  422. font-size: 28rpx;
  423. // font-weight: bold;
  424. color: $u-main-color;
  425. }
  426. .list-label{
  427. position: absolute;
  428. bottom: 0;
  429. right: 0;
  430. background-color: rgba(0,0,0,0.5);
  431. width: 140rpx;
  432. height: 48rpx;
  433. border-radius: 20rpx 0rpx 0rpx 0rpx;
  434. font-size: 22rpx;
  435. color: #FFFFFF;
  436. line-height: 48rpx;
  437. text-align: center;
  438. }
  439. .list-tag {
  440. display: flex;
  441. margin-top: 5px;
  442. }
  443. .list-tag-owner {
  444. background-color: $u-type-error;
  445. color: #FFFFFF;
  446. display: flex;
  447. align-items: center;
  448. padding: 4rpx 14rpx;
  449. border-radius: 50rpx;
  450. font-size: 20rpx;
  451. line-height: 1;
  452. }
  453. .list-tag-text {
  454. border: 1px solid $u-type-primary;
  455. color: $u-type-primary;
  456. margin-left: 10px;
  457. border-radius: 50rpx;
  458. line-height: 1;
  459. padding: 4rpx 14rpx;
  460. display: flex;
  461. align-items: center;
  462. border-radius: 50rpx;
  463. font-size: 20rpx;
  464. }
  465. .list-price {
  466. font-size: 30rpx;
  467. color: $u-type-error;
  468. margin-top: 5px;
  469. display: flex;
  470. align-items: center;
  471. }
  472. </style>