index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template style="background-color: red">
  2. <div
  3. style="
  4. background-image: url(https://file.rongcyl.cn/festatic/bkm/bg_i.png);
  5. background-repeat: no-repeat;
  6. background-position: center center;
  7. background-size: contain;
  8. background-color: #000;
  9. "
  10. >
  11. <img src="https://file.rongcyl.cn/festatic/bkm/banner.png" class="w-full" style="height: 400rpx" />
  12. <div
  13. style="
  14. background: rgba(0, 0, 0, 0.85);
  15. background-image: url(https://file.rongcyl.cn/festatic/bkm/box.png);
  16. background-size: cover;
  17. "
  18. >
  19. <div class="flex justify-between">
  20. <img src="https://file.rongcyl.cn/festatic/bkm/activity.png" class="area" @click="activity" />
  21. <img
  22. src="https://file.rongcyl.cn/festatic/bkm/task.png"
  23. class="area"
  24. @click="$navigateTo('/pages/task/index')"
  25. />
  26. <img
  27. src="https://file.rongcyl.cn/festatic/bkm/invite.png"
  28. class="area"
  29. @click="$navigateTo('/pages/invite/invite')"
  30. />
  31. </div>
  32. <div class="flex justify-between m-2 co">
  33. <img src="https://file.rongcyl.cn/festatic/bkm/center.png" class="center" />
  34. <div class="clicks flex-1 overflow-scroll flex flex-nowrap">
  35. <div class="ml-2 mt-2 inline-block relative" v-for="c in couponList" :key="c.id" @click="receive(c)">
  36. <img src="https://file.rongcyl.cn/festatic/bkm/clicked.png" v-if="c.status == 1" />
  37. <img src="https://file.rongcyl.cn/festatic/bkm/click.png" v-if="c.status == 0" />
  38. <div class="absolute top-4 left-0 text-center right-0">
  39. <div class="bold fs12">{{ c.name }}</div>
  40. <div class="fs11 text-zinc-600">{{ c.desc }}</div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- <img src="https://file.rongcyl.cn/festatic/bkm/more.png" class="more" /> -->
  45. </div>
  46. <div class="flex justify-between m-2">
  47. <img src="https://file.rongcyl.cn/festatic/bkm/c1.png" class="c" />
  48. <img src="https://file.rongcyl.cn/festatic/bkm/c2.png" @click="$navigateTo('/pages/vip/vip')" class="c" />
  49. <img src="https://file.rongcyl.cn/festatic/bkm/c3.png" class="c" />
  50. <img src="https://file.rongcyl.cn/festatic/bkm/c4.png" class="c" />
  51. </div>
  52. <div class="tabs">
  53. <div class="tab" :class="{ active: type == 0 }" @click="type = 0">热门</div>
  54. <div class="tab" :class="{ active: type == 5 }" @click="type = 5">FIRST赏</div>
  55. <div class="tab" :class="{ active: type == 2 }" @click="type = 2">LAST赏</div>
  56. <div class="tab" :class="{ active: type == 3 }" @click="type = 3">全套赏</div>
  57. <div class="tab" :class="{ active: type == 1 }" @click="type = 1">无限赏</div>
  58. <!-- <div class="tab" :class="{ active: type == 4 }" @click="type = 4">抽盒机</div> -->
  59. </div>
  60. <div class="cards">
  61. <div class="card relative" v-for="(item, i) in list" @click="toDrawCard(item)" :key="i">
  62. <img
  63. :src="`https://file.rongcyl.cn/festatic/bkm/tags/${item.type}.png`"
  64. class="absolute top-0 left-0"
  65. style="width: 62px; height: 24px"
  66. />
  67. <img
  68. :src="`https://file.rongcyl.cn/festatic/bkm/tags/tag1.png`"
  69. class="absolute top-0 right-0"
  70. style="width: 88rpx; height: 88rpx"
  71. v-if="item.subType && item.subType.includes('110')"
  72. />
  73. <img
  74. :src="`https://file.rongcyl.cn/festatic/bkm/tags/tag2.png`"
  75. class="absolute top-0 right-0"
  76. style="width: 88rpx; height: 88rpx"
  77. v-if="item.subType && item.subType.includes('120')"
  78. />
  79. <img
  80. :src="`https://file.rongcyl.cn/festatic/bkm/tags/tag3.png`"
  81. class="absolute top-0 right-0"
  82. style="width: 88rpx; height: 88rpx"
  83. v-if="item.subType && item.subType.includes('112')"
  84. />
  85. <img :src="item.icon" />
  86. <div class="mt-1">{{ item.name }}</div>
  87. <!-- <div class="flex justify-between" style="font-size: 13px; margin-top: 12rpx">
  88. <img src="https://file.rongcyl.cn/festatic/bkm/imgv2/raffle/tag2.png" style="height: 35rpx; width: 80rpx" />
  89. <div>
  90. <span style="font-size: 14px; margin-right: 4px; color: #fc5b20" class="bold">{{ item.totalNum }}</span>
  91. <span style="color: #666666">销量</span>
  92. </div>
  93. </div> -->
  94. <div class="flex justify-between">
  95. <div style="color: #fc5b20; margin-top: 12rpx">
  96. <span class="fs14">¥</span>
  97. <span class="bold fs16">{{ item.price }}</span>
  98. </div>
  99. <!-- <div v-if="item.subType">
  100. <div class="tag" v-if="item.subType.includes('110')">欧王</div>
  101. <div class="tag" v-if="item.subType.includes('120')">连击</div>
  102. <div class="tag" v-if="item.subType.includes('112')">免单</div>
  103. </div> -->
  104. <div
  105. style="margin-top: 12rpx; color: #a79e9e; font-size: 12px"
  106. v-if="!item.subType && (item.type == 5 || item.type == 2)"
  107. >
  108. 剩余 {{ item.balaceNum }}/ {{ item.totalNum }}
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="p" @click="$navigateTo('/pages/integralRecord/integralRecord')">
  114. <img src="https://file.rongcyl.cn/festatic/bkm/p.png" />
  115. <div class="absolute text-white bottom-2 fs11 text-center left-0 right-0">{{ userInfo.integral }}</div>
  116. </div>
  117. </div>
  118. <!-- <div
  119. class="fixed left-0 right-0 bottom-0 pb-1 bg-black flex justify-around items-center fs13"
  120. style="color: #b4c9da; height: 80px"
  121. >
  122. <div class="text-center">
  123. <img src="https://file.rongcyl.cn/festatic/bkm/index2tabs/home_a.png" class="w-7 h-7" />
  124. <div style="color: #fc5b20">首页</div>
  125. </div>
  126. <div class="text-center">
  127. <img src="https://file.rongcyl.cn/festatic/bkm/index2tabs/shop.png" class="w-7 h-7" />
  128. <div>商城</div>
  129. </div>
  130. <div class="text-center">
  131. <img src="https://file.rongcyl.cn/festatic/bkm/index2tabs/cc.png" class="w-8 h-8" />
  132. <div>抽卡机</div>
  133. </div>
  134. <div class="text-center">
  135. <img src="https://file.rongcyl.cn/festatic/bkm/index2tabs/bag.png" class="w-7 h-7" />
  136. <div>背包</div>
  137. </div>
  138. <div class="text-center">
  139. <img src="https://file.rongcyl.cn/festatic/bkm/index2tabs/mine.png" class="w-7 h-7" />
  140. <div>我的</div>
  141. </div>
  142. </div> -->
  143. </div>
  144. </template>
  145. <script>
  146. import { raffleListApi } from '@/api/drawCard'
  147. import { couponCenter, couponReceive } from '@/api/coupon'
  148. import { userInfoApi } from '@/api/user.js'
  149. export default {
  150. data() {
  151. return {
  152. list: [],
  153. type: 0,
  154. couponList: [],
  155. userInfo: {},
  156. }
  157. },
  158. created() {
  159. this.getList()
  160. this.getCouponList()
  161. if (wx.getStorageSync('token')) {
  162. userInfoApi().then(res => {
  163. this.userInfo = res.data
  164. })
  165. }
  166. },
  167. onLoad(query) {
  168. if (query.inviteId) {
  169. getApp().globalData.inviteId = query.inviteId
  170. } else {
  171. const scene = decodeURIComponent(query.scene)
  172. let inviteId = scene.split('=')[1]
  173. console.log(inviteId, 'inviteId')
  174. getApp().globalData.inviteId = inviteId
  175. }
  176. console.log(this.$refs)
  177. },
  178. watch: {
  179. type() {
  180. this.getList()
  181. },
  182. },
  183. methods: {
  184. // 跳转抽卡页面
  185. toDrawCard(item) {
  186. console.log(item, 'item')
  187. let params = {
  188. id: item.id,
  189. }
  190. let url = ''
  191. if (item.type == 1) {
  192. url = '/pages/drawCard_infinite/drawCard_infinite'
  193. } else if (item.type == 2) {
  194. url = '/pages/drawCard_last/drawCard_last'
  195. } else if (item.type == 3) {
  196. url = '/pages/drawCard_fullSet/drawCard_fullSet'
  197. } else if (item.type == 5) {
  198. url = '/pages/drawCard_first/drawCard_first'
  199. }
  200. this.$navigateTo(url, params)
  201. },
  202. activity() {
  203. wx.showToast({
  204. title: '敬请期待',
  205. icon: 'none',
  206. })
  207. },
  208. receive(item) {
  209. if (item.status == 1) return
  210. couponReceive({
  211. couponId: item.id,
  212. }).then(res => {
  213. wx.showToast({
  214. title: '领取成功',
  215. icon: 'none',
  216. })
  217. this.getCouponList()
  218. })
  219. },
  220. getCouponList() {
  221. couponCenter().then(res => {
  222. this.couponList = res.data
  223. })
  224. },
  225. getList() {
  226. let params = {
  227. limit: 999,
  228. page: 1,
  229. type: this.type || '',
  230. isHot: this.type == 0,
  231. }
  232. raffleListApi(params).then(res => {
  233. let list = res.data.list
  234. for (var i = 0; i < list.length; i++) {
  235. if (list[i].subType) {
  236. list[i].subType = list[i].subType.split(',')
  237. }
  238. }
  239. this.list = list
  240. })
  241. },
  242. },
  243. }
  244. </script>
  245. <style scoped lang="scss">
  246. .area {
  247. width: 168px;
  248. height: 88px;
  249. }
  250. .c {
  251. width: 82px;
  252. height: 47px;
  253. }
  254. .center {
  255. width: 38px;
  256. height: 98px;
  257. }
  258. .clicks {
  259. height: 98px;
  260. background-image: linear-gradient(to bottom, #ffaea6, #ff654c);
  261. img {
  262. height: 82px;
  263. width: 82px;
  264. }
  265. }
  266. .tag {
  267. border-radius: 3px;
  268. margin-top: 12rpx;
  269. height: 20px;
  270. line-height: 20px;
  271. text-align: center;
  272. background: #fc5b20;
  273. color: #fff;
  274. padding: 0 8rpx;
  275. font-size: 13px;
  276. display: inline-block;
  277. margin-left: 10px;
  278. }
  279. .more {
  280. width: 28px;
  281. height: 98px;
  282. }
  283. .p {
  284. position: fixed;
  285. bottom: 120px;
  286. right: 20px;
  287. img {
  288. width: 50px;
  289. height: 50px;
  290. }
  291. }
  292. .tabs {
  293. display: flex;
  294. justify-content: space-around;
  295. .tab {
  296. font-size: 16px;
  297. font-weight: 400;
  298. color: #fff;
  299. padding: 10px 0;
  300. &.active {
  301. font-weight: 600;
  302. border-bottom: 2px solid #fc5b20;
  303. color: #fc5b20;
  304. }
  305. }
  306. }
  307. .cards {
  308. margin-top: 20px;
  309. display: flex;
  310. justify-content: space-between;
  311. padding: 0 20rpx;
  312. flex-wrap: wrap;
  313. .card {
  314. box-sizing: border-box;
  315. width: 344rpx;
  316. // height: 500rpx;
  317. background: #fff;
  318. border-radius: 10px;
  319. margin-bottom: 20rpx;
  320. padding: 20rpx;
  321. padding-bottom: 12rpx;
  322. img {
  323. width: 308rpx;
  324. height: 308rpx;
  325. border-radius: 8px;
  326. }
  327. }
  328. }
  329. </style>