index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <div class="mine">
  3. <div class="banner">
  4. <div class="flex-row">
  5. <div class="block_1">
  6. <img src="@/assets/logo.jpg" class="avatar" />
  7. </div>
  8. <div class="flex-col">
  9. <div>
  10. <span class="text_1">{{ userinfo.nickname }}</span>
  11. <span class="level_name" v-if="userinfo.level_name">{{"("+userinfo.level_name+")"}}</span>
  12. </div>
  13. <div class="flex-row">
  14. <span class="text_2">{{ userinfo.addressEncrypt }}</span>
  15. <div class="text-wrapper_2">
  16. <span class="copys" @click="copy" :data-clipboard-text="this.userinfo.address">复制</span>
  17. </div>
  18. </div>
  19. <div class="flex-row">
  20. <span class="text_2">{{ userinfo.team_level_name || '' }}</span>
  21. <!-- <div class="text-wrapper_1" v-if="userinfo.submit_limit == 1" @click="reckoningClick('partition', '')">
  22. <span>申请分区</span>
  23. </div> -->
  24. </div>
  25. </div>
  26. </div>
  27. <div class="grade" @click="reckoningClick('personal', '')">
  28. <img src="@/assets/images/right-black.png" class="grade_img" />
  29. </div>
  30. </div>
  31. <div class="content">
  32. <div class="balance_box">
  33. <div class="balance_li" @click="reckoningClick('assetDetails', { coin_type: 'usdt' })">
  34. <div class="left">
  35. <span class="amount">{{ Math.floor(userinfo.usdt * 100) / 100 || 0 }}</span>
  36. </div>
  37. <div class="right">
  38. <img src="@/assets/images/usdt.png" class="icon1" />
  39. <span>USDT</span>
  40. </div>
  41. </div>
  42. <div class="balance_li" @click="reckoningClick('assetDetails', { coin_type: 'power', coin_name: '算力' })">
  43. <div class="left">
  44. <span class="amount">{{ Math.floor(userinfo.power * 100) / 100 || 0 }}</span>
  45. </div>
  46. <div class="right">
  47. <img src="@/assets/images/mine.png" class="icon2" />
  48. <span>算力</span>
  49. </div>
  50. </div>
  51. </div>
  52. <!-- <div class="order">
  53. <div class="top">
  54. <span class="order_text1">订单</span>
  55. <span class="order_text2" @click="reckoningClick('orders', '')">全部订单 ></span>
  56. </div>
  57. <div class="bottom flex-row">
  58. <div class="item flex-col" @click="reckoningClick('orders', { status_id: 1 })">
  59. <span class="num">{{ order_count.pay || 0 }}</span>
  60. <span>待支付</span>
  61. </div>
  62. <div class="item flex-col" @click="reckoningClick('orders', { status_id: 2 })">
  63. <span class="num">{{ order_count.pay || 0 }}</span>
  64. <span>待出售</span>
  65. </div>
  66. <div class="item flex-col" @click="reckoningClick('orders', { status_id: 3 })">
  67. <span class="num">{{ order_count.sell || 0 }}</span>
  68. <span>出售中</span>
  69. </div>
  70. <div class="item flex-col" @click="reckoningClick('orders', { status_id: 4 })">
  71. <span class="num">{{ order_count.success || 0 }}</span>
  72. <span>已完成</span>
  73. </div>
  74. <div class="item flex-col" @click="reckoningClick('orders', { status_id: 5 })">
  75. <span class="num">{{ order_count.cancel || 0 }}</span>
  76. <span>已失效</span>
  77. </div>
  78. </div>
  79. </div> -->
  80. <div class="list">
  81. <div v-for="(item, index) of list" :key="index" @click="switchovers(item)" class="li">
  82. <template v-if="index != 5 ? true : userinfo.level_id > 0 ? true : false">
  83. <div class="li_left">
  84. <img :src="item.image" class="li_img" />
  85. <span>{{ item.name }}</span>
  86. </div>
  87. <img src="@/assets/images/right-white.png" class="right" />
  88. </template>
  89. </div>
  90. </div>
  91. </div>
  92. <!-- 上级弹窗 -->
  93. <van-popup v-model="superiorShow" round style="width: 80%">
  94. <Superior :address="userinfo.parent_address" :level="userinfo.team_level_name" :parantId="userinfo.parent_id"></Superior>
  95. </van-popup>
  96. <BottomNavigation></BottomNavigation>
  97. </div>
  98. </template>
  99. <script>
  100. import Superior from './superiorPopup.vue';
  101. import { Notify } from 'vant';
  102. import { usApi, newsLetterApi, walletApi, homeApi } from '@/api/index';
  103. import { mapState } from 'vuex';
  104. import union from '../../api/union';
  105. import BottomNavigation from '@/components/BottomNavigation.vue';
  106. import Clipboard from 'clipboard';
  107. import Web3 from 'web3';
  108. export default {
  109. data() {
  110. return {
  111. show: false, //上级弹窗状态
  112. withdrawShow: false, //提现弹窗状态
  113. list: [
  114. {
  115. image: require('@/assets/images/link.png'),
  116. name: '邀请链接',
  117. router: 'invite',
  118. },
  119. {
  120. image: require('@/assets/images/team.png'),
  121. name: '我的团队',
  122. router: 'team',
  123. },
  124. {
  125. image: require('@/assets/images/record.png'),
  126. name: '订单记录',
  127. router: 'orders',
  128. },
  129. {
  130. image: require('@/assets/images/record.png'),
  131. name: '提现记录',
  132. router: 'withdrawRecord',
  133. },
  134. {
  135. image: require('@/assets/images/money.png'),
  136. name: '我的上级',
  137. router: '',
  138. },
  139. {
  140. image: require('@/assets/images/money.png'),
  141. name: '我的薪资',
  142. router: 'myAssets',
  143. },
  144. ],
  145. total: 0,
  146. team_level_name: '',
  147. userinfo: {
  148. address: undefined,
  149. nickname: undefined,
  150. avatar: undefined,
  151. team_level_id: undefined,
  152. seso_url: undefined,
  153. submit_limit: 0,
  154. },
  155. order_count: {
  156. pay: 0,
  157. sell: 0,
  158. success: 0,
  159. cancel: 0,
  160. },
  161. withdrawAmount: 0, // 提现金额
  162. feeObj: {
  163. usdt: 0,
  164. withdraw_fee_rate: 0,
  165. withdraw_min_amount: 0,
  166. },
  167. receiptAmount: 0, // 实际到账金额
  168. superiorShow: false, //上级弹窗
  169. };
  170. },
  171. created() {
  172. this.init();
  173. },
  174. mounted() {
  175. // this.init();
  176. },
  177. methods: {
  178. init() {
  179. if (this.account) {
  180. this.userinfo = JSON.parse(localStorage.getItem('userinfo'));
  181. this.userinfo.addressEncrypt = this.userinfo.address.substring(0, 5) + '****' + this.userinfo.address.substring(this.userinfo.address.length - 5, this.userinfo.address.length);
  182. this.getUserInfo();
  183. }
  184. },
  185. switchovers(item) {
  186. console.log(item.router);
  187. if (item.router == '') {
  188. // window.location.href = this.userinfo.seso_url;
  189. this.superiorShow = true;
  190. } else {
  191. this.$router.push({ name: item.router });
  192. }
  193. },
  194. reckoningClick(name, query) {
  195. this.$router.push({ name: name, query: query });
  196. },
  197. getUserInfo() {
  198. homeApi.getUserInfo({}).then(res => {
  199. if (res.code == 200) {
  200. this.userinfo = res.data;
  201. this.order_count = res.data.order_count;
  202. this.userinfo.addressEncrypt = this.userinfo.address.substring(0, 5) + '****' + this.userinfo.address.substring(this.userinfo.address.length - 5, this.userinfo.address.length);
  203. }
  204. });
  205. },
  206. copy() {
  207. if (this.userinfo.address) {
  208. var clipboard = new Clipboard('.copys');
  209. clipboard.on('success', e => {
  210. this.$toast('复制成功');
  211. clipboard.destroy(); // 释放内存
  212. });
  213. clipboard.on('error', e => {
  214. this.$toast('复制失败,浏览器不支持');
  215. clipboard.destroy(); // 释放内存
  216. });
  217. }
  218. },
  219. },
  220. computed: {
  221. ...mapState(['account']),
  222. },
  223. watch: {
  224. account() {
  225. this.init();
  226. },
  227. withdrawAmount(e) {
  228. // this.receiptAmount = 0;
  229. this.receiptAmount = Number(e) - Number(e) * Number(this.feeObj.withdraw_fee_rate);
  230. },
  231. },
  232. components: {
  233. Superior,
  234. BottomNavigation,
  235. },
  236. };
  237. </script>
  238. <style lang="less" scoped>
  239. .mine {
  240. min-height: 100vh;
  241. .banner {
  242. display: flex;
  243. justify-content: space-between;
  244. background: linear-gradient(to bottom right, #7f84f4, #dae9fd);
  245. padding: 40px 16px 80px;
  246. .block_1 {
  247. box-shadow: 0px 0px 29px 0px rgba(97, 142, 184, 0.19);
  248. background-color: rgba(169, 191, 245, 1);
  249. border-radius: 50%;
  250. width: 68px;
  251. height: 68px;
  252. border: 3px solid rgba(#b6b3b3, 1);
  253. margin-right: 14px;
  254. overflow: hidden;
  255. .avatar {
  256. width: 100%;
  257. height: 100%;
  258. }
  259. }
  260. .grade {
  261. display: flex;
  262. align-items: center;
  263. font-size: 14px;
  264. color: #fff;
  265. .grade_img {
  266. display: block;
  267. width: 7px;
  268. height: 12px;
  269. }
  270. }
  271. .text_1 {
  272. color: rgba(6, 12, 80, 1);
  273. font-size: 16px;
  274. font-weight: 600;
  275. padding-bottom: 4px;
  276. }
  277. .level_name {
  278. color: rgba(#000, 0.8);
  279. font-size: 13px;
  280. }
  281. .text_2 {
  282. color: rgba(#000, 0.6);
  283. font-size: 13px;
  284. }
  285. .text-wrapper_1 {
  286. font-size: 11px;
  287. line-height: 100%;
  288. padding: 5px 10px;
  289. background-color: rgba(246, 162, 15, 1);
  290. border-radius: 6px;
  291. margin: 6px;
  292. }
  293. .text-wrapper_2 {
  294. font-size: 11px;
  295. line-height: 100%;
  296. padding: 5px 10px;
  297. background-color: rgb(15, 142, 246);
  298. border-radius: 6px;
  299. margin: 6px;
  300. }
  301. }
  302. .flex-col {
  303. display: flex;
  304. flex-direction: column;
  305. }
  306. .flex-row {
  307. display: flex;
  308. align-items: center;
  309. }
  310. .content {
  311. padding: 0 16px 100px;
  312. margin-top: -40px;
  313. color: #000;
  314. .balance_box {
  315. display: flex;
  316. align-items: center;
  317. justify-content: space-between;
  318. .balance_li {
  319. display: flex;
  320. flex-direction: column;
  321. width: 48%;
  322. font-size: 14px;
  323. padding: 14px;
  324. box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.59);
  325. border-radius: 16px;
  326. background: #fff;
  327. .left {
  328. display: flex;
  329. flex-direction: column;
  330. }
  331. .icon1 {
  332. width: 16px;
  333. height: 16px;
  334. margin-right: 4px;
  335. }
  336. .icon2 {
  337. width: 16px;
  338. height: 14px;
  339. margin-right: 4px;
  340. }
  341. .right {
  342. display: flex;
  343. align-items: center;
  344. color: rgba(92, 112, 157, 1);
  345. font-size: 13px;
  346. margin-top: 6px;
  347. }
  348. .btn {
  349. color: rgba(48, 70, 212, 1);
  350. font-size: 12px;
  351. padding: 4px 8px;
  352. border-radius: 3px;
  353. margin-left: 8px;
  354. background-color: rgba(48, 70, 212, 0.1);
  355. }
  356. .amount {
  357. font-size: 16px;
  358. font-weight: bold;
  359. }
  360. }
  361. }
  362. .order {
  363. font-size: 13px;
  364. color: rgba(153, 153, 153, 1);
  365. border-radius: 16px;
  366. padding: 16px;
  367. box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.59);
  368. margin-top: 16px;
  369. background-color: rgba(255, 255, 255, 1);
  370. .top {
  371. display: flex;
  372. align-items: center;
  373. justify-content: space-between;
  374. padding-bottom: 16px;
  375. border-bottom: 1px solid rgba(232, 240, 247, 1);
  376. .order_text1 {
  377. font-size: 16px;
  378. color: rgba(0, 0, 0, 1);
  379. font-weight: 600;
  380. }
  381. .order_text2 {
  382. font-size: 12px;
  383. }
  384. }
  385. .bottom {
  386. padding-top: 16px;
  387. justify-content: space-between;
  388. .item {
  389. align-items: center;
  390. text-align: center;
  391. .num {
  392. color: rgba(#000, 0.75);
  393. font-size: 16px;
  394. font-weight: 650;
  395. padding-bottom: 4px;
  396. }
  397. }
  398. }
  399. }
  400. .list {
  401. border-radius: 16px;
  402. padding: 0 16px;
  403. margin-top: 16px;
  404. box-shadow: 4px 4px 15px 0px rgba(180, 212, 212, 0.59);
  405. background-color: rgba(255, 255, 255, 1);
  406. .li {
  407. display: flex;
  408. align-items: center;
  409. justify-content: space-between;
  410. font-size: 14px;
  411. color: rgba(51, 51, 51, 1);
  412. padding: 16px 0;
  413. border-bottom: 1px solid rgba(232, 240, 247, 1);
  414. .li_left {
  415. display: flex;
  416. align-items: center;
  417. .li_img {
  418. display: block;
  419. width: 30px;
  420. height: 30px;
  421. margin-right: 6px;
  422. }
  423. }
  424. .right {
  425. width: 7px;
  426. height: 12px;
  427. }
  428. }
  429. :li:last-child {
  430. border-bottom: 0;
  431. }
  432. }
  433. }
  434. .withdrawPopup {
  435. padding: 20px 30px;
  436. color: #666666;
  437. font-size: 14px;
  438. .title {
  439. display: flex;
  440. justify-content: center;
  441. padding-bottom: 20px;
  442. font-weight: bold;
  443. font-size: 16px;
  444. color: #000000;
  445. }
  446. .tip {
  447. font-size: 12px;
  448. display: flex;
  449. flex-direction: column;
  450. }
  451. .btn {
  452. color: #fff;
  453. padding: 16px 0;
  454. text-align: center;
  455. line-height: 50%;
  456. border-radius: 20px;
  457. margin-top: 18px;
  458. background-color: #238be8;
  459. }
  460. .close—icon {
  461. position: absolute;
  462. bottom: -40px;
  463. left: 45%;
  464. }
  465. }
  466. }
  467. /deep/ .van-popup {
  468. overflow-y: visible;
  469. }
  470. /deep/ .van-field {
  471. background-color: #f2f9f9;
  472. border-radius: 8px;
  473. margin: 6px 0;
  474. }
  475. /deep/ .van-field__body {
  476. padding: 10px 10px;
  477. }
  478. </style>