ticket.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <!-- 票务 -->
  3. <view class="ticket-box iPhone-bottom flex-common-css box-border-box">
  4. <view class="nav-box">
  5. <image class="head-bg" src="@/static/img/buy/ticket-bg.png" mode="scaleToFill"></image>
  6. <Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
  7. <template>
  8. <view slot="custom" class="align-items-center">
  9. <uni-icons type="left" size="20" @click="toBack()" color="#fff"></uni-icons>
  10. <view class="w-390 text-overflow-ellipsis-one fs-36 fw-400 fc-f">票务</view>
  11. </view>
  12. </template>
  13. </Nav>
  14. <view class="box-border-box plr-24 mb-32">
  15. <view class="head-search">
  16. <uni-icons class="s-icon" type="search" size="19"></uni-icons>
  17. <input v-model="search" type="text" placeholder="搜一搜带你玩周边">
  18. <view class="head-search-buttom text-align-center fs-28 fw-500 fc-f" @click="searchFun()">搜索</view>
  19. </view>
  20. </view>
  21. <view class="display-flex box-border-box plr-24 nav-list">
  22. <view class="text-align-center nav-item" v-for="(item,i) in navList" :key="i" @click="selectType(item.id)">
  23. <image class="nav-img" :src="item.img" mode="scaleToFill"></image>
  24. <view class="fs-24 w-96" :class="type == item.id?'fw-600 fc-41ABF5':'fw-400'">{{item.name}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view v-if="list.length === 0" class="scroll-view-css">
  29. <EnBlank :customSrc='true'>
  30. <template v-slot:blankImg>
  31. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  32. </template>
  33. </EnBlank>
  34. </view>
  35. <scroll-view v-else class="scroll-view-css box-border-box plr-24" scroll-y="true" @scrolltolower="scrolltolower">
  36. <view class="list-item display-flex" v-for="(item,i) in list" :key="i" @click="toDet(item)">
  37. <image :src="item.cover_img" mode="aspectFill"></image>
  38. <view class="flex-1 flex-direction flex-justify-space">
  39. <view class="w-470 text-overflow-ellipsis fw-600 fs-32 mb-48">{{item.title}}</view>
  40. <view class=" flex-justify-space align-items-flex-end">
  41. <view class="">
  42. <span class="fs-24 fw-400 fc-FB3D03">¥</span>
  43. <span class="fw-b fs-40 fc-FB3D03">{{item.price}}</span>
  44. <span class="text-line-through fs-24 fc-9 fw-400">¥{{item.line_price}}</span>
  45. </view>
  46. <view class="to-box fs-28 fw-400 fc-f text-align-center">马上抢</view>
  47. </view>
  48. </view>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. </template>
  53. <script>
  54. import {ticketList} from '@/api/ticket.js';
  55. import {getTicket} from '@/api/category.js';
  56. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  57. import tools from "@/service/tools";
  58. export default {
  59. components:{EnBlank},
  60. data(){
  61. return{
  62. type:0,
  63. navList:[
  64. {name:"全部",id:0,img:require('@/static/img/buy/t-all.png')},
  65. ],
  66. page:1,
  67. total:0,
  68. list:[],
  69. search:'',
  70. }
  71. },
  72. onShow() {
  73. this.page = 1;
  74. this.list = [];
  75. this.getList();
  76. },
  77. mounted() {
  78. this.getTicket();
  79. },
  80. methods:{
  81. getTicket(){
  82. getTicket().then((res)=>{
  83. if(res.code === 1){
  84. this.navList = [...this.navList,...res.data]
  85. }
  86. })
  87. },
  88. getList(){
  89. ticketList({category_id:this.type,page:this.page,search:this.search}).then((res)=>{
  90. if(res.code === 1){
  91. this.list = [...this.list,...res.data.items];
  92. this.total = res.data.total;
  93. }
  94. })
  95. },
  96. searchFun(){
  97. this.page = 1;
  98. this.list = [];
  99. this.getList();
  100. },
  101. selectType(id){
  102. if(this.type != id){
  103. this.type = id;
  104. this.page = 1;
  105. this.list = [];
  106. this.getList();
  107. }
  108. },
  109. toBack(){
  110. tools.leftClick()
  111. },
  112. scrolltolower(){
  113. if(this.list.length < this.total){
  114. this.page += 1;
  115. this.getList();
  116. }
  117. },
  118. toDet(item){
  119. uni.navigateTo({
  120. url:"/pages-buy/ticket-det?id=" + item.id
  121. })
  122. },
  123. },
  124. }
  125. </script>
  126. <style>
  127. body{
  128. background-color: #fff;
  129. }
  130. </style>
  131. <style scoped lang="scss">
  132. .w-470{
  133. width: 470rpx;
  134. }
  135. .ticket-box{
  136. .list-item{
  137. width: 100%;
  138. min-height: 200rpx;
  139. margin-bottom: 40rpx;
  140. background-color: #fff;
  141. image{
  142. width: 200rpx;
  143. height: 200rpx;
  144. border-radius: 20rpx;
  145. margin-right: 20rpx;
  146. }
  147. .to-box{
  148. width: 132rpx;
  149. height: 52rpx;
  150. line-height: 52rpx;
  151. background: linear-gradient( 225deg, #41ABF5 0%, #5BD8FB 100%);
  152. border-radius: 200rpx;
  153. }
  154. }
  155. .nav-box{
  156. width: 100%;
  157. height: 452rpx;
  158. position: relative;
  159. .head-bg{
  160. position: absolute;
  161. top: 0;
  162. left: 0;
  163. width: 100%;
  164. height: 452rpx;
  165. z-index: -1;
  166. }
  167. .head-search{
  168. width: 100%;
  169. position: relative;
  170. .s-icon{
  171. position: absolute;
  172. left: 24rpx;
  173. top: 20rpx;
  174. }
  175. input{
  176. width:100%;
  177. height: 72rpx;
  178. background: #FFFFFF;
  179. border-radius: 200rpx;
  180. box-sizing: border-box;
  181. padding: 0 130rpx 0 68rpx;
  182. font-size: 32rpx;
  183. }
  184. .head-search-buttom{
  185. width: 120rpx;
  186. height: 60rpx;
  187. background: linear-gradient( 90deg, #2CE6F8 0%, #41ABF5 100%);
  188. border-radius: 200rpx;
  189. line-height: 60rpx;
  190. position: absolute;
  191. right: 6rpx;
  192. top: 6rpx;
  193. }
  194. }
  195. .nav-list{
  196. overflow-x: scroll;
  197. .nav-item{
  198. width: 96rpx !important;
  199. height: 126rpx;
  200. margin-right: 48rpx;
  201. .nav-img{
  202. width: 80rpx;
  203. height: 80rpx;
  204. margin: 0 auto 12rpx auto;
  205. z-index: 10;
  206. }
  207. .w-96{
  208. width: 96rpx;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. </style>