user.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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/set')">
  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/userinfo')">
  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. orderData,
  137. getUserInfo,
  138. getUser
  139. } from '@/api/user.js';
  140. import {
  141. saveUrl,
  142. interceptor
  143. } from '@/utils/loginUtils.js';
  144. let startY = 0,
  145. moveY = 0,
  146. pageAtTop = true;
  147. export default {
  148. components: {
  149. taber
  150. },
  151. data() {
  152. return {
  153. current: 2,
  154. store_name: '',
  155. achievement: '',
  156. code: '',
  157. levelList: [],
  158. show: true,
  159. userWallet: 0, //余额
  160. recharge: '', // 累计充值
  161. extractTotalPrice: '', //累计体现
  162. sum_win: '', //累计收益
  163. sum_bet: '', //个人交易量
  164. group_sum_bet: '', // 团队交易量
  165. };
  166. },
  167. onShow() {
  168. // 判断是否已经登录
  169. // if (this.hasLogin) {
  170. // this.loadBaseData();
  171. // }
  172. this.loadBaseData();
  173. this.getUserWallet();
  174. this.getUser();
  175. },
  176. filters: {
  177. phone(e) {
  178. var subStr1 = e.substr(0, 3);
  179. var subStr2 = e.substr(e.length - 4, 4);
  180. var subStr = subStr1 + '...' + subStr2;
  181. e = subStr;
  182. return e;
  183. }
  184. },
  185. onReady() {
  186. // 初始化获取页面宽度
  187. uni.createSelectorQuery()
  188. .select('.container')
  189. .fields({
  190. size: true
  191. },
  192. data => {
  193. // 计算最多下拉的高度
  194. this.userDowm = Math.floor((data.width / 750) * 185);
  195. // 计算最大触发修改高度事件
  196. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  197. }
  198. )
  199. .exec();
  200. },
  201. computed: {
  202. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  203. },
  204. methods: {
  205. ...mapMutations('user', ['setUserInfo']),
  206. showY() {
  207. this.show = !this.show
  208. },
  209. // 统计表
  210. async getUser() {
  211. const res = await getUser()
  212. console.log('2222',res);
  213. this.recharge = res.data.recharge;
  214. this.extractTotalPrice = res.data.extractTotalPrice;
  215. this.sum_win = res.data.sum_win;
  216. this.sum_bet = res.data.sum_bet
  217. this.group_sum_bet = res.data.group_sum_bet
  218. },
  219. // 获取用户余额信息
  220. getUserWallet() {
  221. gameWallet().then((res) => {
  222. this.userWallet = +res.data.back.USDT.money.money
  223. })
  224. },
  225. // 加载初始数据
  226. loadBaseData() {
  227. const obj = this
  228. getUserInfo({})
  229. .then(({
  230. data
  231. }) => {
  232. obj.setUserInfo(data);
  233. })
  234. .catch(e => {
  235. console.log(e);
  236. });
  237. },
  238. /**
  239. * 统一跳转接口,拦截未登录路由
  240. * navigator标签现在默认没有转场动画,所以用view
  241. */
  242. navTo(url) {
  243. console.log(url);
  244. if (!this.hasLogin) {
  245. // 保存地址
  246. saveUrl();
  247. // 登录拦截
  248. interceptor();
  249. } else {
  250. uni.navigateTo({
  251. url
  252. });
  253. }
  254. },
  255. cast() {
  256. set_waiter({
  257. uid: this.id
  258. })
  259. .then(e => {
  260. this.$api.msg('绑定成功');
  261. this.$refs.gspass.close();
  262. this.id = '';
  263. })
  264. .catch(err => {
  265. this.$refs.gspass.close();
  266. this.id = '';
  267. });
  268. },
  269. // cancelpass() {
  270. // this.$refs.gspass.close();
  271. // this.id = '';
  272. // }
  273. }
  274. };
  275. </script>
  276. <style lang="scss">
  277. .container {
  278. height: 100%;
  279. line-height: 1;
  280. }
  281. .top {
  282. height: 327rpx;
  283. background-color: #000000;
  284. padding: 0 45rpx;
  285. .my {
  286. padding-top: 40rpx;
  287. font-size: 48rpx;
  288. font-weight: 500;
  289. color: #FFFFFF;
  290. }
  291. .userinfo {
  292. padding-top: 40rpx;
  293. .image {
  294. width: 125rpx;
  295. height: 125rpx;
  296. }
  297. .info {
  298. .infor {
  299. font-size: 30rpx;
  300. font-weight: 500;
  301. color: #FFFFFF;
  302. }
  303. .uservip {
  304. display: flex;
  305. align-items: center;
  306. justify-content: center;
  307. background: url('../../static/img/vip-bg.png') 100%/contain no-repeat;
  308. padding: 6rpx 72rpx;
  309. font-size: 20rpx;
  310. font-weight: 500;
  311. color: #93794B;
  312. }
  313. }
  314. }
  315. }
  316. .in {
  317. width: 128rpx;
  318. height: 45rpx;
  319. }
  320. .inf {
  321. margin-top: 25rpx;
  322. width: 48rpx;
  323. height: 48rpx;
  324. }
  325. // body
  326. .body {
  327. background-color: #191a1f;
  328. padding: 30rpx;
  329. border-top-right-radius: 60rpx;
  330. border-top-left-radius: 60rpx;
  331. color: #FFFFFF;
  332. .yue {
  333. border-radius: 60rpx;
  334. background-color: #000000;
  335. text-align: center;
  336. padding-top: 40rpx;
  337. padding-bottom: 35rpx;
  338. .te {
  339. font-size: 26rpx;
  340. font-weight: 500;
  341. padding-bottom: 30rpx;
  342. }
  343. .tex {
  344. font-size: 48rpx;
  345. font-weight: bold;
  346. padding-bottom: 50rpx;
  347. }
  348. .btn {
  349. padding: 0 50rpx;
  350. .btn1 {
  351. min-width: 270rpx;
  352. background: #FDB242;
  353. border-radius: 10rpx;
  354. font-size: $font-base;
  355. }
  356. }
  357. }
  358. .yue1 {
  359. background-color: #000000;
  360. padding: 30rpx;
  361. color: #FFFFFF;
  362. border-radius: 60rpx;
  363. .tj {
  364. font-size: 30rpx;
  365. font-weight: bold;
  366. text-align: center;
  367. }
  368. .tj-item {
  369. padding-top: 26rpx;
  370. font-size: 24rpx;
  371. opacity: 0.65;
  372. }
  373. }
  374. }
  375. .gj {
  376. margin-top: 50rpx;
  377. margin-left: 20rpx;
  378. font-size: 36rpx;
  379. font-weight: bold;
  380. color: #FFFFFF;
  381. padding-bottom: 10rpx;
  382. }
  383. .user-list {
  384. background: #191a1f;
  385. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  386. margin: 0 auto;
  387. padding: 30rpx 25rpx;
  388. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  389. .left-img {
  390. width: 40rpx;
  391. height: 40rpx;
  392. margin-right: 20rpx;
  393. }
  394. .item-name {
  395. flex-grow: 1;
  396. font-size: 29rpx;
  397. font-weight: bold;
  398. color: #FFF;
  399. }
  400. .right-img {
  401. width: 18rpx;
  402. height: 27rpx;
  403. }
  404. }
  405. </style>