drawCard_infinite.vue 10 KB

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