travel.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="travelPage">
  3. <u-swiper height=500 :list="swiper" circular :autoplay="true" show-center-play-btn :poster="imgUrl" :duration="1000" :interval="5000">
  4. </u-swiper>
  5. <u-sticky bgColor="#fff">
  6. <view class="tags">
  7. <u-tabs :list="list" :activeStyle="{color: '#1E9F6A','font-weight': 'bold'}" lineColor="#1E9F6A"
  8. :inactiveStyle="{color: 'rgba(51, 51, 51, 0.5)'}" :is-scroll="true" lineWidth="55"
  9. @change="chooseTitle">
  10. </u-tabs>
  11. </view>
  12. </u-sticky>
  13. <view class="travelContent" v-for="item,index in listArr" @click="gotravelDetails(item.id)">
  14. <!-- <image src="http://cdn.uviewui.com/uview/empty/list.png" mode=""></image> -->
  15. <view class="video">
  16. <image :src="item.cover_picture" mode="aspectFill"></image>
  17. <!-- <video src="" controls></video> -->
  18. </view>
  19. <view class="travel">
  20. <view class="traveltitle">
  21. {{item.name}}
  22. </view>
  23. <view class="price">
  24. ¥{{item.min_price}}
  25. </view>
  26. </view>
  27. <view class="describe" v-if="item.subtitle">
  28. {{item.subtitle}}
  29. <!-- 夏日的森林,雨水充沛了山林,鲜花盛放,溪水潺潺。漫步于自然之中,感受清新的空气,放空心灵,沉醉于山雾之中,感受不同于城市的静谧与轻松。 -->
  30. </view>
  31. </view>
  32. <view class="paddingsafe"></view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. imgUrl: "https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png",
  40. swiper: [],
  41. // 标签栏
  42. list: [
  43. // {name:"老年康养团",id:1},{name:"上班族解乏团",id:2},{name:"少儿夏令营",id:3},{name:"自然&教育",id:4},
  44. ],
  45. // 套餐列表
  46. listArr: [
  47. // {cover_picture:"https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png",name:"深林康养",description:" 夏日的森林,雨水充沛了山林,鲜花盛放,溪水潺潺。漫步于自然之中,感受清新的空气,放空心灵,沉醉于山雾之中,感受不同于城市的静谧与轻松。",min_price:"300"},
  48. // {cover_picture:"https://t38.9026.com/uploads/golf/images/2022-05-31/20220531601652.png",name:"深林康养",description:" 夏日的森林,雨水充沛了山林,鲜花盛放,溪水潺潺。漫步于自然之中,感受清新的空气,放空心灵,沉醉于山雾之中,感受不同于城市的静谧与轻松。",min_price:"300"}
  49. ],
  50. lineWidth: ''
  51. }
  52. },
  53. onLoad() {
  54. this.init()
  55. },
  56. onShow() {
  57. this.initvist()
  58. },
  59. methods: {
  60. initvist() {
  61. let curPage = getCurrentPages();
  62. let route = curPage[curPage.length - 1].route; //获取当前页面的路由
  63. let code = uni.getStorageSync("code")
  64. let obj = {
  65. page: route,
  66. code: code
  67. }
  68. if (code) {
  69. uni.$u.http.post('/api/visit/add', obj, {
  70. custom: {
  71. auth: true
  72. }
  73. }).then((res) => {}).catch((err) => {})
  74. }
  75. },
  76. init() {
  77. let userinfo = this.$store.state.userinfo
  78. // 获取轮播图
  79. let home = uni.getStorageSync("home")
  80. home.images.forEach(item => {
  81. this.swiper.push(item.url)
  82. })
  83. uni.$u.http.post('/api/category/list', userinfo, {
  84. custom: {
  85. auth: true
  86. }
  87. }).then((res) => {
  88. // console.log(res)
  89. this.list = res
  90. }).catch((err) => {
  91. console.log(err)
  92. })
  93. // 套餐列表
  94. uni.$u.http.post('/api/good/index', {
  95. category_id: 1,
  96. per_page: 15,
  97. page: 1
  98. }, {
  99. custom: {
  100. auth: true
  101. }
  102. }).then((res) => {
  103. // console.log(res.data)
  104. this.listArr = res.data
  105. this.list2 = res.data.picture
  106. // console.log(res.data[0].picture,"详情图")
  107. }).catch((err) => {
  108. console.log(err)
  109. })
  110. },
  111. // 切换标签
  112. chooseTitle(e) {
  113. // console.log(e)
  114. this.lineWidth = e.rect.width
  115. uni.$u.http.post('/api/good/index', {
  116. category_id: e.id,
  117. per_page: 15,
  118. page: 1
  119. }, {
  120. custom: {
  121. auth: true
  122. }
  123. }).then((res) => {
  124. // console.log(res.data)
  125. this.listArr = res.data
  126. }).catch((err) => {
  127. console.log(err)
  128. })
  129. },
  130. // 跳转套餐详情
  131. gotravelDetails(id) {
  132. uni.navigateTo({
  133. url: `/pages/travel/travelDetails?id=${id}`
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="less">
  140. page {
  141. color: rgba(51, 51, 51, 1);
  142. }
  143. .tags {
  144. box-shadow: 0px 2rpx 8rpx 0px rgba(0, 0, 0, 0.06);
  145. }
  146. .travelPage {
  147. // padding: 20rpx;
  148. box-sizing: border-box;
  149. height: 100%;
  150. background-color: #FCFCFC;
  151. .title {
  152. margin: 20rpx;
  153. }
  154. .travelContent {
  155. font-size: 28rpx;
  156. font-family: PingFang-SC-Medium, PingFang-SC;
  157. font-weight: 500;
  158. margin: 40rpx 0rpx;
  159. background-color: #fff;
  160. border-radius: 30rpx;
  161. // background: #FFFFFF;
  162. box-shadow: 0px 8rpx 14rpx 0rpx rgba(0, 21, 3, 0.05);
  163. border-radius: 0px 0px 16rpx 100rpx;
  164. .video {
  165. margin: 0 30rpx;
  166. // box-shadow: 0px 8px 14px 0px rgba(0, 21, 3, 0.05);
  167. // border-radius: 16px 16px 16px 58px;
  168. image {
  169. width: 690rpx;
  170. height: 410rpx;
  171. }
  172. }
  173. // video {
  174. // width: 100%;
  175. // box-shadow: 0px 8px 14px 0px rgba(0, 21, 3, 0.05);
  176. // border-radius: 16rpx 16rpx 0px 0px;
  177. // }
  178. .travel {
  179. font-weight: bold;
  180. font-size: 30rpx;
  181. padding: 40rpx 56rpx 10rpx;
  182. display: flex;
  183. justify-content: space-between;
  184. }
  185. .describe {
  186. font-size: 26rpx;
  187. box-sizing: border-box;
  188. padding: 10rpx 56rpx 40rpx;
  189. }
  190. }
  191. }
  192. </style>