assets.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <view class="container">
  3. <view class="title">资产</view>
  4. <view>
  5. <view class="list-box">
  6. <view class="bg"><image src="../../static/img/assets-bg.png" mode=""></image></view>
  7. <view class="info-box">
  8. <view class="flex" v-show="show == true">
  9. <view class="info">
  10. <view class="list-title">总资产合计(USDT)</view>
  11. <view class="list-name clamp">{{ like_usdt * 1 }}</view>
  12. <view class="ustd">≈ {{ like_rmb * 1 }}RMB</view>
  13. </view>
  14. <image class="image" src="../../static/img/eyes.png" @click="showPick(false)"></image>
  15. </view>
  16. <view class="flex" v-show="show == false">
  17. <view class="info">
  18. <view class="list-title">总资产合计(USDT)</view>
  19. <view class="list-name clamp">****</view>
  20. <view class="ustd">≈ ****RMB</view>
  21. </view>
  22. <image class="image" src="../../static/img/img43.png" @click="showPick(true)"></image>
  23. </view>
  24. </view>
  25. <view class="list-tpl flex">
  26. <view class="tpl" @click="navTo('/pages/assets/transfer')">
  27. <image class="zhuanz" src="../../static/img/zhuan.png"></image>
  28. <view class="tpl-name">转账</view>
  29. </view>
  30. <view class="tpl" @click="navTo('/pages/assets/recharge')">
  31. <!-- @click="recharge" -->
  32. <image src="../../static/img/chong.png"></image>
  33. <view class="tpl-name">充币</view>
  34. </view>
  35. <view class="tpl" @click="navTo('/pages/assets/withdraw')">
  36. <image src="../../static/img/ti.png"></image>
  37. <view class="tpl-name">提币</view>
  38. </view>
  39. </view>
  40. <!-- <view class="list-tips flex_item">
  41. <image src="../../static/img/img07.png"></image>
  42. <view>资产正在保护中</view>
  43. </view> -->
  44. </view>
  45. <view class="list-cell" v-for="(ls, index) in list" :key="index" @click="toDateils(ls, index)">
  46. <view class="cell flex">
  47. <view class="cell-title flex">
  48. <image :src="ls.LOGO" mode="scaleToFill" class="logo"></image>
  49. <view class="name">{{ ls.name }}</view>
  50. </view>
  51. <image src="../../static/img/img16.png"></image>
  52. </view>
  53. <view class="flex cell-list">
  54. <view class="cell-tpl tips">
  55. <view class="name">可用</view>
  56. <view class="tpl">{{ ls.money.money * 1 }}</view>
  57. </view>
  58. <view class="cell-tpl tip-box">
  59. <view class="name">折合(USDT)</view>
  60. <view class="tpl clamp">{{ ls.usdt * 1 }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import { wallet } from '@/api/finance.js';
  69. import easyselect from '@/components/easy-select/easy-select.vue';
  70. export default {
  71. components: {
  72. easyselect
  73. },
  74. data() {
  75. return {
  76. num: '',
  77. money: '',
  78. type: '',
  79. moneyTypeList: [],
  80. list: [],
  81. show: true,
  82. like_rmb: '',
  83. like_usdt: '',
  84. wallet: ''
  85. };
  86. },
  87. onLoad(option) {
  88. this.loadData();
  89. },
  90. onShow() {
  91. this.loadData();
  92. let show = uni.getStorageSync('showPick');
  93. if (show == false) {
  94. this.show = false;
  95. }
  96. if (show == true) {
  97. this.show = true;
  98. }
  99. },
  100. //下拉刷新
  101. onPullDownRefresh() {
  102. this.loadData();
  103. setTimeout(function() {
  104. uni.stopPullDownRefresh();
  105. }, 1000);
  106. },
  107. methods: {
  108. // 请求载入数据
  109. loadData() {
  110. let obj = this;
  111. uni.showLoading({
  112. title: '加载中'
  113. });
  114. obj.loading = true;
  115. wallet({}).then(({ data }) => {
  116. console.log(data);
  117. obj.like_rmb = data.all_rmb;
  118. obj.like_usdt = data.all_usdt;
  119. const arr = Object.keys(data.back);
  120. console.log(arr);
  121. let ar = [];
  122. arr.forEach(e => {
  123. ar.push(data.back[e]);
  124. });
  125. obj.list = ar;
  126. uni.hideLoading();
  127. });
  128. },
  129. showPick(item) {
  130. this.show = item;
  131. uni.setStorage({
  132. key: 'showPick',
  133. data: item,
  134. success: function() {}
  135. });
  136. },
  137. selectOne(options) {
  138. this.money = options.name;
  139. this.type = options.code;
  140. },
  141. useOutClickSide() {
  142. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  143. },
  144. close() {
  145. this.$refs.popup.close();
  146. },
  147. navTo(url) {
  148. uni.navigateTo({
  149. url
  150. });
  151. },
  152. toDateils(ls, index) {
  153. console.log(ls, 88);
  154. let way = ls.way.split(',');
  155. console.log(way[0], 'money-----------', ls.money);
  156. let path = 'address_' + way[0];
  157. console.log(path);
  158. console.log(path === 'address_TRC20');
  159. let address = ls.money[path];
  160. let wayaddress = {};
  161. way.forEach(item => {
  162. let path = 'address_' + item;
  163. wayaddress[item] = ls.money[path];
  164. });
  165. let waypath = JSON.stringify(wayaddress);
  166. uni.navigateTo({
  167. url:
  168. '/pages/finance/details?code=' +
  169. ls.code +
  170. '&name=' +
  171. ls.name +
  172. '&logo=' +
  173. ls.LOGO +
  174. '&price=' +
  175. ls.money.money +
  176. '&_address_qr=' +
  177. ls._address_qr +
  178. '&__money_address=' +
  179. ls.__money_address +
  180. '&mark=' +
  181. ls.mark +
  182. '&ids=' +
  183. ls.money.id +
  184. '&keysAddr=' +
  185. ls.money.address +
  186. '&charge=' +
  187. ls.charge +
  188. '&address=' +
  189. address +
  190. '&way=' +
  191. ls.way +
  192. '&waypath=' +
  193. waypath +
  194. '&less=' +
  195. ls.less
  196. });
  197. }
  198. }
  199. };
  200. </script>
  201. <style lang="scss">
  202. page {
  203. min-height: 100%;
  204. background-color: #ffffff;
  205. .container {
  206. width: 100%;
  207. padding: 25rpx 40rpx;
  208. }
  209. }
  210. .title {
  211. font-size: 46rpx;
  212. font-family: PingFang SC;
  213. font-weight: bold;
  214. color: $font-color-dark;
  215. margin-bottom: 30rpx;
  216. }
  217. .list-tips {
  218. position: absolute;
  219. right: 0;
  220. top: 25rpx;
  221. font-size: 24rpx;
  222. background-color: #f4ca1c;
  223. padding: 14rpx 27rpx;
  224. border-bottom-left-radius: 50rpx;
  225. border-top-left-radius: 50rpx;
  226. color: #5771df;
  227. image {
  228. width: 30rpx;
  229. height: 31rpx;
  230. margin-right: 12rpx;
  231. }
  232. }
  233. .list-box {
  234. .bg {
  235. position: absolute;
  236. right: 0;
  237. left: 0;
  238. top: 0;
  239. width: 100%;
  240. height: 100%;
  241. image {
  242. height: 100%;
  243. width: 100%;
  244. }
  245. }
  246. position: relative;
  247. color: #ffffff;
  248. border-radius: 20rpx;
  249. margin-bottom: 60rpx;
  250. .info-box {
  251. z-index: 10;
  252. position: relative;
  253. padding: 31rpx 43rpx;
  254. .image {
  255. width: 44rpx !important;
  256. height: 30rpx !important;
  257. }
  258. .info {
  259. width: 80%;
  260. .list-title {
  261. position: relative;
  262. z-index: 10;
  263. font-size: 30rpx;
  264. font-weight: 500;
  265. color: #ffffff;
  266. }
  267. .list-name {
  268. width: 100%;
  269. font-size: 64rpx;
  270. font-weight: bold;
  271. padding: 25rpx 0rpx;
  272. }
  273. .ustd {
  274. font-size: 30rpx;
  275. font-weight: normal;
  276. }
  277. }
  278. }
  279. .list-tpl {
  280. z-index: 10;
  281. position: relative;
  282. padding: 30rpx 100rpx;
  283. .tpl {
  284. text-align: center;
  285. image {
  286. width: 45rpx;
  287. height: 42rpx;
  288. }
  289. .zhuanz {
  290. width: 45rpx;
  291. height: 42rpx;
  292. }
  293. .tpl-name {
  294. font-size: 27rpx;
  295. font-weight: bold;
  296. padding-left: 10rpx;
  297. color: #ffffff;
  298. }
  299. }
  300. }
  301. }
  302. .list-cell {
  303. padding-bottom: 58rpx;
  304. .cell {
  305. padding-bottom: 31rpx;
  306. image {
  307. width: 12rpx;
  308. height: 24rpx;
  309. }
  310. .cell-title {
  311. font-size: 34rpx;
  312. font-weight: 500;
  313. color: #5771df;
  314. .logo{
  315. border-radius: 99rpx;
  316. width:50rpx ;
  317. height:50rpx ;
  318. }
  319. .name{
  320. margin-left: 20rpx;
  321. color: $font-color-dark;
  322. font-weight: bold;
  323. }
  324. }
  325. }
  326. .cell-list {
  327. width: 100%;
  328. .cell-tpl {
  329. text-align: left;
  330. .name {
  331. font-size: 24rpx;
  332. font-weight: 500;
  333. color: #999999;
  334. padding-bottom: 15rpx;
  335. }
  336. }
  337. .tip-box {
  338. text-align: right;
  339. width: 40%;
  340. }
  341. .tip-tpl {
  342. text-align: center;
  343. width: 30%;
  344. }
  345. .tips {
  346. width: 30%;
  347. }
  348. }
  349. }
  350. //弹窗
  351. .popup {
  352. background-color: #ffffff;
  353. border-radius: 25rpx;
  354. font-size: 30rpx;
  355. .cancel {
  356. text-align: center;
  357. width: 100%;
  358. line-height: 60rpx;
  359. .tip {
  360. background-color: #5771df;
  361. color: #ffffff;
  362. width: 70rpx;
  363. height: 70rpx;
  364. border-top-right-radius: 25rpx;
  365. }
  366. }
  367. .list-boxs {
  368. padding: 0rpx 80rpx;
  369. .password {
  370. padding: 50rpx 0rpx;
  371. width: 100%;
  372. input {
  373. width: 70%;
  374. height: 80rpx;
  375. border: 2rpx solid #999999;
  376. padding-left: 25rpx;
  377. box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.27);
  378. border-radius: 11rpx;
  379. }
  380. }
  381. .confirm-btn {
  382. padding-bottom: 120rpx;
  383. padding-top: 30rpx;
  384. text {
  385. background-color: #5771df;
  386. color: #ffffff;
  387. width: 70%;
  388. text-align: center;
  389. padding: 25rpx 90rpx;
  390. border-radius: 15rpx;
  391. }
  392. }
  393. }
  394. }
  395. .loading {
  396. width: 100%;
  397. height: 100%;
  398. }
  399. </style>