user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <view class="container">
  3. <view class="top">
  4. <view class="my">{{$t('home.d4')}}</view>
  5. <view class="userinfo flex">
  6. <view class="flex" @click="navTo('/pages/user/set/userinfo')">
  7. <image class="image margin-r-10" :src="userInfo.avatar || '/static/error/missing-face.png'"
  8. mode="scaleToFill">
  9. </image>
  10. <view class="info">
  11. <view class="infor margin-b-20">{{ user.nickname || '游客' }}</view>
  12. <view class="uservip flex-start" v-if="user.vip">
  13. <text>
  14. {{ user.vip_name}}
  15. </text>
  16. <image class="vipIcon" :src="user.vip_icon" mode="scaleToFill"></image>
  17. </view>
  18. </view>
  19. </view>
  20. <image @click="showY" class="inf" src="../../static/shouye/userinfo.png" mode="scaleToFill"></image>
  21. </view>
  22. </view>
  23. <!-- 余额 -->
  24. <view class="body">
  25. <template v-if="hasLogin">
  26. <view v-if="show" class="yue margin-b-30">
  27. <view class="flex">
  28. <view class="item">
  29. <view class="te flex-start">
  30. <image class="tip margin-r-10" src="../../static/icon/user-U.png" mode="scaleToFill">
  31. </image>
  32. <text>
  33. USDT
  34. </text>
  35. </view>
  36. <view class="tex">
  37. {{userWallet}}
  38. </view>
  39. <!-- <view class="texmoney">
  40. ≈¥{{userWalletRmb}}
  41. </view> -->
  42. </view>
  43. <view class="item">
  44. <view class="te flex-start">
  45. <image class="tip margin-r-10" src="../../static/icon/user-R.png" mode="scaleToFill">
  46. </image>
  47. <text>
  48. PKR
  49. </text>
  50. </view>
  51. <view class="tex">
  52. {{userPKR}}
  53. </view>
  54. <!-- <view class="texmoney">
  55. ≈¥{{userPKRRmb}}
  56. </view> -->
  57. </view>
  58. </view>
  59. <view class="btn margin-t-30 flex">
  60. <button @click="navTo('/pages/user/money/recharge')" class="btn1">
  61. <text>{{$t('user.a7')}}</text>
  62. </button>
  63. <button @click="navTo('/pages/user/money/withdrawal')" class="btn1">
  64. <text>{{$t('user.a6')}}</text>
  65. </button>
  66. </view>
  67. </view>
  68. <view v-else class="yue1 margin-b-30">
  69. <view class="tj">{{$t('user.a1')}}</view>
  70. <view class="tj-item flex ">
  71. <view class="lj">{{$t('user.a4')}}{{$t('user.a7')}}</view>
  72. <view class="ljsu">{{userInfo.sum_recharge || 0}}</view>
  73. </view>
  74. <view class="tj-item flex">
  75. <view class="lj">{{$t('user.a4')}}{{$t('user.a6')}}</view>
  76. <view class="ljsu">{{userInfo.sum_extract || 0}}</view>
  77. </view>
  78. <view class="tj-item flex">
  79. <view class="lj">{{$t('user.a8')}}</view>
  80. <view class="ljsu">{{sum_win || 0}}</view>
  81. </view>
  82. <view class="tj-item flex">
  83. <view class="lj">{{$t('user.a9')}}</view>
  84. <view class="ljsu">{{sum_bet || 0}}</view>
  85. </view>
  86. <view class="tj-item flex">
  87. <view class="lj">{{$t('user.a10')}}</view>
  88. <view class="ljsu">{{group_sum_bet || 0}}</view>
  89. </view>
  90. </view>
  91. </template>
  92. <!-- 列表 -->
  93. <view class="gj">
  94. {{$t('user.b1')}}
  95. </view>
  96. <view class="user-list flex" @click="navTo('/pages/user/money/team')">
  97. <image src="../../static/shouye/yue.png" mode="scaleToFill" class="left-img"></image>
  98. <view class="item-name">
  99. {{$t('user.b2')}}
  100. </view>
  101. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  102. </view>
  103. <!-- 额外添加 -->
  104. <view class="user-list flex" @click="navTo('/pages/user/shareQrCode')">
  105. <image src="../../static/shouye/money.png" mode="scaleToFill" class="left-img"></image>
  106. <view class="item-name">
  107. {{$t('user.b3')}}
  108. </view>
  109. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  110. </view>
  111. <!-- 额外添加 -->
  112. <view class="user-list flex" @click="navTo('/pages/user/vip/tabulation')">
  113. <image src="../../static/shouye/liebiao.png" mode="scaleToFill" class="left-img"></image>
  114. <view class="item-name">
  115. {{$t('user.b4')}}
  116. </view>
  117. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  118. </view>
  119. <view class="user-list flex" @click="copyShareLink">
  120. <image src="../../static/shouye/liebiao.png" mode="scaleToFill" class="left-img"></image>
  121. <view class="item-name">
  122. {{$t('user.b5')}}
  123. </view>
  124. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  125. </view>
  126. <!-- <view class="user-list flex" @click="openKf()">
  127. <image src="../../static/shouye/liuyan.png" mode="scaleToFill" class="left-img"></image>
  128. <view class="item-name">
  129. {{$t('user.b6')}}
  130. </view>
  131. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  132. </view> -->
  133. <!-- <view class="user-list flex" @click="navTo('/pages/user/set/transaction')">
  134. <image src="../../static/shouye/jiaoyi.png" mode="scaleToFill" class="left-img"></image>
  135. <view class="item-name">
  136. {{$t('user.b7')}}
  137. </view>
  138. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  139. </view> -->
  140. <!-- <view class="user-list flex" @click="navTo('/pages/public/login')">
  141. <image src="../../static/shouye/tuichu.png" mode="scaleToFill" class="left-img"></image>
  142. <view class="item-name">
  143. {{$t('user.b8')}}
  144. </view>
  145. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  146. </view> -->
  147. <!-- 跳转到联系客服 -->
  148. <view class="user-list flex" @click="nav()">
  149. <image src="../../static/shouye/yue.png" mode="scaleToFill" class="left-img"></image>
  150. <view class="item-name">
  151. {{$t('user.a2')}}
  152. </view>
  153. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  154. </view>
  155. <!-- todo -->
  156. <view class="user-list flex" @click="navTo('/pages/user/set/set')">
  157. <image src="../../static/shouye/shezhi.png" mode="scaleToFill" class="left-img"></image>
  158. <view class="item-name">
  159. {{$t('user.b9')}}
  160. </view>
  161. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  162. </view>
  163. </view>
  164. <taber tab='user'></taber>
  165. </view>
  166. </template>
  167. <script>
  168. import {
  169. getIndex,
  170. } from "@/api/index.js";
  171. import {
  172. gameWallet,
  173. } from "@/api/game.js";
  174. import taber from "@/components/footer/footer.vue";
  175. import {
  176. mapState,
  177. mapMutations
  178. } from 'vuex';
  179. import {
  180. getUserInfo,
  181. getUser
  182. } from '@/api/user.js';
  183. import {
  184. saveUrl,
  185. interceptor
  186. } from '@/utils/loginUtils.js';
  187. export default {
  188. components: {
  189. taber
  190. },
  191. data() {
  192. return {
  193. current: 2,
  194. show: true,
  195. userWallet: 0, //余额
  196. userWalletRmb: 0,
  197. userPKR: 0,
  198. userPKRRmb: 0,
  199. extractTotalPrice: '', //累计体现
  200. sum_win: '', //累计收益
  201. sum_bet: '', //个人交易量
  202. group_sum_bet: '', // 团队交易量
  203. user: {},
  204. service: ""
  205. };
  206. },
  207. onShow() {
  208. // 判断是否已经登录
  209. if (this.hasLogin) {
  210. this.getUserWallet();
  211. this.getUser();
  212. }
  213. this.loadBaseData();
  214. this.getIndex()
  215. },
  216. computed: {
  217. ...mapState('user', ['hasLogin', 'userInfo']),
  218. ...mapState(['baseURL', 'urlFile']),
  219. },
  220. methods: {
  221. ...mapMutations('user', ['setUserInfo']),
  222. copyShareLink() {
  223. if (!this.hasLogin) {
  224. // 保存地址
  225. saveUrl();
  226. // 登录拦截
  227. interceptor();
  228. } else {
  229. uni.setClipboardData({
  230. data: this.baseURL + this.urlFile + '/#/pages/index/index?spread=' + this.user.account,
  231. success: function() {
  232. //调用方法成功
  233. console.log("success");
  234. },
  235. });
  236. }
  237. },
  238. showY() {
  239. this.show = !this.show
  240. },
  241. async getIndex() {
  242. const res = await getIndex()
  243. this.service = res.data.service
  244. },
  245. // 统计表
  246. async getUser() {
  247. const res = await getUser();
  248. this.user = res.data;
  249. this.recharge = res.data.recharge;
  250. this.extractTotalPrice = res.data.extractTotalPrice;
  251. this.sum_win = res.data.sum_win.toFixed(2);
  252. this.sum_bet = res.data.sum_bet
  253. this.group_sum_bet = res.data.group_sum_bet
  254. },
  255. // 跳转到联系客服
  256. nav() {
  257. window.location.href = this.service
  258. },
  259. // 获取用户余额信息
  260. getUserWallet() {
  261. gameWallet().then((res) => {
  262. const balance = Number(res.data.back.USDT.money.money);
  263. this.userWallet = +balance.toFixed(2);
  264. this.userWalletRmb = Number(res.data.back.USDT.rmb);
  265. this.userPKR = Number(res.data.back.PKR.money.money);
  266. this.userPKRRmb = Number(res.data.back.PKR.rmb);
  267. // this.userWallet = +res.data.back.USDT.money.money
  268. })
  269. },
  270. // 加载初始数据
  271. loadBaseData() {
  272. const obj = this
  273. getUserInfo({})
  274. .then(({
  275. data
  276. }) => {
  277. obj.setUserInfo(data);
  278. })
  279. .catch(e => {
  280. console.log(e);
  281. });
  282. },
  283. /**
  284. * 统一跳转接口,拦截未登录路由
  285. * navigator标签现在默认没有转场动画,所以用view
  286. */
  287. navTo(url) {
  288. if (!this.hasLogin) {
  289. // 保存地址
  290. saveUrl();
  291. // 登录拦截
  292. interceptor();
  293. } else {
  294. uni.navigateTo({
  295. url
  296. });
  297. }
  298. },
  299. }
  300. };
  301. </script>
  302. <style lang="scss">
  303. .container {
  304. height: 100%;
  305. line-height: 1;
  306. }
  307. .top {
  308. height: 327rpx;
  309. background-color: #000000;
  310. padding: 0 45rpx;
  311. .my {
  312. padding-top: 40rpx;
  313. font-size: 48rpx;
  314. font-weight: 500;
  315. color: #FFFFFF;
  316. }
  317. .userinfo {
  318. padding-top: 40rpx;
  319. .image {
  320. border-radius: 100rpx;
  321. overflow: hidden;
  322. width: 125rpx;
  323. height: 125rpx;
  324. }
  325. .info {
  326. .infor {
  327. font-size: 30rpx;
  328. font-weight: 500;
  329. color: #FFFFFF;
  330. }
  331. .vipIcon {
  332. width: 40rpx;
  333. height: 40rpx;
  334. margin-left: 10rpx;
  335. }
  336. .uservip {
  337. font-size: 30rpx;
  338. font-weight: 500;
  339. color: #93794B;
  340. }
  341. }
  342. }
  343. }
  344. .inf {
  345. margin-top: 25rpx;
  346. width: 48rpx;
  347. height: 48rpx;
  348. }
  349. // body
  350. .body {
  351. background-color: #191a1f;
  352. padding: 30rpx;
  353. border-top-right-radius: 60rpx;
  354. border-top-left-radius: 60rpx;
  355. color: #FFFFFF;
  356. .yue {
  357. text-align: center;
  358. padding-top: 40rpx;
  359. padding-bottom: 35rpx;
  360. .item {
  361. background-color: #000000;
  362. border-radius: 30rpx;
  363. padding: 30rpx;
  364. text-align: left;
  365. width: 48%;
  366. .te {
  367. font-size: 26rpx;
  368. font-weight: 500;
  369. padding-bottom: 30rpx;
  370. .tip {
  371. width: 64rpx;
  372. height: 64rpx;
  373. }
  374. }
  375. .tex {
  376. font-size: $font-lg;
  377. font-weight: bold;
  378. padding-bottom: 30rpx;
  379. }
  380. .texmoney {
  381. font-size: $font-lg;
  382. color: $font-color-disabled;
  383. }
  384. }
  385. .btn {
  386. padding: 0 50rpx;
  387. .btn1 {
  388. min-width: 270rpx;
  389. background: #FDB242;
  390. border-radius: 10rpx;
  391. font-size: $font-base;
  392. }
  393. }
  394. }
  395. .yue1 {
  396. background-color: #000000;
  397. padding: 30rpx;
  398. color: #FFFFFF;
  399. border-radius: 60rpx;
  400. .tj {
  401. font-size: 30rpx;
  402. font-weight: bold;
  403. text-align: center;
  404. }
  405. .tj-item {
  406. padding-top: 26rpx;
  407. font-size: 24rpx;
  408. opacity: 0.65;
  409. }
  410. }
  411. }
  412. .gj {
  413. margin-left: 20rpx;
  414. padding-top: 10rpx;
  415. font-size: 36rpx;
  416. font-weight: bold;
  417. color: #FFFFFF;
  418. padding-bottom: 10rpx;
  419. }
  420. .user-list {
  421. background: #191a1f;
  422. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  423. margin: 0 auto;
  424. padding: 30rpx 25rpx;
  425. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  426. .left-img {
  427. width: 40rpx;
  428. height: 40rpx;
  429. margin-right: 20rpx;
  430. }
  431. .item-name {
  432. flex-grow: 1;
  433. font-size: 29rpx;
  434. font-weight: bold;
  435. color: #FFF;
  436. }
  437. .right-img {
  438. width: 18rpx;
  439. height: 27rpx;
  440. }
  441. }
  442. </style>