user.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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">{{userWallet || 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">{{extractTotalPrice || 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. <!-- todo -->
  120. <view class="user-list flex" @click="navTo('/pages/user/set/set')">
  121. <image src="../../static/shouye/shezhi.png" mode="scaleToFill" class="left-img"></image>
  122. <view class="item-name">
  123. {{$t('user.b9')}}
  124. </view>
  125. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  126. </view>
  127. </view>
  128. <taber tab='user'></taber>
  129. </view>
  130. </template>
  131. <script>
  132. import {
  133. gameWallet,
  134. } from "@/api/game.js";
  135. import taber from "@/components/footer/footer.vue";
  136. import {
  137. mapState,
  138. mapMutations
  139. } from 'vuex';
  140. import {
  141. getUserInfo,
  142. getUser
  143. } from '@/api/user.js';
  144. import {
  145. saveUrl,
  146. interceptor
  147. } from '@/utils/loginUtils.js';
  148. export default {
  149. components: {
  150. taber
  151. },
  152. data() {
  153. return {
  154. current: 2,
  155. show: true,
  156. userWallet: 0, //余额
  157. extractTotalPrice: '', //累计体现
  158. sum_win: '', //累计收益
  159. sum_bet: '', //个人交易量
  160. group_sum_bet: '', // 团队交易量
  161. userInfo:{}
  162. };
  163. },
  164. onShow() {
  165. // 判断是否已经登录
  166. if (this.hasLogin) {
  167. this.getUserWallet();
  168. this.getUser();
  169. }
  170. this.loadBaseData();
  171. },
  172. computed: {
  173. ...mapState('user', [ 'hasLogin'])
  174. },
  175. methods: {
  176. ...mapMutations('user', ['setUserInfo']),
  177. showY() {
  178. this.show = !this.show
  179. },
  180. // 统计表
  181. async getUser() {
  182. const res = await getUser();
  183. this.userInfo = res.data;
  184. this.recharge = res.data.recharge;
  185. this.extractTotalPrice = res.data.extractTotalPrice;
  186. this.sum_win = res.data.sum_win;
  187. this.sum_bet = res.data.sum_bet
  188. this.group_sum_bet = res.data.group_sum_bet
  189. },
  190. // 获取用户余额信息
  191. getUserWallet() {
  192. gameWallet().then((res) => {
  193. this.userWallet = +res.data.back.USDT.money.money
  194. })
  195. },
  196. // 加载初始数据
  197. loadBaseData() {
  198. const obj = this
  199. getUserInfo({})
  200. .then(({
  201. data
  202. }) => {
  203. obj.setUserInfo(data);
  204. })
  205. .catch(e => {
  206. console.log(e);
  207. });
  208. },
  209. /**
  210. * 统一跳转接口,拦截未登录路由
  211. * navigator标签现在默认没有转场动画,所以用view
  212. */
  213. navTo(url) {
  214. if (!this.hasLogin) {
  215. // 保存地址
  216. saveUrl();
  217. // 登录拦截
  218. interceptor();
  219. } else {
  220. uni.navigateTo({
  221. url
  222. });
  223. }
  224. },
  225. }
  226. };
  227. </script>
  228. <style lang="scss">
  229. .container {
  230. height: 100%;
  231. line-height: 1;
  232. }
  233. .top {
  234. height: 327rpx;
  235. background-color: #000000;
  236. padding: 0 45rpx;
  237. .my {
  238. padding-top: 40rpx;
  239. font-size: 48rpx;
  240. font-weight: 500;
  241. color: #FFFFFF;
  242. }
  243. .userinfo {
  244. padding-top: 40rpx;
  245. .image {
  246. border-radius: 100rpx;
  247. overflow: hidden;
  248. width: 125rpx;
  249. height: 125rpx;
  250. }
  251. .info {
  252. .infor {
  253. font-size: 30rpx;
  254. font-weight: 500;
  255. color: #FFFFFF;
  256. }
  257. .vipIcon{
  258. width: 40rpx;
  259. height: 40rpx;
  260. margin-left: 10rpx;
  261. }
  262. .uservip {
  263. font-size: 20rpx;
  264. font-weight: 500;
  265. color: #93794B;
  266. }
  267. }
  268. }
  269. }
  270. .inf {
  271. margin-top: 25rpx;
  272. width: 48rpx;
  273. height: 48rpx;
  274. }
  275. // body
  276. .body {
  277. background-color: #191a1f;
  278. padding: 30rpx;
  279. border-top-right-radius: 60rpx;
  280. border-top-left-radius: 60rpx;
  281. color: #FFFFFF;
  282. .yue {
  283. border-radius: 60rpx;
  284. background-color: #000000;
  285. text-align: center;
  286. padding-top: 40rpx;
  287. padding-bottom: 35rpx;
  288. .te {
  289. font-size: 26rpx;
  290. font-weight: 500;
  291. padding-bottom: 30rpx;
  292. }
  293. .tex {
  294. font-size: 48rpx;
  295. font-weight: bold;
  296. padding-bottom: 50rpx;
  297. }
  298. .btn {
  299. padding: 0 50rpx;
  300. .btn1 {
  301. min-width: 270rpx;
  302. background: #FDB242;
  303. border-radius: 10rpx;
  304. font-size: $font-base;
  305. }
  306. }
  307. }
  308. .yue1 {
  309. background-color: #000000;
  310. padding: 30rpx;
  311. color: #FFFFFF;
  312. border-radius: 60rpx;
  313. .tj {
  314. font-size: 30rpx;
  315. font-weight: bold;
  316. text-align: center;
  317. }
  318. .tj-item {
  319. padding-top: 26rpx;
  320. font-size: 24rpx;
  321. opacity: 0.65;
  322. }
  323. }
  324. }
  325. .gj {
  326. margin-left: 20rpx;
  327. padding-top: 10rpx;
  328. font-size: 36rpx;
  329. font-weight: bold;
  330. color: #FFFFFF;
  331. padding-bottom: 10rpx;
  332. }
  333. .user-list {
  334. background: #191a1f;
  335. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  336. margin: 0 auto;
  337. padding: 30rpx 25rpx;
  338. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  339. .left-img {
  340. width: 40rpx;
  341. height: 40rpx;
  342. margin-right: 20rpx;
  343. }
  344. .item-name {
  345. flex-grow: 1;
  346. font-size: 29rpx;
  347. font-weight: bold;
  348. color: #FFF;
  349. }
  350. .right-img {
  351. width: 18rpx;
  352. height: 27rpx;
  353. }
  354. }
  355. </style>