voucher.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="voucherContainer">
  3. <JHeader title="我的代金券" width="50" height="50" style="padding: 24upx 0 10upx;z-index: 2;">
  4. </JHeader>
  5. <image class="topBackgrpound" src="../../../static/images/user/vcbgimg.png"></image>
  6. <!-- header区 -->
  7. <view class="userInfo">
  8. <image class="avatar" :src="common.seamingImgUrl($store.getters.userInfo.headImage)"></image>
  9. <text class="userPhone">{{ hiddenPhone(userInfo.phone) }}</text>
  10. </view>
  11. <view class="tabNavs">
  12. <view
  13. v-for="(item, index) in tabNavsData" :key="item" class="tabItem" :class="{ isActice: index == currIndex }"
  14. @click="currIndex = index"
  15. >
  16. {{ item }}
  17. </view>
  18. </view>
  19. <view class="main">
  20. <TopUp
  21. v-if="currIndex != 2" :user-acount="userAcount" :user-info="userInfo" :is-gift="currIndex == 1"
  22. @getVouvher="getUserVoucher"
  23. ></TopUp>
  24. <NewRecords v-if="currIndex == 2"></NewRecords>
  25. </view>
  26. <!-- <view class="footer">
  27. </view> -->
  28. </view>
  29. </template>
  30. <script>
  31. import topUp from './components/topUp.vue'
  32. import { getByUserVoucherShopHoldApi } from '../../../api/anotherTFInterface'
  33. import newRecords from './components/newRecords.vue'
  34. export default {
  35. name: 'Voucher',
  36. components: {
  37. TopUp: topUp,
  38. NewRecords: newRecords
  39. },
  40. data() {
  41. return {
  42. userInfo: null,
  43. tabNavsData: ['充值', '转赠', '流水'],
  44. userAcount: {
  45. number: ''
  46. },
  47. currIndex: 0
  48. }
  49. },
  50. onLoad() {
  51. this.userInfo = this.$store.getters.userInfo
  52. this.getUserVoucher()
  53. },
  54. methods: {
  55. hiddenPhone(Phone) {
  56. return Phone.substr(0, 3) + '****' + Phone.substr(7, 11)
  57. },
  58. getUserVoucher() {
  59. getByUserVoucherShopHoldApi().then((res) => {
  60. this.userAcount = res.data
  61. // console.log(res);
  62. })
  63. .catch((err) => {
  64. console.log(err)
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .voucherContainer {
  72. position: relative;
  73. width: 100vw;
  74. min-height: 100vh;
  75. overflow: hidden;
  76. background: linear-gradient(180deg, #FF380C 0%, rgba(255, 56, 12, 0.88) 20%, #F4F3F8 27%);
  77. .topBackgrpound {
  78. width: 100vw;
  79. height: 418rpx;
  80. position: absolute;
  81. top: 0rpx;
  82. left: 0;
  83. z-index: 0;
  84. }
  85. .tabNavs {
  86. margin-top: 48rpx;
  87. position: relative;
  88. z-index: 2;
  89. width: 100vw;
  90. box-sizing: border-box;
  91. padding: 0 30rpx;
  92. display: flex;
  93. align-items: center;
  94. justify-content: space-around;
  95. .tabItem {
  96. position: relative;
  97. font-family: 思源黑体;
  98. font-size: 36rpx;
  99. font-weight: 500;
  100. font-feature-settings: "kern" on;
  101. color: #FFFFFF;
  102. }
  103. .isActice::before {
  104. content: '';
  105. position: absolute;
  106. width: 100%;
  107. height: 6rpx;
  108. left: 0;
  109. bottom: -8rpx;
  110. background-color: #F4F3F8;
  111. border-radius: 10rpx;
  112. }
  113. }
  114. .userInfo {
  115. box-sizing: border-box;
  116. padding: 0 30rpx;
  117. margin-top: 60rpx;
  118. width: 100%;
  119. height: 70rpx;
  120. display: flex;
  121. align-items: center;
  122. .avatar {
  123. width: 68rpx;
  124. height: 68rpx;
  125. border-radius: 50%;
  126. }
  127. .userPhone {
  128. margin-left: 20rpx;
  129. font-family: 思源黑体;
  130. font-size: 42rpx;
  131. font-weight: 500;
  132. font-feature-settings: "kern" on;
  133. color: #FFFFFF;
  134. }
  135. }
  136. .main {
  137. display: flex;
  138. flex-direction: column;
  139. flex: 1;
  140. position: relative;
  141. z-index: 2;
  142. margin-top: 25rpx;
  143. }
  144. }
  145. </style>