select-coin.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <uni-popup ref="popupRef" type="bottom">
  3. <view class="popup-box">
  4. <view class="title-box">
  5. <text class="title-name">选择币种</text>
  6. <!-- <image class="title-close" src="../../../static/logo.png" mode="aspectFit"></image> -->
  7. <text class="title-close iconfont">&#xeca0;</text>
  8. </view>
  9. <view class="content-box">
  10. <view class="search-box">
  11. <input class="search-input" v-model="searchContent" placeholder-class="search-input-placeholder" placeholder="搜索您要的币种" />
  12. <!-- <image class="search-icon" src="../../../static/logo.png" mode="aspectFit"></image> -->
  13. <text class="search-icon iconfont">&#xe606;</text>
  14. </view>
  15. <scroll-view scroll-y class="scroll-view-list">
  16. <view class="content-item" v-for="(item , index) in selectList" v-if="searchVal(item)" @click.stop="selectItem(item)" :key="`content_${index}`">
  17. <image class="item-icon" :src="item.logo" mode="aspectFit"></image>
  18. <text class="item-text hide_1">{{item.name}}</text>
  19. </view>
  20. </scroll-view>
  21. </view>
  22. </view>
  23. </uni-popup>
  24. </template>
  25. <script>
  26. export default {
  27. name: "exchangeSelectCoin",
  28. props: {
  29. activeVal:{
  30. type:Object,
  31. default: () => {
  32. return {}
  33. }
  34. },
  35. selectList: {
  36. type: Array,
  37. default: () => []
  38. }
  39. },
  40. data() {
  41. return {
  42. searchContent:''
  43. // contentList: [{
  44. // icon: require('../../../static/icon/icon_01.png'),
  45. // name: 'BTC'
  46. // }, {
  47. // icon: require('../../../static/icon/icon_02.png'),
  48. // name: 'FIL'
  49. // }, {
  50. // icon: require('../../../static/icon/icon_03.png'),
  51. // name: 'ETH'
  52. // }, {
  53. // icon: require('../../../static/icon/icon_04.png'),
  54. // name: 'SHIB'
  55. // }]
  56. };
  57. },
  58. mounted() {
  59. // this.$refs.popupRef.open()
  60. },
  61. methods: {
  62. searchVal(val){
  63. if(this.searchContent){
  64. let v = this.searchContent.toUpperCase()
  65. return val.name.indexOf(v) >= 0
  66. };
  67. return true
  68. },
  69. open() {
  70. this.$nextTick(() => {
  71. this.$refs.popupRef.open();
  72. })
  73. },
  74. close() {
  75. this.$refs.popupRef.close();
  76. },
  77. selectItem(item){
  78. this.$emit('update:activeVal', item);
  79. this.close();
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .popup-box {
  86. width: 100%;
  87. border-radius: 50rpx 50rpx 0px 0px;
  88. background-color: #fff;
  89. .scroll-view-list{
  90. width: 100%;
  91. height: 35vh;
  92. }
  93. .title-box {
  94. width: 100%;
  95. height: 113rpx;
  96. border-radius: 50rpx 50rpx 0px 0px;
  97. background-color: #F7F7F7 !important;
  98. display: flex;
  99. justify-content: space-between;
  100. align-items: center;
  101. padding: 0 $pages-padding;
  102. .title-name {
  103. font-size: 34rpx;
  104. font-family: PingFang SC, PingFang SC-Bold;
  105. font-weight: 700;
  106. text-align: center;
  107. color: #1a1a1a;
  108. line-height: 48rpx;
  109. }
  110. .title-close {
  111. width: 25rpx;
  112. height: 25rpx;
  113. // background-color: #666666;
  114. }
  115. }
  116. .content-box {
  117. width: 100%;
  118. padding: 0 $pages-padding 20rpx;
  119. .search-box {
  120. margin: 30rpx 0 20rpx;
  121. width: 100%;
  122. height: 60rpx;
  123. display: flex;
  124. align-items: center;
  125. background-color: #dbdce0;
  126. border-radius: 30rpx;
  127. padding: 0 30rpx;
  128. // <view class="search-box">
  129. // <input class="search-input" placeholder-class="search-input-placeholder" placeholder="请输入密码"/>
  130. // <image class="search-icon" src="../../../static/logo.png" mode="aspectFit"></image>
  131. // </view>
  132. .search-input {
  133. flex: 1;
  134. height: 100%;
  135. }
  136. .search-input,
  137. .search-input-placeholder {
  138. font-size: 24rpx;
  139. font-family: PingFang SC, PingFang SC-Regular;
  140. font-weight: 400;
  141. text-align: left;
  142. color: #333333;
  143. }
  144. .search-icon {
  145. width: 38rpx;
  146. height: 38rpx;
  147. flex-shrink: 0;
  148. }
  149. }
  150. .content-item {
  151. width: 100%;
  152. height: 66rpx;
  153. display: flex;
  154. align-items: center;
  155. .item-icon {
  156. width: 46rpx;
  157. height: 46rpx;
  158. flex-shrink: 0;
  159. }
  160. .item-text {
  161. font-size: 26rpx;
  162. font-family: PingFang SC, PingFang SC-Bold;
  163. font-weight: 700;
  164. text-align: left;
  165. color: #343434;
  166. line-height: 37rpx;
  167. padding-left: 14rpx;
  168. }
  169. }
  170. }
  171. }
  172. </style>