index.vue 26 KB

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