drawCard_infinite.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. <template>
  2. <view class="container">
  3. <view class="head">
  4. <image class="img" :src="detail.prizeIcon" mode="aspectFill"></image>
  5. <view class="info">
  6. <view class="title row">
  7. {{ detail.name }}
  8. </view>
  9. <view class="row">
  10. <view class="price">
  11. ¥{{ detail.price }}
  12. <span class="text fontPFR">/张明信片</span>
  13. </view>
  14. <image
  15. @click="$navigateTo('/pages/rule/rule', { type: 1 })"
  16. class="button"
  17. :src="$fileUrl() + '/invite/button1.png'"
  18. mode="widthFix"
  19. ></image>
  20. </view>
  21. <view class="row">
  22. <!-- <view class="users">
  23. <image class="photo" :style="'left:' + index * 11 + 'px'" :src="$fileUrl() + '/Frame1.png'"
  24. v-for="(item, index) in userList" mode="widthFix"></image>
  25. </view> -->
  26. <!-- <view class="hot">
  27. <image :src="$fileUrl() + /first/hot.png" mode="widthFix"></image>
  28. {{ detail.hotNum }}
  29. </view> -->
  30. </view>
  31. </view>
  32. </view>
  33. <div v-if="detail.subType.includes('110')" class="oubox flex justify-around items-center">
  34. <div class="flex items-center" @click="showList">
  35. <img src="https://file.rongcyl.cn/festatic/bkm/ouking_a.png" class="w-10 h-10" />
  36. <div class="ml-1">
  37. <div class="fontPFSCS" style="font-size: 15px">欧王奖励</div>
  38. <div style="font-size: 12px">{{ ouCount }}届欧王</div>
  39. </div>
  40. </div>
  41. <div class="flex items-center">
  42. <img
  43. src="https://file.rongcyl.cn/festatic/bkm/x_a.png"
  44. class="w-10 h-10"
  45. v-if="detail.subType.includes('111')"
  46. />
  47. <img src="https://file.rongcyl.cn/festatic/bkm/x.png" class="w-10 h-10" v-else />
  48. <div class="ml-1" :style="{ color: detail.subType.includes('111') ? '' : '#a9bcd1' }">
  49. <div class="fontPFSCS" style="font-size: 15px">随机掉落</div>
  50. <div style="font-size: 12px">未开启</div>
  51. </div>
  52. </div>
  53. <div class="flex items-center">
  54. <img
  55. src="https://file.rongcyl.cn/festatic/bkm/free_a.png"
  56. class="w-10 h-10"
  57. v-if="detail.subType.includes('112')"
  58. />
  59. <img src="https://file.rongcyl.cn/festatic/bkm/free.png" class="w-10 h-10" v-else />
  60. <div class="ml-1" :style="{ color: detail.subType.includes('112') ? '' : '#a9bcd1' }">
  61. <div class="fontPFSCS" style="font-size: 15px">随机免单</div>
  62. <div style="font-size: 12px">未开启</div>
  63. </div>
  64. </div>
  65. </div>
  66. <view class="box" v-if="detail.subType && !detail.subType.includes('110')">
  67. <view class="boxContent">
  68. <view class="boxLeft">
  69. <view class="row1">
  70. <view class="text">连击 × {{ combos || 0 }}</view>
  71. <view class="text">
  72. {{ combos || 0 }}
  73. <span class="text1">/300</span>
  74. </view>
  75. </view>
  76. <view class="row2">
  77. <view class="row2content">
  78. <p>每连击300发未出传说赏,可获得一个宝箱。</p>
  79. <p>如果中间抽出传说赏,则清空连击次数。</p>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="boxRiaht">
  84. <image class="icon" :src="$fileUrl() + '/drawCard_infinite/icon1.png'" mode="widthFix"></image>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="buttons1">
  89. <image
  90. class="button"
  91. @click="tabClick(1)"
  92. style="margin-right: 20px"
  93. :src="$fileUrl() + `/drawCard_infinite/button1${active1 == 1 ? 'A' : ''}.png`"
  94. mode="widthFix"
  95. ></image>
  96. <image
  97. class="button"
  98. @click="tabClick(2)"
  99. :src="$fileUrl() + `/drawCard_infinite/button2${active1 == 2 ? 'A' : ''}.png`"
  100. mode="widthFix"
  101. ></image>
  102. </view>
  103. <view class="prizeList" v-if="active1 == 1">
  104. <view class="prizeRow" v-for="(item, index) in prizeList">
  105. <image class="bk" :src="$fileUrl() + '/drawCard_infinite/bk.png'" mode="scaleToFill"></image>
  106. <view class="prizeRowContent">
  107. <view class="prizesTitle">
  108. <span>
  109. <span style="font-size: 18px; margin-right: 5px; font-weight: 600">
  110. {{ $selectDictLabel(rewardType, item.type) }}
  111. </span>
  112. <span style="font-weight: 600">概率 {{ item.probability }}%</span>
  113. </span>
  114. <span class="sp">各类别赏中赏概率不代表具体产品中赏概率</span>
  115. </view>
  116. <view class="prizesItems">
  117. <view class="prize" v-for="(item2, index2) in item.prizeList">
  118. <view class="kaImg">
  119. <image class="kabk" :src="$fileUrl() + '/drawCard_infinite/kaBk.png'" mode="widthFix"></image>
  120. <image class="img" :src="item2.icon" mode="aspectFit"></image>
  121. </view>
  122. <view class="kaName">
  123. {{ item2.name }}
  124. </view>
  125. <view class="price">
  126. <span class="priceText">¥{{ detail.price }}</span>
  127. 参考价
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="winningRecord" v-if="active1 == 2">
  135. <view class="card" v-for="(item, index) in winningRecordList" :key="index">
  136. <view class="row">
  137. <view class="left">
  138. <image class="photo" :src="item.userAvtar" mode="aspectFill"></image>
  139. <span class="name">{{ item.userName }}</span>
  140. </view>
  141. <view class="right text1">
  142. <span style="margin-right: 5px">{{ item.creatTime }}</span>
  143. <span>No.{{ item.id }}</span>
  144. </view>
  145. </view>
  146. <view class="row" style="margin-top: 10px">
  147. <view class="left">
  148. <image class="img" :src="item.prizeIcon" mode="aspectFill"></image>
  149. <span class="name">{{ item.prizeName }}</span>
  150. </view>
  151. <view class="right" style="font-size: 14px">{{ $selectDictLabel(rewardType, item.prizeType) }} × 1</view>
  152. </view>
  153. </view>
  154. <div class="text-center" v-if="winningRecordList.length == 0">
  155. <image
  156. style="width: 80vw; margin: auto; margin-top: -40px"
  157. :src="$fileUrl() + '/noData.png'"
  158. mode="widthFix"
  159. ></image>
  160. <view class="text-center" style="margin-top: -30px; color: #999999">啊哦,没有任何内容</view>
  161. </div>
  162. </view>
  163. <view class="buttons2">
  164. <view class="button" @click="submit(1)">
  165. <p>一发</p>
  166. </view>
  167. <view class="button" @click="submit(3)">
  168. <p>三发</p>
  169. </view>
  170. <view class="button" @click="submit(5)">
  171. <p>五发</p>
  172. </view>
  173. <view class="button" @click="submit(10)">
  174. <p>十发</p>
  175. </view>
  176. </view>
  177. <paymentPopup ref="paymentPopup" @callBack="paymentSuccess" />
  178. <uni-popup ref="popup">
  179. <view class="popup-content oulist">
  180. <img src="https://file.rongcyl.cn/festatic/bkm/oulist.png" class="w-full h-full" />
  181. <div class="absolute left-0 right-0 bottom-0 overflow-scroll py-2" style="height: 270px">
  182. <div v-for="(ou, i) in ouList" :key="i" class="flex justify-between items-center px-2 py-2">
  183. <div class="flex mr-2">
  184. <img
  185. :src="`https://file.rongcyl.cn/festatic/bkm/${i + 1}.png`"
  186. v-if="i < 3"
  187. class="inline-block mt-1"
  188. style="width: 28px; height: 28px"
  189. />
  190. <span
  191. v-else
  192. class="bold inline-block mt-1"
  193. style="width: 28px; height: 28px; text-align: center; line-height: 28px"
  194. >
  195. {{ i + 1 }}
  196. </span>
  197. <img
  198. :src="ou.userAvtar"
  199. style="width: 34px; height: 34px; border-radius: 50%"
  200. class="inline-block ml-2"
  201. />
  202. </div>
  203. <div class="flex-1">
  204. <div style="font-size: 14px" class="bold">{{ ou.userName }}</div>
  205. <div style="font-size: 11px; color: #666666">
  206. <span style="margin-right: 18px">在线{{ ou.onlineTime }}分钟</span>
  207. <img src="https://file.rongcyl.cn/festatic/bkm/tri.png" class="w-4 h-4 inline-block relative top-1" />
  208. <span style="font-size: 12px; color: #666666">{{ ou.reward }} 奖励</span>
  209. </div>
  210. </div>
  211. <div>
  212. <span v-if="ou.status" style="color: #00c537; font-size: 12px">在线中</span>
  213. <span v-else style="font-size: 12px; color: #666666">{{ ou.downTime | formatTime }}下线</span>
  214. </div>
  215. </div>
  216. </div>
  217. </view>
  218. <div @click="closeList">
  219. <img
  220. src="https://file.rongcyl.cn/festatic/bkm/close.png"
  221. class="w-9 h-9 mt-6"
  222. style="margin-left: 50%; transform: translateX(-50%); z-index: 9999; position: relative"
  223. />
  224. </div>
  225. </uni-popup>
  226. <view style="width: 100%; height: 100px"></view>
  227. </view>
  228. </template>
  229. <script>
  230. import noData from '@/component/noData.vue'
  231. import { rewardType } from '@/utils/commonConfig.js'
  232. import { raffleDetailApi, prizeListApi, prizeUserListApi, combosApi, getOuCount, getOuList } from '@/api/drawCard.js'
  233. import { cardType, formatSeconds } from '@/utils/utils.js'
  234. import paymentPopup from '@/component/paymentPopup.vue'
  235. export default {
  236. components: {
  237. paymentPopup,
  238. noData,
  239. },
  240. onLoad(query) {
  241. console.log(query, 'query')
  242. if (query.id) {
  243. this.raffleId = query.id
  244. this.init()
  245. }
  246. },
  247. data() {
  248. return {
  249. rewardType: rewardType,
  250. active1: 1,
  251. detail: {},
  252. raffleId: null,
  253. prizeList: [],
  254. userIds: [],
  255. prizeUserList: [],
  256. winningRecordList: [],
  257. combos: 0,
  258. ouCount: 0,
  259. ouList: [],
  260. }
  261. },
  262. filters: {
  263. formatTime(dateString) {
  264. let month = dateString.substring(5, 7)
  265. let day = dateString.substring(8, 10)
  266. let time = dateString.substring(11, 16)
  267. return month + '/' + day + ' ' + time
  268. },
  269. },
  270. methods: {
  271. showList() {
  272. this.getOuKingList()
  273. this.$refs.popup.open('center')
  274. },
  275. closeList() {
  276. this.$refs.popup.close()
  277. },
  278. subType(value) {
  279. let index = null
  280. if (value == 120) {
  281. index = 1
  282. } else if (value == 110) {
  283. index = 2
  284. } else if (value == 111) {
  285. index = 3
  286. } else if (value == 112) {
  287. index = 4
  288. }
  289. return index
  290. },
  291. init() {
  292. // 获取卡包详情
  293. this.getDetail()
  294. this.tabClick(1)
  295. // 判断是否登录
  296. let hasLogin = getApp().globalData.hasLogin
  297. if (hasLogin) {
  298. this.getCombos()
  299. }
  300. },
  301. // 支付成功后回调
  302. paymentSuccess() {
  303. this.init()
  304. },
  305. clickDrawCard() {
  306. this.$refs.paymentPopup.show(this.raffleId, this.selectIndex, this.detail)
  307. },
  308. tabClick(index) {
  309. this.active1 = index
  310. if (index == 1) {
  311. //获取奖池
  312. this.getPrizeList()
  313. } else if (index == 2) {
  314. // 获取中奖记录
  315. this.getPrizeUserList()
  316. }
  317. },
  318. getOuKingList() {
  319. getOuList({ raffleId: this.raffleId, page: 1, limit: 1000 }).then(rs => {
  320. this.ouList = rs.data
  321. })
  322. },
  323. getDetail() {
  324. let params = {
  325. raffleId: this.raffleId,
  326. }
  327. raffleDetailApi(params).then(res => {
  328. console.log(res, '详情')
  329. this.detail = res.data
  330. if (res.data.subType.includes('110')) {
  331. getOuCount(params).then(rs => {
  332. this.ouCount = rs.data
  333. })
  334. }
  335. })
  336. this.getOuKingList()
  337. },
  338. getPrizeList() {
  339. let params = {
  340. raffleId: this.raffleId,
  341. }
  342. prizeListApi(params).then(res => {
  343. console.log(res, '奖池预览')
  344. let newArray = res.data
  345. for (var i = 0; i < res.data.length; i++) {
  346. if (res.data[i].type == 21) {
  347. newArray = []
  348. newArray.push(res.data[i])
  349. res.data.splice(i, 1)
  350. newArray.push(...res.data)
  351. break
  352. }
  353. }
  354. this.prizeList = newArray
  355. })
  356. },
  357. getPrizeUserList() {
  358. let params = {
  359. limit: 999,
  360. page: 1,
  361. raffleId: this.raffleId,
  362. }
  363. prizeUserListApi(params).then(res => {
  364. this.winningRecordList = res.data
  365. })
  366. },
  367. getCombos() {
  368. let params = {
  369. raffleId: this.raffleId,
  370. }
  371. combosApi(params).then(res => {
  372. console.log(res, '连击数')
  373. this.combos = res.data.combos
  374. })
  375. },
  376. submit(number) {
  377. let params = {
  378. raffleId: this.raffleId,
  379. }
  380. this.$refs.paymentPopup.show(params, number, this.detail)
  381. },
  382. },
  383. }
  384. </script>
  385. <style>
  386. .container >>> .uni-popup__wrapper.center {
  387. border-radius: 12px !important;
  388. }
  389. </style>
  390. <style scoped lang="scss">
  391. .oulist {
  392. width: 330px;
  393. height: 408px;
  394. overflow: hidden;
  395. position: relative;
  396. }
  397. .container {
  398. background: #9ec8f9;
  399. padding-top: 15px;
  400. overflow: auto;
  401. .head {
  402. background: #fff;
  403. border: 10px;
  404. padding: 15px;
  405. border-radius: 10px 10px 0 0;
  406. display: flex;
  407. justify-content: space-between;
  408. margin-bottom: 20px;
  409. .img {
  410. width: 106px;
  411. height: 106px;
  412. border-radius: 5px;
  413. overflow: hidden;
  414. margin-right: 10px;
  415. }
  416. .info {
  417. display: flex;
  418. flex-direction: column;
  419. justify-content: start;
  420. flex: 1;
  421. .row {
  422. margin: 5px 0;
  423. display: flex;
  424. justify-content: space-between;
  425. color: #999999;
  426. .button {
  427. width: 67px;
  428. }
  429. .hot {
  430. display: flex;
  431. font-size: 12px;
  432. color: #999999;
  433. image {
  434. width: 16px;
  435. }
  436. }
  437. .users {
  438. position: relative;
  439. .photo {
  440. position: absolute;
  441. width: 20px;
  442. height: 20px;
  443. border-radius: 50%;
  444. }
  445. }
  446. }
  447. .title {
  448. font-weight: 600;
  449. color: #000;
  450. }
  451. .price {
  452. font-size: 16px;
  453. font-weight: 600;
  454. color: #ff2c43;
  455. .text {
  456. font-size: 14px;
  457. color: #999999;
  458. font-weight: 500;
  459. }
  460. }
  461. }
  462. }
  463. .oubox {
  464. width: 95vw;
  465. height: 148rpx;
  466. background: rgba(255, 255, 255, 0.85);
  467. box-shadow: 0px 2px 6px 0px rgba(176, 123, 255, 0.3);
  468. border-radius: 24px;
  469. margin: auto;
  470. opacity: 1;
  471. border: 1px solid rgba(58, 67, 207, 1);
  472. }
  473. .box {
  474. margin: 0 10px 10px 10px;
  475. padding: 2px;
  476. background: linear-gradient(90deg, rgba(211, 252, 111, 1), rgba(61, 248, 255, 1));
  477. box-shadow: 0px 2px 6px 0px rgba(176, 123, 255, 0.3);
  478. border-radius: 24px;
  479. .boxContent {
  480. background: linear-gradient(90deg, #a4fcff 0%, #d3fc6e 100%);
  481. border-radius: 24px;
  482. opacity: 1;
  483. display: flex;
  484. padding: 8px 15px;
  485. .boxLeft {
  486. position: relative;
  487. flex: 1;
  488. .row1 {
  489. display: flex;
  490. justify-content: space-between;
  491. font-size: 18px;
  492. margin-bottom: 4px;
  493. .text {
  494. color: #000000;
  495. font-weight: 600;
  496. text-shadow: -2px -1px 0px rgba(255, 255, 255, 1);
  497. font-family: auto;
  498. }
  499. .text1 {
  500. text-shadow: none;
  501. font-weight: 500;
  502. }
  503. }
  504. .row2 {
  505. position: relative;
  506. top: 3px;
  507. height: 12vw;
  508. border-radius: 6vw;
  509. background: linear-gradient(90deg, #65c3e5 0%, #b1ff29 100%);
  510. .row2content {
  511. position: relative;
  512. top: -3px;
  513. background: #0d2a2c;
  514. height: 12vw;
  515. border-radius: 6vw;
  516. font-size: 10px;
  517. color: rgba(255, 255, 255, 0.9);
  518. display: flex;
  519. flex-direction: column;
  520. justify-content: center;
  521. align-items: flex-start;
  522. padding: 0 13px;
  523. }
  524. }
  525. }
  526. .boxRiaht {
  527. padding-left: 8vw;
  528. padding-right: 15px;
  529. display: flex;
  530. align-items: center;
  531. .icon {
  532. width: 12vw;
  533. height: 12vw;
  534. }
  535. }
  536. }
  537. }
  538. .buttons1 {
  539. display: flex;
  540. justify-content: center;
  541. .button {
  542. width: 38vw;
  543. height: 10vw;
  544. }
  545. }
  546. .prizeList {
  547. .prizeRow {
  548. position: relative;
  549. margin: 0 10px 10px 10px;
  550. padding-bottom: 10px;
  551. .bk {
  552. position: relative;
  553. width: 100%;
  554. height: 100%;
  555. position: absolute;
  556. top: 0;
  557. z-index: 1;
  558. }
  559. .prizeRowContent {
  560. position: relative;
  561. width: calc(100% - 30px);
  562. padding: 10px 15px;
  563. z-index: 2;
  564. .prizesTitle {
  565. font-size: 12px;
  566. padding-bottom: 5px;
  567. width: 100%;
  568. color: #fff;
  569. display: flex;
  570. justify-content: space-between;
  571. .sp {
  572. color: rgba(255, 255, 255, 0.7);
  573. padding-top: 8px;
  574. font-size: 10px;
  575. }
  576. }
  577. .prizesItems {
  578. background: #fffbe8;
  579. display: flex;
  580. width: calc(100% - 16px);
  581. padding: 8px;
  582. border-radius: 8px;
  583. .prize {
  584. width: 22vw;
  585. .kaImg {
  586. position: relative;
  587. .kabk {
  588. width: 100%;
  589. height: 100%;
  590. }
  591. .img {
  592. position: absolute;
  593. top: 0;
  594. width: 70%;
  595. height: 80%;
  596. left: 52%;
  597. top: 50%;
  598. transform: translateX(-50%) translateY(-50%);
  599. }
  600. }
  601. .kaName {
  602. width: 100%;
  603. overflow: hidden;
  604. white-space: nowrap;
  605. text-overflow: ellipsis;
  606. font-size: 12px;
  607. font-weight: 600;
  608. text-align: center;
  609. }
  610. .price {
  611. text-align: center;
  612. font-size: 10px;
  613. color: #999999;
  614. .priceText {
  615. color: #ff2c43;
  616. font-weight: 600;
  617. font-size: 12px;
  618. }
  619. }
  620. }
  621. }
  622. }
  623. }
  624. }
  625. .buttons2 {
  626. position: fixed;
  627. bottom: 10vw;
  628. display: flex;
  629. z-index: 4;
  630. justify-content: space-around;
  631. width: 100%;
  632. .button {
  633. width: 13vw;
  634. height: 13vw;
  635. font-size: 16px;
  636. color: #fff;
  637. background: linear-gradient(270deg, #531dbb 0%, #6e2fe5 100%);
  638. text-align: center;
  639. line-height: 13vw;
  640. border-radius: 4px;
  641. box-shadow: inset 0px 2px 3px 0px rgba(255, 255, 255, 0.25);
  642. position: relative;
  643. transform: rotate(45deg);
  644. font-weight: 600;
  645. p {
  646. transform: rotate(-45deg);
  647. }
  648. }
  649. }
  650. .winningRecord {
  651. .card {
  652. margin: 10px 10px 0 10px;
  653. border-radius: 8px;
  654. background: #fff;
  655. padding: 10px;
  656. .row {
  657. display: flex;
  658. justify-content: space-between;
  659. align-items: center;
  660. .left {
  661. display: flex;
  662. align-items: center;
  663. .photo {
  664. margin-right: 5px;
  665. width: 30px;
  666. height: 30px;
  667. border-radius: 50%;
  668. }
  669. .name {
  670. font-size: 14px;
  671. font-weight: 600;
  672. }
  673. .img {
  674. width: 40px;
  675. height: 40px;
  676. border-radius: 2px;
  677. margin-right: 5px;
  678. }
  679. }
  680. .text1 {
  681. color: #666666;
  682. font-size: 12px;
  683. }
  684. }
  685. }
  686. }
  687. }
  688. </style>