record.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view>
  3. <u-navbar title="获奖名单" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  4. <view class="list">
  5. <view v-for="(item,index) in list" :key="index" class="list-view">
  6. <view class="award">
  7. <view class="award-avatar">
  8. <image :src="item.avatar" mode=""></image>
  9. </view>
  10. <view class="award-nickNames">
  11. <view class="nickName"><text>{{item.nickName}}</text>
  12. <view v-if="item.awardName == '一等奖'" class="awardName">
  13. <image src="../static/activity/one.png" mode="">
  14. </image>
  15. <text style="color: #FFD225;">{{item.awardName}}</text>
  16. </view>
  17. <view v-else-if="item.awardName == '二等奖'" class="awardName">
  18. <image src="../static/activity/two.png" mode="">
  19. </image>
  20. <text style="color: #94CBEC;">{{item.awardName}}</text>
  21. </view>
  22. <view v-else-if="item.awardName == '三等奖'" class="awardName">
  23. <image src="../static/activity/three.png" mode=""></image>
  24. <text style="color: #F2B47A;">{{item.awardName}}</text>
  25. </view>
  26. </view>
  27. <view style="line-height: 46rpx; color: #666666;">中奖码:{{item.code}}</view>
  28. <view style="line-height: 46rpx; color: #666666;">{{item.prizeTitle}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 中奖 -->
  34. <u-popup :show="activityShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5"
  35. @touchmove.prevent.stop>
  36. <view class="choiceShow-wrap">
  37. <view style="width: 200rpx; height: 200rpx;margin: 100rpx; text-align: center;">
  38. 恭喜你获得一等奖
  39. </view>
  40. <button @click="toPrize()">前往查看</button>
  41. <button @click="close()">关闭</button>
  42. </view>
  43. </u-popup>
  44. <!-- 未中奖 -->
  45. <u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5"
  46. @touchmove.prevent.stop>
  47. <view class="choiceShow-wrap">
  48. <view style="width: 200rpx; height: 200rpx;margin: 100rpx; text-align: center;">
  49. 很遗憾你未中奖,欢迎继续参与其他抽奖,好运就在你身边
  50. </view>
  51. <button @click="close()">取消</button>
  52. </view>
  53. </u-popup>
  54. </view>
  55. </template>
  56. <script>
  57. import env from '../../config/env.js'
  58. import $http from '@/utils/request.js'
  59. export default {
  60. data() {
  61. return {
  62. list: [],
  63. marketingId: '',
  64. total: '',
  65. closeShow: false,
  66. activityShow: false,
  67. }
  68. },
  69. onLoad(opthios) {
  70. this.marketingId = opthios.id
  71. this.pageList()
  72. },
  73. methods: {
  74. pageList() {
  75. this.pageNum = 1
  76. this.list = []
  77. this.getList()
  78. },
  79. getList() {
  80. uni.showLoading({
  81. title: '加载中'
  82. });
  83. this.loading = true
  84. $http.post(`/api/v1/mp/user/marketing/hit/prize/list`, {
  85. marketingId: this.marketingId,
  86. }).then(res => {
  87. uni.hideLoading();
  88. this.loading = false
  89. if (res.code == 0) {
  90. res.rows.forEach(item => {
  91. let prizePicUrlArr = item.prizePicUrl.split(',')
  92. item.prizePicUrl = env.filePublic + prizePicUrlArr[0] + '?imageView2/2/w/170'
  93. item.avatar = env.filePublic + item.avatar + '?imageView2/2/w/170'
  94. })
  95. this.total = res.total
  96. this.list = this.list.concat(res.rows)
  97. }
  98. }).catch(() => {
  99. uni.hideLoading();
  100. this.loading = false
  101. });
  102. try {
  103. const value = uni.getStorageSync(this.marketingId);
  104. if (value) {
  105. }else {
  106. this.successFail()
  107. uni.setStorageSync(this.marketingId, this.marketingId);
  108. }
  109. } catch (e) {
  110. // error
  111. }
  112. },
  113. close() {
  114. this.closeShow = false
  115. this.activityShow = false
  116. },
  117. toPrize() {
  118. uni.navigateTo({
  119. url: '/packagePrize/prize/index'
  120. })
  121. },
  122. successFail() {
  123. $http.post(`/api/v1/mp/user/marketing/hit/prize/isHit/${this.marketingId}`, {}).then(
  124. res => {
  125. if (res.code == 0 && res.data && res.data.isHit == 1) {
  126. this.activityShow = true
  127. }
  128. if (res.code == 0 && res.data && res.data.isHit == 0) {
  129. this.closeShow = true
  130. }
  131. })
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .list {
  138. &-view {
  139. padding: 10rpx 20rpx;
  140. .award {
  141. border-radius: 22rpx;
  142. width: 100%;
  143. height: 108px;
  144. background-color: #fff;
  145. overflow: hidden;
  146. &-avatar {
  147. float: left;
  148. padding: 50rpx 32rpx;
  149. image {
  150. height: 100rpx;
  151. width: 100rpx;
  152. border-radius: 100rpx;
  153. }
  154. }
  155. &-nickNames {
  156. float: left;
  157. padding: 30rpx 0;
  158. .nickName {
  159. line-height: 60rpx;
  160. font-size: 30rpx;
  161. .awardName {
  162. display: inline-block;
  163. image {
  164. width: 40rpx;
  165. height: 36rpx;
  166. margin-left: 30rpx;
  167. vertical-align: -10%;
  168. }
  169. text {
  170. display: inline-block;
  171. font-size: 26rpx;
  172. line-height: 26rpx;
  173. }
  174. }
  175. }
  176. }
  177. }
  178. }
  179. // 设置ios刘海屏底部横线安全区域
  180. padding-bottom: constant(safe-area-inset-bottom);
  181. padding-bottom: env(safe-area-inset-bottom);
  182. }
  183. </style>