record.vue 9.6 KB

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