record.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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 flex">
  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; " class="ells-one">{{item.prizeTitle}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 中奖 -->
  34. <u-popup :show="activityShow" mode="center" round="11" @close="close" :closeable="true" overlayOpacity="0.5"
  35. @touchmove.prevent.stop>
  36. <view class="activityShow-wrap">
  37. <view class="activityShow-wrap-award">
  38. <view class="award">恭喜你 获得{{listData.awardName}}</view>
  39. <view class="award-name">{{listData.prizeTitle}}title名字</view>
  40. </view>
  41. <view class="activityShow-wrap-rela" style="position: relative;">
  42. <image :src="listData.prizePicUrl" mode="aspectFit" style="position: absolute;top: -260rpx;left: 170rpx; width: 350rpx;"></image>
  43. <!-- <image src="../static/activity/effectstwo.png" mode="aspectFit"
  44. style="position: absolute;top: -260rpx;left: 170rpx; width: 350rpx;"></image> -->
  45. </view>
  46. <view style="text-align: center;margin-top: 120rpx;font-size: 24rpx;color: #999;line-height: 80rpx;">
  47. 奖品已放入我的奖品库</view>
  48. <view class="flex" style="padding-bottom: 40rpx;">
  49. <button @click="toPrize()"
  50. style="width: 288rpx;height: 100rpx;font-size: 30rpx; line-height: 90rpx; background-color: #fff;color: #F8832C;border: 2rpx solid #F8832C;">前往查看</button><button
  51. @click="close()"
  52. style="width: 288rpx;height: 100rpx;font-size: 30rpx; line-height: 90rpx; background-color: #F8832C;color: #fff;border: 2rpx solid #F8832C;">关闭</button>
  53. </view>
  54. </view>
  55. </u-popup>
  56. <!-- 未中奖 -->
  57. <u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5"
  58. @touchmove.prevent.stop>
  59. <view class="choiceShow-wrap">
  60. <view style="width: 200rpx; height: 200rpx;margin: 100rpx; text-align: center;">
  61. 很遗憾你未中奖,欢迎继续参与其他抽奖,好运就在你身边
  62. </view>
  63. <button @click="close()">确定</button>
  64. </view>
  65. </u-popup>
  66. </view>
  67. </template>
  68. <script>
  69. import env from '../../config/env.js'
  70. import $http from '@/utils/request.js'
  71. export default {
  72. data() {
  73. return {
  74. list: [],
  75. marketingId: '',
  76. closeShow: false,
  77. activityShow: false,
  78. listData: {}
  79. }
  80. },
  81. onLoad(opthios) {
  82. this.marketingId = opthios.id
  83. this.pageList()
  84. },
  85. methods: {
  86. pageList() {
  87. this.pageNum = 1
  88. this.list = []
  89. this.getList()
  90. },
  91. getList() {
  92. uni.showLoading({
  93. title: '加载中'
  94. });
  95. this.loading = true
  96. $http.post(`/api/v1/mp/user/marketing/hit/prize/list`, {
  97. marketingId: this.marketingId,
  98. }).then(res => {
  99. uni.hideLoading();
  100. this.loading = false
  101. if (res.code == 0) {
  102. res.rows.forEach(item => {
  103. let prizePicUrlArr = item.prizePicUrl.split(',')
  104. item.prizePicUrl = env.filePublic + prizePicUrlArr[0] + '?imageView2/2/w/170'
  105. item.avatar = env.filePublic + item.avatar + '?imageView2/2/w/170'
  106. })
  107. this.list = this.list.concat(res.rows)
  108. }
  109. }).catch(() => {
  110. uni.hideLoading();
  111. this.loading = false
  112. });
  113. try {
  114. const value = uni.getStorageSync(this.marketingId);
  115. if (value) {
  116. } else {
  117. this.successFail()
  118. uni.setStorageSync(this.marketingId, this.marketingId);
  119. }
  120. } catch (e) {
  121. // error
  122. }
  123. },
  124. close() {
  125. this.closeShow = false
  126. this.activityShow = false
  127. },
  128. toPrize() {
  129. uni.navigateTo({
  130. url: '/packagePrize/prize/index'
  131. })
  132. },
  133. successFail() {
  134. this.listData = {}
  135. $http.post(`/api/v1/mp/user/marketing/hit/prize/isHit/${this.marketingId}`, {}).then(
  136. res => {
  137. console.log(res)
  138. if (res.code == 0 && res.data && res.data.isHit == 1) {
  139. res.data.prizePicUrl = env.filePublic + res.data.prizePicUrl + '?imageView2/2/w/170'
  140. this.listData = res.data
  141. this.activityShow = true
  142. }
  143. if (res.code == 0 && res.data && res.data.isHit == 0) {
  144. this.closeShow = true
  145. }
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .list {
  153. &-view {
  154. padding: 10rpx 20rpx;
  155. .award {
  156. justify-content: flex-start;
  157. border-radius: 22rpx;
  158. width: 100%;
  159. height: 108px;
  160. background-color: #fff;
  161. overflow: hidden;
  162. &-avatar {
  163. padding: 50rpx 32rpx;
  164. image {
  165. height: 100rpx;
  166. width: 100rpx;
  167. border-radius: 100rpx;
  168. }
  169. }
  170. &-nickNames {
  171. flex: 1;
  172. padding: 30rpx 0;
  173. .nickName {
  174. line-height: 60rpx;
  175. font-size: 30rpx;
  176. .awardName {
  177. display: inline-block;
  178. image {
  179. width: 40rpx;
  180. height: 36rpx;
  181. margin-left: 30rpx;
  182. vertical-align: -10%;
  183. }
  184. text {
  185. display: inline-block;
  186. font-size: 26rpx;
  187. line-height: 26rpx;
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. // 设置ios刘海屏底部横线安全区域
  195. padding-bottom: constant(safe-area-inset-bottom);
  196. padding-bottom: env(safe-area-inset-bottom);
  197. }
  198. .activityShow-wrap {
  199. border-radius: 22rpx;
  200. overflow: hidden;
  201. width: 700rpx;
  202. &-award {
  203. width: 100%;
  204. height: 350rpx;
  205. text-align: center;
  206. background-image: radial-gradient(#FFAE64, #FF866B);
  207. text-align: center;
  208. .award {
  209. font-size: 40rpx;
  210. color: #fff;
  211. font-weight: bold;
  212. line-height: 80rpx;
  213. padding-top: 50rpx;
  214. &-name {
  215. font-size: 30rpx;
  216. color: #fff;
  217. font-weight: bold;
  218. }
  219. }
  220. }
  221. }
  222. .choiceShow-wrap {}
  223. </style>