record.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <view>
  3. <view v-if="pagesNum > 1">
  4. <u-navbar title="获奖名单" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  5. </view>
  6. <view v-else>
  7. <u-navbar leftIconSize="0" :placeholder="true" bgColor="#fff" title="获奖名单">
  8. <view class="nav-left flex" slot="left" @click="toActivity">
  9. <u-icon name="arrow-left" size="20" color="#333"></u-icon>
  10. </view>
  11. </u-navbar>
  12. </view>
  13. <view class="list">
  14. <view v-for="(item,index) in list" :key="index" class="list-view">
  15. <view class="award flex">
  16. <view class="award-avatar">
  17. <image :src="item.avatar" mode=""></image>
  18. </view>
  19. <view class="award-nickNames">
  20. <view class="nickName"><text>{{item.nickName}}</text>
  21. <view v-if="item.awardName == '一等奖'" class="awardName">
  22. <image src="../static/activity/one.png" mode="">
  23. </image>
  24. <text style="color: #FFD225;">{{item.awardName}}</text>
  25. </view>
  26. <view v-else-if="item.awardName == '二等奖'" class="awardName">
  27. <image src="../static/activity/two.png" mode="">
  28. </image>
  29. <text style="color: #94CBEC;">{{item.awardName}}</text>
  30. </view>
  31. <view v-else-if="item.awardName == '三等奖'" class="awardName">
  32. <image src="../static/activity/three.png" mode=""></image>
  33. <text style="color: #F2B47A;">{{item.awardName}}</text>
  34. </view>
  35. </view>
  36. <view class="prize">中奖码:{{item.code}}</view>
  37. <view class="ells-one prize">{{item.prizeTitle}}</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 中奖 -->
  43. <u-popup :show="activityShow" mode="center" round="11" @close="close" :closeable="true" overlayOpacity="0.5"
  44. @touchmove.prevent.stop>
  45. <view class="activityShow-wrap">
  46. <view class="activityShow-wrap-award">
  47. <view class="award">恭喜你 获得{{listData.awardName}}</view>
  48. <view class="award-name">{{listData.prizeTitle}}</view>
  49. </view>
  50. <view class="activityShow-wrap-rela">
  51. <image :src="listData.prizePicUrl" mode="aspectFit" class="relaimg"></image>
  52. <!-- <image src="../static/activity/effectstwo.png" mode="aspectFit" class="relaimg"></image> -->
  53. </view>
  54. <view class="activityShow-wrap-library">
  55. 奖品已放入我的奖品库</view>
  56. <view class="flex activityShow-wrap-btn">
  57. <button @click="toPrize()" class="btnone" style="">前往查看</button><button @click="close()"
  58. class="btntwo" style="">关闭</button>
  59. </view>
  60. </view>
  61. </u-popup>
  62. <!-- 未中奖 -->
  63. <u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5"
  64. @touchmove.prevent.stop>
  65. <view class="choiceShow-wrap">
  66. <view style="width: 200rpx; height: 200rpx;margin: 100rpx; text-align: center;">
  67. 很遗憾你未中奖,欢迎继续参与其他抽奖,好运就在你身边
  68. </view>
  69. <button @click="close()">确定</button>
  70. </view>
  71. </u-popup>
  72. </view>
  73. </template>
  74. <script>
  75. import env from '../../config/env.js'
  76. import $http from '@/utils/request.js'
  77. export default {
  78. data() {
  79. return {
  80. list: [],
  81. marketingId: '',
  82. closeShow: false,
  83. activityShow: true,
  84. listData: {},
  85. pagesNum: "",
  86. }
  87. },
  88. onLoad(opthios) {
  89. this.marketingId = opthios.id
  90. this.pageList()
  91. },
  92. onShow() {
  93. this.pagesNum = getCurrentPages().length
  94. },
  95. methods: {
  96. toActivity() {
  97. uni.reLaunch({
  98. url: `/pages/activity/index?triggerStatus=1`
  99. })
  100. },
  101. pageList() {
  102. this.pageNum = 1
  103. this.list = []
  104. this.getList()
  105. },
  106. getList() {
  107. uni.showLoading({
  108. title: '加载中'
  109. });
  110. this.loading = true
  111. $http.post(`/api/v1/mp/user/marketing/hit/prize/list`, {
  112. marketingId: this.marketingId,
  113. }).then(res => {
  114. uni.hideLoading();
  115. this.loading = false
  116. if (res.code == 0) {
  117. res.rows.forEach(item => {
  118. let prizePicUrlArr = item.prizePicUrl.split(',')
  119. item.prizePicUrl = env.filePublic + prizePicUrlArr[0] + '?imageView2/2/w/170'
  120. item.avatar = env.filePublic + item.avatar + '?imageView2/2/w/170'
  121. })
  122. this.list = this.list.concat(res.rows)
  123. }
  124. }).catch(() => {
  125. uni.hideLoading();
  126. this.loading = false
  127. });
  128. try {
  129. const value = uni.getStorageSync(this.marketingId);
  130. if (value) {
  131. } else {
  132. this.successFail()
  133. uni.setStorageSync(this.marketingId, this.marketingId);
  134. }
  135. } catch (e) {
  136. // error
  137. }
  138. },
  139. close() {
  140. this.closeShow = false
  141. this.activityShow = false
  142. },
  143. toPrize() {
  144. uni.navigateTo({
  145. url: '/packagePrize/prize/index'
  146. })
  147. },
  148. successFail() {
  149. this.listData = {}
  150. $http.post(`/api/v1/mp/user/marketing/hit/prize/isHit/${this.marketingId}`, {}).then(
  151. res => {
  152. console.log(res)
  153. if (res.code == 0 && res.data && res.data.isHit == 1) {
  154. let prizePicUrlArr = res.data.prizePicUrl.split(',')
  155. res.data.prizePicUrl = env.filePublic + prizePicUrlArr[0] + '?imageView2/2/w/170'
  156. this.listData = res.data
  157. this.activityShow = true
  158. }
  159. if (res.code == 0 && res.data && res.data.isHit == 0) {
  160. this.closeShow = true
  161. }
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. .list {
  169. &-view {
  170. padding: 10rpx 20rpx;
  171. .award {
  172. justify-content: flex-start;
  173. border-radius: 22rpx;
  174. width: 100%;
  175. height: 108px;
  176. background-color: #fff;
  177. overflow: hidden;
  178. &-avatar {
  179. padding: 50rpx 32rpx;
  180. image {
  181. height: 100rpx;
  182. width: 100rpx;
  183. border-radius: 100rpx;
  184. }
  185. }
  186. &-nickNames {
  187. flex: 1;
  188. padding: 30rpx 0;
  189. .prize {
  190. line-height: 46rpx;
  191. color: #666666;
  192. }
  193. .nickName {
  194. line-height: 60rpx;
  195. font-size: 30rpx;
  196. .awardName {
  197. display: inline-block;
  198. image {
  199. width: 40rpx;
  200. height: 36rpx;
  201. margin-left: 30rpx;
  202. vertical-align: -10%;
  203. }
  204. text {
  205. display: inline-block;
  206. font-size: 26rpx;
  207. line-height: 26rpx;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. }
  214. // 设置ios刘海屏底部横线安全区域
  215. padding-bottom: constant(safe-area-inset-bottom);
  216. padding-bottom: env(safe-area-inset-bottom);
  217. }
  218. .activityShow-wrap {
  219. border-radius: 22rpx;
  220. overflow: hidden;
  221. width: 700rpx;
  222. &-rela {
  223. position: relative;
  224. .relaimg {
  225. margin-top: 100rpx;
  226. height: 310rpx;
  227. position: absolute;
  228. top: -260rpx;
  229. left: 170rpx;
  230. width: 350rpx;
  231. }
  232. }
  233. &-award {
  234. width: 100%;
  235. height: 350rpx;
  236. text-align: center;
  237. background-image: radial-gradient(#FFAE64, #FF866B);
  238. text-align: center;
  239. .award {
  240. font-size: 40rpx;
  241. color: #fff;
  242. font-weight: bold;
  243. line-height: 80rpx;
  244. padding-top: 50rpx;
  245. &-name {
  246. font-size: 30rpx;
  247. color: #fff;
  248. font-weight: bold;
  249. }
  250. }
  251. }
  252. &-library {
  253. text-align: center;
  254. margin-top: 140rpx;
  255. font-size: 24rpx;
  256. color: #999;
  257. line-height: 80rpx;
  258. }
  259. &-btn {
  260. padding-bottom: 40rpx;
  261. .btnone {
  262. width: 288rpx;
  263. height: 100rpx;
  264. font-size: 30rpx;
  265. line-height: 90rpx;
  266. background-color: #fff;
  267. color: #F8832C;
  268. border: 2rpx solid #F8832C;
  269. }
  270. .btntwo {
  271. width: 288rpx;
  272. height: 100rpx;
  273. font-size: 30rpx;
  274. line-height: 90rpx;
  275. background-color: #F8832C;
  276. color: #fff;
  277. border: 2rpx solid #F8832C;
  278. }
  279. }
  280. }
  281. .choiceShow-wrap {}
  282. </style>