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