select-currency.vue 3.6 KB

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