select-currency.vue 3.2 KB

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