user.vue 11 KB

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