select-currency.vue 3.5 KB

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