user.vue 16 KB

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