user.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <template>
  2. <view class="container">
  3. <!-- 用户信息 -->
  4. <view class="user">
  5. <!-- 背景图片 -->
  6. <image src="../../static/img/img17.png" mode="scaleToFill"></image>
  7. <!-- 用户头像和信息 -->
  8. <view class="infor">
  9. <!-- 用户信息 -->
  10. <view class="infor-left" @click="nav('/pages/set/userdata')">
  11. <image :src=" userInfo.avatar || '../../static/error/missing-face.png' "></image>
  12. <view class="info-box">
  13. <view class="username">{{ userInfo.nickname || '游客' }}</view>
  14. <view class="phone" v-if="userInfo.phone">{{userInfo.phone | phone}}</view>
  15. </view>
  16. </view>
  17. <!-- 设置 -->
  18. <!-- <view class="infor-right" @click="nav('/pages/set/userinfo')">
  19. <image src="../../static/img/img18.png" mode="scaleToFill"></image>
  20. <view class="setting">设置</view>
  21. </view> -->
  22. </view>
  23. <!-- 我的订单 -->
  24. <view class="order-box">
  25. <view class="my-order" @click="nav('/pages/order/order')">
  26. <view class="order">我的订单</view>
  27. <image src="../../static/img/xiangxia.png" mode="scaleToFill"></image>
  28. </view>
  29. <!-- 订单栏 -->
  30. <view class="order-section">
  31. <view class="order-item" @click="nav('/pages/order/order?state=0')">
  32. <image src="../../static/img/img19.png" mode="scaleToFill"></image>
  33. <view class="text">待付款</view>
  34. </view>
  35. <view class="order-item" @click="nav('/pages/order/order?state=1')">
  36. <image src="../../static/img/img20.png" mode="scaleToFill"></image>
  37. <view class="text">待发货</view>
  38. </view>
  39. <view class="order-item" @click="nav('/pages/order/order?state=2')">
  40. <image src="../../static/img/img21.png" mode="scaleToFill"></image>
  41. <view class="text">待收货</view>
  42. </view>
  43. <view class="order-item" @click="nav('/pages/order/order?state=4')">
  44. <image src="../../static/img/img22.png" mode="scaleToFill"></image>
  45. <view class="text">已完成</view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 下部分 -->
  51. <view class="my-tools">
  52. <view class="my-order">
  53. <view class="order">我的工具</view>
  54. <!-- <image src="../../static/img/xiangxia.png" mode="scaleToFill"></image> -->
  55. </view>
  56. <view class="tool flex">
  57. <view class="tool-item" @click="nav('/pages/vip/vip')" v-if="userInfo.level == 0">
  58. <view class="tool-img"><image src="../../static/icon/g1.png" mode=""></image></view>
  59. <view class="tool-name">成为会员</view>
  60. </view>
  61. <view class="tool-item" @click="nav('/pages/vip/fwbDetail')" v-if="userInfo.level > 0">
  62. <view class="tool-img"><image src="../../static/icon/g1.png" mode=""></image></view>
  63. <view class="tool-name">服务包专区</view>
  64. </view>
  65. <view class="tool-item" @click="nav('/pages/user/shareQrCode')">
  66. <view class="tool-img"><image src="../../static/icon/g2.png" mode=""></image></view>
  67. <view class="tool-name">推广二维码</view>
  68. </view>
  69. <view class="tool-item" @click="nav('/pages/user/extension')">
  70. <view class="tool-img"><image src="../../static/icon/g3.png" mode=""></image></view>
  71. <view class="tool-name">我的团队</view>
  72. </view>
  73. <view class="tool-item" @click="nav('/pages/set/address')">
  74. <view class="tool-img"><image src="../../static/icon/g4.png" mode=""></image></view>
  75. <view class="tool-name">我的地址</view>
  76. </view>
  77. <view class="tool-item" @click="nav('/pages/set/password')">
  78. <view class="tool-img"><image src="../../static/icon/g6.png" mode=""></image></view>
  79. <view class="tool-name">修改密码</view>
  80. </view>
  81. <view class="tool-item" @click="open()">
  82. <view class="tool-img"><image src="../../static/icon/g7.png" mode=""></image></view>
  83. <view class="tool-name">联系客服</view>
  84. </view>
  85. <view class="tool-item" @click="nav('/pages/set/userdata')">
  86. <view class="tool-img"><image src="../../static/icon/g8.png" mode=""></image></view>
  87. <view class="tool-name">设置</view>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- <view class="item-box"> -->
  92. <!-- <view class="order-section">
  93. <view class="order-item" @click="nav('/pages/money/wallet')">
  94. <image src="../../static/img/img26.png" mode="scaleToFill"></image>
  95. <view class="text">我的余额</view>
  96. </view>
  97. <view class="order-item" @click="nav('/pages/user/award')">
  98. <image src="../../static/img/img23.png" mode="scaleToFill"></image>
  99. <view class="text">我的佣金</view>
  100. </view>
  101. <view class="order-item" @click="nav('/pages/user/integral')">
  102. <image src="../../static/img/img24.png" mode="scaleToFill"></image>
  103. <view class="text">我的积分</view>
  104. </view>
  105. <view class="order-item" @click="nav('/pages/user/extension')">
  106. <image src="../../static/img/img25.png" mode="scaleToFill"></image>
  107. <view class="text">我的推广</view>
  108. </view>
  109. </view> -->
  110. <!-- 底部列表 -->
  111. <!-- <view class="btm">
  112. <view class="ul-btm" @click="nav('/pages/user/jiedian')">
  113. <image src="../../static/img/img27.png" mode="scaleToFill"></image>
  114. <view class="text">我的接点</view>
  115. <image class="jiantou" src="../../static/img/img32.png" mode="scaleToFill"></image>
  116. </view>
  117. <view class="ul-btm" @click="nav('/pages/user/shareQrCode')">
  118. <image src="../../static/img/img28.png" mode="scaleToFill"></image>
  119. <view class="text">邀请海报</view>
  120. <image class="jiantou" src="../../static/img/img32.png" mode="scaleToFill"></image>
  121. </view>
  122. <view class="ul-btm" @click="nav('/pages/public/register')">
  123. <image src="../../static/img/img29.png" mode="scaleToFill"></image>
  124. <view class="text">会员注册</view>
  125. <image class="jiantou" src="../../static/img/img32.png" mode="scaleToFill"></image>
  126. </view>
  127. <view class="ul-btm" @click="nav('/pages/user/registerList')">
  128. <image src="../../static/img/img28.png" mode="scaleToFill"></image>
  129. <view class="text">报单列表</view>
  130. <image class="jiantou" src="../../static/img/img32.png" mode="scaleToFill"></image>
  131. </view>
  132. <view class="ul-btm" @click="nav('/pages/set/address')">
  133. <image src="../../static/img/img30.png" mode="scaleToFill"></image>
  134. <view class="text">收货地址</view>
  135. <image class="jiantou" src="../../static/img/img32.png" mode="scaleToFill"></image>
  136. </view>
  137. <view class="ul-btm" @click="open()">
  138. <image src="../../static/img/img31.png" mode="scaleToFill"></image>
  139. <view class="text">联系客服</view>
  140. <image class="jiantou" src="../../static/img/img32.png" mode="scaleToFill"></image>
  141. </view>
  142. </view> -->
  143. <!-- </view> -->
  144. <uni-popup ref="popup" type="center">
  145. <view class="popup-box">
  146. <view class="img"><image src="../../static/img/img009.png" mode=""></image></view>
  147. <view class="mian">
  148. <view class="delivery">
  149. <view class="title">已经为您定制专属客服</view>
  150. <image src="../../static/img/img010.png" mode=""></image>
  151. </view>
  152. <view class="nocancel">客服VX:{{ text }}</view>
  153. <view class="comfirm-box">
  154. <view class="cancel" @click="cancel">取消</view>
  155. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  156. </view>
  157. </view>
  158. </view>
  159. </uni-popup>
  160. <!-- <u-tabbar v-if="userInfo.uid" v-model="current" :list="tabbar" active-color="#FF0000" inactive-color="#f19c99"></u-tabbar>
  161. <u-tabbar v-else v-model="current" :list="tabbar1" active-color="#FF0000" inactive-color="#f19c99"></u-tabbar> -->
  162. </view>
  163. </template>
  164. <script>
  165. import { orderData, getUserInfo,service } from '@/api/user.js';
  166. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  167. import uniCopy from '@/utils/uni-copy.js';
  168. import { mapState, mapMutations } from 'vuex';
  169. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  170. import { tabbar,tabbar1 } from "@/utils/tabbar.js";
  171. export default {
  172. components: {
  173. uniPopup
  174. },
  175. data() {
  176. return {
  177. tabbar: tabbar,
  178. tabbar1: tabbar1,
  179. current: 5,
  180. text:'123465'
  181. }
  182. },
  183. filters: {
  184. phone(val) {
  185. let str = ''
  186. if(val) {
  187. val = "" + val;
  188. str = val.substr(0,3) + "****" + val.substr(7)
  189. }
  190. return str
  191. }
  192. },
  193. onShow() {
  194. //判断是否已经登录
  195. if (this.hasLogin) {
  196. this.loadBaseData();
  197. } else {
  198. uni.showModal({
  199. title: '登录',
  200. content: '您未登录,是否马上登陆?',
  201. success: e => {
  202. if (e.confirm) {
  203. interceptor();
  204. }
  205. },
  206. fail: e => {
  207. console.log(e);
  208. }
  209. });
  210. }
  211. },
  212. computed: {
  213. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  214. },
  215. methods: {
  216. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  217. loadBaseData() {
  218. getUserInfo({})
  219. .then(({ data }) => {
  220. console.log(data)
  221. this.setUserInfo(data);
  222. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  223. orderData({})
  224. .then(({ data }) => {
  225. this.setOrderInfo(data);
  226. })
  227. .catch(e => {
  228. this.setOrderInfo({
  229. complete_count: 0, //完成
  230. received_count: 0, //待收货
  231. unshipped_count: 0, //待发货
  232. order_count: 0, //订单总数
  233. unpaid_count: 0 //待付款
  234. });
  235. });
  236. })
  237. .catch(e => {
  238. console.log(e);
  239. });
  240. },
  241. nav(url) {
  242. console.log(url)
  243. if(!this.hasLogin) {
  244. // 保存地址
  245. saveUrl();
  246. // 登录拦截
  247. interceptor();
  248. }else {
  249. console.log('ddd')
  250. uni.navigateTo({
  251. url
  252. })
  253. }
  254. },
  255. open(){
  256. console.log('点击出现弹窗');
  257. this.$refs.popup.open();
  258. },
  259. // 客服弹窗 - 复制微信
  260. comfirm(value) {
  261. let content = value; //需要复制的内容
  262. console.log('复制的内容:', content);
  263. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  264. const result = uniCopy({content});
  265. if (result === false) {
  266. uni.showToast({
  267. title: '不支持'
  268. });
  269. } else {
  270. uni.showToast({
  271. title: '复制成功',
  272. icon: 'none'
  273. });
  274. }
  275. this.$refs.popup.close();
  276. },
  277. // 客服弹窗 - 取消
  278. cancel() {
  279. this.$refs.popup.close();
  280. }
  281. }
  282. }
  283. </script>
  284. <style lang="scss">
  285. .container {
  286. background-color: #fff;
  287. }
  288. .user {
  289. image {
  290. width: 750rpx;
  291. height: 480rpx;
  292. position: relative;
  293. }
  294. .infor {
  295. height: 126.5rpx;
  296. width: 100%;
  297. // background-color: pink;
  298. display: flex;
  299. position: absolute;
  300. top: 0;
  301. display: flex;
  302. justify-content: space-around; // 水平平均分布
  303. align-items: center; // 垂直居中
  304. margin-top: 80rpx;
  305. text-align: center;
  306. .infor-left {
  307. width: 100%;
  308. height: 126.5rpx;
  309. display: flex;
  310. align-items: center;
  311. padding-left: 23rpx;
  312. flex-direction: column;
  313. image {
  314. width: 126.5rpx;
  315. height: 126.5rpx;
  316. border-radius: 50%;
  317. flex-shrink: 0;
  318. }
  319. .info-box {
  320. margin-left: 21rpx;
  321. }
  322. .username {
  323. font-size: 34rpx;
  324. font-family: PingFang SC;
  325. font-weight: bold;
  326. color: #fff;
  327. }
  328. .phone {
  329. padding-top: 10rpx;
  330. font-size: 26rpx;
  331. font-family: PingFang SC;
  332. font-weight: 500;
  333. color: #fff;
  334. }
  335. }
  336. .infor-right {
  337. width: 165rpx;
  338. height: 64rpx;
  339. background: #FFFFFF;
  340. border-radius: 32px 0px 0px 32px;
  341. display: flex;
  342. align-items: center; // 垂直居中
  343. padding-left: 20rpx;
  344. image {
  345. width: 32rpx;
  346. height: 31rpx;
  347. }
  348. .setting {
  349. font-size: 28rpx;
  350. font-family: PingFang SC;
  351. font-weight: 500;
  352. color: #3F7C1F;
  353. padding-left: 10rpx;
  354. }
  355. }
  356. }
  357. // 我的订单
  358. .order-box {
  359. width: 710rpx;
  360. height: 221rpx;
  361. background: #FFFFFF;
  362. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  363. border-radius: 20rpx;
  364. position: absolute;
  365. top: 335rpx;
  366. // display: flex;
  367. // justify-content: center; // 水平居中
  368. margin-left: 20rpx;
  369. .my-order {
  370. height: 73rpx;
  371. width: 100%;
  372. border-bottom: 2rpx solid #F5F5F5;
  373. display: flex;
  374. align-items: center;
  375. justify-content: flex-start;
  376. .order {
  377. font-size: 30rpx;
  378. font-family: PingFang SC;
  379. font-weight: bold;
  380. color: #333333;
  381. margin-left: 36rpx;
  382. margin-right: 520rpx;
  383. }
  384. image {
  385. width: 12rpx;
  386. height: 22rpx;
  387. }
  388. }
  389. .order-section {
  390. display: flex;
  391. align-items: center;
  392. justify-content: space-between;
  393. .order-item {
  394. flex: 1;
  395. display: flex;
  396. flex-direction: column;
  397. align-items: center;
  398. justify-content: center;
  399. margin-top: 30rpx;
  400. image {
  401. width: 42rpx;
  402. height: 42rpx;
  403. }
  404. .text {
  405. margin-top: 20rpx;
  406. font-size: 24rpx;
  407. color: #333333;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .item-box {
  414. padding-top: 80rpx;
  415. height: 900rpx;
  416. .order-box {
  417. width: 710rpx;
  418. height: 221rpx;
  419. background: #FFFFFF;
  420. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  421. border-radius: 20rpx;
  422. position: absolute;
  423. top: 335rpx;
  424. // display: flex;
  425. // justify-content: center; // 水平居中
  426. margin-left: 20rpx;
  427. .my-order {
  428. height: 73rpx;
  429. width: 100%;
  430. border-bottom: 2rpx solid #F5F5F5;
  431. display: flex;
  432. align-items: center;
  433. justify-content: flex-start;
  434. .order {
  435. font-size: 30rpx;
  436. font-family: PingFang SC;
  437. font-weight: bold;
  438. color: #333333;
  439. margin-left: 36rpx;
  440. margin-right: 520rpx;
  441. }
  442. image {
  443. width: 12rpx;
  444. height: 22rpx;
  445. }
  446. }
  447. .order-section {
  448. display: flex;
  449. align-items: center;
  450. justify-content: space-between;
  451. .order-item {
  452. flex: 1;
  453. display: flex;
  454. flex-direction: column;
  455. align-items: center;
  456. justify-content: center;
  457. margin-top: 30rpx;
  458. image {
  459. width: 42rpx;
  460. height: 42rpx;
  461. }
  462. .text {
  463. margin-top: 20rpx;
  464. font-size: 24rpx;
  465. color: #333333;
  466. }
  467. }
  468. }
  469. }
  470. // background-color: #fff;
  471. // background-color: pink;
  472. .order-section {
  473. display: flex;
  474. align-items: center;
  475. justify-content: space-between; // 水平平均分布
  476. .order-item {
  477. flex: 1;
  478. display: flex;
  479. flex-direction: column;
  480. align-items: center;
  481. justify-content: center;
  482. margin-top: 30rpx;
  483. image {
  484. width: 90rpx;
  485. height: 90rpx;
  486. }
  487. .text {
  488. margin-top: 10rpx;
  489. font-size: 26rpx;
  490. color: #3B3B3B;
  491. }
  492. }
  493. }
  494. }
  495. .btm {
  496. margin-top: 40rpx;
  497. padding-bottom: 200rpx;
  498. margin-left: 42rpx;
  499. .ul-btm {
  500. width: 100%;
  501. height: 100rpx;
  502. display: flex;
  503. // justify-content: center; // 水平居中
  504. align-items: center; // 水平居中
  505. // justify-content: center; // 垂直居中
  506. image {
  507. width: 35rpx;
  508. height: 35rpx;
  509. }
  510. .text {
  511. margin-right: 468rpx;
  512. margin-left: 30rpx;
  513. }
  514. .jiantou {
  515. width: 16rpx;
  516. height: 30rpx;
  517. }
  518. }
  519. }
  520. .popup-box {
  521. width: 522rpx;
  522. height: 605rpx;
  523. background-color: #ffffff;
  524. border-radius: 20rpx;
  525. position: relative;
  526. .img {
  527. position: relative;
  528. top: -56rpx;
  529. left: 0;
  530. width: 522rpx;
  531. height: 132rpx;
  532. display: flex;
  533. justify-content: center;
  534. image {
  535. border-radius: 20rpx 20rpx 0 0;
  536. width: 450rpx;
  537. height: 132rpx;
  538. }
  539. }
  540. .mian {
  541. margin-top: -44rpx;
  542. display: flex;
  543. flex-direction: column;
  544. align-items: center;
  545. // padding: 32rpx 32rpx;
  546. background-color: #ffffff;
  547. border-radius: 0 0 20rpx 20rpx;
  548. text-align: center;
  549. .delivery {
  550. font-size: 40rpx;
  551. color: #333333;
  552. display: flex;
  553. align-items: center;
  554. flex-direction: column;
  555. .title {
  556. }
  557. image {
  558. margin-top: 48rpx;
  559. width: 172rpx;
  560. height: 160rpx;
  561. }
  562. }
  563. .nocancel {
  564. font-size: 32rpx;
  565. color: #333333;
  566. margin-top: 14rpx;
  567. }
  568. .comfirm-box {
  569. margin-top: 52rpx;
  570. display: flex;
  571. // margin-bottom: 32rpx;
  572. // justify-content: space-around;
  573. .cancel {
  574. display: flex;
  575. align-items: center;
  576. justify-content: center;
  577. width: 197rpx;
  578. height: 74rpx;
  579. border: 1px solid #dcc786;
  580. border-radius: 38rpx;
  581. font-size: 32rpx;
  582. color: #605128;
  583. }
  584. .comfirm {
  585. margin-left: 32rpx;
  586. display: flex;
  587. align-items: center;
  588. justify-content: center;
  589. width: 197rpx;
  590. height: 74rpx;
  591. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  592. border-radius: 38px;
  593. font-size: 32rpx;
  594. color: #605128;
  595. }
  596. }
  597. }
  598. }
  599. .my-tools {
  600. width: 710rpx;
  601. height: 418rpx;
  602. background: #FFFFFF;
  603. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  604. border-radius: 20rpx;
  605. margin: 120rpx auto;
  606. // background-color: red;
  607. .my-order {
  608. height: 73rpx;
  609. width: 100%;
  610. border-bottom: 2rpx solid #F5F5F5;
  611. display: flex;
  612. align-items: center;
  613. justify-content: flex-start;
  614. .order {
  615. font-size: 30rpx;
  616. font-family: PingFang SC;
  617. font-weight: bold;
  618. color: #333333;
  619. margin-left: 36rpx;
  620. margin-right: 520rpx;
  621. }
  622. image {
  623. width: 12rpx;
  624. height: 22rpx;
  625. }
  626. }
  627. .tool {
  628. flex-wrap: wrap;
  629. justify-content: flex-start;
  630. align-items: center;
  631. .tool-item {
  632. width: 25%;
  633. height: 160rpx;
  634. // background-color: #bfa;
  635. display: flex;
  636. align-items: center;
  637. flex-direction: column;
  638. justify-content: center;
  639. .tool-img {
  640. width: 42rpx;
  641. height: 42rpx;
  642. image {
  643. width: 100%;
  644. height: 100%;
  645. }
  646. }
  647. .tool-name {
  648. padding-top: 10rpx;
  649. font-size: 24rpx;
  650. font-family: PingFang SC;
  651. font-weight: 500;
  652. color: #333333;
  653. }
  654. }
  655. }
  656. }
  657. </style>