index.vue 4.0 KB

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