animation.vue 8.0 KB

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