animation.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view>
  3. <view class="lucky"></view>
  4. <u-overlay :show="luckyShow" :opacity="0.8" zIndex="100">
  5. <view class="flex luck-warp" @touchmove.prevent.stop>
  6. <view class="luck-info">
  7. <view class="luck-info-bg">
  8. <image src="../../static/lucky/lucky_bg.png" mode="scaleToFill"></image>
  9. </view>
  10. <view class="luck-info-content flex">
  11. <view class="luck-info-content-num">
  12. <image src="../../static/lucky/lucky_gkmp.png" mode="scaleToFill"
  13. v-if="info.salePrice == 0"></image>
  14. <image src="../../static/lucky/lucky_gkmptwo.png" mode="scaleToFill" v-else></image>
  15. </view>
  16. <view class="luck-info-content-img">
  17. <view class="luck-info-content-img-word">
  18. <image class="img" src="../../static/lucky/lucky_tu.png" mode="scaleToFill"></image>
  19. <view class="luck-info-content-img-word__content">
  20. <text>{{ info.awardsName }}</text>
  21. </view>
  22. <image class="imgtwo" src="../../static/lucky/lucky_xiaoguo.png" mode="scaleToFill"
  23. v-if="infoimg">
  24. </image>
  25. <image class="img" src="../../static/lucky/lucky_guajiangqu.png" mode="scaleToFill"
  26. v-if="info.status == 1">
  27. <image class="imgone" src="../../static/lucky/lucky_yidong.png"
  28. v-else-if="info.status == 2"></image>
  29. </view>
  30. </view>
  31. <view class="luck-info-content-ticket">
  32. <image src="../../static/lucky/lucky_piaohao.png" mode="scaleToFill"></image>
  33. <view class="luck-info-content-ticket-info flex">
  34. <view class="title" :class="{ 'action': info.status == 2 }">{{ info.title }}</view>
  35. <view class="serialNo" :class="{ 'action': info.status == 2 }">序列号:{{ info.serialNo }}
  36. </view>
  37. </view>
  38. </view>
  39. <view class="luck-info-content-btn" style="width: 500rpx;" @click="toChoice" v-if="Choice">领取奖品</view>
  40. <view class=" code" v-else>开奖啦!</view>
  41. </view>
  42. </view>
  43. </view>
  44. </u-overlay>
  45. </view>
  46. </template>
  47. <script>
  48. import env from '../../config/env.js'
  49. import $http from '@/utils/request.js'
  50. export default {
  51. components: {
  52. },
  53. data() {
  54. return {
  55. orderId: '',
  56. info: '',
  57. luckyShow: true,
  58. status: 2,
  59. infoimg: false,
  60. Choice: false,
  61. ChoiceData: '',
  62. pagesNum: '',
  63. };
  64. },
  65. onShow() {
  66. this.pagesNum = getCurrentPages().length
  67. },
  68. onLoad(options) {
  69. if (options.orderId) {
  70. this.orderId = options.orderId
  71. this.getDetail()
  72. }
  73. },
  74. methods: {
  75. getDetail() {
  76. let _this = this
  77. uni.showLoading({
  78. title: '加载中'
  79. });
  80. $http.post('/api/v1/mp/user/ticket/query', {
  81. orderId: this.orderId,
  82. }).then(res => {
  83. uni.hideLoading();
  84. if (res.code == 0) {
  85. if (res.data.status == 2) {
  86. _this.info = res.data
  87. setTimeout(() => {
  88. this.infoimg = true
  89. setTimeout(() => {
  90. this.ChoiceData = res.data.ticketId
  91. this.Choice = true
  92. }, 500)
  93. }, 500)
  94. } else {
  95. let num = 0
  96. let time = setInterval(() => {
  97. num++
  98. uni.showLoading({
  99. title: '加载中'
  100. });
  101. $http.post('/api/v1/mp/user/ticket/query', {
  102. orderId: this.orderId,
  103. }).then(ele => {
  104. if (ele.data.status == 2) {
  105. uni.hideLoading();
  106. clearInterval(time)
  107. _this.info = res.data
  108. setTimeout(() => {
  109. this.infoimg = true
  110. setTimeout(() => {
  111. this.ChoiceData = res.data.ticketId
  112. this.Choice = true
  113. }, 500)
  114. }, 500)
  115. }
  116. })
  117. if (num == 10) {
  118. uni.hideLoading();
  119. clearInterval(time)
  120. if(_this.pagesNum > 2) {
  121. uni.navigateBack({
  122. delta: 2
  123. })
  124. }else {
  125. uni.switchTab({
  126. url: `/pages/index/index`
  127. })
  128. }
  129. }
  130. }, 1000)
  131. }
  132. }
  133. }).catch(() => {
  134. uni.hideLoading();
  135. })
  136. },
  137. //跳转奖品页
  138. toChoice() {
  139. uni.redirectTo({
  140. url: `/packagePrize/choice/index?id=${ this.ChoiceData }&type=offline`
  141. })
  142. },
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. .luck-warp {
  148. height: 100%;
  149. .luck-info {
  150. position: relative;
  151. width: 87vw;
  152. height: 60vh;
  153. &-bg {
  154. position: absolute;
  155. top: 0;
  156. image {
  157. width: 87vw;
  158. height: 60vh;
  159. }
  160. }
  161. &-content {
  162. flex-direction: column;
  163. justify-content: flex-start;
  164. position: absolute;
  165. top: 0;
  166. z-index: 10;
  167. width: 100%;
  168. height: 100%;
  169. &-num {
  170. position: relative;
  171. width: 422rpx;
  172. height: 8vh;
  173. margin-top: 16vh;
  174. margin-bottom: 3vh;
  175. image {
  176. position: absolute;
  177. top: 0;
  178. width: 100%;
  179. height: 100%;
  180. }
  181. }
  182. &-img {
  183. position: relative;
  184. width: 73%;
  185. height: 10vh;
  186. background-color: #fff;
  187. border-radius: 12rpx;
  188. &-word {
  189. position: absolute;
  190. top: 15%;
  191. left: 5%;
  192. width: 90%;
  193. height: 85%;
  194. overflow: hidden;
  195. .img {
  196. position: absolute;
  197. width: 100%;
  198. height: 82.6%;
  199. }
  200. .imgtwo {
  201. position: absolute;
  202. width: 20%;
  203. height: 82%;
  204. left: -20%;
  205. animation: shadowTwoMove 0.5s linear infinite;
  206. animation-iteration-count: 1;
  207. }
  208. .imgone {
  209. position: absolute;
  210. left: 100%;
  211. width: 100%;
  212. height: 100%;
  213. animation: shadowMove 0.5s linear infinite;
  214. animation-iteration-count: 1;
  215. }
  216. &__content {
  217. position: absolute;
  218. top: 25%;
  219. text-align: center;
  220. width: 100%;
  221. height: 100%;
  222. font-size: 36rpx;
  223. font-family: YouSheBiaoTiHei;
  224. font-weight: 400;
  225. color: #fff;
  226. }
  227. }
  228. }
  229. &-title {
  230. font-size: 40rpx;
  231. line-height: 40rpx;
  232. color: #FEFEFE;
  233. margin-bottom: 1vh;
  234. }
  235. &-tip {
  236. width: 80%;
  237. font-size: 26rpx;
  238. line-height: 35rpx;
  239. text-align: center;
  240. color: #fff;
  241. }
  242. &-ticket {
  243. position: relative;
  244. width: 73%;
  245. height: 10vh;
  246. margin-top: 2vh;
  247. image {
  248. position: absolute;
  249. top: 0;
  250. width: 100%;
  251. height: 95%;
  252. }
  253. &-info {
  254. width: 90%;
  255. height: 75%;
  256. left: 5%;
  257. position: absolute;
  258. top: 0;
  259. z-index: 5;
  260. flex-direction: column;
  261. .title {
  262. font-size: 30rpx;
  263. line-height: 30rpx;
  264. color: #FF6D2C;
  265. margin-top: 1vh;
  266. margin-bottom: 1vh;
  267. width: 90%;
  268. white-space: nowrap;
  269. overflow: hidden;
  270. text-overflow: ellipsis;
  271. }
  272. .serialNo {
  273. font-size: 24rpx;
  274. color: #FF6D2C;
  275. }
  276. .action {
  277. color: #FFCBAA;
  278. }
  279. }
  280. }
  281. &-btn {
  282. padding: 0 8%;
  283. height: 7vh;
  284. line-height: 7vh;
  285. background: linear-gradient(0deg, #FF4924, #F9D448);
  286. box-shadow: 0px 6px 9px 0px rgba(135, 19, 3, 0.49);
  287. border-radius: 4vh;
  288. text-align: center;
  289. color: #FEFEFE;
  290. font-size: 40rpx;
  291. margin-top: 1vh;
  292. }
  293. .code {
  294. padding: 0 20%;
  295. height: 7vh;
  296. line-height: 10vh;
  297. text-align: center;
  298. color: #FEFEFE;
  299. font-family: YouSheBiaoTiHei;
  300. font-size: 38rpx
  301. }
  302. }
  303. &-close {
  304. width: 100%;
  305. position: absolute;
  306. bottom: -140rpx;
  307. &-content {
  308. width: 70rpx;
  309. height: 70rpx;
  310. border-radius: 50%;
  311. border: 1px solid #fff;
  312. }
  313. }
  314. }
  315. }
  316. .lucky {
  317. width: 100%;
  318. height: 100vh;
  319. background: url(https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/v2/hit_bkg.png) center center no-repeat;
  320. background-size: 100vw 100vh;
  321. }
  322. .null-prize {
  323. display: flex;
  324. flex-direction: column;
  325. align-items: center;
  326. justify-content: center;
  327. width: 80vw;
  328. height: 320rpx;
  329. background-color: #FFFFFF;
  330. border: 1px solid rgba(187, 187, 187, 100);
  331. .btn {
  332. margin-top: 60rpx;
  333. width: 160rpx;
  334. height: 60rpx;
  335. line-height: 60rpx;
  336. border-radius: 8rpx;
  337. background-color: rgba(235, 112, 9, 100);
  338. color: rgba(255, 255, 255, 100);
  339. font-size: 28rpx;
  340. text-align: center;
  341. }
  342. }
  343. // 支付后移动动画
  344. @keyframes shadowMove {
  345. 0% {
  346. left: 0%;
  347. }
  348. 100% {
  349. left: 100%;
  350. }
  351. }
  352. // 支付后移动动画
  353. @keyframes shadowTwoMove {
  354. 0% {
  355. left: -20%;
  356. }
  357. 100% {
  358. left: 100%;
  359. }
  360. }
  361. </style>