drawCardsList.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="container" style="background-color: #131313; overflow: scroll">
  3. <!-- <PageTitle color="#fff" title="抽盒机" /> -->
  4. <uni-swiper-dot
  5. class="uni-swiper-dot-box"
  6. @clickItem="clickItem"
  7. :info="info"
  8. :current="current"
  9. :mode="mode"
  10. :dots-styles="dotsStyles"
  11. field="content"
  12. >
  13. <swiper class="swiper-box" @change="change" :current="swiperDotIndex">
  14. <swiper-item>
  15. <image
  16. class="swiperItem"
  17. :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/2.jpg'"
  18. mode="aspectFill"
  19. />
  20. </swiper-item>
  21. <swiper-item>
  22. <image
  23. class="swiperItem"
  24. :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/3.jpg'"
  25. mode="aspectFill"
  26. />
  27. </swiper-item>
  28. <swiper-item>
  29. <image
  30. class="swiperItem"
  31. :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/1.jpg'"
  32. mode="aspectFill"
  33. />
  34. </swiper-item>
  35. </swiper>
  36. </uni-swiper-dot>
  37. <!-- <view class="tabs">
  38. <view class="tab" @click="clickTab(1)">
  39. <image
  40. class="tabImg"
  41. v-show="tabActive == 1"
  42. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab1a.png"
  43. mode="widthFix"
  44. />
  45. <image
  46. class="tabImg"
  47. v-show="tabActive != 1"
  48. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab1.png"
  49. mode="widthFix"
  50. />
  51. </view>
  52. <view class="tab" @click="clickTab(2)">
  53. <image
  54. class="tabImg"
  55. v-show="tabActive == 2"
  56. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab2a.png"
  57. mode="widthFix"
  58. />
  59. <image
  60. class="tabImg"
  61. v-show="tabActive != 2"
  62. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab2.png"
  63. mode="widthFix"
  64. />
  65. </view>
  66. <view class="tab" @click="clickTab(3)">
  67. <image
  68. class="tabImg"
  69. v-show="tabActive == 3"
  70. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab3a.png"
  71. mode="widthFix"
  72. />
  73. <image
  74. class="tabImg"
  75. v-show="tabActive != 3"
  76. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab3.png"
  77. mode="widthFix"
  78. />
  79. </view>
  80. <view class="tab" @click="clickTab(4)">
  81. <image
  82. class="tabImg"
  83. v-show="tabActive == 4"
  84. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab4a.png"
  85. mode="widthFix"
  86. />
  87. <image
  88. class="tabImg"
  89. v-show="tabActive != 4"
  90. src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab4.png"
  91. mode="widthFix"
  92. />
  93. </view>
  94. </view> -->
  95. <view class="list2">
  96. <!-- <view class="ka" v-for="(item, index) in list" @click="toDrawCard({ id: item.id })" :key="index">
  97. <view class="top">
  98. <image mode="aspectFit" :src="item.icon"></image>
  99. </view>
  100. <view class="ka-info">
  101. <view class="ka-name">
  102. {{ item.name }}
  103. </view>
  104. <view class="row">
  105. <uni-tag class="tag" text="创意热销" inverted type="default"></uni-tag>
  106. <view class="money">¥{{ item.price }}</view>
  107. </view>
  108. </view>
  109. </view> -->
  110. <div class="card relative" v-for="(item, i) in list" @click="toDrawCard({ id: item.id })" :key="i">
  111. <image mode="aspectFill" :src="item.icon"></image>
  112. <div class="mt-1">{{ item.name }}</div>
  113. <div class="flex justify-between" style="font-size: 26rpx; margin-top: 12rpx">
  114. <!-- <div
  115. style="
  116. border-radius: 6rpx;
  117. height: 40rpx;
  118. line-height: 40rpx;
  119. text-align: center;
  120. background: #fc5b20;
  121. color: #fff;
  122. padding: 0 8rpx;
  123. "
  124. >
  125. 创意热销
  126. </div> -->
  127. <!-- <div>
  128. <span style="font-size: 28rpx; margin-right: 8rpx; color: #fc5b20"
  129. class="bold">{{ item.totalNum }}</span>
  130. <span style="color: #666666">销量</span>
  131. </div> -->
  132. </div>
  133. <div style="color: #fc5b20; margin-top: 12rpx">
  134. <span class="fs14">¥</span>
  135. <span class="bold fs16">{{ item.price }}</span>
  136. </div>
  137. </div>
  138. </view>
  139. </view>
  140. </template>
  141. <script>
  142. import PageTitle from '@/component/pageTitle.vue'
  143. import { raffleListApi } from '@/api/drawCard.js'
  144. export default {
  145. components: {
  146. PageTitle,
  147. },
  148. data() {
  149. return {
  150. tabActive: 4,
  151. list: [],
  152. info: [],
  153. dotsStyles: {},
  154. current: 0,
  155. mode: 'dot',
  156. swiperDotIndex: 0,
  157. }
  158. },
  159. onShow() {
  160. this.getList()
  161. },
  162. methods: {
  163. toDrawCard(params) {
  164. let url = ''
  165. if (this.tabActive == 1) {
  166. url = '/pages/drawCard_infinite/drawCard_infinite'
  167. } else if (this.tabActive == 2) {
  168. url = '/pages/drawCard_last/drawCard_last'
  169. } else if (this.tabActive == 3) {
  170. url = '/pages/drawCard_fullSet/drawCard_fullSet'
  171. } else if (this.tabActive == 4) {
  172. url = '/pages/drawCard_box/drawCard_box'
  173. }
  174. this.$navigateTo(url, params)
  175. },
  176. getList() {
  177. let params = {
  178. limit: 999,
  179. page: 1,
  180. type: this.tabActive,
  181. }
  182. raffleListApi(params).then(res => {
  183. console.log(res, 'res')
  184. let list = res.data.list
  185. for (var i = 0; i < list.length; i++) {
  186. if (list[i].subType) {
  187. list[i].subType = list[i].subType.split(',')
  188. }
  189. }
  190. console.log('list', list)
  191. this.list = list
  192. })
  193. },
  194. subType(value) {
  195. let index = null
  196. if (value == 120) {
  197. index = 1
  198. } else if (value == 110) {
  199. index = 2
  200. } else if (value == 111) {
  201. index = 3
  202. } else if (value == 112) {
  203. index = 4
  204. }
  205. return index
  206. },
  207. tabImg(index) {
  208. let url =
  209. 'https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tab' + index + (this.tabActive == index ? 'a' : '') + '.png'
  210. return url
  211. },
  212. clickTab(index) {
  213. this.list = []
  214. this.tabActive = index
  215. this.getList()
  216. },
  217. clickItem() {},
  218. change() {},
  219. },
  220. }
  221. </script>
  222. <style scoped lang="scss">
  223. .swiperItem {
  224. width: 100%;
  225. height: 100%;
  226. }
  227. .tabs {
  228. margin: 20rpx 0;
  229. height: 72rpx;
  230. display: flex;
  231. justify-content: space-around;
  232. align-items: center;
  233. .tab {
  234. .tabImg {
  235. width: 18vw;
  236. height: 100%;
  237. }
  238. }
  239. }
  240. .list {
  241. padding: 20rpx;
  242. .kabk {
  243. padding: 2rpx;
  244. background: linear-gradient(180deg, rgba(211, 74, 216, 0.3) 0%, rgba(58, 67, 207, 0.3) 25%);
  245. border-radius: 26rpx;
  246. box-shadow: 2rpx 2rpx 8rpx rgba(176, 123, 255, 0.5);
  247. margin-bottom: 20rpx;
  248. overflow: hidden;
  249. }
  250. .ka1 {
  251. padding: 20rpx;
  252. display: flex;
  253. background: #fff;
  254. border-radius: 24rpx;
  255. position: relative;
  256. .leftImg {
  257. width: 30vw;
  258. height: 30vw;
  259. border-radius: 20rpx;
  260. margin-right: 16rpx;
  261. }
  262. .rightInfo {
  263. flex: 1;
  264. .row {
  265. margin-bottom: 10rpx;
  266. .price {
  267. font-size: 28rpx;
  268. font-weight: 600;
  269. color: #ff2c43;
  270. }
  271. }
  272. .title {
  273. font-size: 34rpx;
  274. font-weight: 600;
  275. width: 100%;
  276. white-space: nowrap;
  277. text-overflow: ellipsis;
  278. overflow: hidden;
  279. }
  280. .prizes {
  281. display: grid;
  282. grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
  283. .prize {
  284. border-radius: 8rpx;
  285. width: 10vw;
  286. height: 10vw;
  287. margin-right: 10rpx;
  288. }
  289. }
  290. .tags {
  291. position: absolute;
  292. right: -2rpx;
  293. bottom: -4rpx;
  294. display: flex;
  295. flex-direction: row-reverse;
  296. justify-content: flex-end;
  297. .tag {
  298. position: relative;
  299. width: 100rpx;
  300. height: 40rpx;
  301. }
  302. .tag_0 {
  303. z-index: 3;
  304. }
  305. .tag_1 {
  306. right: -18rpx;
  307. z-index: 2;
  308. }
  309. .tag_2 {
  310. right: -36rpx;
  311. z-index: 1;
  312. }
  313. }
  314. }
  315. }
  316. }
  317. .list2 {
  318. display: grid;
  319. grid-template-columns: 1fr 1fr;
  320. grid-gap: 20rpx;
  321. padding: 20rpx;
  322. width: calc(100% - 40rpx);
  323. .card {
  324. position: relative;
  325. // box-sizing: border-box;
  326. // width: 100%;
  327. // width: 344rpx;
  328. // height: 500rpx;
  329. background: #fff;
  330. border-radius: 20rpx;
  331. margin-bottom: 20rpx;
  332. padding: 20rpx;
  333. padding-bottom: 12rpx;
  334. image {
  335. width: 100%;
  336. height: 50vw;
  337. border-radius: 16rpx;
  338. }
  339. }
  340. }
  341. .three {
  342. grid-template-columns: 1fr 1fr 1fr;
  343. .ka {
  344. width: 100%;
  345. .top {
  346. image {
  347. width: 80%;
  348. height: 30vw;
  349. }
  350. }
  351. .ka-info {
  352. padding: 10rpx 10rpx 20rpx 10rpx;
  353. .ka-name {
  354. font-size: 24rpx;
  355. }
  356. .row {
  357. margin-top: 4rpx;
  358. justify-content: flex-end;
  359. .tag {
  360. display: none;
  361. }
  362. }
  363. }
  364. }
  365. }
  366. </style>