user.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="bg"><image class="imgBg" src="../../static/user/img17.png" mode=""></image></view>
  5. <view class="title">
  6. <view class="header">
  7. <view class="tx"><image src="../../static/error/missing-face.png" mode=""></image></view>
  8. <view class="dl"><image src="../../static/user/jiedian1.png" mode=""></image></view>
  9. </view>
  10. <view class="message">
  11. <view class="name">{{ userInfo.nickname }}</view>
  12. <view class="phone">{{ userInfo.phone }}</view>
  13. <view class="vip-box">
  14. <view class="vip">会员等级LV.5</view>
  15. <view class="pintuan">拼团等级LV.2</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="box">
  21. <view class="sweets-box">
  22. <view class="sweets" @click="nav('/pages/money/award')">
  23. <view class="limit">{{ userInfo.now_money }}</view>
  24. <view class="sweets-name">糖果</view>
  25. </view>
  26. <view class="jiange"></view>
  27. <view class="sweets" @click="nav('/pages/money/integralP')">
  28. <view class="limit">{{ userInfo.integral }}</view>
  29. <view class="sweets-name">拼团积分</view>
  30. </view>
  31. <view class="jiange"></view>
  32. <view class="sweets" @click="nav('/pages/money/integralShopping')">
  33. <view class="limit">{{ userInfo.integral }}</view>
  34. <view class="sweets-name">购物积分</view>
  35. </view>
  36. <view class="jiange"></view>
  37. <view class="sweets" @click="nav('/pages/money/wallet')">
  38. <view class="limit">{{ userInfo.broken_commission }}</view>
  39. <view class="sweets-name">佣金</view>
  40. </view>
  41. </view>
  42. <view class="my-order">
  43. <view class="box-title flex ">
  44. <view class="title1"><text>我的订单</text></view>
  45. <view class="link" @click="nav('/pages/order/order?state=0')" hover-class="common-hover"><text class="iconfont iconenter"></text></view>
  46. </view>
  47. <view class="order-section">
  48. <view class="order-item" @click="nav('/pages/order/order?state=0')" hover-class="common-hover" :hover-stay-time="50">
  49. <view class=" icon1 position-relative">
  50. <image class="icon-img" src="/static/user/user01.png" mode="aspectFit"></image>
  51. </view>
  52. <text>待付款</text>
  53. </view>
  54. <view class="order-item" @click="nav('/pages/order/order?state=1')" hover-class="common-hover" :hover-stay-time="50">
  55. <view class="icon1 position-relative">
  56. <image class="icon-img" src="/static/user/user02.png" mode="aspectFit"></image>
  57. </view>
  58. <text>待发货</text>
  59. </view>
  60. <view class="order-item" @click="nav('/pages/order/order?state=2')" hover-class="common-hover" :hover-stay-time="50">
  61. <view class="icon1 position-relative">
  62. <image class="icon-img" src="/static/user/user03.png" mode="aspectFit"></image>
  63. </view>
  64. <text>待收货</text>
  65. </view>
  66. <view class="order-item" @click="nav('/pages/order/order?state=4')" hover-class="common-hover" :hover-stay-time="50">
  67. <view class=" icon1 position-relative"><image class="icon-img" src="/static/user/user04.png" mode="aspectFit"></image></view>
  68. <text>已完成</text>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="my-order">
  73. <view class="box-title flex ">
  74. <view class="title1"><text>拼购工具</text></view>
  75. <view class="link" hover-class="common-hover"></view>
  76. </view>
  77. <view class="order-section">
  78. <view class="order-item" @click="nav('/pages/assets/myPing')" hover-class="common-hover" :hover-stay-time="50">
  79. <view class=" icon1 position-relative"><image class="icon-img" src="../../static/user/myPing.png" mode="aspectFit"></image></view>
  80. <text>我的拼购</text>
  81. </view>
  82. <view class="order-item" @click="nav('/pages/user/myNote')" hover-class="common-hover" :hover-stay-time="50">
  83. <view class="icon1 position-relative"><image class="icon-img" src="../../static/user/myPoint.png" mode="aspectFit"></image></view>
  84. <text>我的节点</text>
  85. </view>
  86. <view class="order-item" @click="nav('/pages/market/myCalculation')" hover-class="common-hover" :hover-stay-time="50">
  87. <view class="icon1 position-relative"><image class="icon-img" src="../../static/user/myFu.png" mode="aspectFit"></image></view>
  88. <text>我的服务器</text>
  89. </view>
  90. <view class="order-item" @click="nav('/pages/index/info')" hover-class="common-hover" :hover-stay-time="50">
  91. <view class=" icon1 position-relative"><image class="icon-img" src="../../static/user/data.png" mode="aspectFit"></image></view>
  92. <text>汇总数据</text>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="my-order">
  97. <view class="box-title flex ">
  98. <view class="title1"><text>更多功能</text></view>
  99. <view class="link" hover-class="common-hover"></view>
  100. </view>
  101. <view class="order-section">
  102. <view class="order-item" @click="nav('/pages/user/extension')" hover-class="common-hover" :hover-stay-time="50">
  103. <view class=" icon1 position-relative"><image class="icon-img" src="../../static/user/myTeam.png" mode="aspectFit"></image></view>
  104. <text>我的团队</text>
  105. </view>
  106. <view class="order-item" @click="nav('/pages/user/myjiedian')" hover-class="common-hover" :hover-stay-time="50">
  107. <view class="icon1 position-relative"><image class="icon-img" src="../../static/user/myTeams.png" mode="aspectFit"></image></view>
  108. <text>互助团队</text>
  109. </view>
  110. <view class="order-item" @click="nav('/pages/user/shareQrCode')" hover-class="common-hover" :hover-stay-time="50">
  111. <view class="icon1 position-relative"><image class="icon-img" src="../../static/user/myShare.png" mode="aspectFit"></image></view>
  112. <text>团队邀请</text>
  113. </view>
  114. <view class="order-item" @click="nav('/pages/address/address')" hover-class="common-hover" :hover-stay-time="50">
  115. <view class=" icon1 position-relative"><image class="icon-img" src="../../static/user/myAddress.png" mode="aspectFit"></image></view>
  116. <text>收货地址</text>
  117. </view>
  118. <view class="order-item" @click="server()" hover-class="common-hover" :hover-stay-time="50">
  119. <view class=" icon1 position-relative"><image class="icon-img" src="../../static/user/myKefu.png" mode="aspectFit"></image></view>
  120. <text>联系客服</text>
  121. </view>
  122. <view class="order-item" @click="nav('/pages/user/about')" hover-class="common-hover" :hover-stay-time="50">
  123. <view class=" icon1 position-relative"><image class="icon-img" src="../../static/user/myAbout.png" mode="aspectFit"></image></view>
  124. <text>关于我们</text>
  125. </view>
  126. <view class="order-item" @click="nav('/pages/set/set')" hover-class="common-hover" :hover-stay-time="50">
  127. <view class=" icon1 position-relative"><image class="icon-img" src="../../static/user/mySet.png" mode="aspectFit"></image></view>
  128. <text>设置</text>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <uni-popup ref="popup" type="center">
  134. <view class="popup">
  135. <view class="popup-dox">
  136. <image class="popup-logo" src="../../static/img/lianxi.png"></image>
  137. <view class="pop-title">已为您定制专属客服</view>
  138. <view>{{ weixin }}</view>
  139. <image class="popup-text" @longtap="bc_code" :src="erweima"></image>
  140. <view class="btn" @click="copy(weixin)">复制微信号</view>
  141. <view class="pop-tip flex">
  142. <view class="weixin"><image src="../../static/img/weixin.png" mode=""></image></view>
  143. <view>长按保存二维码</view>
  144. </view>
  145. </view>
  146. </view>
  147. <view class="close_icon" @click="close"><image src="../../static/img/Close.png"></image></view>
  148. </uni-popup>
  149. </view>
  150. </template>
  151. <script>
  152. import uniCopy from '@/components/js_sdk/xb-copy/uni-copy.js';
  153. import { mapState, mapMutations } from 'vuex';
  154. import uniList from '@/components/uni-list/uni-list.vue';
  155. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  156. import { orderData, getUserInfo, service } from '@/api/user.js';
  157. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  158. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  159. export default {
  160. components: {
  161. uniList,
  162. uniListItem,
  163. uniPopup
  164. },
  165. data() {
  166. return {
  167. erweima: '',
  168. weixin: ''
  169. };
  170. },
  171. onShow() {
  172. //判断是否已经登录
  173. if (this.hasLogin) {
  174. this.loadBaseData();
  175. } else {
  176. uni.showModal({
  177. title: '登录',
  178. content: '您未登录,是否马上登陆?',
  179. success: e => {
  180. if (e.confirm) {
  181. interceptor();
  182. }
  183. },
  184. fail: e => {
  185. console.log(e);
  186. }
  187. });
  188. }
  189. },
  190. computed: {
  191. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  192. },
  193. methods: {
  194. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  195. loadBaseData() {
  196. console.log(this.userInfo);
  197. getUserInfo({}).then(({ data }) => {
  198. this.setUserInfo(data);
  199. });
  200. service({}).then(({ data }) => {
  201. this.erweima = data.service_qr;
  202. this.weixin = data.service_wechat;
  203. });
  204. },
  205. server() {
  206. this.$refs.popup.open();
  207. },
  208. close() {
  209. this.$refs.popup.close();
  210. },
  211. nav(url) {
  212. // 判断是否已经登录
  213. // if (this.hasLogin) {
  214. console.log(url);
  215. uni.navigateTo({
  216. url: url,
  217. fail() {
  218. uni.switchTab({
  219. url: url
  220. });
  221. }
  222. });
  223. // }else {
  224. // uni.showModal({
  225. // title: '登录',
  226. // content: '您未登录,是否马上登陆?',
  227. // success: e => {
  228. // if (e.confirm) {
  229. // interceptor();
  230. // }
  231. // },
  232. // fail: e => {{}
  233. // console.log(e);
  234. // }
  235. // });
  236. // }
  237. },
  238. bc_code() {
  239. let that = this;
  240. console.log('保存二维码', this.erweima);
  241. uni.downloadFile({
  242. //获得二维码的临时地址
  243. url: this.erweima,
  244. success: res => {
  245. //console.log('获取url',res)
  246. if (res.statusCode == 200) {
  247. uni.saveImageToPhotosAlbum({
  248. filePath: res.tempFilePath, //传入临时地址
  249. success() {
  250. that.$api.msg('保存成功'); //封装的提示
  251. },
  252. fail() {
  253. that.$api.msg('保存失败');
  254. }
  255. });
  256. }
  257. }
  258. });
  259. },
  260. copy(value) {
  261. let obj = this;
  262. let content = value; //需要复制的内容
  263. console.log('复制的内容:', content);
  264. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  265. const result = uniCopy(content);
  266. if (result === false) {
  267. uni.showToast({
  268. title: '不支持'
  269. });
  270. } else {
  271. uni.showToast({
  272. title: '复制成功',
  273. icon: 'none'
  274. });
  275. }
  276. }
  277. }
  278. };
  279. </script>
  280. <style lang="scss">
  281. page,
  282. .content {
  283. height: auto;
  284. min-height: 100%;
  285. background-color: #FFFFFF;
  286. padding-bottom: 44rpx;
  287. }
  288. .top {
  289. width: 100%;
  290. height: 530rpx;
  291. position: relative;
  292. .bg {
  293. position: absolute;
  294. width: 100%;
  295. height: 530rpx;
  296. image {
  297. width: 100%;
  298. height: 100%;
  299. }
  300. }
  301. .title {
  302. position: relative;
  303. display: flex;
  304. flex-direction: column;
  305. top: 20%;
  306. .header {
  307. display: flex;
  308. flex-direction: column;
  309. align-items: center;
  310. .tx {
  311. width: 132rpx;
  312. height: 132rpx;
  313. image {
  314. width: 100%;
  315. height: 100%;
  316. }
  317. }
  318. .dl {
  319. position: relative;
  320. margin-top: -16rpx;
  321. width: 100rpx;
  322. height: 32rpx;
  323. image {
  324. width: 100%;
  325. height: 100%;
  326. }
  327. }
  328. }
  329. .message {
  330. margin-top: 10rpx;
  331. display: flex;
  332. flex-direction: column;
  333. align-items: center;
  334. .name {
  335. font-size: 34rpx;
  336. font-family: PingFang SC;
  337. font-weight: bold;
  338. color: #ffffff;
  339. }
  340. .phone {
  341. font-size: 26rpx;
  342. font-family: PingFang SC;
  343. font-weight: 500;
  344. color: #ffffff;
  345. }
  346. }
  347. .vip-box {
  348. margin-top: 10rpx;
  349. display: flex;
  350. align-items: center;
  351. .vip {
  352. padding: 6rpx 16rpx;
  353. text-align: center;
  354. background: #ffffff;
  355. border-radius: 24rpx;
  356. font-size: 20rpx;
  357. font-family: PingFang SC;
  358. font-weight: bold;
  359. color: #2e58ff;
  360. margin-right: 10rpx;
  361. }
  362. .pintuan {
  363. padding: 6rpx 16rpx;
  364. text-align: center;
  365. background: #ffffff;
  366. border-radius: 24rpx;
  367. font-size: 20rpx;
  368. font-family: PingFang SC;
  369. font-weight: bold;
  370. color: #2e58ff;
  371. }
  372. }
  373. }
  374. }
  375. .box {
  376. display: flex;
  377. flex-direction: column;
  378. width: 710rpx;
  379. position: relative;
  380. margin: -80rpx 20rpx;
  381. color: #fefefe;
  382. }
  383. .sweets-box {
  384. display: flex;
  385. align-items: center;
  386. width: 710rpx;
  387. padding: 48rpx 0;
  388. background: #ffffff;
  389. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  390. border-radius: 20rpx;
  391. .jiange {
  392. width: 1rpx;
  393. height: 36rpx;
  394. background: #999999;
  395. }
  396. .sweets {
  397. width: 25%;
  398. display: flex;
  399. flex-direction: column;
  400. align-items: center;
  401. font-size: 28rpx;
  402. font-family: PingFang SC;
  403. font-weight: 500;
  404. .limit {
  405. font-size: 36rpx;
  406. font-family: PingFang SC;
  407. font-weight: bold;
  408. color: #666666;
  409. }
  410. .sweets-name {
  411. font-size: 28rpx;
  412. font-family: PingFang SC;
  413. font-weight: 500;
  414. color: #666666;
  415. }
  416. }
  417. }
  418. .my-order {
  419. margin-top: 20rpx;
  420. display: flex;
  421. justify-content: space-between;
  422. flex-direction: column;
  423. width: 710rpx;
  424. background: #ffffff;
  425. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  426. border-radius: 20rpx;
  427. }
  428. .box-title {
  429. border-top-left-radius: 20rpx;
  430. border-top-right-radius: 20rpx;
  431. background-color: #ffffff;
  432. line-height: 1;
  433. padding: 26rpx 34rpx 20rpx;
  434. border-bottom: 1px solid #F5F5F5;;
  435. .title1 {
  436. font-size: 30rpx;
  437. font-family: PingFang SC;
  438. font-weight: bold;
  439. color: #333333;
  440. }
  441. .link {
  442. font-size: $font-base - 2rpx;
  443. color: $font-color-light;
  444. }
  445. }
  446. .order-section {
  447. display: flex;
  448. flex-wrap: wrap;
  449. align-items: center;
  450. text-align: center;
  451. padding: 34rpx 0 10rpx;
  452. .order-item {
  453. display: flex;
  454. flex-direction: column;
  455. width: 25%;
  456. align-items: center;
  457. height: 140rpx;
  458. font-size: $font-sm;
  459. color: $font-color-dark;
  460. }
  461. .iconfont {
  462. font-size: 48rpx;
  463. margin-bottom: 18rpx;
  464. color: #fa436a;
  465. }
  466. .icon-shouhoutuikuan {
  467. font-size: 44rpx;
  468. }
  469. .icon {
  470. height: 88rpx;
  471. width: 90rpx;
  472. margin-bottom: 18rpx;
  473. background-size: 100%;
  474. background-repeat: no-repeat;
  475. background-position: center;
  476. .icon-img {
  477. width: 100%;
  478. height: 100%;
  479. }
  480. }
  481. .icon1 {
  482. height: 50rpx;
  483. width: 48rpx;
  484. margin-bottom: 18rpx;
  485. background-size: 100%;
  486. background-repeat: no-repeat;
  487. background-position: center;
  488. .icon-img {
  489. width: 100%;
  490. height: 100%;
  491. }
  492. }
  493. }
  494. .popup {
  495. width: 640rpx;
  496. background-color: #ffffff;
  497. border-radius: 15rpx;
  498. text-align: center;
  499. .popup-dox {
  500. position: relative;
  501. top: -60rpx;
  502. .popup-logo {
  503. width: 460rpx;
  504. height: 132rpx;
  505. }
  506. .pop-title {
  507. font-size: 40rpx;
  508. font-weight: bold;
  509. color: #333333;
  510. padding: 25rpx 0rpx;
  511. margin-bottom: 50rpx;
  512. }
  513. .popup-text {
  514. width: 400rpx;
  515. height: 400rpx;
  516. margin-bottom: 50rpx;
  517. }
  518. .btn {
  519. width: 300rpx;
  520. height: 50rpx;
  521. line-height: 50rpx;
  522. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  523. margin: 0 auto;
  524. color: #ffffff;
  525. border-radius: 25rpx;
  526. }
  527. .pop-tip {
  528. font-size: 30rpx;
  529. font-weight: 500;
  530. color: #333333;
  531. justify-content: center;
  532. margin-top: 20rpx;
  533. .weixin {
  534. width: 48rpx;
  535. height: 40rpx;
  536. margin-right: 14rpx;
  537. image {
  538. width: 48rpx;
  539. height: 40rpx;
  540. }
  541. }
  542. }
  543. }
  544. }
  545. .close_icon {
  546. width: 60rpx;
  547. height: 60rpx;
  548. margin: 88rpx auto 0;
  549. image {
  550. width: 100%;
  551. height: 100%;
  552. }
  553. }
  554. </style>