drawCard_first.vue 20 KB

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