record.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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. </view>
  55. <view v-if="listData.prizeType && listData.prizeType !='COIN'" class="activityShow-wrap-library">
  56. 奖品已放入我的仓库</view>
  57. <view v-else class="activityShow-wrap-library">奖品已放入“我的盲豆”</view>
  58. <view class="flex activityShow-wrap-btn">
  59. <button @click="toPrize()" v-if="listData.prizeType && listData.prizeType !='COIN'" class="btnone"
  60. style="">前往查看</button>
  61. <button @click="toCore()" v-else class="btnone">去兑换商品</button>
  62. <button @click="close()" class="btntwo" style="">关闭</button>
  63. </view>
  64. </view>
  65. </u-popup>
  66. <!-- 未中奖 -->
  67. <u-popup :show="closeShow" mode="center" round="11" @close="close" :closeable="true" overlayOpacity="0.5"
  68. @touchmove.prevent.stop>
  69. <view class="choiceShow-wrap">
  70. <view class="choiceShow-wrap-award">
  71. <view></view>
  72. <view class="awardone">
  73. 很遗憾, 您未中奖
  74. </view>
  75. <!-- <view class="awardtwo">
  76. 欢迎继续参与其他抽奖, 好运就在你身边
  77. </view> -->
  78. </view>
  79. <button @click="close()" class="btntwo">确定</button>
  80. </view>
  81. </u-popup>
  82. </view>
  83. </template>
  84. <script>
  85. import env from '../../config/env.js'
  86. import $http from '@/utils/request.js'
  87. export default {
  88. data() {
  89. return {
  90. list: [],
  91. marketingId: '',
  92. closeShow: false,
  93. activityShow: false,
  94. listData: {},
  95. pagesNum: "",
  96. }
  97. },
  98. onLoad(opthios) {
  99. this.marketingId = opthios.id
  100. this.pageList()
  101. },
  102. onShow() {
  103. this.pagesNum = getCurrentPages().length
  104. },
  105. methods: {
  106. toActivity() {
  107. uni.reLaunch({
  108. url: `/pages/activity/index`
  109. })
  110. },
  111. toCore() {
  112. uni.reLaunch({
  113. url: '/pages/core/index'
  114. })
  115. },
  116. pageList() {
  117. this.pageNum = 1
  118. this.list = []
  119. this.getList()
  120. },
  121. getList() {
  122. uni.showLoading({
  123. title: '加载中'
  124. });
  125. this.loading = true
  126. $http.post(`/api/v1/mp/user/marketing/hit/prize/list`, {
  127. marketingId: this.marketingId,
  128. }).then(res => {
  129. uni.hideLoading();
  130. this.loading = false
  131. if (res.code == 0) {
  132. res.rows.forEach(item => {
  133. let prizePicUrlArr = item.prizePicUrl.split(',')
  134. item.prizePicUrl = env.filePublic + prizePicUrlArr[0] + '?imageView2/2/w/170'
  135. item.avatar = env.filePublic + item.avatar + '?imageView2/2/w/170'
  136. })
  137. this.list = this.list.concat(res.rows)
  138. }
  139. }).catch(() => {
  140. uni.hideLoading();
  141. this.loading = false
  142. });
  143. try {
  144. const value = uni.getStorageSync(this.marketingId);
  145. if (value) {
  146. } else {
  147. this.successFail()
  148. uni.setStorageSync(this.marketingId, this.marketingId);
  149. }
  150. } catch (e) {
  151. // error
  152. }
  153. },
  154. close() {
  155. this.closeShow = false
  156. this.activityShow = false
  157. },
  158. toPrize() {
  159. if (this.listData.prizeType != 'GOODS') {
  160. uni.navigateTo({
  161. url: '/packagePrize/prize/index?coupon=1'
  162. })
  163. }else{
  164. uni.navigateTo({
  165. url: '/packagePrize/prize/index?coupon=0'
  166. })
  167. }
  168. },
  169. successFail() {
  170. this.listData = {}
  171. $http.post(`/api/v1/mp/user/marketing/hit/prize/isHit/${this.marketingId}`, {}).then(
  172. 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: 550rpx;
  242. height: 630rpx;
  243. &-rela {
  244. position: relative;
  245. .relaimg {
  246. margin-top: 130rpx;
  247. height: 270rpx;
  248. position: absolute;
  249. top: -280rpx;
  250. left: 102rpx;
  251. width: 350rpx;
  252. }
  253. }
  254. &-award {
  255. width: 100%;
  256. height: 320rpx;
  257. text-align: center;
  258. // background: linear-gradient(0deg, #FF866B, #FFAE64);
  259. // box-shadow: 0px 6px 6px 0px rgba(26, 109, 190, 0.1);
  260. background: linear-gradient(180deg, #FC981B, #F4641B);
  261. box-shadow: 0px 6px 6px 0px rgba(26, 109, 190, 0.1);
  262. text-align: center;
  263. .award {
  264. font-size: 40rpx;
  265. color: #fff;
  266. font-weight: bold;
  267. line-height: 80rpx;
  268. padding-top: 30rpx;
  269. &-name {
  270. font-size: 30rpx;
  271. color: #fff;
  272. font-weight: bold;
  273. padding: 0 34rpx;
  274. }
  275. }
  276. }
  277. &-library {
  278. text-align: center;
  279. margin-top: 110rpx;
  280. font-size: 24rpx;
  281. color: #999;
  282. line-height: 80rpx;
  283. }
  284. &-btn {
  285. padding: 10rpx 20rpx 40rpx;
  286. .btnone {
  287. width: 200rpx;
  288. height: 78rpx;
  289. font-size: 32rpx;
  290. line-height: 74rpx;
  291. background-color: #fff;
  292. color: #F8832C;
  293. border: 2rpx solid #F8832C;
  294. }
  295. .btntwo {
  296. width: 200rpx;
  297. height: 78rpx;
  298. font-size: 32rpx;
  299. line-height: 74rpx;
  300. background-color: #F8832C;
  301. color: #fff;
  302. border: 2rpx solid #F8832C;
  303. }
  304. }
  305. }
  306. .choiceShow-wrap {
  307. border-radius: 22rpx;
  308. overflow: hidden;
  309. width: 550rpx;
  310. height: 340rpx;
  311. &-award {
  312. width: 100%;
  313. height: 190rpx;
  314. text-align: center;
  315. font-weight: bold;
  316. // background: linear-gradient(0deg, #FF866B, #FFAE64);
  317. // box-shadow: 0px 6px 6px 0px rgba(26, 109, 190, 0.1);
  318. background: linear-gradient(180deg, #FC981B, #F4641B);
  319. box-shadow: 0px 6px 6px 0px rgba(26, 109, 190, 0.1);
  320. text-align: center;
  321. .awardone {
  322. padding-top: 70rpx; color: #fff;font-size: 40rpx;
  323. }
  324. .awardtwo {
  325. padding-top: 60rpx;color: #fff;font-size: 30rpx;
  326. }
  327. }
  328. .btntwo {
  329. width: 252rpx;
  330. height: 82rpx;
  331. font-size: 34rpx;
  332. line-height: 82rpx;
  333. background-color: #F8832C;
  334. color: #fff;
  335. margin-top: 30rpx;
  336. }
  337. }
  338. </style>