drawCard_infinite.vue 12 KB

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