user.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. <template>
  2. <view class="container">
  3. <!-- <view class="vheigh"></view> -->
  4. <view class="user-info">
  5. <image src="../../static/img/user-bg.png" mode="" class="bg"></image>
  6. <view class="user flex">
  7. <view class="">
  8. <image :src="userInfo.avatar" mode="" class="avt" v-if="userInfo && userInfo.avatar"></image>
  9. <image src="../../static/error/missing-face.png" mode="" class="avt" v-else></image>
  10. </view>
  11. <view class="">
  12. <view class="flex" >
  13. <view class="clamp" style="max-width: 400rpx;">
  14. {{userInfo && userInfo.uid ? userInfo.nickname: '游客'}}
  15. </view>
  16. <image v-if="userInfo && userInfo.vip" :src="userInfo.vip_icon" mode="" class="gp" ></image>
  17. </view>
  18. <view class="phone" v-if="userInfo && userInfo.uid">
  19. UID: {{userInfo.uid}}
  20. </view>
  21. </view>
  22. </view>
  23. <view class="vip">
  24. <image src="../../static/img/vip-bg.png" mode=""></image>
  25. <view class="ffz flex">
  26. <view class="tit">
  27. 服务站
  28. </view>
  29. <view class="ct" >
  30. {{userInfo.uid && userInfo.is_server ? '您当前已是服务站':'申请成为服务站' }}
  31. </view>
  32. <view class="btn" @click="openSq()" v-if="hasLogin && !(userInfo.uid && userInfo.is_server)">
  33. 立即申请
  34. </view>
  35. </view>
  36. <view class="hy flex" v-if="endTime">
  37. <image src="../../static/icon/laba.png" mode=""></image>您已开通会员,{{formatTimestamp(endTime*1000)}}{{ntime*1 < endTime*1000 ? '到期':'已到期'}}
  38. </view>
  39. </view>
  40. </view>
  41. <view class="user-list flex" @click="navTo('/pages/user/award')">
  42. <image src="../../static/icon/jf.png" mode="" class="left-img"></image>
  43. <view class="">
  44. 我的积分
  45. </view>
  46. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  47. </view>
  48. <view class="user-list flex" @click="navTo('/pages/user/yue')">
  49. <image src="../../static/icon/yeb.png" mode="" class="left-img"></image>
  50. <view class="">
  51. 我的余额
  52. </view>
  53. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  54. </view>
  55. <view class="user-list flex" @click="navTo('/pages/user/team1')">
  56. <image src="../../static/icon/u0.png" mode="" class="left-img"></image>
  57. <view class="">
  58. 我的推广
  59. </view>
  60. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  61. </view>
  62. <view class="user-list flex" @click="navTo('/pages/user/buyList')">
  63. <image src="../../static/icon/order.png" mode="" class="left-img"></image>
  64. <view class="">
  65. 订单记录
  66. </view>
  67. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  68. </view>
  69. <view class="user-list flex" @click="navTo('/pages/user/shareQrCode')">
  70. <image src="../../static/icon/gn1.png" mode="" class="left-img"></image>
  71. <view class="">
  72. 邀请好友
  73. </view>
  74. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  75. </view>
  76. <!-- <view class="user-list flex" @click="openKf()">
  77. <image src="../../static/icon/u5.png" mode="" class="left-img"></image>
  78. <view class="">
  79. 客服中心
  80. </view>
  81. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  82. </view> -->
  83. <view class="user-list flex" @click="navTo('/pages/set/userinfo')">
  84. <image src="../../static/icon/u6.png" mode="" class="left-img"></image>
  85. <view class="">
  86. 设置
  87. </view>
  88. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  89. </view>
  90. <uni-popup ref="popupkf" type="center">
  91. <view class="popup-box">
  92. <view class="img">
  93. <image src="../../static/img/img009.png" mode=""></image>
  94. </view>
  95. <view class="mian">
  96. <view class="delivery">
  97. <view class="title">已经为您定制专属客服</view>
  98. <image src="../../static/img/img010.png" mode=""></image>
  99. </view>
  100. <view class="nocancel">客服VX:{{ text }}</view>
  101. <view class="comfirm-box">
  102. <view class="cancel" @click="cancel">取消</view>
  103. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  104. </view>
  105. </view>
  106. </view>
  107. </uni-popup>
  108. <uni-popup ref="popupFwz" type="center">
  109. <view class="popup-fwz">
  110. <image src="../../static/img/pop-top.png" mode=""></image>
  111. <view class="tit">
  112. 确认申请服务站吗?
  113. </view>
  114. <view class="">
  115. 成为服务站需等待官方审核
  116. </view>
  117. <view class="btn" @click="goSq">
  118. 发送申请
  119. </view>
  120. <image src="../../static/icon/close.png" mode="" class="close" @click="cancelSq"></image>
  121. </view>
  122. </uni-popup>
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. orderVerific
  128. } from '@/api/index.js'
  129. import {
  130. toScanCode
  131. } from '@/components/scan.js'
  132. // #ifdef H5
  133. import weixinObj from "@/plugin/jweixin-module/index.js";
  134. // #endif
  135. import {
  136. mapState,
  137. mapMutations
  138. } from 'vuex';
  139. import uniList from '@/components/uni-list/uni-list.vue';
  140. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  141. import {
  142. getUser,
  143. orderData,
  144. getUserInfo,
  145. goHx,
  146. getBuyList,
  147. details,
  148. gosq,
  149. getss
  150. } from '@/api/user.js';
  151. import {
  152. saveUrl,
  153. interceptor
  154. } from '@/utils/loginUtils.js';
  155. let startY = 0,
  156. moveY = 0,
  157. pageAtTop = true;
  158. export default {
  159. components: {
  160. uniList,
  161. uniListItem
  162. },
  163. data() {
  164. return {
  165. ntime: new Date().getTime(),
  166. endTime: '',
  167. jhe: 0, //进货额
  168. listList: [], //等级列表
  169. current: 2,
  170. id: '', //是否已签到
  171. store_name: '',
  172. achievement: '',
  173. code: '',
  174. levelList: [],
  175. text: '', //客服微信
  176. hxcode: '', //核销码
  177. hxLoading: false
  178. };
  179. },
  180. onShow() {
  181. this.loadBaseData();
  182. },
  183. filters: {
  184. phone(e) {
  185. var subStr1 = e.substr(0, 3);
  186. var subStr2 = e.substr(e.length - 4, 4);
  187. var subStr = subStr1 + '****' + subStr2;
  188. e = subStr;
  189. return e;
  190. }
  191. },
  192. onReady() {
  193. // 初始化获取页面宽度
  194. uni.createSelectorQuery()
  195. .select('.container')
  196. .fields({
  197. size: true
  198. },
  199. data => {
  200. // 计算最多下拉的高度
  201. this.userDowm = Math.floor((data.width / 750) * 185);
  202. // 计算最大触发修改高度事件
  203. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  204. }
  205. )
  206. .exec();
  207. },
  208. computed: {
  209. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  210. },
  211. methods: {
  212. ...mapMutations('user', ['setUserInfo']),
  213. details() {
  214. details({},1).then(res => {
  215. console.log(res)
  216. })
  217. },
  218. formatTimestamp(timestamp) {
  219. var date = new Date(timestamp);
  220. var year = date.getFullYear();
  221. var month = ("0" + (date.getMonth() + 1)).slice(-2);
  222. var day = ("0" + date.getDate()).slice(-2);
  223. var hours = ("0" + date.getHours()).slice(-2);
  224. var minutes = ("0" + date.getMinutes()).slice(-2);
  225. var seconds = ("0" + date.getSeconds()).slice(-2);
  226. return year + "-" + month + "-" + day;
  227. },
  228. close() {
  229. this.hxcode = ''
  230. this.$refs.popuphx.close()
  231. },
  232. goSq() {
  233. gosq().then(res => {
  234. this.$refs.popupFwz.close()
  235. uni.showModal({
  236. // title:"提示",
  237. content: '提交成功请耐心等待审核'
  238. })
  239. })
  240. },
  241. gorz() {
  242. if (!this.hasLogin) {
  243. saveUrl();
  244. interceptor();
  245. } else {
  246. // uni.navigateTo({
  247. // url
  248. // });
  249. if (this.userInfo.is_real == 0) {
  250. this.navTo('/pages/user/smrz')
  251. } else if (this.userInfo.is_real == 1) {
  252. uni.showModal({
  253. title: "提示",
  254. content: '您提交的资料正在审核中,请耐心等待审核'
  255. })
  256. }
  257. }
  258. },
  259. sqdl() {
  260. },
  261. sao() {
  262. let obj = this;
  263. // #ifndef H5
  264. uni.scanCode({
  265. success(e) {
  266. obj.code = e.result;
  267. obj.$refs.popuphx.open();
  268. console.log(obj.$refs.popuphx);
  269. }
  270. });
  271. // #endif
  272. },
  273. comfirm(text) {
  274. console.log(text);
  275. const result = this.uniCopy(text);
  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.popupkf.close();
  287. },
  288. uniCopy(content) {
  289. /**
  290. * 小程序端 和 app端的复制逻辑
  291. */
  292. //#ifndef H5
  293. uni.setClipboardData({
  294. data: content,
  295. success: function() {
  296. console.log('success');
  297. return true;
  298. }
  299. });
  300. //#endif
  301. /**
  302. * H5端的复制逻辑
  303. */
  304. // #ifdef H5
  305. if (!document.queryCommandSupported('copy')) {
  306. //为了兼容有些浏览器 queryCommandSupported 的判断
  307. // 不支持
  308. return false;
  309. }
  310. let textarea = document.createElement('textarea');
  311. textarea.value = content;
  312. textarea.readOnly = 'readOnly';
  313. document.body.appendChild(textarea);
  314. textarea.select(); // 选择对象
  315. textarea.setSelectionRange(0, content.length); //核心
  316. let result = document.execCommand('copy'); // 执行浏览器复制命令
  317. textarea.remove();
  318. return result;
  319. // #endif
  320. },
  321. // 加载初始数据
  322. loadBaseData() {
  323. const obj = this
  324. getUser({})
  325. .then(({
  326. data
  327. }) => {
  328. obj.setUserInfo(data);
  329. obj.getBuyList()
  330. })
  331. .catch(e => {
  332. console.log(e);
  333. });
  334. },
  335. getBuyList() {
  336. getBuyList({
  337. page: 1,
  338. limit: 1
  339. }).then(res => {
  340. this.endTime = res.data.list[0].valid_time
  341. })
  342. },
  343. /**
  344. * 统一跳转接口,拦截未登录路由
  345. * navigator标签现在默认没有转场动画,所以用view
  346. */
  347. navTo(url) {
  348. console.log(url);
  349. if (!this.hasLogin) {
  350. // 保存地址
  351. saveUrl();
  352. // 登录拦截
  353. interceptor();
  354. } else {
  355. uni.navigateTo({
  356. url
  357. });
  358. }
  359. },
  360. close() {
  361. this.$refs.popuphx.close();
  362. this.code = '';
  363. },
  364. // 打开客服
  365. openKf() {
  366. this.$refs.popupkf.open();
  367. },
  368. openSq() {
  369. if (this.hasLogin) {
  370. // if (this.userInfo.enroll_status == 1) {
  371. // uni.showModal({
  372. // title: "提示",
  373. // content: '您提交的申请正在审核中,请耐心等待审核'
  374. // })
  375. // } else {
  376. // }
  377. // getss().then(res => {
  378. // console.log(res)
  379. // })
  380. this.$refs.popupFwz.open();
  381. } else {
  382. saveUrl();
  383. interceptor();
  384. }
  385. },
  386. // 关闭客服
  387. cancel() {
  388. this.$refs.popupkf.close();
  389. },
  390. cancelSq() {
  391. this.$refs.popupFwz.close();
  392. },
  393. // 打开绑定
  394. open() {
  395. this.$refs.gspass.open();
  396. },
  397. }
  398. };
  399. </script>
  400. <style lang="scss">
  401. .container,
  402. page {
  403. min-height: 100%;
  404. height: auto;
  405. background-color: $page-color-base;
  406. }
  407. .vheigh {
  408. height: var(--status-bar-height);
  409. background-color: $base-color;
  410. }
  411. .user-info {
  412. width: 750rpx;
  413. height: 439rpx;
  414. position: relative;
  415. .bg {
  416. width: 100%;
  417. height: 100%;
  418. }
  419. .user {
  420. height: 110rpx;
  421. width: 100%;
  422. position: absolute;
  423. top: 136rpx;
  424. padding: 0 30rpx;
  425. justify-content: flex-start;
  426. font-size: 36rpx;
  427. color: #847360;
  428. .avt {
  429. width: 110rpx;
  430. height: 110rpx;
  431. margin-right: 10rpx;
  432. border-radius: 50%;
  433. }
  434. .gp {
  435. width: 103rpx;
  436. height: 32rpx;
  437. // padding-left: ;
  438. margin-left: 10rpx;
  439. }
  440. .phone {
  441. font-weight: 500;
  442. font-size: 28rpx;
  443. color: #847360;
  444. padding-top: 5;
  445. }
  446. }
  447. .vip {
  448. width: 692rpx;
  449. height: 133rpx;
  450. position: absolute;
  451. left: 0;
  452. right: 0;
  453. bottom: 0;
  454. margin: auto;
  455. image {
  456. width: 100%;
  457. height: 100%;
  458. }
  459. .ffz {
  460. position: absolute;
  461. bottom: 0;
  462. width: 100%;
  463. padding:0 30rpx;
  464. height: 95rpx;
  465. .tit {
  466. font-weight: 500;
  467. font-size: 32rpx;
  468. color: #F3D184;
  469. font-style: italic;
  470. background: linear-gradient(71deg, #D4AE45 0%, #FFF2BF 100%);
  471. -webkit-background-clip: text;
  472. -webkit-text-fill-color: transparent;
  473. }
  474. .ct {
  475. padding-left: 15rpx;
  476. flex-grow: 1;
  477. width: 184rpx;
  478. font-weight: 500;
  479. font-size: 28rpx;
  480. color: #F3D184;
  481. }
  482. .btn {
  483. width: 152rpx;
  484. line-height: 36rpx;
  485. background: #F2D18A;
  486. text-align: center;
  487. border-radius: 18rpx;
  488. font-weight: normal;
  489. font-size: 24rpx;
  490. color: #494347;
  491. }
  492. }
  493. .hy{
  494. font-weight: 500;
  495. font-size: 20rpx;
  496. color: #84592F;
  497. justify-content: flex-start;
  498. padding-left: 30rpx;
  499. position: absolute;
  500. height: 40rpx;
  501. top: 0;
  502. image {
  503. margin-right: 7rpx;
  504. width: 24rpx;
  505. height: 21rpx;
  506. }
  507. }
  508. }
  509. }
  510. .popup-box {
  511. width: 522rpx;
  512. height: 605rpx;
  513. background-color: #ffffff;
  514. border-radius: 20rpx;
  515. position: relative;
  516. .img {
  517. position: relative;
  518. top: -56rpx;
  519. left: 0;
  520. width: 522rpx;
  521. height: 132rpx;
  522. display: flex;
  523. justify-content: center;
  524. image {
  525. border-radius: 20rpx 20rpx 0 0;
  526. width: 450rpx;
  527. height: 132rpx;
  528. }
  529. }
  530. .mian {
  531. margin-top: -44rpx;
  532. display: flex;
  533. flex-direction: column;
  534. align-items: center;
  535. // padding: 32rpx 32rpx;
  536. background-color: #ffffff;
  537. border-radius: 0 0 20rpx 20rpx;
  538. text-align: center;
  539. .delivery {
  540. font-size: 40rpx;
  541. color: #333333;
  542. display: flex;
  543. align-items: center;
  544. flex-direction: column;
  545. image {
  546. margin-top: 48rpx;
  547. width: 172rpx;
  548. height: 160rpx;
  549. }
  550. }
  551. .nocancel {
  552. font-size: 32rpx;
  553. color: #333333;
  554. margin-top: 14rpx;
  555. }
  556. .comfirm-box {
  557. margin-top: 52rpx;
  558. display: flex;
  559. .cancel {
  560. display: flex;
  561. align-items: center;
  562. justify-content: center;
  563. width: 197rpx;
  564. height: 74rpx;
  565. border: 1px solid #dcc786;
  566. border-radius: 38rpx;
  567. font-size: 32rpx;
  568. color: #605128;
  569. }
  570. .comfirm {
  571. margin-left: 32rpx;
  572. display: flex;
  573. align-items: center;
  574. justify-content: center;
  575. width: 197rpx;
  576. height: 74rpx;
  577. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  578. border-radius: 38px;
  579. font-size: 32rpx;
  580. color: #605128;
  581. }
  582. }
  583. }
  584. }
  585. .user-list {
  586. width: 691rpx;
  587. height: 104rpx;
  588. background: #FFFFFF;
  589. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  590. border-radius: 28rpx;
  591. margin: 20rpx auto;
  592. padding: 0 25rpx;
  593. .left-img {
  594. width: 40rpx;
  595. height: 40rpx;
  596. }
  597. view {
  598. padding-left: 20rpx;
  599. flex-grow: 1;
  600. font-size: 29rpx;
  601. font-weight: bold;
  602. color: #5D5D5D;
  603. }
  604. .right-img {
  605. width: 13rpx;
  606. height: 23rpx;
  607. }
  608. }
  609. .popup-fwz {
  610. width: 536rpx;
  611. height: 630rpx;
  612. border-radius: 20rpx;
  613. background-color: #fff;
  614. position: relative;
  615. image {
  616. width: 100%;
  617. height: 281rpx;
  618. }
  619. font-weight: 500;
  620. font-size: 24rpx;
  621. color: #999999;
  622. text-align: center;
  623. .tit {
  624. // 确认申请服务站吗?
  625. font-weight: 500;
  626. font-size: 36rpx;
  627. color: #333333;
  628. padding: 50rpx 0 15rpx;
  629. }
  630. .btn {
  631. width: 353rpx;
  632. line-height: 71rpx;
  633. background: linear-gradient(45deg, #E8D49B, #CFB880);
  634. border-radius: 34rpx;
  635. margin:93rpx auto 0;
  636. color: #5C5133;
  637. font-weight: 500;
  638. font-size: 36rpx;
  639. }
  640. .close {
  641. position: absolute;
  642. bottom: -100rpx;
  643. left: 0;
  644. right: 0;
  645. margin: auto;
  646. width: 52rpx;
  647. height: 52rpx;
  648. }
  649. }
  650. </style>