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