user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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. </view>
  165. </template>
  166. <script>
  167. import {
  168. getIndex,
  169. } from "@/api/index.js";
  170. import {
  171. gameWallet,
  172. } from "@/api/game.js";
  173. import {
  174. mapState,
  175. mapMutations
  176. } from 'vuex';
  177. import {
  178. getUserInfo,
  179. getUser
  180. } from '@/api/user.js';
  181. import {
  182. saveUrl,
  183. interceptor
  184. } from '@/utils/loginUtils.js';
  185. export default {
  186. data() {
  187. return {
  188. current: 2,
  189. show: true,
  190. userWallet: 0, //余额
  191. userWalletRmb: 0,
  192. userPKR: 0,
  193. userPKRRmb: 0,
  194. extractTotalPrice: '', //累计体现
  195. sum_win: '', //累计收益
  196. sum_bet: '', //个人交易量
  197. group_sum_bet: '', // 团队交易量
  198. user: {},
  199. service: ""
  200. };
  201. },
  202. onShow() {
  203. // 判断是否已经登录
  204. if (this.hasLogin) {
  205. this.getUserWallet();
  206. this.getUser();
  207. }
  208. this.loadBaseData();
  209. this.getIndex()
  210. },
  211. computed: {
  212. ...mapState('user', ['hasLogin', 'userInfo']),
  213. ...mapState(['baseURL', 'urlFile']),
  214. },
  215. methods: {
  216. ...mapMutations('user', ['setUserInfo']),
  217. copyShareLink() {
  218. if (!this.hasLogin) {
  219. // 保存地址
  220. saveUrl();
  221. // 登录拦截
  222. interceptor();
  223. } else {
  224. uni.setClipboardData({
  225. data: this.baseURL + this.urlFile + '/#/pages/index/index?spread=' + this.user.account,
  226. success: function() {
  227. //调用方法成功
  228. console.log("success");
  229. },
  230. });
  231. }
  232. },
  233. showY() {
  234. this.show = !this.show
  235. },
  236. async getIndex() {
  237. const res = await getIndex()
  238. this.service = res.data.service
  239. },
  240. // 统计表
  241. async getUser() {
  242. const res = await getUser();
  243. this.user = res.data;
  244. this.recharge = res.data.recharge;
  245. this.extractTotalPrice = res.data.extractTotalPrice;
  246. this.sum_win = res.data.sum_win.toFixed(2);
  247. this.sum_bet = res.data.sum_bet
  248. this.group_sum_bet = res.data.group_sum_bet
  249. },
  250. // 跳转到联系客服
  251. nav() {
  252. window.location.href = this.service
  253. },
  254. // 获取用户余额信息
  255. getUserWallet() {
  256. gameWallet().then((res) => {
  257. const balance = Number(res.data.back.USDT.money.money);
  258. this.userWallet = +balance.toFixed(2);
  259. this.userWalletRmb = Number(res.data.back.USDT.rmb);
  260. this.userPKR = Number(res.data.back.PKR.money.money);
  261. this.userPKRRmb = Number(res.data.back.PKR.rmb);
  262. // this.userWallet = +res.data.back.USDT.money.money
  263. })
  264. },
  265. // 加载初始数据
  266. loadBaseData() {
  267. const obj = this
  268. getUserInfo({})
  269. .then(({
  270. data
  271. }) => {
  272. obj.setUserInfo(data);
  273. })
  274. .catch(e => {
  275. console.log(e);
  276. });
  277. },
  278. /**
  279. * 统一跳转接口,拦截未登录路由
  280. * navigator标签现在默认没有转场动画,所以用view
  281. */
  282. navTo(url) {
  283. if (!this.hasLogin) {
  284. // 保存地址
  285. saveUrl();
  286. // 登录拦截
  287. interceptor();
  288. } else {
  289. uni.navigateTo({
  290. url
  291. });
  292. }
  293. },
  294. }
  295. };
  296. </script>
  297. <style lang="scss">
  298. .container {
  299. height: 100%;
  300. line-height: 1;
  301. }
  302. .top {
  303. height: 327rpx;
  304. background-color: #000000;
  305. padding: 0 45rpx;
  306. .my {
  307. padding-top: 40rpx;
  308. font-size: 48rpx;
  309. font-weight: 500;
  310. color: #FFFFFF;
  311. }
  312. .userinfo {
  313. padding-top: 40rpx;
  314. .image {
  315. border-radius: 100rpx;
  316. overflow: hidden;
  317. width: 125rpx;
  318. height: 125rpx;
  319. }
  320. .info {
  321. .infor {
  322. font-size: 30rpx;
  323. font-weight: 500;
  324. color: #FFFFFF;
  325. }
  326. .vipIcon {
  327. width: 40rpx;
  328. height: 40rpx;
  329. margin-left: 10rpx;
  330. }
  331. .uservip {
  332. font-size: 30rpx;
  333. font-weight: 500;
  334. color: #93794B;
  335. }
  336. }
  337. }
  338. }
  339. .inf {
  340. margin-top: 25rpx;
  341. width: 48rpx;
  342. height: 48rpx;
  343. }
  344. // body
  345. .body {
  346. background-color: #191a1f;
  347. padding: 30rpx;
  348. border-top-right-radius: 60rpx;
  349. border-top-left-radius: 60rpx;
  350. color: #FFFFFF;
  351. .yue {
  352. text-align: center;
  353. padding-top: 40rpx;
  354. padding-bottom: 35rpx;
  355. .item {
  356. background-color: #000000;
  357. border-radius: 30rpx;
  358. padding: 30rpx;
  359. text-align: left;
  360. width: 48%;
  361. .te {
  362. font-size: 26rpx;
  363. font-weight: 500;
  364. padding-bottom: 30rpx;
  365. .tip {
  366. width: 64rpx;
  367. height: 64rpx;
  368. }
  369. }
  370. .tex {
  371. font-size: $font-lg;
  372. font-weight: bold;
  373. padding-bottom: 30rpx;
  374. }
  375. .texmoney {
  376. font-size: $font-lg;
  377. color: $font-color-disabled;
  378. }
  379. }
  380. .btn {
  381. padding: 0 50rpx;
  382. .btn1 {
  383. min-width: 270rpx;
  384. background: #FDB242;
  385. border-radius: 10rpx;
  386. font-size: $font-base;
  387. }
  388. }
  389. }
  390. .yue1 {
  391. background-color: #000000;
  392. padding: 30rpx;
  393. color: #FFFFFF;
  394. border-radius: 60rpx;
  395. .tj {
  396. font-size: 30rpx;
  397. font-weight: bold;
  398. text-align: center;
  399. }
  400. .tj-item {
  401. padding-top: 26rpx;
  402. font-size: 24rpx;
  403. opacity: 0.65;
  404. }
  405. }
  406. }
  407. .gj {
  408. margin-left: 20rpx;
  409. padding-top: 10rpx;
  410. font-size: 36rpx;
  411. font-weight: bold;
  412. color: #FFFFFF;
  413. padding-bottom: 10rpx;
  414. }
  415. .user-list {
  416. background: #191a1f;
  417. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  418. margin: 0 auto;
  419. padding: 30rpx 25rpx;
  420. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  421. .left-img {
  422. width: 40rpx;
  423. height: 40rpx;
  424. margin-right: 20rpx;
  425. }
  426. .item-name {
  427. flex-grow: 1;
  428. font-size: 29rpx;
  429. font-weight: bold;
  430. color: #FFF;
  431. }
  432. .right-img {
  433. width: 18rpx;
  434. height: 27rpx;
  435. }
  436. }
  437. </style>