user.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <view class="bg"><image src="../../static/img/mybg.png" mode=""></image></view>
  5. <view class="user-section flex">
  6. <view class="detail" @click="navTo('/pages/set/set')">
  7. <view class="portrait-box"><image class="portrait" :src="userInfo.avatar || '/static/error/missing-face.png'"></image></view>
  8. <view class="info-box">
  9. <view class="username">{{ userInfo.nickname || '游客' }}</view>
  10. <view class="phone" v-if="userInfo.phone">{{ userInfo.phone | hiddenphone }}</view>
  11. </view>
  12. </view>
  13. <view class="config" v-if="userInfo.is_promoter != 0">
  14. <view class="setting"><image src="../../static/icon/set.png" mode=""></image></view>
  15. <view class="config-font">VIP会员</view>
  16. </view>
  17. </view>
  18. <view class="list-top"></view>
  19. <view class="balance">
  20. <view class="balance-main">
  21. <view class="tj-item" @click="navTo('/pages/money/wallet')">
  22. <view class="tj-img"><image src="../../static/icon/my1.png" mode=""></image></view>
  23. <view class="tj-num">¥{{ userInfo.now_money * 1 || 0 }}</view>
  24. <view class="tj-font">我的余额</view>
  25. </view>
  26. <view class="tj-item" @click="navTo('/user/page/scoreAccumulate')">
  27. <view class="tj-img"><image src="../../static/icon/my3.png" mode=""></image></view>
  28. <view class="tj-num">¥{{ userInfo.integral * 1 || 0 }}</view>
  29. <view class="tj-font">我的积分</view>
  30. </view>
  31. <view class="tj-item" @click="navTo('/user/page/extension')">
  32. <view class="tj-img"><image src="../../static/icon/my4.png" mode=""></image></view>
  33. <view class="tj-num">{{ userInfo.spread_count || 0 }}</view>
  34. <view class="tj-font">我的推广</view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="cover-container">
  39. <view class="order-section">
  40. <view class="order-item" @click="navTo('/user/page/shareQrCode')" hover-class="common-hover" :hover-stay-time="50" v-if="userInfo.is_promoter != 0">
  41. <view class="o-ic">
  42. <view class="icon"><image class="icon-img" src="/static/icon/1-my.png" mode="widthFix"></image></view>
  43. <view class="text">邀请海报</view>
  44. </view>
  45. <view class="order-img"><image src="../../static/img/img74.png" mode=""></image></view>
  46. </view>
  47. <view class="order-item" hover-class="common-hover" :hover-stay-time="50" @click="showPopup">
  48. <view class="o-ic">
  49. <view class="icon"><image class="icon-img" src="/static/icon/2-my.png" mode="widthFix"></image></view>
  50. <view class="text">客服中心</view>
  51. </view>
  52. <view class="order-img"><image src="../../static/img/img74.png" mode=""></image></view>
  53. </view>
  54. <view class="order-item" @click="navTo('/pages/set/address')" hover-class="common-hover" :hover-stay-time="50">
  55. <view class="o-ic">
  56. <view class="icon"><image class="icon-img" src="/static/icon/3-my.png" mode="widthFix"></image></view>
  57. <view class="text">收货地址</view>
  58. </view>
  59. <view class="order-img"><image src="../../static/img/img74.png" mode=""></image></view>
  60. </view>
  61. <view class="order-item" @click="navTo('/pages/set/set')" hover-class="common-hover" :hover-stay-time="50">
  62. <view class="o-ic">
  63. <view class="icon"><image class="icon-img" src="/static/icon/4-my.png" mode="widthFix"></image></view>
  64. <view class="text">设置</view>
  65. </view>
  66. <view class="order-img"><image src="../../static/img/img74.png" mode=""></image></view>
  67. </view>
  68. </view>
  69. </view>
  70. <uni-popup ref="popup" type="center">
  71. <view class="popup-box">
  72. <view class="img"><image src="https://37shop.liuniu946.com/front/img/img009.png" mode=""></image></view>
  73. <view class="mian">
  74. <view class="delivery">
  75. <view class="title">已经为您定制专属客服</view>
  76. <image src="https://37shop.liuniu946.com/front/img/img010.png" mode=""></image>
  77. </view>
  78. <view class="nocancel">{{ text }}</view>
  79. <view class="comfirm-box">
  80. <view class="cancel" @click="cancel">取消</view>
  81. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  82. </view>
  83. </view>
  84. </view>
  85. </uni-popup>
  86. </view>
  87. </template>
  88. <script>
  89. import { mapState, mapMutations } from 'vuex';
  90. import uniList from '@/components/uni-list/uni-list.vue';
  91. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  92. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  93. import { getArticleDetail } from '@/api/index.js';
  94. import { orderData, getUserInfo, getSpreadCount, bindAdmin, sendStk, checkStk } from '@/api/user.js';
  95. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  96. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js';
  97. export default {
  98. components: {
  99. uniList,
  100. uniListItem
  101. },
  102. data() {
  103. return {
  104. text: '123456'
  105. };
  106. },
  107. onShow() {
  108. // 判断是否已经登录
  109. if (this.hasLogin) {
  110. this.loadBaseData();
  111. console.log(this.userInfo);
  112. }
  113. },
  114. // #ifndef MP
  115. // onNavigationBarButtonTap(e) {
  116. // const index = e.index;
  117. // if (index === 0) {
  118. // this.navTo('/pages/set/set');
  119. // } else if (index === 1) {
  120. // // #ifdef APP-PLUS
  121. // const pages = getCurrentPages();
  122. // const page = pages[pages.length - 1];
  123. // const currentWebview = page.$getAppWebview();
  124. // currentWebview.hideTitleNViewButtonRedDot({
  125. // index
  126. // });
  127. // // #endif
  128. // uni.navigateTo({
  129. // url: '/pages/user/notice'
  130. // });
  131. // }
  132. // },
  133. // #endif
  134. computed: {
  135. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  136. },
  137. filters: {
  138. hiddenphone(value) {
  139. return value.substring(0, 3) + '****' + value.substring(7, 12);
  140. }
  141. },
  142. methods: {
  143. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  144. // 加载初始数据
  145. loadBaseData() {
  146. getUserInfo({})
  147. .then(({ data }) => {
  148. this.setUserInfo(data);
  149. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  150. orderData({})
  151. .then(({ data }) => {
  152. this.setOrderInfo(data);
  153. console.log(this.orderInfo);
  154. })
  155. .catch(e => {
  156. this.setOrderInfo({
  157. complete_count: 0, //完成
  158. received_count: 0, //待收货
  159. unshipped_count: 0, //待发货
  160. order_count: 0, //订单总数
  161. unpaid_count: 0 //待付款
  162. });
  163. });
  164. })
  165. .catch(e => {
  166. console.log(e);
  167. });
  168. },
  169. /**
  170. * 统一跳转接口,拦截未登录路由
  171. * navigator标签现在默认没有转场动画,所以用view
  172. */
  173. navTo(url) {
  174. if (!this.hasLogin) {
  175. // 保存地址
  176. saveUrl();
  177. // 登录拦截
  178. interceptor();
  179. } else {
  180. uni.navigateTo({
  181. url
  182. });
  183. }
  184. },
  185. showPopup() {
  186. this.$refs.popup.open();
  187. },
  188. cancel() {
  189. this.$refs.popup.close();
  190. },
  191. comfirm(text) {
  192. console.log(text);
  193. const result = uniCopy(text);
  194. if (result === false) {
  195. uni.showToast({
  196. title: '不支持'
  197. });
  198. } else {
  199. uni.showToast({
  200. title: '复制成功',
  201. icon: 'none'
  202. });
  203. }
  204. this.$refs.popup.close();
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="scss">
  210. page,
  211. .container {
  212. height: auto;
  213. min-height: 100%;
  214. background-color: #ffffff;
  215. }
  216. %flex-center {
  217. display: flex;
  218. flex-direction: column;
  219. justify-content: center;
  220. align-items: center;
  221. }
  222. %section {
  223. display: flex;
  224. justify-content: space-around;
  225. align-content: center;
  226. background: #fff;
  227. border-radius: 10rpx;
  228. }
  229. .bg {
  230. position: absolute;
  231. top: 0;
  232. left: 0;
  233. height: 400rpx;
  234. width: 100%;
  235. image {
  236. width: 100%;
  237. height: 100%;
  238. }
  239. }
  240. .user-section {
  241. padding: 112rpx 42rpx 0 38rpx;
  242. position: relative;
  243. z-index: 10;
  244. .detail {
  245. display: flex;
  246. align-items: center;
  247. .portrait-box {
  248. height: 120rpx;
  249. width: 120rpx;
  250. .portrait {
  251. width: 100%;
  252. height: 100%;
  253. border: 4rpx solid #fff;
  254. border-radius: 50%;
  255. }
  256. }
  257. .info-box {
  258. margin-left: 20rpx;
  259. line-height: 1;
  260. .username {
  261. font-size: 32rpx;
  262. font-family: PingFang SC;
  263. font-weight: bold;
  264. color: #ffffff;
  265. }
  266. .phone {
  267. font-size: 25rpx;
  268. font-family: PingFang SC;
  269. font-weight: 500;
  270. color: #ffffff;
  271. margin-top: 18rpx;
  272. }
  273. }
  274. }
  275. .config {
  276. width: 161rpx;
  277. height: 51rpx;
  278. background: #ffffff;
  279. border-radius: 25rpx;
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. line-height: 1;
  284. .setting {
  285. width: 25rpx;
  286. height: 36rpx;
  287. image {
  288. width: 25rpx;
  289. height: 36rpx;
  290. }
  291. }
  292. .config-font {
  293. margin-left: 10rpx;
  294. font-size: 25rpx;
  295. font-family: PingFang SC;
  296. font-weight: 500;
  297. color: #ee2f72;
  298. }
  299. }
  300. }
  301. .list-top {
  302. position: relative;
  303. z-index: 10;
  304. margin-top: 50rpx;
  305. width: 750rpx;
  306. height: 30rpx;
  307. background: #ffffff;
  308. border-radius: 30rpx 30rpx 0px 0px;
  309. }
  310. .cover-container {
  311. position: relative;
  312. background: #ffffff;
  313. margin-top: 20rpx;
  314. }
  315. .order-section {
  316. .order-item {
  317. padding: 60rpx 55rpx 0 43rpx;
  318. display: flex;
  319. justify-content: space-between;
  320. align-items: center;
  321. .o-ic {
  322. display: flex;
  323. align-items: center;
  324. .icon {
  325. margin-right: 20rpx;
  326. display: flex;
  327. justify-content: center;
  328. align-items: center;
  329. image {
  330. width: 32rpx;
  331. }
  332. }
  333. .text {
  334. font-size: 30rpx;
  335. font-family: PingFang SC;
  336. font-weight: 500;
  337. color: #363636;
  338. }
  339. }
  340. .order-img {
  341. width: 16rpx;
  342. height: 28rpx;
  343. image {
  344. width: 16rpx;
  345. height: 28rpx;
  346. }
  347. }
  348. }
  349. .iconfont {
  350. font-size: 48rpx;
  351. margin-bottom: 18rpx;
  352. color: #fa436a;
  353. }
  354. .icon-shouhoutuikuan {
  355. font-size: 44rpx;
  356. }
  357. }
  358. .user-item {
  359. font-size: 30rpx;
  360. font-weight: bold;
  361. color: #666666;
  362. border-bottom: 1px #f5f5f5 solid;
  363. padding: 25rpx 20rpx 26rpx 20rpx;
  364. display: flex;
  365. justify-content: space-between;
  366. text {
  367. }
  368. }
  369. .balance {
  370. position: relative;
  371. z-index: 10;
  372. background: #ffffff;
  373. margin-top: -3rpx;
  374. .balance-main {
  375. padding-top: 40rpx;
  376. display: flex;
  377. align-items: center;
  378. .tj-item {
  379. display: flex;
  380. flex-direction: column;
  381. flex-grow: 1;
  382. text-align: center;
  383. font-size: 26rpx;
  384. font-weight: 500;
  385. color: #3b3b3b;
  386. line-height: 1;
  387. .tj-img {
  388. image {
  389. width: 112rpx;
  390. height: 112rpx;
  391. }
  392. }
  393. .tj-num {
  394. font-size: 28rpx;
  395. font-family: PingFang SC;
  396. font-weight: 500;
  397. color: #363636;
  398. }
  399. .tj-font {
  400. margin-top: 10rpx;
  401. font-size: 28rpx;
  402. font-family: PingFang SC;
  403. font-weight: 500;
  404. color: #363636;
  405. }
  406. }
  407. }
  408. }
  409. .popup-box {
  410. width: 522rpx;
  411. height: 605rpx;
  412. background-color: #ffffff;
  413. border-radius: 20rpx;
  414. position: relative;
  415. .img {
  416. position: relative;
  417. top: -56rpx;
  418. left: 0;
  419. width: 522rpx;
  420. height: 132rpx;
  421. display: flex;
  422. justify-content: center;
  423. image {
  424. border-radius: 20rpx 20rpx 0 0;
  425. width: 450rpx;
  426. height: 132rpx;
  427. }
  428. }
  429. .mian {
  430. margin-top: -44rpx;
  431. display: flex;
  432. flex-direction: column;
  433. align-items: center;
  434. // padding: 32rpx 32rpx;
  435. background-color: #ffffff;
  436. border-radius: 0 0 20rpx 20rpx;
  437. text-align: center;
  438. .delivery {
  439. font-size: 40rpx;
  440. color: #333333;
  441. display: flex;
  442. align-items: center;
  443. flex-direction: column;
  444. .title {
  445. }
  446. image {
  447. margin-top: 48rpx;
  448. width: 172rpx;
  449. height: 160rpx;
  450. }
  451. }
  452. .nocancel {
  453. font-size: 32rpx;
  454. color: #333333;
  455. margin-top: 14rpx;
  456. }
  457. .comfirm-box {
  458. margin-top: 52rpx;
  459. display: flex;
  460. // margin-bottom: 32rpx;
  461. // justify-content: space-around;
  462. .cancel {
  463. display: flex;
  464. align-items: center;
  465. justify-content: center;
  466. width: 197rpx;
  467. height: 74rpx;
  468. border: 1px solid #dcc786;
  469. border-radius: 38rpx;
  470. font-size: 32rpx;
  471. color: #605128;
  472. }
  473. .comfirm {
  474. margin-left: 32rpx;
  475. display: flex;
  476. align-items: center;
  477. justify-content: center;
  478. width: 197rpx;
  479. height: 74rpx;
  480. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  481. border-radius: 38px;
  482. font-size: 32rpx;
  483. color: #605128;
  484. }
  485. }
  486. }
  487. }
  488. .bind-admin-wappper {
  489. width: 600rpx;
  490. height: 682rpx;
  491. border-radius: 20rpx;
  492. background-color: #fff;
  493. .title {
  494. padding-top: 70rpx;
  495. font-size: 42rpx;
  496. text-align: center;
  497. font-family: PingFang SC;
  498. font-weight: 500;
  499. color: #ffa200;
  500. }
  501. .admin-item {
  502. .item-name {
  503. padding-top: 55rpx;
  504. padding-bottom: 20rpx;
  505. font-size: 32rpx;
  506. font-family: PingFang SC;
  507. font-weight: 500;
  508. color: #333333;
  509. padding-left: 68rpx;
  510. }
  511. .item-val {
  512. width: 470rpx;
  513. height: 70rpx;
  514. line-height: 70rpx;
  515. margin: 0 auto;
  516. background: #ffffff;
  517. border: 1px solid #999999;
  518. border-radius: 6px;
  519. outline: none;
  520. input {
  521. padding-left: 20rpx;
  522. display: block;
  523. height: 70rpx;
  524. line-height: 70rpx;
  525. }
  526. }
  527. }
  528. .btn-wrapper {
  529. margin-top: 60rpx;
  530. display: flex;
  531. justify-content: space-between;
  532. height: 50rpx;
  533. padding: 0 65rpx;
  534. .btn {
  535. // margin-right: 22rpx;
  536. text-align: center;
  537. font-size: 30rpx;
  538. font-family: PingFang SC;
  539. font-weight: 500;
  540. line-height: 70rpx;
  541. color: #666666;
  542. width: 224rpx;
  543. height: 70rpx;
  544. border-radius: 6rpx;
  545. border: 1px solid #999999;
  546. }
  547. .btn1 {
  548. color: #fff;
  549. background-color: #ff6600;
  550. }
  551. }
  552. }
  553. .icon-img {
  554. width: 52rpx;
  555. height: 43rpx;
  556. }
  557. </style>