add-address.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view>
  3. <!-- 头部 -->
  4. <headContent borderBottom>
  5. <template #left>
  6. <reverse-back />
  7. </template>
  8. </headContent>
  9. <view class="content">
  10. <view class="pages-title">
  11. 地址管理
  12. </view>
  13. <view class="currency-type">
  14. <view class="currency-lable">
  15. <template v-if="currencyInfo">
  16. <image class="lable-title" :src="currencyInfo.logo" mode="aspectFit"></image>
  17. <text class="lable-tag">{{ currencyInfo.name }}</text>
  18. </template>
  19. </view>
  20. <view class="select-currency" @click.stop="selectCurrency">
  21. <text class="select-text">请选择币种</text>
  22. <text class="select-icon iconfont">&#xe88e;</text>
  23. </view>
  24. </view>
  25. <view class="add-box">
  26. <view class="add-type">
  27. <text @click.stop="type = 'TRC20'"
  28. :class="['link-btn' , type === 'TRC20' ? 'active-link-btn' : '']">TRC20</text>
  29. <text @click.stop="type = 'ERC20'"
  30. :class="['link-btn' , type === 'ERC20' ? 'active-link-btn' : '']">ERC20</text>
  31. </view>
  32. <view class="address-text">
  33. <text class="address-lable">地址</text>
  34. <view class="address-info">
  35. <textarea class="address-input" v-model="address" maxlength="100" auto-height
  36. placeholder-class="placeholder-class" placeholder="请输入地址" />
  37. <text class="address-moer">粘贴</text>
  38. <text class="address-link"></text>
  39. <text class="address-icon iconfont">&#xe606;</text>
  40. </view>
  41. </view>
  42. <view class="address-text">
  43. <text class="address-lable">钱包备注</text>
  44. <view class="address-info"><textarea class="address-input" v-model="notes" maxlength="20"
  45. auto-height placeholder-class="placeholder-class" placeholder="请输入备注" />
  46. </view>
  47. </view>
  48. </view>
  49. <view class="add-address">
  50. <view class="add-btn" @click.stop="submitAddress()">
  51. 添加
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. Api_addAddress
  60. } from "@/api/index.js"
  61. export default {
  62. name: 'addAddress',
  63. data() {
  64. return {
  65. currencyInfo: null,
  66. type: 'ERC20',
  67. address: '',
  68. notes: ''
  69. };
  70. },
  71. onLoad() {
  72. const eventChannel = this.getOpenerEventChannel();
  73. // 监听setCurrency事件,获取上一页面通过eventChannel传送到当前页面的数据
  74. eventChannel.on('setCurrency', data => {
  75. this.currencyInfo = data
  76. })
  77. },
  78. onShow() {},
  79. mounted() {
  80. },
  81. methods: {
  82. // 选择币种
  83. selectCurrency() {
  84. uni.navigateTo({
  85. url: `/pages/content/select-currency?type=addAddress`
  86. })
  87. },
  88. submitAddress() {
  89. if (this.currencyInfo && this.address && this.notes) {
  90. const obj = {
  91. currency_id: this.currencyInfo.id,
  92. type: this.type,
  93. wallet_address: this.address,
  94. notes: this.notes
  95. }
  96. Api_addAddress(obj).then(res => {
  97. uni.redirectTo({
  98. url: '/pages/content/address'
  99. });
  100. }).catch(err => {
  101. })
  102. }
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .content {
  109. width: 100%;
  110. padding: 0 $pages-padding;
  111. .pages-title {
  112. height: 120rpx;
  113. font-size: 60rpx;
  114. font-weight: bold;
  115. line-height: 130rpx;
  116. }
  117. // <view class="currency-type">
  118. // <view class="currency-lable">
  119. // <image class="lable-title" src="../../static/logo.png" mode="aspectFit"></image>
  120. // <text class="lable-tag">USDT</text>
  121. // </view>
  122. // <view class="select-currency">
  123. // <text class="select-text">请选择币种</text>
  124. // <text class="select-icon iconfont">&#xe88e;</text>
  125. // </view>
  126. // </view>
  127. .currency-type {
  128. width: 100%;
  129. min-height: 100rpx;
  130. display: flex;
  131. align-items: stretch;
  132. justify-content: space-between;
  133. padding: 20rpx 20rpx 20rpx 30rpx;
  134. background-color: #f6f6f6;
  135. margin-bottom: 20rpx;
  136. border-radius: 10rpx;
  137. .currency-lable {
  138. display: flex;
  139. align-items: center;
  140. .lable-title {
  141. width: 50rpx;
  142. height: 50rpx;
  143. border-radius: 50%;
  144. }
  145. .lable-tag {
  146. font-size: 30rpx;
  147. font-weight: 700;
  148. padding-left: 20rpx;
  149. }
  150. }
  151. .select-currency {
  152. display: flex;
  153. align-items: center;
  154. font-size: 24rpx;
  155. color: #010101;
  156. .select-icon {
  157. font-size: 24rpx;
  158. color: #010101;
  159. }
  160. }
  161. }
  162. .add-box {
  163. width: 100%;
  164. padding: 30rpx 20rpx;
  165. border-radius: 10rpx;
  166. background-color: #f6f6f6;
  167. .add-type {
  168. width: 100%;
  169. .link-btn {
  170. display: inline-block;
  171. width: 140rpx;
  172. height: 72rpx;
  173. background: #f6f5f3;
  174. border-radius: 8px;
  175. text-align: center;
  176. line-height: 70rpx;
  177. font-size: 28rpx;
  178. font-weight: 400;
  179. color: #666666;
  180. border-radius: 8rpx;
  181. border: 1rpx solid #f6f5f3;
  182. &:nth-child(n + 2) {
  183. margin-left: 20rpx;
  184. }
  185. }
  186. .active-link-btn {
  187. background: #ffffff;
  188. border-color: #05c175;
  189. color: #FFBA6A;
  190. }
  191. }
  192. .address-text {
  193. width: 100%;
  194. padding-top: 40rpx;
  195. .address-lable {
  196. font-size: 30rpx;
  197. }
  198. .address-info {
  199. width: 100%;
  200. height: 80rpx;
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. overflow: hidden;
  205. border-bottom: 1rpx solid $border-color4;
  206. .address-input {
  207. height: 100%;
  208. font-size: 26rpx;
  209. padding-right: 20rpx;
  210. }
  211. .address-moer {
  212. flex-shrink: 0;
  213. font-size: 26rpx;
  214. color: #FFBA6A;
  215. }
  216. .address-link {
  217. width: 1rpx;
  218. height: 70%;
  219. background-color: $border-color4;
  220. margin: 0 16rpx;
  221. }
  222. .address-icon {
  223. flex-shrink: 0;
  224. font-size: 40rpx;
  225. color: #000;
  226. margin-right: 10rpx;
  227. }
  228. .placeholder-class {
  229. // color: #f6f5f3;
  230. }
  231. }
  232. }
  233. // <view class="address-text">
  234. // <text class="address-lable">钱包备注</text>
  235. // <view class="address-info">
  236. // <input class="address-input" focus placeholder="自动获得焦点" />
  237. // </view>
  238. // </view>
  239. }
  240. .add-address {
  241. width: 100%;
  242. height: 160rpx;
  243. padding: 40rpx 10rpx;
  244. .add-btn {
  245. width: 100%;
  246. height: 100%;
  247. text-align: center;
  248. line-height: 80rpx;
  249. background-color: $Theme-Color;
  250. font-size: 32rpx;
  251. color: #fff;
  252. border-radius: 10rpx;
  253. }
  254. }
  255. }
  256. </style>