ticket.vue 6.0 KB

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