drawCard_first.vue 21 KB

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