user.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. this.userWallet = +res.data.back.USDT.money.money
  215. })
  216. },
  217. // 加载初始数据
  218. loadBaseData() {
  219. const obj = this
  220. getUserInfo({})
  221. .then(({
  222. data
  223. }) => {
  224. obj.setUserInfo(data);
  225. })
  226. .catch(e => {
  227. console.log(e);
  228. });
  229. },
  230. /**
  231. * 统一跳转接口,拦截未登录路由
  232. * navigator标签现在默认没有转场动画,所以用view
  233. */
  234. navTo(url) {
  235. if (!this.hasLogin) {
  236. // 保存地址
  237. saveUrl();
  238. // 登录拦截
  239. interceptor();
  240. } else {
  241. uni.navigateTo({
  242. url
  243. });
  244. }
  245. },
  246. }
  247. };
  248. </script>
  249. <style lang="scss">
  250. .container {
  251. height: 100%;
  252. line-height: 1;
  253. }
  254. .top {
  255. height: 327rpx;
  256. background-color: #000000;
  257. padding: 0 45rpx;
  258. .my {
  259. padding-top: 40rpx;
  260. font-size: 48rpx;
  261. font-weight: 500;
  262. color: #FFFFFF;
  263. }
  264. .userinfo {
  265. padding-top: 40rpx;
  266. .image {
  267. border-radius: 100rpx;
  268. overflow: hidden;
  269. width: 125rpx;
  270. height: 125rpx;
  271. }
  272. .info {
  273. .infor {
  274. font-size: 30rpx;
  275. font-weight: 500;
  276. color: #FFFFFF;
  277. }
  278. .vipIcon{
  279. width: 40rpx;
  280. height: 40rpx;
  281. margin-left: 10rpx;
  282. }
  283. .uservip {
  284. font-size: 20rpx;
  285. font-weight: 500;
  286. color: #93794B;
  287. }
  288. }
  289. }
  290. }
  291. .inf {
  292. margin-top: 25rpx;
  293. width: 48rpx;
  294. height: 48rpx;
  295. }
  296. // body
  297. .body {
  298. background-color: #191a1f;
  299. padding: 30rpx;
  300. border-top-right-radius: 60rpx;
  301. border-top-left-radius: 60rpx;
  302. color: #FFFFFF;
  303. .yue {
  304. border-radius: 60rpx;
  305. background-color: #000000;
  306. text-align: center;
  307. padding-top: 40rpx;
  308. padding-bottom: 35rpx;
  309. .te {
  310. font-size: 26rpx;
  311. font-weight: 500;
  312. padding-bottom: 30rpx;
  313. }
  314. .tex {
  315. font-size: 48rpx;
  316. font-weight: bold;
  317. padding-bottom: 50rpx;
  318. }
  319. .btn {
  320. padding: 0 50rpx;
  321. .btn1 {
  322. min-width: 270rpx;
  323. background: #FDB242;
  324. border-radius: 10rpx;
  325. font-size: $font-base;
  326. }
  327. }
  328. }
  329. .yue1 {
  330. background-color: #000000;
  331. padding: 30rpx;
  332. color: #FFFFFF;
  333. border-radius: 60rpx;
  334. .tj {
  335. font-size: 30rpx;
  336. font-weight: bold;
  337. text-align: center;
  338. }
  339. .tj-item {
  340. padding-top: 26rpx;
  341. font-size: 24rpx;
  342. opacity: 0.65;
  343. }
  344. }
  345. }
  346. .gj {
  347. margin-left: 20rpx;
  348. padding-top: 10rpx;
  349. font-size: 36rpx;
  350. font-weight: bold;
  351. color: #FFFFFF;
  352. padding-bottom: 10rpx;
  353. }
  354. .user-list {
  355. background: #191a1f;
  356. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  357. margin: 0 auto;
  358. padding: 30rpx 25rpx;
  359. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  360. .left-img {
  361. width: 40rpx;
  362. height: 40rpx;
  363. margin-right: 20rpx;
  364. }
  365. .item-name {
  366. flex-grow: 1;
  367. font-size: 29rpx;
  368. font-weight: bold;
  369. color: #FFF;
  370. }
  371. .right-img {
  372. width: 18rpx;
  373. height: 27rpx;
  374. }
  375. }
  376. </style>