record.vue 8.5 KB

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