user.vue 19 KB

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