drawCard_infinite.vue 14 KB

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