drawCard_infinite.vue 20 KB

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