user.vue 9.4 KB

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