select-currency.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 {
  30. Api_getQuotationNew,
  31. Api_getBiTypeList,
  32. Api_getFlashRecord,
  33. Api_getSubmit
  34. } from "@/api/index.js"
  35. export default {
  36. name: 'selectCurrency',
  37. components: {
  38. reverseBack
  39. },
  40. data() {
  41. return {
  42. pageType: '',
  43. currencyList: []
  44. };
  45. },
  46. onLoad(opt) {
  47. this.pageType = opt?.type;
  48. this.getBiTypeList();
  49. },
  50. methods: {
  51. getBiTypeList() {
  52. uni.showLoading()
  53. Api_getQuotationNew().then(res => {
  54. this.currencyList = res || [];
  55. }).catch(err => {}).finally(() => {
  56. uni.hideLoading();
  57. })
  58. },
  59. // pages/content/top-up
  60. topUp(item) {
  61. let path = ''
  62. switch (this.pageType) {
  63. case 'addAddress':
  64. path = 'pages/content/add-address';
  65. break;
  66. case 'address':
  67. path = 'pages/content/address';
  68. break;
  69. }
  70. // let path = `/pages/content/top-up?key=${`bi_${time}`}`
  71. // 'pages/content/top-up'
  72. const pages = getCurrentPages()
  73. if (pages.length >= 2 && pages[pages.length - 2].route === path) {
  74. let prevPage = pages[pages.length - 2];
  75. // pages
  76. prevPage.$vm.currencyInfo = item;
  77. uni.navigateBack({
  78. delta: 1
  79. });
  80. } else {
  81. const time = new Date().getTime();
  82. let key = {};
  83. key[`bi_${time}`] = item
  84. this.$setStorageSync('select', key)
  85. path = `/${path}?key=${`bi_${time}`}`
  86. uni.navigateTo({
  87. url: path
  88. });
  89. }
  90. // uni.navigateTo({
  91. // url: path
  92. // });
  93. },
  94. // 查看充值记录
  95. lookRecord() {
  96. uni.navigateTo({
  97. url: '/pages/content/charge-record'
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style>
  104. page {
  105. background-color: #f5f5f5;
  106. }
  107. </style>
  108. <style lang="scss" scoped>
  109. .head-record {
  110. font-size: 60rpx;
  111. }
  112. .currency-box {
  113. width: 100%;
  114. padding: 40rpx $pages-padding 0;
  115. .currency-item {
  116. width: 100%;
  117. display: flex;
  118. align-items: center;
  119. padding: 30rpx 0;
  120. .currency-icon {
  121. width: 46rpx;
  122. height: 46rpx;
  123. flex-shrink: 0;
  124. }
  125. .currency-name {
  126. font-size: 28rpx;
  127. padding-left: 7px;
  128. font-weight: 700;
  129. }
  130. }
  131. // <view class="currency-box">
  132. // <block v-for="(item , index) in currencyList" :key="`currency_${index}`">
  133. // <view class="currency-item">
  134. // <image class="currency-icon" :src="item.icon" mode="aspectFit"></image>
  135. // <text class="currency-name">{{ item.name }}</text>
  136. // </view>
  137. // </block>
  138. // </view>
  139. }
  140. </style>