card.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <view class="top"><image src="../../static/img/cardbg.png" mode=""></image></view>
  5. <view class="main">
  6. <view class="main-item" v-for="(item, index) in cardList" @click="navTo(item)">
  7. <view class="main-item-top flex">
  8. <view class="main-item-top-bg"><image :src="item.image" mode=""></image></view>
  9. <view class="main-item-top-left">
  10. <view class="main-item-title">{{ item.name }}</view>
  11. <view class="main-item-time" v-if="item.type == 1">有效期{{ item.time }}天</view>
  12. <view class="main-item-time" v-if="item.type == 2">有效次数{{ item.number }}次</view>
  13. </view>
  14. <view class="main-item-type">{{ item.type == 1 ? '时效卡' : '次卡' }}</view>
  15. </view>
  16. <view class="main-item-bottom">
  17. <view class="main-item-bottom-bg"><image src="../../static/img/cardbottom.png" mode=""></image></view>
  18. <view class="main-item-price">
  19. <text class="fh">¥</text>
  20. {{ item.price }}
  21. <text class="time"></text>
  22. </view>
  23. <view class="main-item-info flex">
  24. <view class="main-item-info-left">{{ item.info }}</view>
  25. <view class="main-item-info-right">
  26. <view class="main-item-info-font">查看详情</view>
  27. <view class="main-item-info-icon"><image src="../../static/img/img39.png" mode=""></image></view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { cardlist } from '@/api/jdr.js';
  37. export default {
  38. data() {
  39. return {
  40. cardList: [],
  41. page: 1,
  42. limit: 1000
  43. };
  44. },
  45. onLoad() {
  46. this.loadData();
  47. },
  48. methods: {
  49. navTo(opt) {
  50. uni.navigateTo({
  51. url: '/pages/index/cardDetail?id=' + opt.id
  52. });
  53. },
  54. loadData() {
  55. const obj = this;
  56. cardlist({ page: obj.page, limit: obj.limit }).then(({ data }) => {
  57. obj.cardList = data;
  58. });
  59. }
  60. }
  61. };
  62. </script>
  63. <style lang="scss">
  64. page,
  65. .container {
  66. min-height: 100%;
  67. height: auto;
  68. background: #ffffff;
  69. }
  70. .vheigh {
  71. height: var(--status-bar-height);
  72. background-color: $base-color;
  73. }
  74. .top {
  75. position: relative;
  76. height: 534rpx;
  77. width: 750rpx;
  78. image {
  79. width: 100%;
  80. height: 100%;
  81. }
  82. }
  83. .main {
  84. margin: 52rpx 0 0;
  85. padding: 0 24rpx;
  86. width: 750rpx;
  87. .main-item {
  88. .main-item-top {
  89. align-items: flex-start;
  90. width: 702rpx;
  91. height: 150rpx;
  92. position: relative;
  93. .main-item-top-bg {
  94. position: absolute;
  95. top: 0;
  96. left: 0;
  97. right: 0;
  98. width: 702rpx;
  99. height: 150rpx;
  100. image {
  101. width: 100%;
  102. height: 100%;
  103. }
  104. }
  105. .main-item-top-left {
  106. position: relative;
  107. z-index: 2;
  108. padding: 40rpx 0 0 30rpx;
  109. line-height: 1;
  110. .main-item-title {
  111. font-size: 42rpx;
  112. font-family: PingFang SC;
  113. font-weight: bold;
  114. color: #c99f62;
  115. }
  116. .main-item-time {
  117. margin-top: 20rpx;
  118. font-size: 24rpx;
  119. font-family: PingFang SC;
  120. font-weight: 500;
  121. color: #d6d1d1;
  122. }
  123. }
  124. .main-item-type {
  125. padding: 56rpx 24rpx 0 0;
  126. position: relative;
  127. z-index: 2;
  128. font-size: 24rpx;
  129. font-family: PingFang SC;
  130. font-weight: bold;
  131. color: #d6d1d1;
  132. }
  133. }
  134. .main-item-bottom {
  135. width: 702rpx;
  136. height: 176rpx;
  137. position: relative;
  138. padding: 30rpx 30rpx 0;
  139. line-height: 1;
  140. .main-item-bottom-bg {
  141. position: absolute;
  142. top: 0;
  143. left: 0;
  144. right: 0;
  145. width: 702rpx;
  146. height: 176rpx;
  147. image {
  148. width: 100%;
  149. height: 100%;
  150. }
  151. }
  152. .main-item-price {
  153. position: relative;
  154. z-index: 2;
  155. font-size: 38rpx;
  156. font-family: PingFang SC;
  157. font-weight: bold;
  158. color: #ff6f0f;
  159. .fh {
  160. font-size: 20px;
  161. }
  162. .time {
  163. font-size: 20px;
  164. color: #333333;
  165. }
  166. }
  167. .main-item-info {
  168. position: relative;
  169. z-index: 2;
  170. margin-top: 20rpx;
  171. .main-item-info-left {
  172. width: 100%;
  173. font-size: 22rpx;
  174. font-family: PingFang SC;
  175. font-weight: 500;
  176. color: #666666;
  177. }
  178. .main-item-info-right {
  179. flex-shrink: 0;
  180. display: flex;
  181. align-items: center;
  182. line-height: 1;
  183. .main-item-info-font {
  184. font-size: 24rpx;
  185. font-family: PingFang SC;
  186. font-weight: 500;
  187. color: #999999;
  188. margin-right: 10rpx;
  189. }
  190. .main-item-info-icon {
  191. position: relative;
  192. top: -10rpx;
  193. width: 19rpx;
  194. height: 19rpx;
  195. image {
  196. width: 100%;
  197. height: 100%;
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. </style>