ticket.vue 5.6 KB

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