list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <view class="container" v-if="fetch">
  3. <use-tabbar :tabbar="false"></use-tabbar>
  4. <view class="w-full navbar-area bg-main">
  5. <view class="state-area dflex-a">
  6. <view v-for="(item, index) in navList" :key="index" :class="{ active: status === index }" class="nav-item dflex-c pos-r fs padding-lr-lg h-full"
  7. @click="tabClick(index)">
  8. {{ item.state }}
  9. <text v-if="item.cnt > 0">({{ item.cnt }})</text>
  10. </view>
  11. </view>
  12. </view>
  13. <scroll-view class="list-scroll-content h-full" scroll-y >
  14. <!-- 空白页 -->
  15. <u-empty v-if="fetch.list && fetch.list.length == 0" marginTop="200" mode="coupon" text="暂无礼品卡"></u-empty>
  16. <view v-else class="padding-lr" v-for="(item, index) in fetch.list" :key="index">
  17. <view class="coupon_box border-radius margin-top-sm bg-main" :class="[{ 'disabled': status != 0 }]" @click="showModal(item.scope.title, item.scope.tip)">
  18. <view class="dflex-b">
  19. <view class="left pos-a h-full dflex-c dflex-flow-c">
  20. <view>
  21. <text class="price fs-big">{{ item.yue }}</text>
  22. </view>
  23. <view class="fs-sm">余额</view>
  24. </view>
  25. <view class="right padding left_t flex1">
  26. <view class="dflex-b padding-bottom-xs">
  27. <view class="fwb fs">{{ item.name }}</view>
  28. <text class="arrow" v-if="item.scope.tip">›</text>
  29. </view>
  30. <view v-if="status == 1" class="ft-dark iconfont iconyishiyong"></view>
  31. <view v-if="status == 2" class="ft-dark iconfont iconyiguoqi"></view>
  32. <view class="dflex-b ft-dark fs-xs padding-bottom border-line">
  33. <view class="">{{ item.date_name }}</view>
  34. </view>
  35. <view class="fs-xs ft-dark padding-top-xs">
  36. {{ item.title }}
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </scroll-view>
  43. <u-modal @close="closeModal" @confirm="closeModal" :show="show.state" :title="show.title" :closeOnClickOverlay="true">
  44. <view class="slot-content">
  45. <u-parse :content="show.content"></u-parse>
  46. </view>
  47. </u-modal>
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. mapState
  53. } from 'vuex';
  54. export default {
  55. data() {
  56. return {
  57. fetch: {},
  58. status: 0,
  59. show : {
  60. state : false,
  61. title : '',
  62. content : '',
  63. },
  64. navList: [{
  65. id: 0,
  66. state: '已领取',
  67. cnt: 0,
  68. },
  69. {
  70. id: 1,
  71. state: '已过期',
  72. cnt: 0,
  73. }
  74. ],
  75. };
  76. },
  77. onLoad(options) {
  78. this.loadData(1);
  79. },
  80. // 下拉刷新
  81. onPullDownRefresh() {
  82. this.loadData(1);
  83. },
  84. // 上拉加载更多
  85. onReachBottom() {
  86. this.loadData(2);
  87. },
  88. methods: {
  89. loadData(page) {
  90. this.DeverApi.page([page, 'list'], this, 'gift.my', {status:this.status});
  91. },
  92. // 顶部tab点击
  93. tabClick(index) {
  94. this.status = index;
  95. this.fetch.list = {}
  96. this.loadData(1);
  97. },
  98. showModal(title, content) {
  99. if (content) {
  100. this.show.title = title;
  101. this.show.content = content;
  102. this.show.state = true;
  103. }
  104. },
  105. closeModal() {
  106. this.show.state = false;
  107. },
  108. }
  109. };
  110. </script>
  111. <style lang="scss">
  112. page,
  113. .container {
  114. min-height: 100%;
  115. background: $page-color-base;
  116. }
  117. /* 优惠券状态区 */
  118. .navbar-area {
  119. white-space: nowrap;
  120. .state-area {
  121. height: 7vh;
  122. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  123. z-index: 10;
  124. }
  125. .nav-item {
  126. flex: 1;
  127. &.active {
  128. &:after {
  129. content: '';
  130. position: absolute;
  131. left: 50%;
  132. transform: translate(-50%);
  133. bottom: 0;
  134. width: 44px;
  135. height: 0;
  136. border-bottom: 2px solid $base-color;
  137. }
  138. }
  139. }
  140. }
  141. /* 优惠券轮播区 */
  142. .swiper-area {
  143. height: 93vh;
  144. }
  145. .coupon_box {
  146. position: relative;
  147. &:last-child {
  148. margin-bottom: 20rpx;
  149. }
  150. .left {
  151. background-color: #ff8b6a;
  152. color: #fff;
  153. width: 30%;
  154. .price {
  155. color: #fff !important;
  156. }
  157. }
  158. .right {
  159. margin-left: 30%;
  160. }
  161. .discount {
  162. font-weight: 580;
  163. }
  164. .discount::after {
  165. content: '折';
  166. font-size: 24rpx;
  167. margin-left: 6rpx;
  168. }
  169. .border-line {
  170. border-bottom: 1px dotted #ededed;
  171. }
  172. }
  173. .disabled {
  174. .left {
  175. background-color: #d9d9d9;
  176. color: #b2b2b2 !important;
  177. .price {
  178. color: #b2b2b2 !important;
  179. }
  180. }
  181. .iconfont {
  182. position: absolute;
  183. /*top: 0rpx;*/
  184. right: 30rpx;
  185. font-size: 110rpx;
  186. }
  187. }
  188. .btn-container {
  189. left: 9px;
  190. right: 9px;
  191. bottom: 0;
  192. }
  193. </style>