user.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. <template>
  2. <view class="container">
  3. <view class="userinfo flex">
  4. <view class="avt">
  5. <image src="../../static/error/missing-face.png" mode=""></image>
  6. </view>
  7. <view class="info">
  8. <view class="name clamp">
  9. 李丹丹李丹丹李丹丹李丹丹李丹丹李丹丹李丹丹李丹丹李丹丹
  10. </view>
  11. <view class="id flex">
  12. <view class="xs">
  13. ID
  14. </view>
  15. <view class="val">
  16. 236322
  17. </view>
  18. <image src="../../static/user/copy.png" mode="" class="copy"></image>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="ks flex">
  23. <image src="../../static/user/ks.png" mode=""></image>
  24. <view class="value">
  25. <view class="val">
  26. 7772032.30
  27. </view>
  28. <view class="">
  29. 我的矿石
  30. </view>
  31. </view>
  32. <view class="btn ">
  33. 转赠
  34. </view>
  35. </view>
  36. <view class="friend">
  37. <view class="top flex">
  38. <view class="">
  39. 邀请好友
  40. </view>
  41. <image src="../../static/user/djl.png" mode=""></image>
  42. <view class="tc">
  43. </view>
  44. <view class="xq">
  45. 详情<image src="../../static/user/back.png" mode=""></image>
  46. </view>
  47. </view>
  48. <view class="tit">
  49. 好友会为你贡献一定比例的奖励
  50. </view>
  51. <view class="val-wrap flex">
  52. <view class="item ">
  53. <view class="val">
  54. 72032.30
  55. </view>
  56. <view class="">
  57. 累计收益
  58. </view>
  59. </view>
  60. <view class="item item1">
  61. <view class="val">
  62. 203
  63. </view>
  64. <view class="">
  65. 好友数
  66. </view>
  67. </view>
  68. <view class="btn">
  69. 邀请好友
  70. </view>
  71. </view>
  72. </view>
  73. <view class="main-box">
  74. <view class="title flex">
  75. <view class="title-left">
  76. <view class="title-font">常用功能</view>
  77. </view>
  78. <!-- <image class="title-right" src="../../static/icon/back.png" mode=""></image> -->
  79. </view>
  80. <view class="main flex">
  81. <view class="oitem" @click="navTo('/pages/order/order?state=0')">
  82. <image class="oitem-image" src="../../static/user/u1.png" mode=""></image>
  83. <view class="oitem-font">我的好友</view>
  84. </view>
  85. <view class="oitem" @click="openKf()">
  86. <image class="oitem-image" src="../../static/user/u2.png" mode=""></image>
  87. <view class="oitem-font">联系客服</view>
  88. </view>
  89. <view class="oitem" @click="navTo('/pages/order/order?state=2')">
  90. <image class="oitem-image" src="../../static/user/u3.png" mode=""></image>
  91. <view class="oitem-font">我的邀请人</view>
  92. </view>
  93. <view class="oitem" @click="navTo('/pages/order/order?state=3')">
  94. <image class="oitem-image" src="../../static/user/u5.png" mode=""></image>
  95. <view class="oitem-font">开通联盟</view>
  96. </view>
  97. <view class="oitem" @click="navTo('/pages/order/order?state=3')">
  98. <image class="oitem-image" src="../../static/user/u4.png" mode=""></image>
  99. <view class="oitem-font">设置</view>
  100. </view>
  101. </view>
  102. </view>
  103. <uni-popup ref="popupkf" type="center">
  104. <view class="popup-box">
  105. </view>
  106. </uni-popup>
  107. </view>
  108. </template>
  109. <script>
  110. // import {
  111. // tabbar1
  112. // } from '@/utils/tabbar.js';
  113. import {
  114. mapState,
  115. mapMutations
  116. } from 'vuex';
  117. import uniList from '@/components/uni-list/uni-list.vue';
  118. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  119. import uniCopy from '@/components/js_sdk/xb-copy/uni-copy.js';
  120. import {
  121. orderData,
  122. getUserInfo,
  123. rate,
  124. apply_status
  125. } from '@/api/user.js';
  126. import {
  127. signList,
  128. integral,
  129. signUser
  130. } from '@/api/functionalUnit.js';
  131. import {
  132. saveUrl,
  133. interceptor
  134. } from '@/utils/loginUtils.js';
  135. // #ifdef APP-PLUS
  136. import {
  137. getUpApp
  138. } from '@/utils/upApp.js';
  139. // #endif
  140. let startY = 0,
  141. moveY = 0,
  142. pageAtTop = true;
  143. export default {
  144. components: {
  145. uniList,
  146. uniListItem
  147. },
  148. data() {
  149. return {
  150. // #ifdef APP
  151. wgtinfo: {
  152. version: '1.0.0'
  153. }, //版本信息
  154. // #endif
  155. sm: 0, //是否已实名认证
  156. money: '', //保存当前月份
  157. year: '', //保存当前年份
  158. day: '', //保存当前日期
  159. current: 4,
  160. tabbar: tabbar1,
  161. qded: false, //是否已签到
  162. text: '18967672398', //客服微信
  163. actionDay: 0, //连续签到天数
  164. sum_integral: 0, //累计获得积分
  165. today_integral: '', //签到获得的数值
  166. tom_integral: '', //明天签到获得的数值
  167. tom_type: '', //签到获得的数值单位
  168. userDowm: 0, //卡片升级专属高度
  169. userMaxDowm: 0, //卡片最高高度
  170. toolList: [
  171. // {
  172. // id: 't1',
  173. // name: '新人通道',
  174. // width: '56rpx',
  175. // heigt: '54rpx',
  176. // img: '../../static/icon/tool-1.png',
  177. // path: '/pages/user/xrtd'
  178. // },
  179. {
  180. id: 't2',
  181. name: '邀请好友',
  182. width: '56rpx',
  183. heigt: '57rpx',
  184. img: '../../static/icon/tool-2.png',
  185. path: '/pages/user/shareQrCode'
  186. },
  187. {
  188. id: 't3',
  189. name: '我的粉丝',
  190. width: '68rpx',
  191. heigt: '53rpx',
  192. img: '../../static/icon/tool-3.png',
  193. path: '/pages/user/myfans'
  194. },
  195. {
  196. id: 't4',
  197. name: '我的订单',
  198. width: '55rpx',
  199. heigt: '54rpx',
  200. img: '../../static/icon/tool-4.png',
  201. path: '/pages/order/index'
  202. },
  203. {
  204. id: 't5',
  205. name: '我的商品',
  206. width: '50rpx',
  207. heigt: '58rpx',
  208. img: '../../static/icon/tool-5.png',
  209. path: '/pages/user/myproduct'
  210. },
  211. // #ifndef APP
  212. {
  213. id: 't6',
  214. name: '馆长申请',
  215. width: '59rpx',
  216. heigt: '56rpx',
  217. img: '../../static/icon/tool-6.png',
  218. path: '/pages/user/gzsq'
  219. },
  220. // #endif
  221. {
  222. id: 't7',
  223. name: '我的金豆',
  224. width: '59rpx',
  225. heigt: '56rpx',
  226. img: '../../static/icon/jindou.png',
  227. path: '/pages/user/myyue'
  228. }
  229. ]
  230. };
  231. },
  232. onShow() {
  233. // 判断是否已经登录
  234. if (this.hasLogin) {
  235. this.loadBaseData();
  236. // this.signUser();
  237. // this.loadList();
  238. // this.getData();
  239. // this.isSm();
  240. }
  241. // #ifdef APP
  242. if (this.appversion !== this.wgtinfo.version) {
  243. getUpApp();
  244. }
  245. // #endif
  246. },
  247. onReady() {
  248. const that = this;
  249. // 初始化获取页面宽度
  250. uni.createSelectorQuery()
  251. .select('.container')
  252. .fields({
  253. size: true
  254. },
  255. data => {
  256. // 计算最多下拉的高度
  257. this.userDowm = Math.floor((data.width / 750) * 185);
  258. // 计算最大触发修改高度事件
  259. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  260. }
  261. )
  262. .exec();
  263. // #ifdef APP
  264. plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
  265. that.wgtinfo = wgtinfo;
  266. });
  267. // #endif
  268. },
  269. computed: {
  270. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  271. ...mapState(["isShowIllegality", "appversion"])
  272. },
  273. methods: {
  274. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  275. getData(current) {
  276. const date = current ? new Date(current) : new Date();
  277. this.year = date.getFullYear(); //保存当前年份
  278. this.month = date.getMonth() + 1; //保存当前月份
  279. this.day = date.getDate(); //保存当前日期
  280. },
  281. isSm() {
  282. rate({}).then(e => {
  283. if (e.data.is_auth == 2) {
  284. this.sm = 1;
  285. }
  286. });
  287. },
  288. comfirm(text) {
  289. let obj = this;
  290. let content = text; //需要复制的内容
  291. console.log('复制的内容:', content);
  292. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  293. const result = uniCopy(content);
  294. if (result === false) {
  295. uni.showToast({
  296. title: '不支持'
  297. });
  298. } else {
  299. uni.showToast({
  300. title: '复制成功',
  301. icon: 'none'
  302. });
  303. }
  304. },
  305. // 获取签到列表
  306. loadList() {
  307. let obj = this;
  308. let present = this.day; //保存当前天数用于后续计算
  309. let actionDay = 0; //用于计算活跃天数
  310. let arr = []; //保存返回数组;
  311. signList({
  312. page: 1,
  313. limit: 31
  314. }).then(e => {
  315. arr = e.data.map((e, ind) => {
  316. let time = e.add_time.split('-');
  317. let day = parseInt(time[2].replace(/^0/i, ''));
  318. let year = time[0];
  319. let month = +time[1];
  320. if (obj.year == year && obj.month == month) {
  321. return day;
  322. }
  323. });
  324. // 判断今天是否已经签到
  325. if (arr[0] == this.day) {
  326. this.qded = true;
  327. }
  328. });
  329. },
  330. //获取签到用户信息
  331. signUser() {
  332. signUser({
  333. all: 1
  334. }).then(({
  335. data
  336. }) => {
  337. this.actionDay = data.sign_num; //连续签到天数
  338. this.sum_integral = data.sum_integral; //累计总积分
  339. });
  340. },
  341. // 加载初始数据
  342. loadBaseData() {
  343. getUserInfo({})
  344. .then(({
  345. data
  346. }) => {
  347. this.setUserInfo(data);
  348. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  349. orderData({})
  350. .then(({
  351. data
  352. }) => {
  353. this.setOrderInfo(data);
  354. })
  355. .catch(e => {
  356. this.setOrderInfo({
  357. complete_count: 0, //完成
  358. received_count: 0, //待收货
  359. unshipped_count: 0, //待发货
  360. order_count: 0, //订单总数
  361. unpaid_count: 0 //待付款
  362. });
  363. });
  364. })
  365. .catch(e => {
  366. console.log(e);
  367. });
  368. },
  369. /**
  370. * 统一跳转接口,拦截未登录路由
  371. * navigator标签现在默认没有转场动画,所以用view
  372. */
  373. navTo(url) {
  374. const obj = this;
  375. if (!this.hasLogin) {
  376. // 保存地址
  377. saveUrl();
  378. // 登录拦截
  379. interceptor();
  380. } else {
  381. if (url == '/pages/user/approve') {
  382. rate({})
  383. .then(e => {
  384. console.log(e);
  385. if (e.data.is_auth == null) {
  386. uni.navigateTo({
  387. url
  388. });
  389. }
  390. if (e.data.is_auth == 0) {
  391. uni.navigateTo({
  392. url
  393. });
  394. }
  395. if (e.data.is_auth == 1) {
  396. // this.$api.msg('正在审核中请耐心等待');
  397. uni.navigateTo({
  398. url
  399. });
  400. }
  401. if (e.data.is_auth == 2) {
  402. this.$api.msg('已通过实名认证,无需再实名认证');
  403. }
  404. if (e.data.is_auth == 3) {
  405. uni.navigateTo({
  406. url
  407. });
  408. // uni.showModal({
  409. // title: '提示',
  410. // content: '申请失败,原因' + e.data.off + '是否重新申请',
  411. // success: function(res) {
  412. // if (res.confirm) {
  413. // uni.navigateTo({
  414. // url
  415. // });
  416. // } else if (res.cancel) {
  417. // console.log('用户点击取消');
  418. // }
  419. // }
  420. // });
  421. }
  422. })
  423. .catch(e => {
  424. return;
  425. });
  426. } else if (url == '/pages/user/gzsq') {
  427. apply_status({})
  428. .then(e => {
  429. if (e.data.status != 0) {
  430. if (e.data.status == 3) {
  431. uni.showModal({
  432. title: '提示',
  433. content: '申请失败是否重新申请',
  434. success: function(res) {
  435. if (res.confirm) {
  436. uni.navigateTo({
  437. url
  438. });
  439. } else if (res.cancel) {
  440. console.log('用户点击取消');
  441. }
  442. }
  443. });
  444. } else {
  445. obj.$api.msg(e.data.str);
  446. }
  447. } else {
  448. uni.navigateTo({
  449. url
  450. });
  451. }
  452. })
  453. .catch(e => {});
  454. } else {
  455. uni.navigateTo({
  456. url,
  457. fail() {
  458. uni.switchTab({
  459. url
  460. });
  461. }
  462. });
  463. }
  464. }
  465. },
  466. useTool(e) {
  467. this.navTo(e.path);
  468. },
  469. // 签到弹窗
  470. goQd() {
  471. integral({})
  472. .then(e => {
  473. this.integral = console.log(e);
  474. // 改为已签到
  475. this.qded = true;
  476. this.today_integral = e.data.integral;
  477. this.actionDay++;
  478. this.sum_integral = +this.sum_integral + +e.data.integral;
  479. this.$refs.popupqd.open();
  480. })
  481. .catch(e => {
  482. console.log(e);
  483. });
  484. },
  485. // 关闭签到弹窗
  486. closeQd() {
  487. this.$refs.popupqd.close();
  488. },
  489. // 打开客服
  490. openKf() {
  491. this.$refs.popupkf.open();
  492. },
  493. // 关闭客服
  494. cancel() {
  495. this.$refs.popupkf.close();
  496. }
  497. }
  498. };
  499. </script>
  500. <style lang="scss">
  501. .container {
  502. background-image: url('../../static/user/user-bg.png');
  503. background-size: 100% 100%;
  504. min-height: 1200rpx;
  505. }
  506. .userinfo {
  507. width: 709rpx;
  508. height: 316rpx;
  509. margin: auto;
  510. justify-content: flex-start;
  511. .avt {
  512. border-radius: 50%;
  513. // border-radius: 2rpx;
  514. border: 2rpx solid #fff;
  515. height: 124rpx;
  516. width: 124rpx;
  517. image {
  518. width: 120rpx;
  519. height: 120rpx;
  520. }
  521. }
  522. .info {
  523. font-weight: 800;
  524. font-size: 31rpx;
  525. color: #212121;
  526. padding-left: 23rpx;
  527. .name {
  528. width: 500rpx;
  529. }
  530. .id {
  531. width: 188rpx;
  532. height: 32rpx;
  533. border-radius: 5rpx;
  534. border: 1px solid #797E96;
  535. padding-right: 10rpx;
  536. margin-top: 20rpx;
  537. .xs {
  538. width: 40rpx;
  539. line-height:30rpx;
  540. background: linear-gradient(0deg, #384054, #707991);
  541. border-radius: 5rpx;
  542. font-size: 25rpx;
  543. color: #FFFFFF;
  544. text-align: center;
  545. }
  546. .copy {
  547. width: 24rpx;
  548. height: 24rpx;
  549. }
  550. .val {
  551. flex-grow: 1;
  552. padding-left: 6rpx;
  553. font-weight: 500;
  554. font-size: 25rpx;
  555. color: #212121;
  556. }
  557. }
  558. }
  559. }
  560. .ks {
  561. width: 709rpx;
  562. height: 162rpx;
  563. background-color: #1b2d59;
  564. margin:auto;
  565. color: #FFFFFF;
  566. position: relative;
  567. padding: 0 30rpx 0 20rpx;
  568. &::before ,&::after {
  569. content: '';
  570. width: 15rpx;
  571. height: 15rpx;
  572. position: absolute;
  573. background-color: #fff;
  574. }
  575. &::after {
  576. right: 15rpx;
  577. top: 0;
  578. }
  579. &::before {
  580. right: 0;
  581. top: 15rpx;
  582. }
  583. image {
  584. width: 107rpx;
  585. height: 84rpx;
  586. }
  587. .value {
  588. font-size: 23rpx;
  589. padding-left: 10rpx;
  590. flex-grow: 1;
  591. .val {
  592. font-size: 44rpx;
  593. }
  594. }
  595. .btn {
  596. width: 89rpx;
  597. // height: 38rpx;
  598. padding: 6rpx 0;
  599. border-radius: 19rpx;
  600. border: 1px solid #DDE1EB;
  601. font-weight: 500;
  602. font-size: 24rpx;
  603. text-align: center;
  604. }
  605. }
  606. .friend {
  607. width: 709rpx;
  608. height: 253rpx;
  609. background: #FFFFFF;
  610. border-radius: 10rpx;
  611. margin: 26rpx auto 30rpx;
  612. padding: 30rpx 20rpx;
  613. .top {
  614. font-weight: bold;
  615. font-size: 29rpx;
  616. color: #212121;
  617. justify-content: flex-start;
  618. image {
  619. width: 89rpx;
  620. height: 35rpx;
  621. }
  622. .tc {
  623. flex-grow: 1;
  624. }
  625. .xq {
  626. font-weight: 400;
  627. font-size: 26rpx;
  628. color: #8B8B8B;
  629. image {
  630. width: 10rpx;
  631. height: 20rpx;
  632. margin-left: 13rpx;
  633. }
  634. }
  635. }
  636. .tit {
  637. font-size: 24rpx;
  638. color: #8B8B8B;
  639. padding-top: 15rpx;
  640. }
  641. .val-wrap {
  642. padding-top: 30rpx;
  643. justify-content: flex-start;
  644. .item {
  645. padding:0 15rpx 0 0rpx;
  646. font-size: 24rpx;
  647. color: #8B8B8B;
  648. .val {
  649. font-size: 41rpx;
  650. color: #222222;
  651. &::after {
  652. content: '个';
  653. font-size: 24rpx;
  654. }
  655. }
  656. }
  657. .item1 {
  658. flex-grow: 1;
  659. border-left: 1px solid #ECECEC;
  660. padding-left: 30rpx;
  661. }
  662. .btn {
  663. width: 211rpx;
  664. line-height: 83rpx;
  665. background: #333333;
  666. border-radius: 8rpx;
  667. font-weight: bold;
  668. font-size: 28rpx;
  669. color: #FFFFFF;
  670. text-align: center;
  671. }
  672. }
  673. }
  674. .main-box {
  675. margin: 20rpx auto 0;
  676. width: 710rpx;
  677. background: #ffffff;
  678. box-shadow: 0px 4rpx 14rpx 0px rgba(229, 229, 229, 0.46);
  679. border-radius: 20rpx;
  680. .title {
  681. display: flex;
  682. justify-content: space-between;
  683. align-items: center;
  684. padding: 24rpx;
  685. .title-left {
  686. display: flex;
  687. align-items: center;
  688. .title-icon {
  689. width: 32rpx;
  690. height: 32rpx;
  691. }
  692. .title-font {
  693. margin-left: 20rpx;
  694. font-size: 30rpx;
  695. font-family: PingFang SC;
  696. font-weight: bold;
  697. color: #333333;
  698. }
  699. }
  700. .title-right {
  701. width: 14rpx;
  702. height: 24rpx;
  703. }
  704. }
  705. .main {
  706. padding: 30rpx 0 30rpx;
  707. flex-wrap: wrap;
  708. justify-content: flex-start;
  709. .jg {
  710. width: 1px;
  711. height: 100rpx;
  712. background: #eeeeee;
  713. }
  714. .item {
  715. padding-bottom: 20rpx;
  716. width: 25%;
  717. display: flex;
  718. flex-direction: column;
  719. align-items: center;
  720. .item-num {
  721. font-size: 36rpx;
  722. font-family: PingFang SC;
  723. font-weight: bold;
  724. color: #333333;
  725. }
  726. .item-font {
  727. margin-top: 18rpx;
  728. font-size: 22rpx;
  729. font-family: PingFang SC;
  730. font-weight: 500;
  731. color: #666666;
  732. }
  733. }
  734. .oitem {
  735. width: 25%;
  736. display: flex;
  737. flex-direction: column;
  738. align-items: center;
  739. margin-bottom: 50rpx;
  740. .oitem-image {
  741. height: 50rpx;
  742. width: 58rpx;
  743. }
  744. .oitem-font {
  745. font-weight: 500;
  746. font-size: 25rpx;
  747. color: #212121;
  748. padding-top: 15rpx;
  749. }
  750. }
  751. }
  752. }
  753. .popup-box {
  754. background-image: url('../../static/user/tc.png');
  755. width: 542rpx;
  756. height: 647rpx;
  757. background-size: 100% 100%;
  758. }
  759. </style>