user.vue 9.8 KB

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