drawCardsList.vue 8.8 KB

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