record.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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 v-if="item.prizeType =='COIN'" class="ells-one prize">盲豆 x{{item.value}}</view>
  38. <view v-else class="ells-one prize">{{item.prizeTitle}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 中奖 -->
  44. <u-popup :show="activityShow" mode="center" round="11" @close="close" :closeable="true" overlayOpacity="0.5"
  45. @touchmove.prevent.stop>
  46. <view class="activityShow-wrap">
  47. <view class="activityShow-wrap-award">
  48. <view class="award">恭喜你 获得{{listData.awardName}}</view>
  49. <view v-if="listData.prizeType && listData.prizeType =='COIN'" class="award-name ells-one">盲豆 x{{listData.value}}</view>
  50. <view v-else class="award-name ells-one">{{listData.prizeTitle}}</view>
  51. </view>
  52. <view class="activityShow-wrap-rela">
  53. <image :src="listData.prizePicUrl" mode="aspectFit" class="relaimg"></image>
  54. <!-- <image src="../static/activity/effectstwo.png" mode="aspectFit" class="relaimg"></image> -->
  55. </view>
  56. <view v-if="listData.prizeType && listData.prizeType !='COIN'" class="activityShow-wrap-library">
  57. 奖品已放入我的奖品库</view>
  58. <view v-else class="activityShow-wrap-library">奖品已放入“我的盲豆”</view>
  59. <view class="flex activityShow-wrap-btn">
  60. <button @click="toPrize()" v-if="listData.prizeType && listData.prizeType !='COIN'" class="btnone"
  61. style="">前往查看</button>
  62. <button @click="toCore()" v-else class="btnone">去兑换商品</button>
  63. <button @click="close()" class="btntwo" style="">关闭</button>
  64. </view>
  65. </view>
  66. </u-popup>
  67. <!-- 未中奖 -->
  68. <u-popup :show="closeShow" mode="center" round="17" @close="close" :closeable="true" overlayOpacity="0.5"
  69. @touchmove.prevent.stop>
  70. <view class="choiceShow-wrap">
  71. <view class="choiceShow-wrap-award">
  72. <view></view>
  73. <view class="awardone">
  74. 很遗憾, 您未中奖
  75. </view>
  76. <view class="awardtwo">
  77. 欢迎继续参与其他抽奖, 好运就在你身边
  78. </view>
  79. </view>
  80. <button @click="close()" class="btntwo">确定</button>
  81. </view>
  82. </u-popup>
  83. </view>
  84. </template>
  85. <script>
  86. import env from '../../config/env.js'
  87. import $http from '@/utils/request.js'
  88. export default {
  89. data() {
  90. return {
  91. list: [],
  92. marketingId: '',
  93. closeShow: false,
  94. activityShow: false,
  95. listData: {},
  96. pagesNum: "",
  97. }
  98. },
  99. onLoad(opthios) {
  100. this.marketingId = opthios.id
  101. this.pageList()
  102. },
  103. onShow() {
  104. this.pagesNum = getCurrentPages().length
  105. },
  106. methods: {
  107. toActivity() {
  108. uni.reLaunch({
  109. url: `/pages/activity/index?triggerStatus=1`
  110. })
  111. },
  112. toCore() {
  113. uni.reLaunch({
  114. url: '/pages/core/index'
  115. })
  116. },
  117. pageList() {
  118. this.pageNum = 1
  119. this.list = []
  120. this.getList()
  121. },
  122. getList() {
  123. uni.showLoading({
  124. title: '加载中'
  125. });
  126. this.loading = true
  127. $http.post(`/api/v1/mp/user/marketing/hit/prize/list`, {
  128. marketingId: this.marketingId,
  129. }).then(res => {
  130. uni.hideLoading();
  131. this.loading = false
  132. if (res.code == 0) {
  133. res.rows.forEach(item => {
  134. let prizePicUrlArr = item.prizePicUrl.split(',')
  135. item.prizePicUrl = env.filePublic + prizePicUrlArr[0] + '?imageView2/2/w/170'
  136. item.avatar = env.filePublic + item.avatar + '?imageView2/2/w/170'
  137. })
  138. this.list = this.list.concat(res.rows)
  139. }
  140. }).catch(() => {
  141. uni.hideLoading();
  142. this.loading = false
  143. });
  144. try {
  145. const value = uni.getStorageSync(this.marketingId);
  146. if (value) {
  147. } else {
  148. this.successFail()
  149. uni.setStorageSync(this.marketingId, this.marketingId);
  150. }
  151. } catch (e) {
  152. // error
  153. }
  154. },
  155. close() {
  156. this.closeShow = false
  157. this.activityShow = false
  158. },
  159. toPrize() {
  160. if (this.listData.prizeType != 'GOODS') {
  161. uni.navigateTo({
  162. url: '/packagePrize/prize/index?coupon=1'
  163. })
  164. }else{
  165. uni.navigateTo({
  166. url: '/packagePrize/prize/index?coupon=0'
  167. })
  168. }
  169. },
  170. successFail() {
  171. this.listData = {}
  172. $http.post(`/api/v1/mp/user/marketing/hit/prize/isHit/${this.marketingId}`, {}).then(
  173. res => {
  174. if (res.code == 0 && res.data && res.data.isHit == 1) {
  175. let prizePicUrlArr = res.data.prizePicUrl.split(',')
  176. res.data.prizePicUrl = env.filePublic + prizePicUrlArr[0] + '?imageView2/2/w/170'
  177. this.listData = res.data
  178. this.activityShow = true
  179. }
  180. if (res.code == 0 && res.data && res.data.isHit == 0) {
  181. this.closeShow = true
  182. }
  183. })
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .list {
  190. &-view {
  191. padding: 10rpx 20rpx;
  192. .award {
  193. justify-content: flex-start;
  194. border-radius: 22rpx;
  195. width: 100%;
  196. height: 108px;
  197. background-color: #fff;
  198. overflow: hidden;
  199. &-avatar {
  200. padding: 50rpx 32rpx;
  201. image {
  202. height: 100rpx;
  203. width: 100rpx;
  204. border-radius: 100rpx;
  205. }
  206. }
  207. &-nickNames {
  208. flex: 1;
  209. padding: 30rpx 0;
  210. .prize {
  211. line-height: 46rpx;
  212. color: #666666;
  213. }
  214. .nickName {
  215. line-height: 60rpx;
  216. font-size: 30rpx;
  217. .awardName {
  218. display: inline-block;
  219. image {
  220. width: 40rpx;
  221. height: 36rpx;
  222. margin-left: 30rpx;
  223. vertical-align: -10%;
  224. }
  225. text {
  226. display: inline-block;
  227. font-size: 26rpx;
  228. line-height: 26rpx;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. // 设置ios刘海屏底部横线安全区域
  236. padding-bottom: constant(safe-area-inset-bottom);
  237. padding-bottom: env(safe-area-inset-bottom);
  238. }
  239. .activityShow-wrap {
  240. border-radius: 22rpx;
  241. overflow: hidden;
  242. width: 600rpx;
  243. height: 650rpx;
  244. &-rela {
  245. position: relative;
  246. .relaimg {
  247. margin-top: 130rpx;
  248. height: 250rpx;
  249. position: absolute;
  250. top: -260rpx;
  251. left: 125rpx;
  252. width: 350rpx;
  253. }
  254. }
  255. &-award {
  256. width: 100%;
  257. height: 320rpx;
  258. text-align: center;
  259. background: linear-gradient(0deg, #FF866B, #FFAE64);
  260. box-shadow: 0px 6px 6px 0px rgba(26, 109, 190, 0.1);
  261. text-align: center;
  262. .award {
  263. font-size: 40rpx;
  264. color: #fff;
  265. font-weight: bold;
  266. line-height: 80rpx;
  267. padding-top: 50rpx;
  268. &-name {
  269. font-size: 30rpx;
  270. color: #fff;
  271. font-weight: bold;
  272. }
  273. }
  274. }
  275. &-library {
  276. text-align: center;
  277. margin-top: 110rpx;
  278. font-size: 24rpx;
  279. color: #999;
  280. line-height: 80rpx;
  281. }
  282. &-btn {
  283. // padding-bottom: 40rpx;
  284. padding: 10rpx 20rpx 40rpx;
  285. .btnone {
  286. width: 252rpx;
  287. height: 84rpx;
  288. font-size: 34rpx;
  289. line-height: 82rpx;
  290. background-color: #fff;
  291. color: #F8832C;
  292. border: 2rpx solid #F8832C;
  293. }
  294. .btntwo {
  295. width: 252rpx;
  296. height: 82rpx;
  297. font-size: 34rpx;
  298. line-height: 82rpx;
  299. background-color: #F8832C;
  300. color: #fff;
  301. border: 2rpx solid #F8832C;
  302. }
  303. }
  304. }
  305. .choiceShow-wrap {
  306. border-radius: 22rpx;
  307. overflow: hidden;
  308. width: 600rpx;
  309. height: 500rpx;
  310. &-award {
  311. width: 100%;
  312. height: 290rpx;
  313. text-align: center;
  314. font-weight: bold;
  315. background: linear-gradient(0deg, #FF866B, #FFAE64);
  316. box-shadow: 0px 6px 6px 0px rgba(26, 109, 190, 0.1);
  317. text-align: center;
  318. .awardone {
  319. padding-top: 70rpx; color: #fff;font-size: 40rpx;
  320. }
  321. .awardtwo {
  322. padding-top: 60rpx;color: #fff;font-size: 30rpx;
  323. }
  324. }
  325. .btntwo {
  326. width: 252rpx;
  327. height: 82rpx;
  328. font-size: 34rpx;
  329. line-height: 82rpx;
  330. background-color: #F8832C;
  331. color: #fff;
  332. margin-top: 50rpx;
  333. }
  334. }
  335. </style>