index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view>
  3. <u-navbar title="兑奖" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  4. <view class="process">
  5. <view class="flex box-wrap">
  6. <view class="flex box">
  7. <image :src="picUrlArr[0]" mode=""></image>
  8. <view class="box-title">
  9. <view class="txt">{{ info.title }}</view>
  10. <view class="id">序列号:{{ info.serialNo }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="flex btn-wrap">
  15. <view class="btn" @click="toChoice">立即刮开兑奖</view>
  16. <!-- <view class="btn" @click="put">暂不兑奖</view> -->
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import env from '../../config/env.js'
  23. import $http from '@/utils/request.js'
  24. export default {
  25. data() {
  26. return {
  27. id: '',
  28. info: {},
  29. picUrlArr: []
  30. };
  31. },
  32. onLoad(options) {
  33. this.id = options.id
  34. this.getDetail()
  35. },
  36. methods: {
  37. getDetail() {
  38. uni.showLoading({
  39. title: '加载中'
  40. });
  41. $http.post('/api/v1/mp/user/ticket/query', {
  42. orderId: this.id,
  43. }).then(res => {
  44. if (res.code == 0) {
  45. uni.hideLoading();
  46. this.info = res.data
  47. let picUrlArr = res.data.picUrl.split(',')
  48. picUrlArr.forEach(item => {
  49. this.picUrlArr.push(env.filePublic + item + '?imageView2/2/w/750')
  50. })
  51. } else if (res.code == 1022) {
  52. let time = setInterval(() => {
  53. uni.showLoading({
  54. title: '加载中'
  55. });
  56. $http.post('/api/v1/mp/user/ticket/query', {
  57. orderId: this.id,
  58. }).then(ele => {
  59. if (ele.code == 0) {
  60. uni.hideLoading();
  61. clearInterval(time)
  62. this.info = ele.data
  63. let picUrlArr = ele.data.picUrl.split(',')
  64. picUrlArr.forEach(item => {
  65. this.picUrlArr.push(env.filePublic + item)
  66. })
  67. }
  68. })
  69. }, 1000)
  70. }
  71. }).catch(() => {
  72. uni.hideLoading();
  73. })
  74. },
  75. put() {
  76. uni.navigateBack({
  77. delta: 1
  78. })
  79. },
  80. toChoice() {
  81. uni.redirectTo({
  82. url: `/pages/choice/index?id=${ this.info.ticketId }&type=onLine`
  83. })
  84. },
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .process {
  90. width: 100%;
  91. min-height: calc(100vh - 44px - var(--status-bar-height));
  92. background: url(https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/openprize_bg.png) center center;
  93. }
  94. .box-wrap {
  95. padding: 140rpx 0 120rpx;
  96. .box {
  97. flex-direction: column;
  98. justify-content: flex-start;
  99. position: relative;
  100. width: 540rpx;
  101. height: 820rpx;
  102. background-color: rgba(255, 255, 255, 0.75);
  103. border-radius: 10rpx;
  104. image {
  105. width: 480rpx;
  106. height: 630rpx;
  107. padding-top: 40rpx;
  108. }
  109. &-title {
  110. margin-top: 20rpx;
  111. .txt {
  112. text-align: center;
  113. font-size: 36rpx;
  114. font-weight: bold;
  115. line-height: 50rpx;
  116. margin-bottom: 16rpx;
  117. }
  118. .id {
  119. line-height: 40rpx;
  120. text-align: center;
  121. color: #888787;
  122. }
  123. }
  124. }
  125. }
  126. .btn-wrap {
  127. flex-direction: column;
  128. .btn {
  129. width: 400rpx;
  130. height: 80rpx;
  131. font-size: 36rpx;
  132. line-height: 80rpx;
  133. border-radius: 20rpx;
  134. background-color: rgba(235, 112, 9, 100);
  135. color: #FFFFFF;
  136. text-align: center;
  137. margin-bottom: 40rpx;
  138. }
  139. .btn:last-child {
  140. background-color: #FFFFFF;
  141. color: rgba(235, 112, 9, 100);
  142. border: 1px solid rgba(235, 112, 9, 100);
  143. }
  144. }
  145. </style>