drawCard_infinite.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <template>
  2. <view class="container">
  3. <view class="head">
  4. <image class="img" :src="$fileUrl() + '/ka.jpeg'" 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. this.$refs.paymentPopup.show(this.raffleId, number, this.detail)
  378. },
  379. },
  380. }
  381. </script>
  382. <style>
  383. .container >>> .uni-popup__wrapper.center {
  384. border-radius: 12px !important;
  385. }
  386. </style>
  387. <style scoped lang="scss">
  388. .oulist {
  389. width: 330px;
  390. height: 408px;
  391. overflow: hidden;
  392. position: relative;
  393. }
  394. .container {
  395. background: #9ec8f9;
  396. padding-top: 15px;
  397. overflow: auto;
  398. .head {
  399. background: #fff;
  400. border: 10px;
  401. padding: 15px;
  402. border-radius: 10px 10px 0 0;
  403. display: flex;
  404. justify-content: space-between;
  405. margin-bottom: 20px;
  406. .img {
  407. width: 106px;
  408. height: 106px;
  409. border-radius: 5px;
  410. overflow: hidden;
  411. margin-right: 10px;
  412. }
  413. .info {
  414. display: flex;
  415. flex-direction: column;
  416. justify-content: start;
  417. flex: 1;
  418. .row {
  419. margin: 5px 0;
  420. display: flex;
  421. justify-content: space-between;
  422. color: #999999;
  423. .button {
  424. width: 67px;
  425. }
  426. .hot {
  427. display: flex;
  428. font-size: 12px;
  429. color: #999999;
  430. image {
  431. width: 16px;
  432. }
  433. }
  434. .users {
  435. position: relative;
  436. .photo {
  437. position: absolute;
  438. width: 20px;
  439. height: 20px;
  440. border-radius: 50%;
  441. }
  442. }
  443. }
  444. .title {
  445. font-weight: 600;
  446. color: #000;
  447. }
  448. .price {
  449. font-size: 16px;
  450. font-weight: 600;
  451. color: #ff2c43;
  452. .text {
  453. font-size: 14px;
  454. color: #999999;
  455. font-weight: 500;
  456. }
  457. }
  458. }
  459. }
  460. .oubox {
  461. width: 95vw;
  462. height: 148rpx;
  463. background: rgba(255, 255, 255, 0.85);
  464. box-shadow: 0px 2px 6px 0px rgba(176, 123, 255, 0.3);
  465. border-radius: 24px;
  466. margin: auto;
  467. opacity: 1;
  468. border: 1px solid rgba(58, 67, 207, 1);
  469. }
  470. .box {
  471. margin: 0 10px 10px 10px;
  472. padding: 2px;
  473. background: linear-gradient(90deg, rgba(211, 252, 111, 1), rgba(61, 248, 255, 1));
  474. box-shadow: 0px 2px 6px 0px rgba(176, 123, 255, 0.3);
  475. border-radius: 24px;
  476. .boxContent {
  477. background: linear-gradient(90deg, #a4fcff 0%, #d3fc6e 100%);
  478. border-radius: 24px;
  479. opacity: 1;
  480. display: flex;
  481. padding: 8px 15px;
  482. .boxLeft {
  483. position: relative;
  484. flex: 1;
  485. .row1 {
  486. display: flex;
  487. justify-content: space-between;
  488. font-size: 18px;
  489. margin-bottom: 4px;
  490. .text {
  491. color: #000000;
  492. font-weight: 600;
  493. text-shadow: -2px -1px 0px rgba(255, 255, 255, 1);
  494. font-family: auto;
  495. }
  496. .text1 {
  497. text-shadow: none;
  498. font-weight: 500;
  499. }
  500. }
  501. .row2 {
  502. position: relative;
  503. top: 3px;
  504. height: 12vw;
  505. border-radius: 6vw;
  506. background: linear-gradient(90deg, #65c3e5 0%, #b1ff29 100%);
  507. .row2content {
  508. position: relative;
  509. top: -3px;
  510. background: #0d2a2c;
  511. height: 12vw;
  512. border-radius: 6vw;
  513. font-size: 10px;
  514. color: rgba(255, 255, 255, 0.9);
  515. display: flex;
  516. flex-direction: column;
  517. justify-content: center;
  518. align-items: flex-start;
  519. padding: 0 13px;
  520. }
  521. }
  522. }
  523. .boxRiaht {
  524. padding-left: 8vw;
  525. padding-right: 15px;
  526. display: flex;
  527. align-items: center;
  528. .icon {
  529. width: 12vw;
  530. height: 12vw;
  531. }
  532. }
  533. }
  534. }
  535. .buttons1 {
  536. display: flex;
  537. justify-content: center;
  538. .button {
  539. width: 38vw;
  540. height: 10vw;
  541. }
  542. }
  543. .prizeList {
  544. .prizeRow {
  545. position: relative;
  546. margin: 0 10px 10px 10px;
  547. padding-bottom: 10px;
  548. .bk {
  549. position: relative;
  550. width: 100%;
  551. height: 100%;
  552. position: absolute;
  553. top: 0;
  554. z-index: 1;
  555. }
  556. .prizeRowContent {
  557. position: relative;
  558. width: calc(100% - 30px);
  559. padding: 10px 15px;
  560. z-index: 2;
  561. .prizesTitle {
  562. font-size: 12px;
  563. padding-bottom: 5px;
  564. width: 100%;
  565. color: #fff;
  566. display: flex;
  567. justify-content: space-between;
  568. .sp {
  569. color: rgba(255, 255, 255, 0.7);
  570. padding-top: 8px;
  571. font-size: 10px;
  572. }
  573. }
  574. .prizesItems {
  575. background: #fffbe8;
  576. display: flex;
  577. width: calc(100% - 16px);
  578. padding: 8px;
  579. border-radius: 8px;
  580. .prize {
  581. width: 22vw;
  582. .kaImg {
  583. position: relative;
  584. .kabk {
  585. width: 100%;
  586. height: 100%;
  587. }
  588. .img {
  589. position: absolute;
  590. top: 0;
  591. width: 70%;
  592. height: 80%;
  593. left: 52%;
  594. top: 50%;
  595. transform: translateX(-50%) translateY(-50%);
  596. }
  597. }
  598. .kaName {
  599. width: 100%;
  600. overflow: hidden;
  601. white-space: nowrap;
  602. text-overflow: ellipsis;
  603. font-size: 12px;
  604. font-weight: 600;
  605. text-align: center;
  606. }
  607. .price {
  608. text-align: center;
  609. font-size: 10px;
  610. color: #999999;
  611. .priceText {
  612. color: #ff2c43;
  613. font-weight: 600;
  614. font-size: 12px;
  615. }
  616. }
  617. }
  618. }
  619. }
  620. }
  621. }
  622. .buttons2 {
  623. position: fixed;
  624. bottom: 10vw;
  625. display: flex;
  626. z-index: 4;
  627. justify-content: space-around;
  628. width: 100%;
  629. .button {
  630. width: 13vw;
  631. height: 13vw;
  632. font-size: 16px;
  633. color: #fff;
  634. background: linear-gradient(270deg, #531dbb 0%, #6e2fe5 100%);
  635. text-align: center;
  636. line-height: 13vw;
  637. border-radius: 4px;
  638. box-shadow: inset 0px 2px 3px 0px rgba(255, 255, 255, 0.25);
  639. position: relative;
  640. transform: rotate(45deg);
  641. font-weight: 600;
  642. p {
  643. transform: rotate(-45deg);
  644. }
  645. }
  646. }
  647. .winningRecord {
  648. .card {
  649. margin: 10px 10px 0 10px;
  650. border-radius: 8px;
  651. background: #fff;
  652. padding: 10px;
  653. .row {
  654. display: flex;
  655. justify-content: space-between;
  656. align-items: center;
  657. .left {
  658. display: flex;
  659. align-items: center;
  660. .photo {
  661. margin-right: 5px;
  662. width: 30px;
  663. height: 30px;
  664. border-radius: 50%;
  665. }
  666. .name {
  667. font-size: 14px;
  668. font-weight: 600;
  669. }
  670. .img {
  671. width: 40px;
  672. height: 40px;
  673. border-radius: 2px;
  674. margin-right: 5px;
  675. }
  676. }
  677. .text1 {
  678. color: #666666;
  679. font-size: 12px;
  680. }
  681. }
  682. }
  683. }
  684. }
  685. </style>