drawCard_first.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template style="background-color: red">
  2. <div
  3. style="
  4. height: 100vh;
  5. background: linear-gradient(216deg, #fe854c 0%, #ff9a5a 100%);
  6. box-sizing: border-box;
  7. overflow: scroll;
  8. "
  9. >
  10. <div
  11. class="first2"
  12. :style="{
  13. background: 'url(https://file.rongcyl.cn/festatic/bkm/first2/bg.png)',
  14. height: 'calc(100vh - 160rpx)',
  15. 'background-repeat': 'no-repeat',
  16. 'background-position': 'center center',
  17. 'background-size': '100% 100%',
  18. 'padding-top': safeAreaTop,
  19. 'box-sizing': 'border-box',
  20. overflow: 'scroll',
  21. 'padding-bottom': '160rpx',
  22. }"
  23. >
  24. <div class="text-white bold text-center mt-2">FIRST赏详情</div>
  25. <div class="card relative">
  26. <div class="flex pt-3 px-3">
  27. <img
  28. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/card.png"
  29. style="width: 168rpx; height: 169rpx; border-radius: 8px"
  30. />
  31. <div class="flex-1 pl-2">
  32. <div class="" style="font-weight: 900">{{ detail.name }}</div>
  33. <div class="flex justify-between">
  34. <div>
  35. <span class="bold" style="color: #ff2c43; font-size: 24rpx">¥</span>
  36. <span class="bold" style="color: #ff2c43; font-size: 38rpx">
  37. {{ ('' + detail.price).split('.')[0] }}
  38. </span>
  39. <span class="bold" style="color: #ff2c43; font-size: 28rpx">
  40. .{{ ('' + detail.price).split('.')[1] }}
  41. </span>
  42. <span style="color: #4e504f; font-size: 14px">/张明信片</span>
  43. </div>
  44. <div class="pt-2">
  45. <img
  46. @click="$navigateTo('/pages/rule/rule', { type: 5 })"
  47. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/first2/rule.png"
  48. style="width: 134rpx; height: 48rpx"
  49. />
  50. </div>
  51. </div>
  52. <div class="flex justify-between" style="margin-top: 5px">
  53. <div>
  54. <img
  55. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/item.png"
  56. style="width: 40rpx; height: 40rpx; border-radius: 50%; display: inline-block; border: 1px solid #fff"
  57. />
  58. <img
  59. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/item.png"
  60. class="relative right-2"
  61. style="width: 40rpx; height: 40rpx; border-radius: 50%; display: inline-block; border: 1px solid #fff"
  62. />
  63. <img
  64. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/item.png"
  65. class="relative right-4"
  66. style="width: 40rpx; height: 40rpx; border-radius: 50%; display: inline-block; border: 1px solid #fff"
  67. />
  68. <img
  69. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/item.png"
  70. class="relative right-6"
  71. style="width: 40rpx; height: 40rpx; border-radius: 50%; display: inline-block; border: 1px solid #fff"
  72. />
  73. <img
  74. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/item.png"
  75. class="relative right-8"
  76. style="width: 40rpx; height: 40rpx; border-radius: 50%; display: inline-block; border: 1px solid #fff"
  77. />
  78. </div>
  79. <div class="flex items-center">
  80. <img
  81. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/first2/hot.png"
  82. class="relative right-2"
  83. style="width: 32rpx; height: 32rpx; display: inline-block"
  84. />
  85. <span style="color: #fc5b20" class="fs11">{{ detail.hotNum }}</span>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <div
  91. class="absolute left-0 right-0 bottom-6 mx-auto"
  92. style="
  93. width: 670rpx;
  94. height: 128rpx;
  95. background: url(https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/first2/notice_c.png) no-repeat
  96. center center;
  97. background-size: cover;
  98. "
  99. >
  100. <img
  101. src="https://fudaanfang.oss-cn-hangzhou.aliyuncs.com/festatic/bkm/first2/notice.png"
  102. class="absolute top-2 left-2"
  103. style="width: 106rpx; height: 28rpx"
  104. />
  105. <div class="text-white fs12 mt-6 px-2">
  106. 购买须知购买须知购买须知购买须知购买须知购买须知购买须知购买须知购买须知购买须知购买须知购买须知。
  107. </div>
  108. </div>
  109. <div
  110. class="absolute left-0 right-0 bottom-1 mx-auto"
  111. style="
  112. width: 690rpx;
  113. height: 12px;
  114. background: #4f5150;
  115. box-shadow: inset 0px 4px 4px 0px rgba(0, 0, 0, 0.8);
  116. border-radius: 22px 22px 22px 22px;
  117. opacity: 1;
  118. "
  119. >
  120. <div
  121. class="absolute top-1 mx-auto"
  122. style="
  123. left: 10rpx;
  124. right: 10rpx;
  125. width: 670rpx;
  126. min-height: 890rpx;
  127. background: linear-gradient(180deg, #ccd3d9 0%, #ffffff 5%);
  128. border-radius: 0px 0px 0px 0px;
  129. opacity: 1;
  130. "
  131. >
  132. <div class="flex justify-around" style="margin: 10px 0">
  133. <img
  134. src="https://file.rongcyl.cn/festatic/bkm/first2/tab1.png"
  135. v-if="tabIndex !== 1"
  136. @click="tabIndex = 1"
  137. style="width: 126rpx; height: 32rpx"
  138. />
  139. <img
  140. v-if="tabIndex == 1"
  141. src="https://file.rongcyl.cn/festatic/bkm/first2/tab1a.png"
  142. @click="tabIndex = 1"
  143. style="width: 126rpx; height: 32rpx"
  144. />
  145. <img
  146. v-if="tabIndex !== 2"
  147. src="https://file.rongcyl.cn/festatic/bkm/first2/tab2.png"
  148. @click="tabIndex = 2"
  149. style="width: 126rpx; height: 32rpx"
  150. />
  151. <img
  152. v-if="tabIndex == 2"
  153. src="https://file.rongcyl.cn/festatic/bkm/first2/tab2a.png"
  154. @click="tabIndex = 2"
  155. style="width: 126rpx; height: 32rpx"
  156. />
  157. <img
  158. v-if="tabIndex != 3"
  159. src="https://file.rongcyl.cn/festatic/bkm/first2/tab3.png"
  160. @click="tabIndex = 3"
  161. style="width: 126rpx; height: 32rpx"
  162. />
  163. <img
  164. v-if="tabIndex == 3"
  165. src="https://file.rongcyl.cn/festatic/bkm/first2/tab3a.png"
  166. @click="tabIndex = 3"
  167. style="width: 126rpx; height: 32rpx"
  168. />
  169. </div>
  170. <div class="cardList list" style="padding: 10rpx 16rpx 20rpx 16rpx" v-if="tabIndex == 1">
  171. <div
  172. :class="['flex', 'items-center', 'justify-center', item.status == 0 ? 'c1' : 'c2']"
  173. v-for="(item, index) in cardList"
  174. @click="clickCard(item)"
  175. >
  176. <numImg v-if="item.status == 0" class="num" :value="item" :type="1" />
  177. <img
  178. v-if="item.status == 2"
  179. src="https://file.rongcyl.cn/festatic/bkm/first2/gift_a.png"
  180. style="width: 60rpx; height: 72rpx"
  181. />
  182. <img
  183. v-if="item.status == 1"
  184. src="https://file.rongcyl.cn/festatic/bkm/first2/lock.png"
  185. style="width: 60rpx; height: 60rpx"
  186. />
  187. <!-- <img v-if="item.check" src="" alt=""> -->
  188. </div>
  189. </div>
  190. <div class="list pt-4" style="position: relative" v-if="tabIndex == 2">
  191. <div v-for="(item, index) in prizeList" :key="index">
  192. <div class="titleTip">概率:{{ item.probability }}%(此概率为当前赏级概率)</div>
  193. <Title :title="$selectDictLabel(rewardType, item.type).split('赏')[0]" />
  194. <div class="flex pl-3 pt-3 mb-3" style="background-color: #f6f0e9">
  195. <div
  196. v-for="(item2, index2) in item.prizeList"
  197. @click="showImg(item2)"
  198. class="mr-2"
  199. style="width: 168rpx; background-color: #f9f6f2; border-radius: 4px; margin-bottom: 10px"
  200. >
  201. <image
  202. :src="item2.icon"
  203. mode="aspectFill"
  204. style="width: 144rpx; height: 144rpx; border-radius: 5px; margin: auto"
  205. />
  206. <div class="fs13 pl-2 prizeName">{{ item2.name }}</div>
  207. <div style="color: #ea6636" class="pl-2">
  208. <span class="fs11">参考价</span>
  209. <span class="fs14 bold">{{ detail.price }}</span>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. <!-- <Title title="FIRST" /> -->
  215. <!-- <div class="flex pl-3 pt-3 mb-3" style="background-color: #f6f0e9">
  216. <div
  217. v-for="item in 3"
  218. class="mr-2"
  219. style="width: 168rpx; background-color: #f9f6f2; border-radius: 4px; margin-bottom: 10px"
  220. >
  221. <img
  222. src="https://file.rongcyl.cn/festatic/bkm/card.png"
  223. style="width: 144rpx; height: 144rpx; border-radius: 5px; margin: auto"
  224. />
  225. <div class="fs13 pl-2">冲四层闯…</div>
  226. <div style="color: #ea6636" class="pl-2">
  227. <span class="fs11">参考价</span>
  228. <span class="fs14 bold">990.5</span>
  229. </div>
  230. </div>
  231. </div> -->
  232. </div>
  233. <div class="list winningRecord" style="padding: 20rpx 16rpx" v-if="tabIndex == 3">
  234. <view class="winningRecordCard" v-for="(item, index) in winningRecordList" :key="index">
  235. <view class="row">
  236. <view class="left">
  237. <image class="photo" :src="item.userAvtar" mode="aspectFill"></image>
  238. <span class="name">{{ item.userName }}</span>
  239. </view>
  240. <view class="right text1">
  241. <span style="margin-right: 5px">{{ item.creatTime }}</span>
  242. <span>No.{{ item.id }}</span>
  243. </view>
  244. </view>
  245. <view class="row" style="margin-top: 10px">
  246. <view class="left">
  247. <image class="img" :src="item.prizeIcon" mode="aspectFill"></image>
  248. <span class="name">{{ item.prizeName }}</span>
  249. </view>
  250. <view class="right" style="font-size: 14px">
  251. {{ $selectDictLabel(rewardType, item.prizeType) }} × 1
  252. </view>
  253. </view>
  254. </view>
  255. </div>
  256. <img
  257. src="https://file.rongcyl.cn/festatic/bkm/first2/dots.png"
  258. class="absolute mx-auto inline-block left-0 right-0"
  259. style="width: 612rpx; height: 24rpx; bottom: -12rpx"
  260. />
  261. </div>
  262. </div>
  263. </div>
  264. <div class="fixed right-2 bottom-20" style="height: 460rpx">
  265. <img
  266. src="https://file.rongcyl.cn/festatic/bkm/first2/fu.png"
  267. style="width: 88rpx; height: 88rpx; margin-bottom: 24rpx"
  268. />
  269. <img
  270. @click="toKnapsack"
  271. src="https://file.rongcyl.cn/festatic/bkm/first2/bag.png"
  272. style="width: 88rpx; height: 88rpx; margin-bottom: 24rpx"
  273. />
  274. <img
  275. @click="refresh"
  276. src="https://file.rongcyl.cn/festatic/bkm/first2/refresh.png"
  277. style="width: 88rpx; height: 88rpx; margin-bottom: 24rpx"
  278. />
  279. <button open-type="share" class="share_btn">
  280. <img
  281. src="https://file.rongcyl.cn/festatic/bkm/first2/share.png"
  282. style="width: 88rpx; height: 88rpx; margin-bottom: 24rpx"
  283. />
  284. </button>
  285. </div>
  286. <div class="buy items-center">
  287. <div class="pica ml-2" style="margin-top: -38rpx">
  288. <img src="https://file.rongcyl.cn/festatic/bkm/first2/pica.png" class="w-full h-full" />
  289. </div>
  290. <div class="flex-1 text-white fs12 ml12 relative bottom-3 pl-3">
  291. <span class="inline-block">已选{{ selectIndex.length }}个 合计:</span>
  292. <span class="inline-block" style="color: #ea6636">
  293. <span class="bold">¥</span>
  294. <span class="fs18 bold">{{ (selectIndex.length * detail.price).toFixed(2) }}</span>
  295. </span>
  296. </div>
  297. <img
  298. @click="submit"
  299. src="https://file.rongcyl.cn/festatic/bkm/first2/bug.png"
  300. class="b_btn relative bottom-3 right-2"
  301. />
  302. </div>
  303. </div>
  304. <paymentPopup ref="paymentPopup" @callBack="paymentSuccess" />
  305. <imgPopup ref="imgPopup" />
  306. </div>
  307. </template>
  308. <script>
  309. import imgPopup from '@/component/imgPopup.vue'
  310. import { rewardType } from '@/utils/commonConfig.js'
  311. import {
  312. prizePoolStatusApi,
  313. drawCardSubmitApi,
  314. raffleDetailApi,
  315. prizeListApi,
  316. prizeUserListApi,
  317. } from '@/api/drawCard.js'
  318. import { cardType } from '@/utils/utils.js'
  319. import numImg from '@/component/numImg.vue'
  320. import paymentPopup from '@/component/paymentPopup.vue'
  321. import Title from '@/component/title.vue'
  322. export default {
  323. data() {
  324. return {
  325. rewardType: rewardType,
  326. safeAreaTop: '0px',
  327. tabIndex: 1,
  328. params: {
  329. raffleId: '',
  330. limit: 999,
  331. page: 1,
  332. },
  333. detail: {},
  334. cardList: [],
  335. selectIndex: [],
  336. prizeList: [],
  337. winningRecordList: [],
  338. }
  339. },
  340. components: {
  341. Title,
  342. imgPopup,
  343. paymentPopup,
  344. numImg,
  345. },
  346. onLoad(query) {
  347. console.log(query, 'query')
  348. if (query.id) {
  349. this.params.raffleId = query.id
  350. this.init()
  351. }
  352. this.paymentSuccess()
  353. },
  354. mounted() {
  355. this.getSafeAreaTop()
  356. },
  357. methods: {
  358. init() {
  359. // 获取卡牌商品列表
  360. this.getCardList()
  361. // 获取卡包详情
  362. this.getDetail()
  363. //获取奖池
  364. this.getPrizeList()
  365. // 中奖记录
  366. this.getPrizeUserList()
  367. },
  368. toKnapsack() {
  369. // 跳转背包界面
  370. wx.navigateTo({
  371. url: '/pages/knapsack/knapsack',
  372. })
  373. },
  374. getPrizeUserList() {
  375. let params = {
  376. limit: 9999,
  377. page: 1,
  378. raffleId: this.params.raffleId,
  379. }
  380. prizeUserListApi(params).then(res => {
  381. this.winningRecordList = res.data
  382. })
  383. },
  384. getCardList() {
  385. prizePoolStatusApi(this.params).then(res => {
  386. console.log(res, '卡牌分页')
  387. for (var i = 0; i < res.data.list.length; i++) {
  388. res.data.list[i].check = false
  389. }
  390. this.cardList = res.data.list
  391. this.selectFormat()
  392. })
  393. },
  394. // 标记已经选中卡牌
  395. selectFormat() {
  396. for (var i = 0; i < this.cardList.length; i++) {
  397. if (this.selectIndex.includes(this.cardList[i].number)) {
  398. this.cardList[i].check = true
  399. }
  400. }
  401. },
  402. getDetail() {
  403. let params = {
  404. raffleId: this.params.raffleId,
  405. }
  406. raffleDetailApi(params).then(res => {
  407. console.log(res, '详情')
  408. this.detail = res.data
  409. })
  410. },
  411. getPrizeList() {
  412. let params = {
  413. raffleId: this.params.raffleId,
  414. }
  415. prizeListApi(params).then(res => {
  416. console.log(res, '奖池预览')
  417. let newArray = res.data
  418. for (var i = 0; i < res.data.length; i++) {
  419. if (res.data[i].type == 21) {
  420. newArray = []
  421. newArray.push(res.data[i])
  422. res.data.splice(i, 1)
  423. newArray.push(...res.data)
  424. break
  425. }
  426. }
  427. this.prizeList = newArray
  428. })
  429. },
  430. // 选中取消选中卡牌
  431. clickCard(item) {
  432. if (item.status == 0) {
  433. item.check = !item.check
  434. }
  435. // 如果是选中
  436. let index = this.selectIndex.indexOf(item.number)
  437. if (item.check && index == -1) {
  438. this.selectIndex.push(item.number)
  439. } else if (!item.check && index != -1) {
  440. this.selectIndex.splice(index, 1)
  441. }
  442. },
  443. // 支付成功后回调
  444. paymentSuccess() {
  445. let _this = this
  446. console.log('刷新抽卡界面')
  447. // 刷新界面
  448. _this.refresh()
  449. },
  450. getSafeAreaTop() {
  451. wx.getSystemInfo({
  452. success: res => {
  453. this.safeAreaTop = res.safeArea.top + 'px'
  454. },
  455. })
  456. },
  457. refresh() {
  458. wx.showLoading()
  459. setTimeout(function () {
  460. wx.hideLoading()
  461. }, 1000)
  462. this.init()
  463. this.selectIndex = []
  464. for (var i = 0; i < this.cardList.length; i++) {
  465. this.cardList[i].check = false
  466. }
  467. },
  468. submit() {
  469. if (this.selectIndex.length == 0) {
  470. wx.showToast({
  471. title: '请选则要购买的卡牌。',
  472. icon: 'none',
  473. })
  474. return
  475. }
  476. let params = {
  477. raffleId: this.params.raffleId,
  478. }
  479. this.$refs.paymentPopup.show(params, this.selectIndex, this.detail)
  480. },
  481. },
  482. }
  483. </script>
  484. <style scoped lang="scss">
  485. .first2 {
  486. padding-top: v-bind(safeAreaBottom);
  487. color: v-bind(color);
  488. .card {
  489. width: 710rpx;
  490. margin: auto;
  491. background-color: #fff;
  492. border-radius: 10px;
  493. height: 400rpx;
  494. margin-top: 18px;
  495. }
  496. .c1 {
  497. background-image: url(https://file.rongcyl.cn/festatic/bkm/imgv2/ka/kabk1.png);
  498. // width: 96rpx;
  499. height: 128rpx;
  500. background-repeat: no-repeat;
  501. background-position: center center;
  502. background-size: contain;
  503. margin-bottom: 14rpx;
  504. }
  505. .c2 {
  506. background-image: url(https://file.rongcyl.cn/festatic/bkm/imgv2/ka/kabk4.png);
  507. // width: 96rpx;
  508. height: 128rpx;
  509. background-repeat: no-repeat;
  510. background-position: center center;
  511. background-size: contain;
  512. margin-bottom: 14rpx;
  513. }
  514. .buy {
  515. position: fixed;
  516. left: 0;
  517. right: 0;
  518. bottom: 0;
  519. width: 750rpx;
  520. height: 160rpx;
  521. background: #000000;
  522. opacity: 1;
  523. display: flex;
  524. .pica {
  525. width: 88rpx;
  526. height: 88rpx;
  527. }
  528. .b_btn {
  529. width: 232rpx;
  530. height: 76rpx;
  531. }
  532. }
  533. }
  534. .cardList {
  535. display: grid;
  536. grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
  537. }
  538. .list {
  539. // height: calc(100% - 32rpx - 20px - 20px);
  540. // overflow: auto;
  541. }
  542. .prizeName {
  543. width: 100%;
  544. white-space: nowrap;
  545. text-overflow: ellipsis;
  546. }
  547. .titleTip {
  548. position: absolute;
  549. z-index: 2;
  550. height: 32px;
  551. line-height: 42px;
  552. padding-left: 25vw;
  553. font-size: 12px;
  554. color: #fff;
  555. }
  556. .winningRecord {
  557. .winningRecordCard {
  558. margin: 10px 10px 0 10px;
  559. border-radius: 8px;
  560. background: #fff;
  561. padding: 10px;
  562. box-shadow: 1px 1px 3px #b7b7b7;
  563. .row {
  564. display: flex;
  565. justify-content: space-between;
  566. align-items: center;
  567. .left {
  568. display: flex;
  569. align-items: center;
  570. .photo {
  571. margin-right: 5px;
  572. width: 30px;
  573. height: 30px;
  574. border-radius: 50%;
  575. }
  576. .name {
  577. font-size: 14px;
  578. font-weight: 600;
  579. }
  580. .img {
  581. width: 40px;
  582. height: 40px;
  583. border-radius: 2px;
  584. margin-right: 5px;
  585. }
  586. }
  587. .text1 {
  588. color: #666666;
  589. font-size: 12px;
  590. }
  591. }
  592. }
  593. }
  594. .share_btn {
  595. background-color: transparent;
  596. border-width: 0 !important;
  597. border-radius: 0;
  598. overflow: initial;
  599. text-align: start;
  600. padding: 0;
  601. box-shadow: none !important;
  602. -webkit-tap-highlight-color: transparent;
  603. &::after {
  604. border: none;
  605. }
  606. }
  607. </style>