user.vue 8.8 KB

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