index.vue 8.6 KB

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