selectMerchant.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="container">
  3. <view class="backHeader">
  4. <image
  5. @click="handleBack"
  6. class="backIcon"
  7. src="@/static/index/convenient-services/return.png"
  8. ></image>
  9. <text class="pageTitle">充值商家</text>
  10. </view>
  11. <view class="checkoutMerchant">
  12. <div class="tabsNavs">
  13. <view class="tab-item" @click="changeTab(index)" :class="{active : currentIndex == index}" v-for="(item, index) in tabs" :key="item">
  14. {{ item }}
  15. </view>
  16. <div class="tab-active" :style="{width: 750/tabs.length + 'rpx', left: currentIndex * 750/tabs.length - 20 + 'rpx'}"></div>
  17. </div>
  18. </view>
  19. <view class="merchantList">
  20. <keep-alive>
  21. <merchantList ref="merchantList" v-if="currentIndex == 0"></merchantList>
  22. <historyMerchantList ref="historyMerchantList" v-if="currentIndex == 1"></historyMerchantList>
  23. </keep-alive>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import historyMerchantList from './components/historyMerchantList.vue'
  29. import merchantList from './components/merchantList.vue'
  30. export default {
  31. name: "selectMerchant",
  32. components: {
  33. historyMerchantList,
  34. merchantList
  35. },
  36. data() {
  37. return {
  38. tabs: ['商家列表','我的商家'],
  39. currentIndex: 0,
  40. };
  41. },
  42. methods: {
  43. handleBack() {
  44. uni.navigateBack();
  45. },
  46. changeTab(index){
  47. this.currentIndex = index
  48. }
  49. },
  50. onReachBottom() {
  51. let arr = [this.$refs.merchantList, this.$refs.historyMerchantList]
  52. arr[this.currentIndex].getMoreList()
  53. }
  54. };
  55. </script>
  56. <style lang="scss">
  57. .container {
  58. background-color: #F8F9FB;
  59. .backHeader {
  60. position: relative;
  61. width: 750rpx;
  62. height: 88rpx;
  63. /* background-color: #fff; */
  64. display: flex;
  65. align-items: center;
  66. .backIcon {
  67. width: 60rpx;
  68. height: 60rpx;
  69. }
  70. .pageTitle {
  71. font-family: 思源黑体;
  72. font-size: 32rpx;
  73. font-weight: 600;
  74. line-height: 44rpx;
  75. letter-spacing: 0.32rpx;
  76. color: #222229;
  77. position: absolute;
  78. left: 50%;
  79. transform: translateX(-50%);
  80. }
  81. }
  82. .checkoutMerchant {
  83. width: 100vw;
  84. box-sizing: border-box;
  85. padding: 32rpx;
  86. display: flex;
  87. .tabsNavs {
  88. position: relative;
  89. display: flex;
  90. justify-content: flex-start;
  91. align-items: center;
  92. overflow: hidden;
  93. width: 100%;
  94. height: 76rpx;
  95. border-bottom: 2rpx solid #F5F5F5;
  96. border-radius: 50rpx;
  97. box-shadow: 0px 2rpx 6rpx 0px rgba(9, 23, 49, 0.21);
  98. .tab-item {
  99. z-index: 2;
  100. display: flex;
  101. justify-content: center;
  102. align-items: center;
  103. flex: 1;
  104. /* height: 100%;
  105. width: 180rpx; */
  106. color: #888889;
  107. padding: 0 10rpx;
  108. }
  109. .active {
  110. color: #FFFFFF;
  111. transition: color .4s; /* 针对 color 来实现动画 */
  112. }
  113. .tab-active {
  114. z-index: 1;
  115. position: absolute;
  116. bottom: 0;
  117. /* width: 110px; */
  118. height: 100%;
  119. display: inline-block;
  120. border-radius: 50rpx;
  121. background: #EF530E;
  122. transition: left .4s; /* 针对 left 变动来实现动画 */
  123. }
  124. }
  125. }
  126. .merchantList {
  127. width: 100vw;
  128. box-sizing: border-box;
  129. padding: 32rpx;
  130. }
  131. }
  132. </style>