推拿小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.5 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="代金券" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  4. <view class="tabs">
  5. <uv-tabs
  6. :list="tabs"
  7. @click="onTabChange"
  8. :customStyle="{
  9. backgroundColor: '#FFFFFF',
  10. }"
  11. :activeStyle="{
  12. color: '#84A73F',
  13. fontSize: '28rpx',
  14. whiteSpace: 'nowrap',
  15. paddingTop: '29rpx',
  16. paddingBottom: '21rpx',
  17. }"
  18. :inactiveStyle="{
  19. color: '#000000',
  20. fontSize: '28rpx',
  21. whiteSpace: 'nowrap',
  22. paddingTop: '29rpx',
  23. paddingBottom: '21rpx',
  24. }"
  25. lineHeight="5rpx"
  26. lineWidth="92rpx"
  27. lineColor="linear-gradient(to right, #84A73F, #D8FF8F)"
  28. :scrollable="false"
  29. ></uv-tabs>
  30. </view>
  31. <template v-if="current == 0" >
  32. <view class="list voucher">
  33. <voucherCard class="list-item"
  34. v-for="item in list"
  35. :key="item.id"
  36. :data="data"
  37. ></voucherCard>
  38. </view>
  39. </template>
  40. <template v-else-if="current == 1" >
  41. <view class="list store">
  42. <storeCard class="list-item"
  43. v-for="item in list"
  44. :key="item.id"
  45. :data="data"
  46. ></storeCard>
  47. </view>
  48. </template>
  49. </view>
  50. </template>
  51. <script>
  52. import mixinsList from '@/mixins/list.js'
  53. import voucherCard from '../components/voucher/voucherCard.vue'
  54. import storeCard from '../components/voucher/storeCard.vue'
  55. const TAB_AND_API_FIELDS_MAPPING = {
  56. // todo: 接口对接
  57. 0: 'fetchVoucher',
  58. 1: 'fetchStore',
  59. }
  60. export default {
  61. mixins : [mixinsList],
  62. components: {
  63. voucherCard,
  64. storeCard,
  65. },
  66. data() {
  67. return {
  68. tabs: [{
  69. name: "代金券"
  70. }, {
  71. name: "可使用门店"
  72. }],
  73. current: 0
  74. };
  75. },
  76. computed: {
  77. mixinsListApi() {
  78. // todo
  79. return TAB_AND_API_FIELDS_MAPPING[this.current]
  80. }
  81. },
  82. methods: {
  83. onTabChange(e) {
  84. this.current = e.index
  85. }
  86. },
  87. }
  88. </script>
  89. <style scoped lang="scss">
  90. .page {
  91. background-color: $uni-bg-color;
  92. min-height: 100vh;
  93. /deep/ .nav-bar__view {
  94. background-image: linear-gradient(#84A73F, #D8FF8F);
  95. }
  96. }
  97. .tabs {
  98. /deep/ .uv-tabs__wrapper__nav__line {
  99. bottom: 0;
  100. }
  101. }
  102. .list {
  103. &-item {
  104. display: block;
  105. & + & {
  106. margin-top: 20rpx;
  107. }
  108. }
  109. &.voucher {
  110. padding: 30rpx 28rpx;
  111. }
  112. &.store {
  113. padding: 29rpx 13rpx;
  114. }
  115. }
  116. </style>