drawCard_infinite.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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 @click="$navigateTo('/pages/rule/rule', { type: 3 })" class="button"
  15. :src="$fileUrl() + '/invite/button1.png'" mode="widthFix"></image>
  16. </view>
  17. <view class="row">
  18. <!-- <view class="users">
  19. <image class="photo" :style="'left:' + index * 11 + 'px'" :src="$fileUrl() + '/Frame1.png'"
  20. v-for="(item, index) in userList" mode="widthFix"></image>
  21. </view> -->
  22. <!-- <view class="hot">
  23. <image :src="$fileUrl() + /first/hot.png" mode="widthFix"></image>
  24. {{ detail.hotNum }}
  25. </view> -->
  26. </view>
  27. </view>
  28. </view>
  29. <view class="box">
  30. <view class="boxContent">
  31. <view class="boxLeft">
  32. <view class="row1">
  33. <view class="text">连击 × {{combos}}</view>
  34. <view class="text">
  35. {{combos}}
  36. <span class="text1">/300</span>
  37. </view>
  38. </view>
  39. <view class="row2">
  40. <view class="row2content">
  41. <p>每连击300发未出传说赏,可获得一个宝箱。</p>
  42. <p>如果中间抽出传说赏,则清空连击次数。</p>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="boxRiaht">
  47. <image class="icon" :src="$fileUrl() + '/drawCard_infinite/icon1.png'" mode="widthFix"></image>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="buttons1">
  52. <image class="button" @click="tabClick(1)" style="margin-right: 20px"
  53. :src="$fileUrl() + `/drawCard_infinite/button1${active1 == 1 ? 'A' : ''}.png`" mode="widthFix"></image>
  54. <image class="button" @click="tabClick(2)"
  55. :src="$fileUrl() + `/drawCard_infinite/button2${active1 == 2 ? 'A' : ''}.png`" mode="widthFix"></image>
  56. </view>
  57. <view class="prizeList" v-if="active1 == 1">
  58. <view class="prizeRow" v-for="(item, index) in prizeList">
  59. <image class="bk" :src="$fileUrl() + '/drawCard_infinite/bk.png'" mode="scaleToFill"></image>
  60. <view class="prizeRowContent">
  61. <view class="prizesTitle">
  62. <span>
  63. <span style="font-size: 18px; margin-right: 5px; font-weight: 600">
  64. {{ $selectDictLabel(rewardType, item.type) }}
  65. </span>
  66. <span style="font-weight: 600">概率 {{item.probability}}%</span>
  67. </span>
  68. <span class="sp">各类别赏中赏概率不代表具体产品中赏概率</span>
  69. </view>
  70. <view class="prizesItems">
  71. <view class="prize" v-for="(item2, index2) in item.prizeList">
  72. <view class="kaImg">
  73. <image class="kabk" :src="$fileUrl() + '/drawCard_infinite/kaBk.png'" mode="widthFix">
  74. </image>
  75. <image class="img" :src="item2.icon" mode="aspectFit"></image>
  76. </view>
  77. <view class="kaName">
  78. {{ item2.name }}
  79. </view>
  80. <view class="price">
  81. <span class="priceText">¥{{ detail.price }}</span>
  82. 参考价
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="winningRecord" v-if="active1 == 2">
  90. <view class="card" v-for="(item, index) in winningRecordList" :key="index">
  91. <view class="row">
  92. <view class="left">
  93. <image class="photo" :src="item.userAvtar" mode="aspectFill"></image>
  94. <span class="name">{{ item.userName }}</span>
  95. </view>
  96. <view class="right text1">
  97. <span style="margin-right: 5px">{{ item.creatTime }}</span>
  98. <span>No.{{ item.id }}</span>
  99. </view>
  100. </view>
  101. <view class="row" style="margin-top: 10px">
  102. <view class="left">
  103. <image class="img" :src="item.prizeIcon" mode="aspectFill"></image>
  104. <span class="name">{{ item.prizeName }}</span>
  105. </view>
  106. <view class="right" style="font-size: 14px">{{ $selectDictLabel(rewardType, item.prizeType) }} × 1
  107. </view>
  108. </view>
  109. </view>
  110. <noData v-if="winningRecordList.length == 0" />
  111. </view>
  112. <view class="buttons2">
  113. <view class="button" @click="submit(1)">
  114. <p>一发</p>
  115. </view>
  116. <view class="button" @click="submit(3)">
  117. <p>三发</p>
  118. </view>
  119. <view class="button" @click="submit(5)">
  120. <p>五发</p>
  121. </view>
  122. <view class="button" @click="submit(10)">
  123. <p>十发</p>
  124. </view>
  125. </view>
  126. <paymentPopup ref="paymentPopup" @callBack="paymentSuccess" />
  127. <view style="width: 100%; height: 100px;"></view>
  128. </view>
  129. </template>
  130. <script>
  131. import noData from '@/component/noData.vue'
  132. import {
  133. rewardType
  134. } from '@/utils/commonConfig.js'
  135. import {
  136. raffleDetailApi,
  137. prizeListApi,
  138. prizeUserListApi,
  139. combosApi
  140. } from '@/api/drawCard.js'
  141. import {
  142. cardType,
  143. formatSeconds
  144. } from '@/utils/utils.js'
  145. import paymentPopup from '@/component/paymentPopup.vue'
  146. export default {
  147. components: {
  148. paymentPopup,
  149. noData
  150. },
  151. onLoad(query) {
  152. console.log(query, 'query')
  153. if (query.id) {
  154. this.raffleId = query.id
  155. this.init()
  156. }
  157. this.paymentSuccess()
  158. },
  159. data() {
  160. return {
  161. rewardType: rewardType,
  162. active1: 1,
  163. detail: {},
  164. raffleId: null,
  165. prizeList: [],
  166. userIds: [],
  167. prizeUserList: [],
  168. winningRecordList: [],
  169. combos: 0
  170. }
  171. },
  172. methods: {
  173. init() {
  174. // 获取卡包详情
  175. this.getDetail()
  176. this.tabClick(1)
  177. this.getCombos()
  178. },
  179. // 支付成功后回调
  180. paymentSuccess() {
  181. let _this = this
  182. this.getCombos()
  183. },
  184. clickDrawCard() {
  185. this.$refs.paymentPopup.show(this.raffleId, this.selectIndex, this.detail)
  186. },
  187. tabClick(index) {
  188. this.active1 = index
  189. if (index == 1) {
  190. //获取奖池
  191. this.getPrizeList()
  192. } else if (index == 2) {
  193. // 获取中奖记录
  194. this.getPrizeUserList()
  195. }
  196. },
  197. getDetail() {
  198. let params = {
  199. raffleId: this.raffleId,
  200. }
  201. raffleDetailApi(params).then(res => {
  202. console.log(res, '详情')
  203. this.detail = res.data
  204. })
  205. },
  206. getPrizeList() {
  207. let params = {
  208. raffleId: this.raffleId,
  209. }
  210. prizeListApi(params).then(res => {
  211. console.log(res, '奖池预览')
  212. let newArray = res.data
  213. for (var i = 0; i < res.data.length; i++) {
  214. if (res.data[i].type == 21) {
  215. newArray = []
  216. newArray.push(res.data[i])
  217. res.data.splice(i, 1)
  218. newArray.push(...res.data)
  219. break
  220. }
  221. }
  222. this.prizeList = newArray
  223. })
  224. },
  225. getPrizeUserList() {
  226. let params = {
  227. limit: 999,
  228. page: 1,
  229. raffleId: this.raffleId,
  230. }
  231. prizeUserListApi(params).then(res => {
  232. this.winningRecordList = res.data
  233. })
  234. },
  235. getCombos() {
  236. let params = {
  237. raffleId: this.raffleId,
  238. }
  239. combosApi(params).then(res => {
  240. console.log(res, '连击数')
  241. this.combos = res.data.combos
  242. })
  243. },
  244. submit(number) {
  245. this.$refs.paymentPopup.show(this.raffleId, number, this.detail)
  246. },
  247. },
  248. }
  249. </script>
  250. <style scoped lang="scss">
  251. .container {
  252. background: #9ec8f9;
  253. padding-top: 15px;
  254. overflow: auto;
  255. .head {
  256. background: #fff;
  257. border: 10px;
  258. padding: 15px;
  259. border-radius: 10px 10px 0 0;
  260. display: flex;
  261. justify-content: space-between;
  262. margin-bottom: 20px;
  263. .img {
  264. width: 106px;
  265. height: 106px;
  266. border-radius: 5px;
  267. overflow: hidden;
  268. margin-right: 10px;
  269. }
  270. .info {
  271. display: flex;
  272. flex-direction: column;
  273. justify-content: start;
  274. flex: 1;
  275. .row {
  276. margin: 5px 0;
  277. display: flex;
  278. justify-content: space-between;
  279. color: #999999;
  280. .button {
  281. width: 67px;
  282. }
  283. .hot {
  284. display: flex;
  285. font-size: 12px;
  286. color: #999999;
  287. image {
  288. width: 16px;
  289. }
  290. }
  291. .users {
  292. position: relative;
  293. .photo {
  294. position: absolute;
  295. width: 20px;
  296. height: 20px;
  297. border-radius: 50%;
  298. }
  299. }
  300. }
  301. .title {
  302. font-weight: 600;
  303. color: #000;
  304. }
  305. .price {
  306. font-size: 16px;
  307. font-weight: 600;
  308. color: #ff2c43;
  309. .text {
  310. font-size: 14px;
  311. color: #999999;
  312. font-weight: 500;
  313. }
  314. }
  315. }
  316. }
  317. .box {
  318. margin: 0 10px 10px 10px;
  319. padding: 2px;
  320. background: linear-gradient(90deg, rgba(211, 252, 111, 1), rgba(61, 248, 255, 1));
  321. box-shadow: 0px 2px 6px 0px rgba(176, 123, 255, 0.3);
  322. border-radius: 24px;
  323. .boxContent {
  324. background: linear-gradient(90deg, #a4fcff 0%, #d3fc6e 100%);
  325. border-radius: 24px;
  326. opacity: 1;
  327. display: flex;
  328. padding: 8px 15px;
  329. .boxLeft {
  330. position: relative;
  331. flex: 1;
  332. .row1 {
  333. display: flex;
  334. justify-content: space-between;
  335. font-size: 18px;
  336. margin-bottom: 4px;
  337. .text {
  338. color: #000000;
  339. font-weight: 600;
  340. text-shadow: -2px -1px 0px rgba(255, 255, 255, 1);
  341. font-family: auto;
  342. }
  343. .text1 {
  344. text-shadow: none;
  345. font-weight: 500;
  346. }
  347. }
  348. .row2 {
  349. position: relative;
  350. top: 3px;
  351. height: 12vw;
  352. border-radius: 6vw;
  353. background: linear-gradient(90deg, #65c3e5 0%, #b1ff29 100%);
  354. .row2content {
  355. position: relative;
  356. top: -3px;
  357. background: #0d2a2c;
  358. height: 12vw;
  359. border-radius: 6vw;
  360. font-size: 10px;
  361. color: rgba(255, 255, 255, 0.9);
  362. display: flex;
  363. flex-direction: column;
  364. justify-content: center;
  365. align-items: flex-start;
  366. padding: 0 13px;
  367. }
  368. }
  369. }
  370. .boxRiaht {
  371. padding-left: 8vw;
  372. padding-right: 15px;
  373. display: flex;
  374. align-items: center;
  375. .icon {
  376. width: 12vw;
  377. height: 12vw;
  378. }
  379. }
  380. }
  381. }
  382. .buttons1 {
  383. display: flex;
  384. justify-content: center;
  385. .button {
  386. width: 38vw;
  387. height: 10vw;
  388. }
  389. }
  390. .prizeList {
  391. .prizeRow {
  392. position: relative;
  393. margin: 0 10px 10px 10px;
  394. padding-bottom: 10px;
  395. .bk {
  396. position: relative;
  397. width: 100%;
  398. height: 100%;
  399. position: absolute;
  400. top: 0;
  401. z-index: 1;
  402. }
  403. .prizeRowContent {
  404. position: relative;
  405. width: calc(100% - 30px);
  406. padding: 10px 15px;
  407. z-index: 2;
  408. .prizesTitle {
  409. font-size: 12px;
  410. padding-bottom: 5px;
  411. width: 100%;
  412. color: #fff;
  413. display: flex;
  414. justify-content: space-between;
  415. .sp {
  416. color: rgba(255, 255, 255, 0.7);
  417. padding-top: 8px;
  418. font-size: 10px;
  419. }
  420. }
  421. .prizesItems {
  422. background: #fffbe8;
  423. display: flex;
  424. width: calc(100% - 16px);
  425. padding: 8px;
  426. border-radius: 8px;
  427. .prize {
  428. width: 22vw;
  429. .kaImg {
  430. position: relative;
  431. .kabk {
  432. width: 100%;
  433. height: 100%;
  434. }
  435. .img {
  436. position: absolute;
  437. top: 0;
  438. width: 70%;
  439. height: 80%;
  440. left: 52%;
  441. top: 50%;
  442. transform: translateX(-50%) translateY(-50%);
  443. }
  444. }
  445. .kaName {
  446. width: 100%;
  447. overflow: hidden;
  448. white-space: nowrap;
  449. text-overflow: ellipsis;
  450. font-size: 12px;
  451. font-weight: 600;
  452. text-align: center;
  453. }
  454. .price {
  455. text-align: center;
  456. font-size: 10px;
  457. color: #999999;
  458. .priceText {
  459. color: #ff2c43;
  460. font-weight: 600;
  461. font-size: 12px;
  462. }
  463. }
  464. }
  465. }
  466. }
  467. }
  468. }
  469. .buttons2 {
  470. position: fixed;
  471. bottom: 10vw;
  472. display: flex;
  473. z-index: 4;
  474. justify-content: space-around;
  475. width: 100%;
  476. .button {
  477. width: 13vw;
  478. height: 13vw;
  479. font-size: 16px;
  480. color: #fff;
  481. background: linear-gradient(270deg, #531DBB 0%, #6E2FE5 100%);
  482. text-align: center;
  483. line-height: 13vw;
  484. border-radius: 4px;
  485. box-shadow: inset 0px 2px 3px 0px rgba(255, 255, 255, 0.25);
  486. position: relative;
  487. transform: rotate(45deg);
  488. font-weight: 600;
  489. p {
  490. transform: rotate(-45deg);
  491. }
  492. }
  493. }
  494. .winningRecord {
  495. .card {
  496. margin: 10px 10px 0 10px;
  497. border-radius: 8px;
  498. background: #fff;
  499. padding: 10px;
  500. .row {
  501. display: flex;
  502. justify-content: space-between;
  503. align-items: center;
  504. .left {
  505. display: flex;
  506. align-items: center;
  507. .photo {
  508. margin-right: 5px;
  509. width: 30px;
  510. height: 30px;
  511. border-radius: 50%;
  512. }
  513. .name {
  514. font-size: 14px;
  515. font-weight: 600;
  516. }
  517. .img {
  518. width: 40px;
  519. height: 40px;
  520. border-radius: 2px;
  521. margin-right: 5px;
  522. }
  523. }
  524. .text1 {
  525. color: #666666;
  526. font-size: 12px;
  527. }
  528. }
  529. }
  530. }
  531. }
  532. </style>