index.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="index" :style="{ top: statusHeight + 'px' }">
  5. <view class="barrage">
  6. <!-- 背景 -->
  7. <image class="barrage-bg" src="../../static/index/barrage_bgTwo.png" mode="scaleToFill"></image>
  8. <!-- 中奖信息轮播 -->
  9. <swiper class="barrage-swiper" :interval="2000" :autoplay="true" :vertical="true" :circular="true">
  10. <swiper-item v-for="(item, index) in prizeNewsListOne" :key="index">
  11. <view class="barrage-swiper-item flex">
  12. <view class="barrage-swiper-item-content flex">
  13. <image :src="item.avatar" mode="scaleToFill" />
  14. <view class="title ells-one">{{ item.nickName }}
  15. {{ item.type == 1 ? '获得了' : '兑换了' }} {{ item.prizeInfo }}
  16. </view>
  17. </view>
  18. </view>
  19. </swiper-item>
  20. </swiper>
  21. <view class="barrage-none"></view>
  22. </view>
  23. <!-- 查看规则 -->
  24. <view class="rule">
  25. <!-- #ifdef MP-WEIXIN -->
  26. <view class="rule-gameimg flex">
  27. <image src="../../static/index/games.png" @click="toExternalGames" mode="scaleToFill"></image>
  28. </view>
  29. <!-- #endif -->
  30. <!-- #ifndef MP-ALIPAY -->
  31. <!-- <view class="rule-content flex" @click="contactService">
  32. <image src="../../static/index/index_tip_bgTwo.png" mode="scaleToFill"></image>
  33. <text>投诉建议</text>
  34. </view> -->
  35. <view class="rule-content flex" @click="toRule">
  36. <image src="../../static/index/index_tip.png" mode="scaleToFill"></image>
  37. <text>查看规则</text>
  38. </view>
  39. <!-- #endif -->
  40. </view>
  41. <!-- <view @click="toLucky">这是测试盲票开奖入口</view> -->
  42. <!-- <view @click="toStore">这是测试门店盲票列表入口</view> -->
  43. <!-- 盲票轮播 -->
  44. <view class="ticket">
  45. <view class="ticket-bgc" @click="ticketLeft()">
  46. <image src="../../static/index/index_anniu.png" mode="scaleToFill"></image>
  47. </view>
  48. <swiper class="ticket-swiper" :current="ticketIndex" :autoplay="false" :circular="true" :duration="200"
  49. @change="changeTicket">
  50. <swiper-item v-for="(item, index) in ticketList" :key="index">
  51. <view class="ticket-swiper-item flex">
  52. <image class="ticket-swiper-item-box" @click="toTicketBox(item)" :src="item.picUrl[0]" mode="aspectFit">
  53. </image>
  54. </view>
  55. </swiper-item>
  56. </swiper>
  57. <view class="ticket-left" @click="ticketRight()">
  58. <image src="../../static/index/index_tip_left.png" mode="scaleToFill"></image>
  59. </view>
  60. <view class="ticket-right" @click="ticketLeft()">
  61. <image src="../../static/index/index_tip_left.png" mode="scaleToFill"></image>
  62. </view>
  63. </view>
  64. <!-- 投诉建议 -->
  65. <view class="proposal flex">
  66. <view class="proposal-time flex" v-if="activityTime && activityTime > 0" @click="toActivity">
  67. <image src="../../static/index/index_time_top.png" mode="scaleToFill"></image>
  68. <view class="time">
  69. <u-count-down :time="activityTime" format="HH:mm:ss:SSS" autoStart millisecond>
  70. </u-count-down>
  71. </view>
  72. </view>
  73. <view v-else></view>
  74. <view class="proposal-progress">
  75. <u-line-progress :percentage="percentage" height="3" :showText="false"
  76. inactiveColor="rgba(255, 255, 255, .36)" activeColor="#fff" />
  77. </view>
  78. </view>
  79. <!-- 盲票名称轮播 -->
  80. <view class="ticket-title" flex>
  81. <swiper class="ticket-title-swiper flex" :duration="0" :current="ticketTitleIndex" previous-margin="80px"
  82. next-margin="80px" :autoplay="false" :circular="true" @change="changeTicketTitle">
  83. <swiper-item v-for="(item, index) in ticketList" :key="index">
  84. <view class="ticket-title-swiper-item flex" @click="clickTicketTitle(index)"
  85. :class="{ 'action': ticketTitleIndex == index }">
  86. <text class="ells-one">{{ item.title }}</text>
  87. </view>
  88. </swiper-item>
  89. </swiper>
  90. </view>
  91. <!-- 刮开盲票 -->
  92. <view class="ticket-btn flex">
  93. <view class="ticket-btn-left flex" @click="toRollingGame">
  94. <image src="../../static/index/index_duihuandating.png" mode="scaleToFill"></image>
  95. <view class="ticket-btn-left__title">兑换大厅</view>
  96. </view>
  97. <view class="ticket-btn-center flex" @click="payment">
  98. <view class="image-wrap flex">
  99. <image class="btn" src="../../static/index/index_btn.png" mode="scaleToFill"></image>
  100. <image class="shadow" src="../../static/index/index_btn_shadow.png" mode="scaleToFill">
  101. </image>
  102. </view>
  103. <view class="ticket-btn-center-wrap flex">
  104. <view class="ticket-btn-center-wrap__title">购买<br />有礼</view>
  105. </view>
  106. </view>
  107. <view class="ticket-btn-right flex" @click="toTicket">
  108. <image src="../../static/index/index_btn_right.png" mode="scaleToFill"></image>
  109. <view class="ticket-btn-right__title">更多商品</view>
  110. </view>
  111. </view>
  112. <!-- 盲票价格 -->
  113. <view class="ticket-price flex">
  114. <view class="ticket-price-amt flex">
  115. <view class="num">{{ $numberFormat(ticketInfo.salePrice) }}</view>
  116. <view class="txt">元</view>
  117. </view>
  118. <view class="ticket-price-discount flex" v-if="ticketInfo.originPrice != 0">
  119. <view class="num">原价¥{{ $numberFormat(ticketInfo.originPrice) }}</view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 引导页面 -->
  125. <!-- <u-modal :show="showMp" content='“盲票”已升级为“码上快购”' width='530rpx' confirmText='立即前往' @confirm='toAnotherApplet'> -->
  126. </u-modal>
  127. <!-- tabbar组件 -->
  128. <custom-tab-bar :activeValue="'index'" />
  129. <!-- 支付弹框组件 -->
  130. <pay-popup :pay-show="payShow" :pay-info="payInfo" @close="close" @success="toProcess" v-if="payShow" />
  131. </view>
  132. </template>
  133. <script>
  134. import env from '../../config/env.js'
  135. import $http from '@/utils/request.js'
  136. import appId from '@/config/appId.js'
  137. import CustomTabBar from '../../components/custom-tab-bar/custom-tab-bar.vue'
  138. import PayPopup from '../../components/pay-popup/pay-popup.vue'
  139. export default {
  140. components: {
  141. CustomTabBar,
  142. PayPopup,
  143. },
  144. data() {
  145. return {
  146. loginState: false, // 登录状态
  147. ticketList: [], // 盲票列表
  148. prizeList: [], // 奖品列表
  149. prizeNewsListOne: [], // 弹幕列表
  150. prizeNewsListTwo: [], // 弹幕列表
  151. payShow: false, // 支付弹框显示
  152. payInfo: {}, // 支付详情
  153. currentIndex: 0, // 盲票选中下标
  154. statusHeight: 20,
  155. ticketIndex: 0, // 盲票选中下标
  156. ticketTitleIndex: 0, // 盲票标题选中下边
  157. list: [1, 2, 3, 4, 5],
  158. percentage: 0,
  159. checkStatus: true,
  160. filterActivityList: [],
  161. activityTime: null,
  162. ticketInfo: {},
  163. clickLoading: true,
  164. userInfo: '',
  165. showMp: false,
  166. pageNum: 1,
  167. };
  168. },
  169. onLoad(opthios) {
  170. this.showMp = uni.getStorageSync('anotherApplet') ? true : false
  171. uni.hideTabBar()
  172. if (opthios.userId) {
  173. uni.setStorageSync('shareUid', opthios.userId != 'undefined' ? opthios.userId : null)
  174. if (opthios.userId === undefined || opthios.userId === 'undefined') {
  175. uni.getSystemInfo({
  176. success(res) {
  177. log.error(
  178. `基础库:${ res.SDKVersion },设备:${ res.model }-${ res.system },页面:/pages/index/index.vue.`
  179. )
  180. }
  181. })
  182. }
  183. }
  184. if (opthios.type) {
  185. uni.setStorageSync('shareType', opthios.type)
  186. }
  187. /**
  188. * 票赢天下小程序分享盲票跳转接受的参数
  189. * shareUid: 用户ID
  190. * shareType: 分享类型
  191. * */
  192. if (opthios.scene) {
  193. let sceneStr = decodeURIComponent(opthios.scene)
  194. this.sceneArr = sceneStr.split('&')
  195. uni.setStorageSync('shareUid', this.sceneArr[0])
  196. if (this.sceneArr[0] === undefined || this.sceneArr[0] === 'undefined') {
  197. uni.getSystemInfo({
  198. success(res) {
  199. log.error(
  200. `基础库:${ res.SDKVersion },设备:${ res.model }-${ res.system },页面:/pages/index/index.vue,来源:票赢天下小程序分享盲票,`
  201. )
  202. }
  203. })
  204. }
  205. uni.setStorageSync('shareType', this.sceneArr[1])
  206. }
  207. /**
  208. * 外部app跳转接受的参数
  209. * shareUid: 用户ID
  210. * shareType: 分享类型
  211. * */
  212. if (opthios.uid) {
  213. uni.setStorageSync('shareUid', opthios.uid != 'undefined' ? opthios.uid : null)
  214. if (opthios.uid === undefined || opthios.uid === 'undefined') {
  215. uni.getSystemInfo({
  216. success(res) {
  217. log.error(
  218. `基础库:${ res.SDKVersion },设备:${ res.model }-${ res.system },页面:/pages/index/index.vue,来源:外部app,`
  219. )
  220. }
  221. })
  222. }
  223. uni.setStorageSync('shareType', opthios.t)
  224. }
  225. // #ifdef MP-WEIXIN
  226. const res = uni.getMenuButtonBoundingClientRect()
  227. this.statusHeight = res.top //胶囊距离顶部
  228. // #endif
  229. // #ifdef MP-ALIPAY
  230. uni.getSystemInfo({
  231. success: (res) => {
  232. this.statusHeight = res.statusBarHeight + 7
  233. }
  234. })
  235. // #endif
  236. let num = Math.round(100 / this.list.length)
  237. this.percentage = num
  238. this.getList()
  239. },
  240. onShow() {
  241. this.loginState = uni.getStorageSync('token') ? true : false
  242. if (this.loginState) {
  243. this.getBaseInfo()
  244. }
  245. this.getPrizeNews()
  246. this.getActivityList()
  247. },
  248. methods: {
  249. toAnotherApplet() {
  250. /**
  251. * envVersion 类型为字符串
  252. * envVersion: 'develop', //开发版
  253. * envVersion: 'trial', //体验版
  254. * envVersion: 'release',//正式版
  255. */
  256. uni.navigateToMiniProgram({
  257. appId: 'wxffb4598e70b9f871', // appid
  258. path: '/pages/index/index', // 首页路径
  259. envVersion: "release",
  260. success: res => {
  261. // 打开成功
  262. },
  263. })
  264. },
  265. // 切换盲票
  266. changeTicket({
  267. detail
  268. }) {
  269. if (this.clickLoading) {
  270. this.clickLoading = false
  271. this.ticketIndex = detail.current
  272. this.ticketTitleIndex = detail.current
  273. this.getTicketDetail(this.ticketList[detail.current].boxId)
  274. this.setNum(detail.current)
  275. setTimeout(() => {
  276. this.clickLoading = true
  277. }, 200)
  278. }
  279. },
  280. // 切换盲票名称
  281. changeTicketTitle({
  282. detail
  283. }) {
  284. if (this.clickLoading) {
  285. this.clickLoading = false
  286. this.ticketIndex = detail.current
  287. this.ticketTitleIndex = detail.current
  288. this.getTicketDetail(this.ticketList[detail.current].boxId)
  289. this.setNum(detail.current)
  290. setTimeout(() => {
  291. this.clickLoading = true
  292. }, 200)
  293. }
  294. },
  295. // 点击名称
  296. clickTicketTitle(index) {
  297. this.ticketIndex = index
  298. this.ticketTitleIndex = index
  299. this.getTicketDetail(this.ticketList[index].boxId)
  300. this.setNum(index)
  301. },
  302. setNum(index) {
  303. let num = Math.round(100 / this.list.length)
  304. if (index == 0) {
  305. this.percentage = uni.$u.range(0, 100, num)
  306. } else if (index == this.list.length - 1) {
  307. this.percentage = uni.$u.range(0, 100, 100)
  308. } else {
  309. this.percentage = uni.$u.range(0, 100, num * (index + 1))
  310. }
  311. },
  312. toLucky() {
  313. uni.navigateTo({
  314. url: `/pages/lucky/index?id=9a4b315da3ef4db5ea378c05f8b0b626f87d793d66714d29dcc7f4ccf9441317`
  315. })
  316. },
  317. toStore() {
  318. uni.navigateTo({
  319. url: `/packageOperate/store/index?channelId=26`
  320. })
  321. },
  322. // 投诉建议
  323. contactService() {
  324. // #ifdef MP-WEIXIN
  325. if (appId == 1) {
  326. uni.navigateTo({
  327. url: `/pages/index/wxofficial`
  328. })
  329. } else {
  330. wx.openCustomerServiceChat({
  331. extInfo: {
  332. url: 'https://work.weixin.qq.com/kfid/kfcf9da505d4dc18c87'
  333. },
  334. corpId: 'ww8522e336cfe5045b',
  335. })
  336. }
  337. // #endif
  338. },
  339. // 跳转酷玩星球
  340. toExternalGames() {
  341. /**
  342. * envVersion 类型为字符串
  343. * envVersion: 'develop', //开发版
  344. * envVersion: 'trial', //体验版
  345. * envVersion: 'release',//正式版
  346. */
  347. uni.navigateToMiniProgram({
  348. appId: 'wx6b4030841ccd653b', // appid
  349. // path: '/pages/index/index', // 首页路径
  350. envVersion: "release",
  351. success: res => {
  352. // 打开成功
  353. },
  354. })
  355. },
  356. // 活动
  357. getActivityList() {
  358. $http.post(`/api/v1/mp/user/marketing/recent`, {}).then(res => {
  359. if (res && res.data) {
  360. let data = res && res.data
  361. let timestamp = parseInt(new Date().getTime())
  362. this.activityTime = data.endTime - timestamp
  363. }
  364. })
  365. },
  366. // 获取盲票列表
  367. getList() {
  368. uni.showLoading({
  369. title: '加载中'
  370. });
  371. let data = {
  372. type: 'online',
  373. noToken: true
  374. }
  375. $http.post(`/api/v1/mp/user/mall/ticket/goods/list?pageNum=${this.pageNum}&pageSize=100`, data).then(
  376. res => {
  377. uni.hideLoading();
  378. if (res.code == 0) {
  379. res.rows.forEach(item => item.picUrl = item.picUrl.split(',').map(item => env.filePublic +
  380. item + '?imageView2/2/w/750'))
  381. this.ticketList = res.rows
  382. this.getTicketDetail(this.ticketList[0].boxId)
  383. }
  384. }).catch(() => {
  385. uni.hideLoading();
  386. })
  387. },
  388. // 获取弹幕列表
  389. getPrizeNews() {
  390. $http.post('/api/v1/mp/user/ticket/hitPrizeBarrage', {}).then(res => {
  391. const {
  392. listOne,
  393. listTwo
  394. } = res && res.data
  395. listOne.forEach(item => {
  396. item.avatar = item.avatar ? env.filePublic + item.avatar : env.filePublic +
  397. '70/EJ305PQR2IBE45O9AFAI'
  398. item.prizeInfo = item.prizeInfo && (item.prizeInfo.length > 14) ? item.prizeInfo
  399. .substring(0, 15) + '...' : item.prizeInfo
  400. })
  401. listTwo.forEach(item => {
  402. item.avatar = item.avatar ? env.filePublic + item.avatar : env.filePublic +
  403. '70/EJ305PQR2IBE45O9AFAI'
  404. item.prizeInfo = item.prizeInfo && (item.prizeInfo.length > 14) ? item.prizeInfo
  405. .substring(0, 15) + '...' : item.prizeInfo
  406. })
  407. this.prizeNewsListOne = listOne
  408. this.prizeNewsListTwo = listTwo
  409. })
  410. },
  411. // 获取当前盲票的详情
  412. getTicketDetail(id) {
  413. this.prizeList = []
  414. $http.post('/api/v1/mp/user/mall/ticket/detail', {
  415. boxId: id,
  416. noToken: true
  417. }).then(res => {
  418. uni.hideLoading();
  419. if (res.code == 0) {
  420. this.ticketInfo = {
  421. ...res.data,
  422. ticketAwardsLabelList: res.data.ticketAwardsLabelList.map(item => {
  423. return {
  424. ...item,
  425. picUrl: env.filePublic + item.picUrl
  426. }
  427. })
  428. }
  429. this.payInfo = this.ticketList[this.ticketIndex]
  430. }
  431. }).catch(() => {
  432. uni.hideLoading();
  433. })
  434. },
  435. // 立即开刮
  436. payment() {
  437. this.payInfo = this.ticketList[this.ticketIndex]
  438. if (this.payInfo) {
  439. let data = {
  440. userCouponIds: [],
  441. autoCoupon: 1,
  442. boxId: this.payInfo.boxId,
  443. orderNum: 1,
  444. appSource: appId
  445. }
  446. $http.post('/api/v1/mp/user/ticket/order/settle', data).then(res => {
  447. if (res.code == 0) {
  448. let info = {
  449. ...res.data,
  450. ...this.payInfo,
  451. picUrl: this.payInfo.picUrl[0],
  452. couponTitle: res.data && res.data.couponList && res.data.couponList.length &&
  453. res
  454. .data.couponList[0].title,
  455. couponId: res.data && res.data.couponList && res.data.couponList.length && res
  456. .data
  457. .couponList[0].id
  458. }
  459. this.payInfo = info
  460. this.payShow = true
  461. }
  462. }).catch(() => {
  463. uni.$u.toast('购买失败,请重试!');
  464. })
  465. } else {
  466. uni.$u.toast('商品正在准备中');
  467. }
  468. },
  469. // 关闭支付弹框
  470. close() {
  471. this.payShow = false
  472. },
  473. changeList() {
  474. let data = {
  475. type: 'online',
  476. noToken: true
  477. }
  478. $http.post(`/api/v1/mp/user/mall/ticket/goods/list?pageNum=${this.pageNum}&pageSize=100`, data).then(
  479. res => {
  480. const boxIdStr = this.ticketList.map(item => item.boxId).join()
  481. let boxIdStrNew = res && res.rows && res.rows.map(item => item.boxId).join()
  482. if (boxIdStr != boxIdStrNew) {
  483. this.currentIndex = 0
  484. this.getList()
  485. }
  486. })
  487. },
  488. // 盲票向左箭头
  489. ticketLeft() {
  490. if ((this.ticketIndex >= 0) && (this.ticketIndex < (this.ticketList.length - 1))) {
  491. this.ticketIndex++
  492. } else if (this.ticketIndex == (this.ticketList.length - 1)) {
  493. this.ticketIndex = 0
  494. }
  495. this.ticketTitleIndex = this.ticketIndex
  496. this.getTicketDetail(this.ticketList[this.ticketTitleIndex].boxId)
  497. },
  498. // 盲票向右箭头
  499. ticketRight() {
  500. if (this.ticketIndex > 0) {
  501. this.ticketIndex--
  502. } else if (this.ticketIndex == 0) {
  503. this.ticketIndex = this.ticketList.length - 1
  504. }
  505. this.ticketTitleIndex = this.ticketIndex
  506. this.getTicketDetail(this.ticketList[this.ticketTitleIndex].boxId)
  507. },
  508. toRollingGame() {
  509. uni.switchTab({
  510. url: '/pages/core/index'
  511. })
  512. },
  513. // 线上立即刮票成功,跳转到刮奖过程
  514. toProcess(id) {
  515. this.payShow = false
  516. uni.navigateTo({
  517. url: `/packagePrize/purchase/index?boxId=${ this.ticketInfo.boxId }&orderId=${ id }&isTry=0`
  518. })
  519. },
  520. // 点击盲票,跳转关联商品详情
  521. toTicketBox(item) {
  522. if (item.refType && JSON.parse(item.refType).value === 'goods') {
  523. uni.navigateTo({
  524. url: `/packagePrize/goods/index?id=${ item.refId }&boxId=${ this.ticketInfo.boxId }`
  525. })
  526. } else if (item.refType && JSON.parse(item.refType).value === 'coin') {
  527. uni.navigateTo({
  528. url: `/packagePrize/goods/index?id=424&boxId=${ this.ticketInfo.boxId }`
  529. })
  530. } else if (item.refType && JSON.parse(item.refType).value === 'coupon' || JSON.parse(item.refType)
  531. .value === 'coupon_pkg') {
  532. if (item.couponDetail) {
  533. uni.setStorageSync('couponDetail', item.couponDetail);
  534. }
  535. uni.navigateTo({
  536. url: `/packagePrize/goods/index?id=425&boxId=${ this.ticketInfo.boxId }`
  537. })
  538. }
  539. },
  540. toActivity() {
  541. uni.switchTab({
  542. url: '/pages/activity/index'
  543. })
  544. },
  545. // 点击所有盲票
  546. toTicket() {
  547. uni.navigateTo({
  548. url: '/packageGoods/ticket/index'
  549. })
  550. },
  551. // 点击仓库
  552. toPrize() {
  553. if (!this.loginState) {
  554. uni.navigateTo({
  555. url: "/pages/login/index"
  556. })
  557. return
  558. }
  559. uni.navigateTo({
  560. url: '/packagePrize/prize/index'
  561. })
  562. },
  563. // 点击规则说明
  564. toRule() {
  565. uni.navigateTo({
  566. url: '/packageOther/rule/purchase'
  567. })
  568. },
  569. getBaseInfo() {
  570. $http.post('/api/v1/mp/user/getLoginUserinfo', {
  571. appSource: appId
  572. }).then(res => {
  573. uni.hideLoading();
  574. if (res.code == 0) {
  575. this.userInfo = res.data
  576. }
  577. })
  578. },
  579. },
  580. //分享好友
  581. onShareAppMessage(res) {
  582. return {
  583. title: '盲票,玩的就是有趣',
  584. path: '/pages/index/index'
  585. }
  586. },
  587. //分享朋友圈
  588. onShareTimeline() {
  589. return {
  590. title: '盲票,玩的就是有趣',
  591. query: `userId=${ this.userInfo.userId?this.userInfo.userId:null }&type=1`
  592. }
  593. }
  594. }
  595. </script>
  596. <style lang="scss" scoped>
  597. .status_bar {
  598. width: 100%;
  599. height: var(--status-bar-height);
  600. }
  601. ::v-deep .u-tabbar__placeholder {
  602. display: none;
  603. }
  604. </style>
  605. <style lang="scss" scoped>
  606. .box {
  607. position: relative;
  608. width: 100%;
  609. height: calc(100vh - 50px);
  610. background: url(https://mp-public-test-1309783959.cos.ap-shanghai.myqcloud.com/v2/bkg1.png) center center no-repeat;
  611. background-size: 100vw calc(100vh - 50px);
  612. .index {
  613. position: absolute;
  614. width: 100%;
  615. }
  616. }
  617. // 中奖信息
  618. .barrage {
  619. position: relative;
  620. width: 518rpx;
  621. height: 70rpx;
  622. border-radius: 42rpx;
  623. margin-bottom: 16rpx;
  624. margin-left: 34rpx;
  625. &-bg {
  626. position: absolute;
  627. width: 518rpx;
  628. height: 70rpx;
  629. }
  630. &-swiper {
  631. position: absolute;
  632. z-index: 10;
  633. width: 100%;
  634. height: 100%;
  635. border-radius: 42rpx;
  636. overflow: hidden;
  637. &-item {
  638. width: 100%;
  639. height: 100%;
  640. &-content {
  641. display: flex;
  642. align-items: center;
  643. width: 510rpx;
  644. height: 70rpx;
  645. image {
  646. width: 58rpx;
  647. height: 58rpx;
  648. border-radius: 50%;
  649. margin-right: 14rpx;
  650. border: 1px solid #fff;
  651. margin-left: 8rpx;
  652. }
  653. .title {
  654. flex: 1;
  655. font-size: 26rpx;
  656. font-weight: 500;
  657. color: #fff;
  658. }
  659. }
  660. }
  661. }
  662. &-none {
  663. position: absolute;
  664. width: 518rpx;
  665. height: 70rpx;
  666. z-index: 20;
  667. }
  668. }
  669. // 查看规则
  670. .rule {
  671. display: flex;
  672. align-items: center;
  673. /* #ifndef MP-WEIXIN */
  674. justify-content: flex-end;
  675. /* #endif */
  676. /* #ifdef MP-WEIXIN */
  677. justify-content: space-between;
  678. /* #endif */
  679. height: 34rpx;
  680. padding: 0 34rpx; //
  681. margin-bottom: 24rpx;
  682. &-content {
  683. image {
  684. width: 34rpx; // 210rpx
  685. height: 34rpx; // 50rpx
  686. margin-right: 14rpx; //
  687. }
  688. text {
  689. // position: absolute;
  690. // right: 20rpx;
  691. font-size: 40rpx;
  692. font-family: 'YouSheBiaoTiHei';
  693. font-weight: 400;
  694. color: #FFFFFF;
  695. }
  696. }
  697. &-gameimg {
  698. width: 165rpx;
  699. height: 155rpx;
  700. image {
  701. width: 165rpx;
  702. height: 155rpx;
  703. margin-top: 64px;
  704. z-index: 100000;
  705. }
  706. }
  707. }
  708. // 盲票
  709. .ticket {
  710. height: 37vh;
  711. position: relative;
  712. &-bgc {
  713. position: absolute;
  714. top: 77%;
  715. width: 100%;
  716. text-align: center;
  717. image {
  718. margin: 0 auto;
  719. height: 156rpx;
  720. width: 570rpx;
  721. }
  722. }
  723. &-swiper {
  724. height: 100%;
  725. &-item {
  726. position: relative;
  727. height: 100%;
  728. &-box {
  729. position: absolute;
  730. // bottom: 100rpx;
  731. bottom: 20%;
  732. width: 380rpx;
  733. height: 380rpx;
  734. animation: movePrize 2s linear infinite;
  735. }
  736. }
  737. }
  738. &-left {
  739. width: 100rpx;
  740. height: 100rpx;
  741. position: absolute;
  742. top: 45%;
  743. left: 0;
  744. display: table-cell;
  745. vertical-align: middle;
  746. image {
  747. display: block;
  748. margin: 25rpx auto;
  749. width: 45rpx;
  750. height: 40rpx;
  751. }
  752. }
  753. &-right {
  754. width: 100rpx;
  755. height: 100rpx;
  756. position: absolute;
  757. top: 45%;
  758. right: 0;
  759. display: table-cell;
  760. vertical-align: middle;
  761. image {
  762. display: block;
  763. margin: 25rpx auto;
  764. width: 45rpx;
  765. height: 40rpx;
  766. transform: rotate(180deg);
  767. }
  768. }
  769. }
  770. // 投诉建议
  771. .proposal {
  772. position: relative;
  773. height: 66rpx;
  774. margin-bottom: 30rpx;
  775. &-time {
  776. position: absolute;
  777. left: 30rpx;
  778. bottom: 0;
  779. flex-direction: column;
  780. align-items: flex-start;
  781. image {
  782. width: 140rpx;
  783. height: 78rpx;
  784. margin-bottom: 12rpx;
  785. animation: scaleTime 3s linear infinite;
  786. }
  787. .time {
  788. animation: moveTime 0.5s linear infinite;
  789. ::v-deep .u-count-down__text {
  790. line-height: 30rpx;
  791. font-size: 30rpx;
  792. font-family: YouSheBiaoTiHei;
  793. font-weight: 400;
  794. color: #FFFFFF;
  795. }
  796. }
  797. }
  798. &-progress {
  799. position: absolute;
  800. bottom: 0;
  801. width: 140rpx;
  802. }
  803. &-tip {
  804. display: flex;
  805. align-items: center;
  806. position: absolute;
  807. right: 0;
  808. bottom: 0;
  809. width: 212rpx;
  810. height: 66rpx;
  811. image {
  812. position: absolute;
  813. right: 0;
  814. bottom: 0;
  815. width: 212rpx;
  816. height: 66rpx;
  817. }
  818. text {
  819. position: absolute;
  820. right: 16rpx;
  821. font-size: 40rpx;
  822. font-family: YouSheBiaoTiHei;
  823. font-weight: 400;
  824. color: #FFFFFF;
  825. }
  826. }
  827. }
  828. // 中奖概率
  829. .chance {
  830. justify-content: flex-start;
  831. height: 44rpx;
  832. margin: 0 34rpx 26rpx;
  833. background-color: rgba(000, 000, 000, .36);
  834. border-radius: 22rpx;
  835. color: #FFFFFF;
  836. font-family: YouSheBiaoTiHei;
  837. font-size: 14px;
  838. &-title {
  839. margin-left: 8rpx;
  840. }
  841. &-hitRate {
  842. flex: 1;
  843. justify-content: space-evenly;
  844. &-content {
  845. image {
  846. width: 56rpx;
  847. height: 50rpx;
  848. }
  849. }
  850. }
  851. }
  852. // 盲票名称轮播
  853. .ticket-title {
  854. height: 66rpx;
  855. padding: 0 34rpx;
  856. margin: 30rpx 0;
  857. overflow: hidden;
  858. // margin: 0 34rpx;
  859. &-swiper {
  860. width: calc(100vw - 34px);
  861. height: 100%;
  862. &-item {
  863. height: 100%;
  864. transform: skew(20deg);
  865. background: rgba(255, 169, 0, 0.16);
  866. margin: 0 17rpx;
  867. color: #fff;
  868. font-size: 34rpx;
  869. text {
  870. // padding: 0 20rpx;
  871. transform: skew(-20deg);
  872. }
  873. }
  874. .action {
  875. background: #FFAE00;
  876. box-shadow: 0px 3px 3px 0px rgba(220, 145, 107, 0.57);
  877. }
  878. }
  879. }
  880. // 刮开盲票
  881. .ticket-btn {
  882. justify-content: space-between;
  883. height: 20vh;
  884. padding: 0 30rpx;
  885. &-left {
  886. flex-direction: column;
  887. image {
  888. width: 142rpx;
  889. height: 142rpx;
  890. margin-bottom: 16rpx;
  891. }
  892. &__title {
  893. line-height: 30rpx;
  894. font-size: 30rpx;
  895. font-family: YouSheBiaoTiHei;
  896. font-weight: 400;
  897. color: #666;
  898. }
  899. }
  900. &-center {
  901. position: relative;
  902. flex-direction: column;
  903. height: 100%;
  904. .image-wrap {
  905. position: absolute;
  906. width: 310rpx;
  907. height: 90%;
  908. border-radius: 50%;
  909. overflow: hidden;
  910. box-shadow: 2px 2px 10px rgba(255, 189, 24, .8), -2px -2px 10px rgba(255, 189, 24, .8), 2px -2px 10px rgba(255, 189, 24, .8), -2px 2px 10px rgba(255, 189, 24, .8);
  911. .btn {
  912. width: 310rpx;
  913. height: 100%;
  914. }
  915. .shadow {
  916. position: absolute;
  917. width: 310rpx;
  918. height: 130%;
  919. left: 0;
  920. animation: shadowMove 1.5s linear infinite;
  921. }
  922. }
  923. &-wrap {
  924. width: 300rpx;
  925. position: absolute;
  926. animation: scaleBtn 1.5s linear infinite;
  927. &__title {
  928. width: 300rpx;
  929. text-align: center;
  930. font-size: 84rpx;
  931. font-family: YouSheBiaoTiHei;
  932. font-weight: 400;
  933. color: #FFFFFF;
  934. line-height: 72rpx;
  935. animation: shadowBtn 1.5s linear infinite;
  936. }
  937. }
  938. }
  939. &-right {
  940. flex-direction: column;
  941. image {
  942. width: 142rpx;
  943. height: 142rpx;
  944. margin-bottom: 16rpx;
  945. }
  946. &__title {
  947. line-height: 30rpx;
  948. font-size: 30rpx;
  949. font-family: YouSheBiaoTiHei;
  950. font-weight: 400;
  951. color: #666;
  952. }
  953. }
  954. }
  955. // 盲票价格
  956. .ticket-price {
  957. height: 44rpx;
  958. &-checkbox {
  959. width: 44rpx;
  960. height: 44rpx;
  961. background-color: #fff;
  962. border-radius: 50%;
  963. overflow: hidden;
  964. margin-right: 20rpx;
  965. image {
  966. width: 44rpx;
  967. height: 44rpx;
  968. }
  969. }
  970. &-amt {
  971. height: 44rpx;
  972. font-family: YouSheBiaoTiHei;
  973. font-weight: 400;
  974. align-items: flex-end;
  975. color: #FE9E48;
  976. margin-right: 20rpx;
  977. .num {
  978. font-size: 56rpx;
  979. line-height: 40rpx;
  980. }
  981. .txt {
  982. line-height: 36rpx;
  983. font-size: 40rpx;
  984. }
  985. }
  986. &-discount {
  987. height: 44rpx;
  988. align-items: flex-end;
  989. .num {
  990. line-height: 26rpx;
  991. font-size: 26rpx;
  992. text-decoration: line-through;
  993. font-style: italic;
  994. color: #FFAE00;
  995. }
  996. }
  997. }
  998. // 奖品移动动画
  999. @keyframes movePrize {
  1000. 0% {
  1001. transform: translate(0, 10px)
  1002. }
  1003. 25% {
  1004. transform: translate(0, 5px)
  1005. }
  1006. 50% {
  1007. transform: translate(0, 0px)
  1008. }
  1009. 75% {
  1010. transform: translate(0, 5px)
  1011. }
  1012. 100% {
  1013. transform: translate(0, 10px)
  1014. }
  1015. }
  1016. // 倒计时移动动画
  1017. @keyframes moveTime {
  1018. 0% {
  1019. transform: translate(2px, 0)
  1020. }
  1021. 25% {
  1022. transform: translate(0, 0)
  1023. }
  1024. 50% {
  1025. transform: translate(1px, 0)
  1026. }
  1027. 75% {
  1028. transform: translate(0, 0)
  1029. }
  1030. 100% {
  1031. transform: translate(2px, 0)
  1032. }
  1033. }
  1034. // 放大缩小动画
  1035. @keyframes scaleTime {
  1036. 0% {
  1037. transform: scale(1.05)
  1038. }
  1039. 25% {
  1040. transform: scale(1.02)
  1041. }
  1042. 50% {
  1043. transform: scale(0.9)
  1044. }
  1045. 75% {
  1046. transform: scale(1.02)
  1047. }
  1048. 100% {
  1049. transform: scale(1.05)
  1050. }
  1051. }
  1052. // 刮开刮票呼吸动画
  1053. @keyframes scaleBtn {
  1054. 0% {
  1055. transform: scale(1.04)
  1056. }
  1057. 25% {
  1058. transform: scale(1.02)
  1059. }
  1060. 50% {
  1061. transform: scale(1)
  1062. }
  1063. 75% {
  1064. transform: scale(1.02)
  1065. }
  1066. 100% {
  1067. transform: scale(1.04)
  1068. }
  1069. }
  1070. // 刮开刮票阴影动画
  1071. @keyframes shadowBtn {
  1072. 0% {
  1073. text-shadow: 2px -2px 3px #fff;
  1074. }
  1075. 25% {
  1076. text-shadow: none;
  1077. }
  1078. 50% {
  1079. text-shadow: none;
  1080. }
  1081. 75% {
  1082. text-shadow: none;
  1083. }
  1084. 100% {
  1085. text-shadow: 2px -2px 3px #fff;
  1086. }
  1087. }
  1088. // 刮开盲票光影移动动画
  1089. @keyframes shadowMove {
  1090. 0% {
  1091. left: -100%;
  1092. }
  1093. 100% {
  1094. left: 110%;
  1095. }
  1096. }
  1097. </style>