raffle.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="container">
  3. <uni-swiper-dot class="uni-swiper-dot-box" @clickItem="clickItem" :info="info" :current="current" :mode="mode"
  4. :dots-styles="dotsStyles" field="content">
  5. <swiper class="swiper-box" @change="change" :current="swiperDotIndex">
  6. <swiper-item>
  7. <image class="swiperItem" src="https://mall.rongtongh.cn/storage/img/raffle/2.jpg" mode="aspectFill">
  8. </swiper-item>
  9. <swiper-item>
  10. <image class="swiperItem" src="https://mall.rongtongh.cn/storage/img/raffle/3.jpg" mode="aspectFill">
  11. </swiper-item>
  12. <swiper-item>
  13. <image class="swiperItem" src="https://mall.rongtongh.cn/storage/img/raffle/1.jpg" mode="aspectFill">
  14. </swiper-item>
  15. </swiper>
  16. </uni-swiper-dot>
  17. <view class="tabs">
  18. <view class="tab" @click="clickTab(1)">
  19. <image class="tabImg" :src="tabImg(1)" mode="widthFix"></image>
  20. </view>
  21. <view class="tab" @click="clickTab(2)">
  22. <image class="tabImg" :src="tabImg(2)" mode="widthFix"></image>
  23. </view>
  24. <view class="tab" @click="clickTab(3)">
  25. <image class="tabImg" :src="tabImg(3)" mode="widthFix"></image>
  26. </view>
  27. <view class="tab" @click="clickTab(4)">
  28. <image class="tabImg" :src="tabImg(4)" mode="widthFix"></image>
  29. </view>
  30. </view>
  31. <view class="list" v-if="tabActive == 1">
  32. </view>
  33. <view class="list2" v-if="tabActive != 1">
  34. <view class="ka" v-for="(item, index) in list" @click="$navigateTo('/pages/drawCard_last/drawCard_last', {id: item.id})">
  35. <view class="top">
  36. <image mode="aspectFit" :src="item.prizeIconList[0]"></image>
  37. </view>
  38. <view class="ka-info">
  39. <view class="ka-name">
  40. {{item.name}}
  41. </view>
  42. <view class="row">
  43. <uni-tag text="创意热销" inverted type="default"></uni-tag>
  44. <view class="money">
  45. ¥{{item.price}}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. raffleListApi
  56. } from "@/api/drawCard.js"
  57. export default {
  58. data() {
  59. return {
  60. tabActive: 1,
  61. list: [],
  62. info: [{
  63. content: '内容 A'
  64. }, {
  65. content: '内容 B'
  66. }, {
  67. content: '内容 C'
  68. }],
  69. dotsStyles: {},
  70. current: 0,
  71. mode: 'dot',
  72. swiperDotIndex: 0
  73. }
  74. },
  75. onShow() {
  76. this.getList()
  77. },
  78. methods: {
  79. getList () {
  80. let params = {
  81. limit: 999,
  82. page: 1,
  83. type: this.tabActive
  84. }
  85. raffleListApi(params).then(res => {
  86. console.log(res, 'res')
  87. this.list = res.data.list
  88. })
  89. },
  90. tabImg(index) {
  91. let url = 'https://mall.rongtongh.cn/storage/img/raffle/tab'
  92. + index
  93. + (this.tabActive == index ? 'a' : '' )
  94. + '.png'
  95. return url
  96. },
  97. clickTab(index) {
  98. this.tabActive = index
  99. this.getList()
  100. },
  101. clickItem() {
  102. },
  103. change() {
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .swiperItem {
  110. width: 100%;
  111. height: 100%;
  112. }
  113. .tabs {
  114. margin: 10px 0;
  115. height: 36px;
  116. display: flex;
  117. justify-content: space-around;
  118. align-items: center;
  119. .tab {
  120. .tabImg {
  121. width: 18vw;
  122. height: 100%;
  123. }
  124. }
  125. }
  126. .list2 {
  127. display: grid;
  128. grid-template-columns: 1fr 1fr;
  129. grid-gap: 10px;
  130. padding: 10px;
  131. .ka {
  132. width: calc(50vw - 15px);
  133. box-shadow: 0px 2px 8px 2px rgba(0,0,0,0.1);
  134. border-radius: 10px;
  135. // height: 60vw;
  136. .top {
  137. // height: 60vw;
  138. background: linear-gradient(180deg, #FAF1A7 0%, #FFE456 100%);
  139. text-align: center;
  140. display: flex;
  141. justify-content: center;
  142. image {
  143. width: 35vw;
  144. height: 50vw;
  145. }
  146. }
  147. .ka-info {
  148. padding: 10px;
  149. .ka-name {
  150. font-size: 15px;
  151. font-weight: 600;
  152. }
  153. .row {
  154. margin-top: 5px;
  155. display: flex;
  156. justify-content: space-between;
  157. .money {
  158. font-size: 16px;
  159. font-weight: 600;
  160. color: #FF2C43;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. </style>