user.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <view class="top-image">
  5. <image src="../../static/user/user-top.png" mode=""></image>
  6. </view>
  7. <view class="user-set flex">
  8. <view class="set-logo" @click="navTo('/pages/set/userinfo')">
  9. <image src="../../static/user/user1.png" mode=""></image>
  10. </view>
  11. <!-- <view class="xx-logo"><image src="../../static/user/user2.png" mode=""></image></view> -->
  12. </view>
  13. <view class="user-wrap">
  14. <view class="info-left flex">
  15. <view class="user-name">
  16. <image :src="userInfo.avatar" mode="" v-if="userInfo.avatar"></image>
  17. <image src="../../static/error/missing-face.png" mode="" v-else></image>
  18. <view class="gpai" v-if="userInfo.is_real">团队长</view>
  19. <view class="user-font">
  20. <view class="name clamp">{{ userInfo.nickname }}</view>
  21. <view class="phone">{{ userInfo.phone }}</view>
  22. <view class="phone" v-if="userInfo.uid">邀请码:{{ userInfo.uid }}</view>
  23. </view>
  24. </view>
  25. <view class="kpi">今日KPI:{{userInfo.kpi|| 0}}</view>
  26. </view>
  27. <view class="info-right" @click="navTo('/pages/user/myxfjf')">
  28. <image class="iright-icon" src="../../static/user/user3.png" mode=""></image>
  29. <view class="iright-font">消费积分:{{ userInfo.now_money || 0}}</view>
  30. </view>
  31. </view>
  32. <view class="main-box">
  33. <view class="title flex">
  34. <view class="title-left">
  35. <image class="title-icon" src="../../static/user/user4.png" mode=""></image>
  36. <view class="title-font">我的资产</view>
  37. </view>
  38. <image class="title-right" src="../../static/img/back.png" mode=""></image>
  39. </view>
  40. <view class="main flex">
  41. <view class="item" @click="navTo('/pages/user/mygwjf')">
  42. <view class="item-num">{{ userInfo.sp_final || 0}}</view>
  43. <view class="item-font">购物积分</view>
  44. </view>
  45. <view class="item" @click="navTo('/pages/user/mythq')">
  46. <view class="item-num">{{userInfo.top_ticket || 0}}</view>
  47. <view class="item-font">提货券</view>
  48. </view>
  49. <view class="item" @click="navTo('/pages/user/myggz')">
  50. <view class="item-num">{{userInfo.aid_val || 0}}</view>
  51. <view class="item-font">广告值</view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="main-box">
  56. <view class="title flex" @click="navTo('/pages/order/order1?state=0')">
  57. <view class="title-left">
  58. <image class="title-icon" src="../../static/user/user5.png" mode=""></image>
  59. <view class="title-font">我的订单</view>
  60. </view>
  61. <image class="title-right" src="../../static/img/back.png" mode=""></image>
  62. </view>
  63. <view class="main flex">
  64. <view class="oitem" @click="navTo('/pages/order/order1?state=0')">
  65. <image class="oitem-image" src="../../static/user/user6.png" mode=""></image>
  66. <view class="oitem-font">待付款</view>
  67. </view>
  68. <view class="oitem" @click="navTo('/pages/order/order1?state=1')">
  69. <image class="oitem-image" src="../../static/user/user7.png" mode=""></image>
  70. <view class="oitem-font">待发货</view>
  71. </view>
  72. <view class="oitem" @click="navTo('/pages/order/order1?state=2')">
  73. <image class="oitem-image" src="../../static/user/user8.png" mode=""></image>
  74. <view class="oitem-font">待收货</view>
  75. </view>
  76. <view class="oitem" @click="navTo('/pages/order/order1?state=3')">
  77. <image class="oitem-image" src="../../static/user/user9.png" mode=""></image>
  78. <view class="oitem-font">已完成</view>
  79. </view>
  80. </view>
  81. </view>
  82. <uni-list class="tool-list">
  83. <uni-list-item title="邀请有礼" @click="navTo('/pages/user/shareQrCode')" thumb="/static/user/user10.png">
  84. </uni-list-item>
  85. <uni-list-item title="我的推广" @click="navTo('/pages/user/mytg')" thumb="/static/icon/mytg.png">
  86. </uni-list-item>
  87. <uni-list-item title="支付密码" @click="navTo('/pages/money/moneyPwd')" thumb="/static/icon/g9.png">
  88. </uni-list-item>
  89. <uni-list-item title="登录密码" @click="navTo('/pages/set/password')" thumb="/static/icon/setpsw.png">
  90. </uni-list-item>
  91. <uni-list-item title="我的收藏" @click="navTo('/pages/user/favorites')" thumb="/static/user/user11.png">
  92. </uni-list-item>
  93. <uni-list-item title="收款方式" @click="navTo('/pages/collection/collection')" thumb="/static/user/user12.png">
  94. </uni-list-item>
  95. <uni-list-item title="客服中心" @click="openKf()" thumb="/static/user/user13.png"></uni-list-item>
  96. </uni-list>
  97. <view class="" style="height: 100rpx;">
  98. </view>
  99. <uni-popup ref="popupkf" type="center">
  100. <view class="popup-box">
  101. <view class="img">
  102. <image src="../../static/img/img009.png" mode=""></image>
  103. </view>
  104. <view class="mian">
  105. <view class="delivery">
  106. <view class="title">已经为您定制专属客服</view>
  107. <image src="../../static/img/img010.png" mode=""></image>
  108. </view>
  109. <view class="nocancel">客服VX:{{ text }}</view>
  110. <view class="comfirm-box">
  111. <view class="cancel" @click="cancel">取消</view>
  112. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  113. </view>
  114. </view>
  115. </view>
  116. </uni-popup>
  117. <uni-popup ref="popupqd" type="center">
  118. <view class="popup">
  119. <view class="popup-dox">
  120. <image class="popup-logo" src="../../static/img/sign-popup.png"></image>
  121. </view>
  122. <view class="popup-title">
  123. 获得
  124. <text>{{ today_integral }}</text>
  125. {{ today_type }}
  126. </view>
  127. <view class="popup-tip">
  128. 明天签到可得
  129. <text>{{ tom_integral }}</text>
  130. {{ tom_type }}
  131. </view>
  132. <view class="popup-btn" @click="closeQd">知道了</view>
  133. </view>
  134. <!-- <view class="close_icon" @click="close">
  135. <image src="../../static/img/Close.png"></image>
  136. </view> -->
  137. </uni-popup>
  138. </view>
  139. </template>
  140. <script>
  141. import {
  142. tabbar1
  143. } from '@/utils/tabbar.js';
  144. import {
  145. mapState,
  146. mapMutations
  147. } from 'vuex';
  148. import uniList from '@/components/uni-list/uni-list.vue';
  149. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  150. import {
  151. orderData,
  152. getUserInfo
  153. } from '@/api/user.js';
  154. import {
  155. saveUrl,
  156. interceptor
  157. } from '@/utils/loginUtils.js';
  158. let startY = 0,
  159. moveY = 0,
  160. pageAtTop = true;
  161. export default {
  162. components: {
  163. uniList,
  164. uniListItem
  165. },
  166. data() {
  167. return {
  168. current: 4,
  169. tabbar: tabbar1,
  170. qded: false, //是否已签到
  171. text: '15606861277', //客服微信
  172. today_integral: '', //签到获得的数值
  173. today_type: '', //签到获得的数值单位
  174. tom_integral: '', //明天签到获得的数值
  175. tom_type: '', //签到获得的数值单位
  176. userDowm: 0, //卡片升级专属高度
  177. userMaxDowm: 0, //卡片最高高度
  178. toolList: [{
  179. id: 't1',
  180. name: '新人通道',
  181. width: '56rpx',
  182. heigt: '54rpx',
  183. img: '../../static/icon/tool-1.png',
  184. path: '/pages/user/xrtd'
  185. },
  186. {
  187. id: 't2',
  188. name: '邀请好友',
  189. width: '56rpx',
  190. heigt: '57rpx',
  191. img: '../../static/icon/tool-2.png',
  192. path: '/pages/user/shareQrCode'
  193. },
  194. {
  195. id: 't3',
  196. name: '我的粉丝',
  197. width: '68rpx',
  198. heigt: '53rpx',
  199. img: '../../static/icon/tool-3.png',
  200. path: '/pages/user/myfans'
  201. },
  202. {
  203. id: 't4',
  204. name: '我的订单',
  205. width: '55rpx',
  206. heigt: '54rpx',
  207. img: '../../static/icon/tool-4.png',
  208. path: '/pages/order/order'
  209. },
  210. {
  211. id: 't5',
  212. name: '我的商品',
  213. width: '50rpx',
  214. heigt: '58rpx',
  215. img: '../../static/icon/tool-5.png',
  216. path: '/pages/order/order'
  217. },
  218. {
  219. id: 't6',
  220. name: '馆长申请',
  221. width: '59rpx',
  222. heigt: '56rpx',
  223. img: '../../static/icon/tool-6.png',
  224. path: '/pages/user/gzsq'
  225. }
  226. ]
  227. };
  228. },
  229. onShow() {
  230. // 判断是否已经登录
  231. if (this.hasLogin) {
  232. this.loadBaseData();
  233. }
  234. this.loadBaseData();
  235. },
  236. onReady() {
  237. // 初始化获取页面宽度
  238. uni.createSelectorQuery()
  239. .select('.container')
  240. .fields({
  241. size: true
  242. },
  243. data => {
  244. // 计算最多下拉的高度
  245. this.userDowm = Math.floor((data.width / 750) * 185);
  246. // 计算最大触发修改高度事件
  247. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  248. }
  249. )
  250. .exec();
  251. },
  252. // #ifndef MP
  253. // onNavigationBarButtonTap(e) {
  254. // const index = e.index;
  255. // if (index === 0) {
  256. // this.navTo('/pages/set/set');
  257. // } else if (index === 1) {
  258. // // #ifdef APP-PLUS
  259. // const pages = getCurrentPages();
  260. // const page = pages[pages.length - 1];
  261. // const currentWebview = page.$getAppWebview();
  262. // currentWebview.hideTitleNViewButtonRedDot({
  263. // index
  264. // });
  265. // // #endif
  266. // uni.navigateTo({
  267. // url: '/pages/user/notice'
  268. // });
  269. // }
  270. // },
  271. // #endif
  272. computed: {
  273. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  274. },
  275. methods: {
  276. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  277. comfirm(text) {
  278. console.log(text);
  279. const result = this.uniCopy(text);
  280. if (result === false) {
  281. uni.showToast({
  282. title: '不支持'
  283. });
  284. } else {
  285. uni.showToast({
  286. title: '复制成功',
  287. icon: 'none'
  288. });
  289. }
  290. this.$refs.popupkf.close();
  291. },
  292. uniCopy(content) {
  293. /**
  294. * 小程序端 和 app端的复制逻辑
  295. */
  296. //#ifndef H5
  297. uni.setClipboardData({
  298. data: content,
  299. success: function() {
  300. console.log('success');
  301. return true;
  302. }
  303. });
  304. //#endif
  305. /**
  306. * H5端的复制逻辑
  307. */
  308. // #ifdef H5
  309. if (!document.queryCommandSupported('copy')) {
  310. //为了兼容有些浏览器 queryCommandSupported 的判断
  311. // 不支持
  312. return false;
  313. }
  314. let textarea = document.createElement('textarea');
  315. textarea.value = content;
  316. textarea.readOnly = 'readOnly';
  317. document.body.appendChild(textarea);
  318. textarea.select(); // 选择对象
  319. textarea.setSelectionRange(0, content.length); //核心
  320. let result = document.execCommand('copy'); // 执行浏览器复制命令
  321. textarea.remove();
  322. return result;
  323. // #endif
  324. },
  325. // 加载初始数据
  326. loadBaseData() {
  327. getUserInfo({})
  328. .then(({
  329. data
  330. }) => {
  331. this.setUserInfo(data);
  332. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  333. orderData({})
  334. .then(({
  335. data
  336. }) => {
  337. this.setOrderInfo(data);
  338. })
  339. .catch(e => {
  340. this.setOrderInfo({
  341. complete_count: 0, //完成
  342. received_count: 0, //待收货
  343. unshipped_count: 0, //待发货
  344. order_count: 0, //订单总数
  345. unpaid_count: 0 //待付款
  346. });
  347. });
  348. })
  349. .catch(e => {
  350. console.log(e);
  351. });
  352. },
  353. /**
  354. * 统一跳转接口,拦截未登录路由
  355. * navigator标签现在默认没有转场动画,所以用view
  356. */
  357. navTo(url) {
  358. console.log(url);
  359. if (!this.hasLogin) {
  360. // 保存地址
  361. saveUrl();
  362. // 登录拦截
  363. interceptor();
  364. } else {
  365. uni.navigateTo({
  366. url
  367. });
  368. }
  369. },
  370. useTool(e) {
  371. this.navTo(e.path);
  372. },
  373. // 签到弹窗
  374. goQd() {
  375. this.$refs.popupqd.open();
  376. this.qded = true;
  377. },
  378. // 关闭签到弹窗
  379. closeQd() {
  380. this.$refs.popupqd.close();
  381. },
  382. // 打开客服
  383. openKf() {
  384. this.$refs.popupkf.open();
  385. },
  386. // 关闭客服
  387. cancel() {
  388. this.$refs.popupkf.close();
  389. }
  390. }
  391. };
  392. </script>
  393. <style lang="scss">
  394. %flex-center {
  395. display: flex;
  396. flex-direction: column;
  397. justify-content: center;
  398. align-items: center;
  399. }
  400. %section {
  401. display: flex;
  402. justify-content: space-around;
  403. align-content: center;
  404. background: #fff;
  405. border-radius: 10rpx;
  406. }
  407. .container,
  408. page {
  409. min-height: 100%;
  410. height: auto;
  411. background-color: $page-color-base;
  412. }
  413. .vheigh {
  414. height: var(--status-bar-height);
  415. background-color: $base-color;
  416. }
  417. .top-image {
  418. position: absolute;
  419. top: 0;
  420. left: 0;
  421. right: 0;
  422. height: 230rpx;
  423. image {
  424. width: 100%;
  425. height: 100%;
  426. }
  427. }
  428. .tool-list {
  429. width: 690rpx;
  430. margin: auto;
  431. margin-top: 20rpx;
  432. background: #ffffff;
  433. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  434. border-radius: 20rpx;
  435. }
  436. .popup-box {
  437. width: 522rpx;
  438. height: 605rpx;
  439. background-color: #ffffff;
  440. border-radius: 20rpx;
  441. position: relative;
  442. .img {
  443. position: relative;
  444. top: -56rpx;
  445. left: 0;
  446. width: 522rpx;
  447. height: 132rpx;
  448. display: flex;
  449. justify-content: center;
  450. image {
  451. border-radius: 20rpx 20rpx 0 0;
  452. width: 450rpx;
  453. height: 132rpx;
  454. }
  455. }
  456. .mian {
  457. margin-top: -44rpx;
  458. display: flex;
  459. flex-direction: column;
  460. align-items: center;
  461. // padding: 32rpx 32rpx;
  462. background-color: #ffffff;
  463. border-radius: 0 0 20rpx 20rpx;
  464. text-align: center;
  465. .delivery {
  466. font-size: 40rpx;
  467. color: #333333;
  468. display: flex;
  469. align-items: center;
  470. flex-direction: column;
  471. image {
  472. margin-top: 48rpx;
  473. width: 172rpx;
  474. height: 160rpx;
  475. }
  476. }
  477. .nocancel {
  478. font-size: 32rpx;
  479. color: #333333;
  480. margin-top: 14rpx;
  481. }
  482. .comfirm-box {
  483. margin-top: 52rpx;
  484. display: flex;
  485. // margin-bottom: 32rpx;
  486. // justify-content: space-around;
  487. .cancel {
  488. display: flex;
  489. align-items: center;
  490. justify-content: center;
  491. width: 197rpx;
  492. height: 74rpx;
  493. border: 1px solid #dcc786;
  494. border-radius: 38rpx;
  495. font-size: 32rpx;
  496. color: #605128;
  497. }
  498. .comfirm {
  499. margin-left: 32rpx;
  500. display: flex;
  501. align-items: center;
  502. justify-content: center;
  503. width: 197rpx;
  504. height: 74rpx;
  505. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  506. border-radius: 38px;
  507. font-size: 32rpx;
  508. color: #605128;
  509. }
  510. }
  511. }
  512. }
  513. .popup {
  514. width: 560rpx;
  515. padding-bottom: 45rpx;
  516. background-color: #ffffff;
  517. border-radius: 15rpx;
  518. text-align: center;
  519. line-height: 1;
  520. .popup-dox {
  521. position: relative;
  522. .popup-logo {
  523. margin: -160rpx auto 0;
  524. width: 400rpx;
  525. height: 200rpx;
  526. }
  527. }
  528. .popup-title {
  529. margin-top: 85rpx;
  530. font-size: 40rpx;
  531. font-family: PingFang SC;
  532. font-weight: bold;
  533. color: #2a2a2a;
  534. text {
  535. font-size: 56rpx;
  536. color: #e83f30;
  537. }
  538. }
  539. .popup-tip {
  540. margin-top: 20rpx;
  541. font-size: 28rpx;
  542. font-family: PingFang SC;
  543. font-weight: 500;
  544. color: #8c8c8c;
  545. text {
  546. color: #e83f30;
  547. }
  548. }
  549. .popup-btn {
  550. margin: 58rpx auto 0;
  551. width: 270rpx;
  552. height: 66rpx;
  553. background: #f0c838;
  554. border-radius: 34rpx;
  555. text-align: center;
  556. line-height: 66rpx;
  557. font-size: 36rpx;
  558. font-family: Source Han Sans CN;
  559. font-weight: 500;
  560. color: #ffffff;
  561. }
  562. }
  563. .user-wrap {
  564. position: relative;
  565. z-index: 10;
  566. width: 690rpx;
  567. height: 283rpx;
  568. background: #ffffff;
  569. box-shadow: 0px 4rpx 13rpx 0px rgba(229, 229, 229, 0.46);
  570. border-radius: 20rpx;
  571. padding: 34rpx 0 40rpx;
  572. margin: auto;
  573. .info-left {
  574. padding-left: 34rpx;
  575. .user-name {
  576. display: flex;
  577. align-items: center;
  578. image {
  579. width: 120rpx;
  580. height: 120rpx;
  581. border-radius: 50%;
  582. }
  583. .user-font {
  584. padding-left: 34rpx;
  585. .name {
  586. width: 250rpx;
  587. font-size: 40rpx;
  588. font-family: Source Han Sans CN;
  589. font-weight: 400;
  590. color: #333333;
  591. }
  592. .phone {
  593. margin-top: 10rpx;
  594. font-size: 20rpx;
  595. font-family: PingFang SC;
  596. font-weight: 500;
  597. color: #999999;
  598. }
  599. }
  600. }
  601. .kpi {
  602. background: #f5eede;
  603. border-radius: 30rpx 0px 0px 30rpx;
  604. padding: 18rpx 24rpx;
  605. font-size: 26rpx;
  606. font-family: PingFang SC;
  607. font-weight: bold;
  608. color: #c6914e;
  609. }
  610. }
  611. .info-right {
  612. display: flex;
  613. align-items: center;
  614. margin-top: 54rpx;
  615. padding: 0 34rpx;
  616. .iright-icon {
  617. width: 32rpx;
  618. height: 32rpx;
  619. }
  620. .iright-font {
  621. margin-left: 12rpx;
  622. font-size: 28rpx;
  623. font-family: PingFang SC;
  624. font-weight: bold;
  625. color: #333333;
  626. }
  627. }
  628. }
  629. .user-set {
  630. justify-content: flex-end;
  631. view {
  632. flex-shrink: 0;
  633. }
  634. padding: 30rpx;
  635. image {
  636. height: 40rpx;
  637. width: 40rpx;
  638. }
  639. }
  640. .main-box {
  641. margin: 20rpx auto 0;
  642. width: 690rpx;
  643. background: #ffffff;
  644. box-shadow: 0px 4rpx 14rpx 0px rgba(229, 229, 229, 0.46);
  645. border-radius: 20rpx;
  646. .title {
  647. display: flex;
  648. justify-content: space-between;
  649. align-items: center;
  650. padding: 24rpx;
  651. border-bottom: 1px solid #EEEEEE;
  652. .title-left {
  653. display: flex;
  654. align-items: center;
  655. .title-icon {
  656. width: 32rpx;
  657. height: 32rpx;
  658. }
  659. .title-font {
  660. margin-left: 20rpx;
  661. font-size: 28rpx;
  662. font-family: PingFang SC;
  663. font-weight: bold;
  664. color: #333333;
  665. }
  666. }
  667. .title-right {
  668. width: 14rpx;
  669. height: 24rpx;
  670. }
  671. }
  672. .main {
  673. padding: 50rpx 0 30rpx;
  674. .item {
  675. padding-bottom: 20rpx;
  676. width: 33%;
  677. display: flex;
  678. flex-direction: column;
  679. align-items: center;
  680. .item-num {
  681. font-size: 36rpx;
  682. font-family: PingFang SC;
  683. font-weight: bold;
  684. color: #333333;
  685. }
  686. .item-font {
  687. margin-top: 18rpx;
  688. font-size: 22rpx;
  689. font-family: PingFang SC;
  690. font-weight: 500;
  691. color: #666666;
  692. }
  693. }
  694. .oitem {
  695. width: 25%;
  696. display: flex;
  697. flex-direction: column;
  698. align-items: center;
  699. .oitem-image {
  700. height: 50rpx;
  701. width: 48rpx;
  702. }
  703. .oitem-font {
  704. margin-top: 20rpx;
  705. font-size: 24rpx;
  706. font-family: PingFang SC;
  707. font-weight: 500;
  708. color: #333333;
  709. }
  710. }
  711. }
  712. }
  713. .gpai {
  714. width: 100rpx;
  715. line-height: 40rpx;
  716. border-radius: 25rpx;
  717. position: absolute;
  718. top: 120rpx;
  719. left: 40rpx;
  720. font-size: 24rpx;
  721. color: #c6914e;
  722. text-align: center;
  723. background-color: #f2d4ae;
  724. }
  725. </style>