ticket.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. mounted() {
  86. this.getTicket();
  87. this.page = 1;
  88. this.list = [];
  89. this.getList();
  90. },
  91. methods: {
  92. getTicket() {
  93. let operate_id = uni.getStorageSync('operate_id');
  94. getTicket({
  95. operate_id: operate_id
  96. }).then((res) => {
  97. if (res.code === 1) {
  98. this.navList = [...this.navList, ...res.data]
  99. }
  100. })
  101. },
  102. getList() {
  103. let operate_id = uni.getStorageSync('operate_id');
  104. ticketList({
  105. category_id: this.type,
  106. page: this.page,
  107. operate_id: operate_id,
  108. search: this.search
  109. }).then((res) => {
  110. if (res.code === 1) {
  111. this.list = [...this.list, ...res.data.items];
  112. this.total = res.data.total;
  113. }
  114. })
  115. },
  116. searchFun() {
  117. this.page = 1;
  118. this.list = [];
  119. this.getList();
  120. },
  121. selectType(id) {
  122. if (this.type != id) {
  123. this.type = id;
  124. this.page = 1;
  125. this.list = [];
  126. this.getList();
  127. }
  128. },
  129. toBack() {
  130. tools.leftClick()
  131. },
  132. scrolltolower() {
  133. if (this.list.length < this.total) {
  134. this.page += 1;
  135. this.getList();
  136. }
  137. },
  138. toDet(item) {
  139. uni.navigateTo({
  140. url: "/pages-buy/ticket-det?id=" + item.id
  141. })
  142. },
  143. },
  144. }
  145. </script>
  146. <style>
  147. body {
  148. background-color: #fff;
  149. }
  150. </style>
  151. <style scoped lang="scss">
  152. .pw-imgage {
  153. width: 85rpx;
  154. height: 45rpx;
  155. }
  156. .wh32 {
  157. position: absolute;
  158. left: 24rpx;
  159. top: 20rpx;
  160. width: 32rpx;
  161. height: 32rpx;
  162. }
  163. .w-470 {
  164. width: 470rpx;
  165. }
  166. .ticket-box {
  167. .list-item {
  168. width: 100%;
  169. min-height: 200rpx;
  170. margin-bottom: 40rpx;
  171. background-color: #fff;
  172. image {
  173. width: 200rpx;
  174. height: 200rpx;
  175. border-radius: 20rpx;
  176. margin-right: 20rpx;
  177. }
  178. .to-box {
  179. width: 132rpx;
  180. height: 52rpx;
  181. line-height: 52rpx;
  182. background: linear-gradient(225deg, #41ABF5 0%, #5BD8FB 100%);
  183. border-radius: 200rpx;
  184. }
  185. }
  186. .nav-box {
  187. width: 100%;
  188. // height: 452rpx;
  189. position: relative;
  190. .head-bg {
  191. position: absolute;
  192. top: 0;
  193. left: 0;
  194. width: 100%;
  195. height: 400rpx;
  196. z-index: -1;
  197. }
  198. .head-search {
  199. width: 100%;
  200. position: relative;
  201. .s-icon {
  202. position: absolute;
  203. left: 24rpx;
  204. top: 20rpx;
  205. }
  206. input {
  207. width: 100%;
  208. height: 72rpx;
  209. background: #FFFFFF;
  210. border-radius: 200rpx;
  211. box-sizing: border-box;
  212. padding: 0 130rpx 0 68rpx;
  213. font-size: 32rpx;
  214. }
  215. .head-search-buttom {
  216. width: 120rpx;
  217. height: 60rpx;
  218. background: linear-gradient(90deg, #2CE6F8 0%, #41ABF5 100%);
  219. border-radius: 200rpx;
  220. line-height: 60rpx;
  221. position: absolute;
  222. right: 6rpx;
  223. top: 6rpx;
  224. }
  225. }
  226. .nav-list {
  227. overflow-x: scroll;
  228. margin: 0 0 36rpx 0;
  229. .nav-item {
  230. width: 96rpx !important;
  231. height: 126rpx;
  232. margin-right: 48rpx;
  233. .nav-img {
  234. width: 80rpx;
  235. height: 80rpx;
  236. margin: 0 auto 12rpx auto;
  237. z-index: 10;
  238. }
  239. .w-96 {
  240. width: 96rpx;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. </style>