select-currency.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. case 'recharge':
  70. path = 'pages/content/top-up';
  71. break;
  72. case 'withdraw':
  73. path = 'pages/content/top-up';
  74. break;
  75. }
  76. // let path = `/pages/content/top-up?key=${`bi_${time}`}`
  77. // 'pages/content/top-up'
  78. const pages = getCurrentPages()
  79. if (pages.length >= 2 && pages[pages.length - 2].route === path) {
  80. let prevPage = pages[pages.length - 2];
  81. // pages
  82. prevPage.$vm.currencyInfo = item;
  83. uni.navigateBack({
  84. delta: 1
  85. });
  86. } else {
  87. const time = new Date().getTime();
  88. let key = {};
  89. key[`bi_${time}`] = item
  90. this.$setStorageSync('select', key)
  91. path = `/${path}?key=${`bi_${time}`}`
  92. uni.navigateTo({
  93. url: path
  94. });
  95. }
  96. // uni.navigateTo({
  97. // url: path
  98. // });
  99. },
  100. // 查看充值记录
  101. lookRecord() {
  102. uni.navigateTo({
  103. url: '/pages/content/charge-record'
  104. })
  105. }
  106. }
  107. }
  108. </script>
  109. <style>
  110. page {
  111. background-color: #f5f5f5;
  112. }
  113. </style>
  114. <style lang="scss" scoped>
  115. .head-record {
  116. font-size: 60rpx;
  117. }
  118. .currency-box {
  119. width: 100%;
  120. padding: 40rpx $pages-padding 0;
  121. .currency-item {
  122. width: 100%;
  123. display: flex;
  124. align-items: center;
  125. padding: 30rpx 0;
  126. .currency-icon {
  127. width: 46rpx;
  128. height: 46rpx;
  129. flex-shrink: 0;
  130. }
  131. .currency-name {
  132. font-size: 28rpx;
  133. padding-left: 7px;
  134. font-weight: 700;
  135. }
  136. }
  137. // <view class="currency-box">
  138. // <block v-for="(item , index) in currencyList" :key="`currency_${index}`">
  139. // <view class="currency-item">
  140. // <image class="currency-icon" :src="item.icon" mode="aspectFit"></image>
  141. // <text class="currency-name">{{ item.name }}</text>
  142. // </view>
  143. // </block>
  144. // </view>
  145. }
  146. </style>