user.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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">
  7. <image class="image margin-r-10" src="../../static/error/missing-face.png" mode="scaleToFill">
  8. </image>
  9. <view class="info">
  10. <view class="infor margin-b-20">v790d7v...v469874561</view>
  11. <image class="in" src="../../static/shouye/huiyuan.png" mode="scaleToFill"></image>
  12. </view>
  13. </view>
  14. <image @click="showY" class="inf" src="../../static/shouye/userinfo.png" mode="scaleToFill"></image>
  15. </view>
  16. </view>
  17. <!-- 余额 -->
  18. <view class="body">
  19. <view v-if="show" class="yue">
  20. <view class="te">
  21. {{$t('user.c1')}}
  22. </view>
  23. <view class="tex">
  24. 12356.00
  25. </view>
  26. <view class="btn flex">
  27. <button class="btn1" @click="navigator"> <text>{{$t('user.a7')}}</text> </button>
  28. <button class="btn1" @click="navigatorT"> <text>{{$t('user.a6')}}</text> </button>
  29. </view>
  30. </view>
  31. <view v-else class="yue1">
  32. <view class="tj">統計表</view>
  33. <view class="tj-item flex ">
  34. <view class="lj">{{$t('user.a4')}}{{$t('user.a7')}}</view>
  35. <view class="ljsu">0.000</view>
  36. </view>
  37. <view class="tj-item flex">
  38. <view class="lj">{{$t('user.a4')}}{{$t('user.a6')}}</view>
  39. <view class="ljsu">0.000</view>
  40. </view>
  41. <view class="tj-item flex">
  42. <view class="lj">{{$t('user.a8')}}</view>
  43. <view class="ljsu">0.000</view>
  44. </view>
  45. <view class="tj-item flex">
  46. <view class="lj">{{$t('user.a9')}}</view>
  47. <view class="ljsu">0.000</view>
  48. </view>
  49. <view class="tj-item flex">
  50. <view class="lj">{{$t('user.a10')}}</view>
  51. <view class="ljsu">0.000</view>
  52. </view>
  53. </view>
  54. <!-- 列表 -->
  55. <view class="gj">
  56. {{$t('user.b1')}}
  57. </view>
  58. <view class="user-list flex" @click="navTo('/pages/user/team')">
  59. <image src="../../static/shouye/yue.png" mode="scaleToFill" class="left-img"></image>
  60. <view class="item-name">
  61. {{$t('user.b2')}}
  62. </view>
  63. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  64. </view>
  65. <!-- 额外添加 -->
  66. <view class="user-list flex" @click="navTo('/pages/user/shareQrCode')">
  67. <image src="../../static/shouye/money.png" mode="scaleToFill" class="left-img"></image>
  68. <view class="item-name">
  69. {{$t('user.b3')}}
  70. </view>
  71. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  72. </view>
  73. <!-- 额外添加 -->
  74. <view class="user-list flex" @click="navTo('/pages/tabulation/tabulation')">
  75. <image src="../../static/shouye/liebiao.png" mode="scaleToFill" class="left-img"></image>
  76. <view class="item-name">
  77. {{$t('user.b4')}}
  78. </view>
  79. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  80. </view>
  81. <view class="user-list flex" @click="navTo('/pages/user/favorites')">
  82. <image src="../../static/shouye/liebiao.png" mode="scaleToFill" class="left-img"></image>
  83. <view class="item-name">
  84. {{$t('user.b5')}}
  85. </view>
  86. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  87. </view>
  88. <view class="user-list flex" @click="openKf()">
  89. <image src="../../static/shouye/liuyan.png" mode="scaleToFill" class="left-img"></image>
  90. <view class="item-name">
  91. {{$t('user.b6')}}
  92. </view>
  93. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  94. </view>
  95. <view class="user-list flex" @click="navTo('/pages/transaction/transaction')">
  96. <image src="../../static/shouye/jiaoyi.png" mode="scaleToFill" class="left-img"></image>
  97. <view class="item-name">
  98. {{$t('user.b7')}}
  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/public/login')">
  103. <image src="../../static/shouye/tuichu.png" mode="scaleToFill" class="left-img"></image>
  104. <view class="item-name">
  105. {{$t('user.b8')}}
  106. </view>
  107. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  108. </view>
  109. <!-- todo -->
  110. <view class="user-list flex" @click="navTo('/pages/user/set')">
  111. <image src="../../static/shouye/shezhi.png" mode="scaleToFill" class="left-img"></image>
  112. <view class="item-name">
  113. {{$t('user.b9')}}
  114. </view>
  115. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  116. </view>
  117. </view>
  118. <taber tab='user'></taber>
  119. </view>
  120. </template>
  121. <script>
  122. import taber from "@/components/footer/footer.vue";
  123. import {
  124. mapState,
  125. mapMutations
  126. } from 'vuex';
  127. import {
  128. orderData,
  129. getUserInfo,
  130. // check,
  131. // getLevelList
  132. } from '@/api/user.js';
  133. import {
  134. saveUrl,
  135. interceptor
  136. } from '@/utils/loginUtils.js';
  137. let startY = 0,
  138. moveY = 0,
  139. pageAtTop = true;
  140. export default {
  141. components: {
  142. taber
  143. },
  144. data() {
  145. return {
  146. current: 2,
  147. store_name: '',
  148. achievement: '',
  149. code: '',
  150. levelList: [],
  151. show: true
  152. };
  153. },
  154. onShow() {
  155. // 判断是否已经登录
  156. // if (this.hasLogin) {
  157. // this.loadBaseData();
  158. // }
  159. this.loadBaseData();
  160. },
  161. filters: {
  162. phone(e) {
  163. var subStr1 = e.substr(0, 3);
  164. var subStr2 = e.substr(e.length - 4, 4);
  165. var subStr = subStr1 + '...' + subStr2;
  166. e = subStr;
  167. return e;
  168. }
  169. },
  170. onReady() {
  171. // 初始化获取页面宽度
  172. uni.createSelectorQuery()
  173. .select('.container')
  174. .fields({
  175. size: true
  176. },
  177. data => {
  178. // 计算最多下拉的高度
  179. this.userDowm = Math.floor((data.width / 750) * 185);
  180. // 计算最大触发修改高度事件
  181. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  182. }
  183. )
  184. .exec();
  185. },
  186. computed: {
  187. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  188. },
  189. methods: {
  190. ...mapMutations('user', ['setUserInfo']),
  191. showY() {
  192. this.show = !this.show
  193. },
  194. navigatorT() {
  195. uni.navigateTo({
  196. url: '/pages/withdrawal/withdrawal'
  197. })
  198. },
  199. navigator() {
  200. uni.navigateTo({
  201. url: '/pages/recharge/recharge'
  202. })
  203. },
  204. // 加载初始数据
  205. loadBaseData() {
  206. const obj = this
  207. getUserInfo({})
  208. .then(({
  209. data
  210. }) => {
  211. obj.setUserInfo(data);
  212. })
  213. .catch(e => {
  214. console.log(e);
  215. });
  216. },
  217. /**
  218. * 统一跳转接口,拦截未登录路由
  219. * navigator标签现在默认没有转场动画,所以用view
  220. */
  221. navTo(url) {
  222. console.log(url);
  223. if (!this.hasLogin) {
  224. // 保存地址
  225. saveUrl();
  226. // 登录拦截
  227. interceptor();
  228. } else {
  229. uni.navigateTo({
  230. url
  231. });
  232. }
  233. },
  234. close() {
  235. this.$refs.popuphx.close();
  236. this.code = '';
  237. },
  238. // 打开绑定
  239. open() {
  240. this.$refs.gspass.open();
  241. },
  242. cast() {
  243. set_waiter({
  244. uid: this.id
  245. })
  246. .then(e => {
  247. this.$api.msg('绑定成功');
  248. this.$refs.gspass.close();
  249. this.id = '';
  250. })
  251. .catch(err => {
  252. this.$refs.gspass.close();
  253. this.id = '';
  254. });
  255. },
  256. // cancelpass() {
  257. // this.$refs.gspass.close();
  258. // this.id = '';
  259. // }
  260. }
  261. };
  262. </script>
  263. <style lang="scss">
  264. .container {
  265. height: 100%;
  266. line-height: 1;
  267. }
  268. .top {
  269. height: 327rpx;
  270. background-color: #000000;
  271. padding: 0 45rpx;
  272. .my {
  273. padding-top: 40rpx;
  274. font-size: 48rpx;
  275. font-weight: 500;
  276. color: #FFFFFF;
  277. }
  278. .userinfo {
  279. padding-top: 40rpx;
  280. .image {
  281. width: 125rpx;
  282. height: 125rpx;
  283. }
  284. .info {
  285. .infor {
  286. font-size: 30rpx;
  287. font-weight: 500;
  288. color: #FFFFFF;
  289. }
  290. }
  291. }
  292. }
  293. .in {
  294. width: 128rpx;
  295. height: 45rpx;
  296. }
  297. .inf {
  298. margin-top: 25rpx;
  299. width: 48rpx;
  300. height: 48rpx;
  301. }
  302. // body
  303. .body {
  304. background-color: #191a1f;
  305. padding: 30rpx;
  306. border-top-right-radius: 60rpx;
  307. border-top-left-radius: 60rpx;
  308. color: #FFFFFF;
  309. .yue {
  310. border-radius: 60rpx;
  311. background-color: #000000;
  312. text-align: center;
  313. padding-top: 40rpx;
  314. padding-bottom: 35rpx;
  315. .te {
  316. font-size: 26rpx;
  317. font-weight: 500;
  318. padding-bottom: 30rpx;
  319. }
  320. .tex {
  321. font-size: 48rpx;
  322. font-weight: bold;
  323. padding-bottom: 50rpx;
  324. }
  325. .btn1 {
  326. min-width: 270rpx;
  327. background: #FDB242;
  328. border-radius: 10rpx;
  329. font-size: $font-base;
  330. }
  331. }
  332. .yue1 {
  333. background-color: #000000;
  334. padding: 30rpx;
  335. color: #FFFFFF;
  336. border-radius: 60rpx;
  337. .tj {
  338. font-size: 30rpx;
  339. font-weight: bold;
  340. text-align: center;
  341. }
  342. .tj-item{
  343. padding-top: 26rpx;
  344. font-size: 24rpx;
  345. opacity: 0.65;
  346. }
  347. }
  348. }
  349. .gj {
  350. margin-top: 50rpx;
  351. margin-left: 20rpx;
  352. font-size: 36rpx;
  353. font-weight: bold;
  354. color: #FFFFFF;
  355. padding-bottom: 10rpx;
  356. }
  357. .user-list {
  358. background: #191a1f;
  359. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  360. margin: 0 auto;
  361. padding: 30rpx 25rpx;
  362. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  363. .left-img {
  364. width: 40rpx;
  365. height: 40rpx;
  366. margin-right: 20rpx;
  367. }
  368. .item-name {
  369. flex-grow: 1;
  370. font-size: 29rpx;
  371. font-weight: bold;
  372. color: #FFF;
  373. }
  374. .right-img {
  375. width: 18rpx;
  376. height: 27rpx;
  377. }
  378. }
  379. </style>