ticket.vue 5.3 KB

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