drawCard_first.vue 20 KB

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