select-currency.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="">
  3. <!-- 头部 -->
  4. <headContent>&#xe642;
  5. <template #left>
  6. <reverse-back />
  7. </template>
  8. <template #content>
  9. <view class="haed-title">
  10. 选择币种
  11. </view>
  12. </template>
  13. <template #right>
  14. <view @click.stop="lookRecord()" class="head-record iconfont">&#xe642;</view>
  15. </template>
  16. </headContent>
  17. <view class="currency-box">
  18. <block v-for="(item , index) in currencyList" :key="`currency_${index}`">
  19. <view class="currency-item" @click.stop="topUp(item)">
  20. <image class="currency-icon" :src="item.logo" mode="aspectFit"></image>
  21. <text class="currency-name">{{ item.name }}</text>
  22. </view>
  23. </block>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import reverseBack from "@/components/headModules/reverse-back.vue"
  29. import { Api_getQuotationNew , Api_getBiTypeList , Api_getFlashRecord , Api_getSubmit} from "@/api/index.js"
  30. export default {
  31. name: 'selectCurrency',
  32. components: {
  33. reverseBack
  34. },
  35. data() {
  36. return {
  37. currencyList: [
  38. // {
  39. // icon: require('@/static/images/bi/bi_01.png'),
  40. // name: 'BTC'
  41. // },
  42. // {
  43. // icon: require('@/static/images/bi/bi_02.png'),
  44. // name: 'BTC'
  45. // },
  46. // {
  47. // icon: require('@/static/images/bi/bi_03.png'),
  48. // name: 'BTC'
  49. // },
  50. // {
  51. // icon: require('@/static/images/bi/bi_03.png'),
  52. // name: 'BTC'
  53. // }
  54. ]
  55. };
  56. },
  57. onLoad() {
  58. this.getBiTypeList();
  59. },
  60. methods:{
  61. getBiTypeList(){
  62. uni.showLoading()
  63. Api_getQuotationNew().then(res => {
  64. console.log('Api_getBiTypeList = ' , res)
  65. this.currencyList = res || []
  66. }).catch(err => {
  67. console.log('Api_getBiTypeList = ' , err)
  68. }).finally(() => {
  69. uni.hideLoading()
  70. })
  71. },
  72. // pages/content/top-up
  73. topUp(item){
  74. const time = new Date().getTime();
  75. let key = {};
  76. key[`bi_${time}`] = item
  77. this.$setStorageSync('select' , key)
  78. let path = `/pages/content/top-up?key=${`bi_${time}`}`
  79. const pages = getCurrentPages()
  80. if(pages.length > 2 && pages[pages.length - 2].route === 'pages/content/top-up' ){
  81. console.log('pages 11 = ' , pages , pages[pages.length - 2].route)
  82. uni.redirectTo({
  83. url:path
  84. })
  85. }else{
  86. console.log('222')
  87. uni.navigateTo({
  88. url: path
  89. });
  90. }
  91. // uni.navigateTo({
  92. // url: path
  93. // });
  94. },
  95. // 查看充值记录
  96. lookRecord(){
  97. uni.navigateTo({
  98. url:'/pages/content/charge-record'
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style>
  105. page {
  106. background-color: #f5f5f5;
  107. }
  108. </style>
  109. <style lang="scss" scoped>
  110. .head-record{
  111. font-size: 60rpx;
  112. }
  113. .currency-box {
  114. width: 100%;
  115. padding: 40rpx $pages-padding 0;
  116. .currency-item{
  117. width: 100%;
  118. display: flex;
  119. align-items: center;
  120. padding: 30rpx 0;
  121. .currency-icon{
  122. width: 46rpx;
  123. height: 46rpx;
  124. flex-shrink: 0;
  125. }
  126. .currency-name{
  127. font-size: 28rpx;
  128. padding-left: 7px;
  129. font-weight: 700;
  130. }
  131. }
  132. // <view class="currency-box">
  133. // <block v-for="(item , index) in currencyList" :key="`currency_${index}`">
  134. // <view class="currency-item">
  135. // <image class="currency-icon" :src="item.icon" mode="aspectFit"></image>
  136. // <text class="currency-name">{{ item.name }}</text>
  137. // </view>
  138. // </block>
  139. // </view>
  140. }
  141. </style>