user.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <view class="" style="width: 750rpx;height: 529rpx;">
  5. <image src="" mode="" class="user-top"></image>
  6. <view class="user-box">
  7. <view class="user-info flex">
  8. <image class="avatar" :src="userInfo.avatar" mode="" v-if="userInfo.avatar"
  9. @click="navTo('/pages/set/userinfo')"></image>
  10. <image class="avatar" src="../../static/error/missing-face.png" mode="" v-else></image>
  11. <view class="user-name-id">
  12. <view class="user-name clamp2">{{ userInfo.nickname || '游客'}}</view>
  13. <view class="user-uid " v-if="userInfo.uid">{{ 'UID: ' + userInfo.uid}}</view>
  14. </view>
  15. </view>
  16. <view class="user-money flex">
  17. <view class="user-money-item" @click="navTo('/pages/user/award')">
  18. <view class="user-money-num">{{ userInfo.brokerage_price*1 || 0 }}</view>
  19. <view class="user-money-font">奖金</view>
  20. </view>
  21. <view class="user-xian"></view>
  22. <view class="user-money-item">
  23. <view class="user-money-num">{{ userInfo.awardrange*1 || 0 }}</view>
  24. <view class="user-money-font">可用奖金额度</view>
  25. </view>
  26. <view class="user-xian"></view>
  27. <view class="user-money-item" @click="navTo('/pages/user/jf')">
  28. <view class="user-money-num">{{ userInfo.tickets*1 || 0 }}</view>
  29. <view class="user-money-font">报单币</view>
  30. </view>
  31. </view>
  32. <view class="user-level" v-if="userInfo.vip">
  33. <image src="../../static/icon/vip.png" mode="widthFix"></image>
  34. <view class="">
  35. {{userInfo.vip_name}}
  36. </view>
  37. </view>
  38. <!-- <image src="../../static/icon/u-set.png" mode="" class="u-set" @click="navTo('/pages/set/userinfo')"> -->
  39. </image>
  40. </view>
  41. </view>
  42. <view class=""
  43. style="height: 50rpx;border-radius: 50rpx 50rpx 0 0;background-color: #fff;width: 750rpx;margin-top: -50rpx;position: relative;">
  44. </view>
  45. <view class="main-box">
  46. <view class="title flex" @click="navTo('/pages/order/order?state=0')">
  47. <view class="title-left">
  48. <view class="title-font">我的订单</view>
  49. </view>
  50. <image class="title-right" src="../../static/icon/back.png" mode=""></image>
  51. </view>
  52. <view class="main flex">
  53. <view class="oitem" @click="navTo('/pages/order/order?state=0')">
  54. <image class="oitem-image" src="../../static/icon/o1.png" mode=""></image>
  55. <view class="oitem-font">待付款</view>
  56. </view>
  57. <view class="oitem" @click="navTo('/pages/order/order?state=1')">
  58. <image class="oitem-image" src="../../static/icon/o2.png" mode=""></image>
  59. <view class="oitem-font">待发货</view>
  60. </view>
  61. <view class="oitem" @click="navTo('/pages/order/order?state=2')">
  62. <image class="oitem-image" src="../../static/icon/o3.png" mode=""></image>
  63. <view class="oitem-font">待收货</view>
  64. </view>
  65. <view class="oitem" @click="navTo('/pages/order/order?state=3')">
  66. <image class="oitem-image" src="../../static/icon/o4.png" mode=""></image>
  67. <view class="oitem-font">已完成</view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="user-list flex" @click="navTo('/pages/user/shareQrCode')">
  72. <image src="../../static/icon/u1.png" mode="" class="left-img"></image>
  73. <view class="">
  74. 推广海报
  75. </view>
  76. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  77. </view>
  78. <view class="user-list flex" @click="navTo('/pages/user/team')">
  79. <image src="../../static/icon/u2.png" mode="" class="left-img"></image>
  80. <view class="">
  81. 我的推广
  82. </view>
  83. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  84. </view>
  85. <view class="user-list flex" @click="navTo('/pages/user/favorites')">
  86. <image src="../../static/icon/u4.png" mode="" class="left-img"></image>
  87. <view class="">
  88. 我的收藏
  89. </view>
  90. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  91. </view>
  92. <view class="user-list flex" @click="navTo('/pages/set/phone')" v-if="!userInfo.phone">
  93. <image src="../../static/icon/u3.png" mode="" class="left-img"></image>
  94. <view class="">
  95. 绑定手机号
  96. </view>
  97. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  98. </view>
  99. <view class="user-list flex" @click="openKf()">
  100. <image src="../../static/icon/u5.png" mode="" class="left-img"></image>
  101. <view class="">
  102. 客服
  103. </view>
  104. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  105. </view>
  106. <view class="user-list flex" @click="navTo('/pages/set/address')">
  107. <image src="../../static/icon/u6.png" mode="" class="left-img"></image>
  108. <view class="">
  109. 收货地址
  110. </view>
  111. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  112. </view>
  113. <view class="user-list flex" @click="navTo('/pages/set/userinfo')" style="border-bottom: none;">
  114. <image src="../../static/icon/u7.png" mode="" class="left-img"></image>
  115. <view class="">
  116. 设置
  117. </view>
  118. <image src="../../static/icon/back.png" mode="" class="right-img"></image>
  119. </view>
  120. <view class="" style="height: 20rpx;">
  121. </view>
  122. <uni-popup ref="popupkf" type="center">
  123. <view class="popup-box">
  124. <view class="img">
  125. <image src="../../static/img/img009.png" mode=""></image>
  126. </view>
  127. <view class="mian">
  128. <view class="delivery">
  129. <view class="title">已经为您定制专属客服</view>
  130. <image src="../../static/img/img010.png" mode=""></image>
  131. </view>
  132. <view class="nocancel">客服VX:{{ text }}</view>
  133. <view class="comfirm-box">
  134. <view class="cancel" @click="cancel">取消</view>
  135. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  136. </view>
  137. </view>
  138. </view>
  139. </uni-popup>
  140. </view>
  141. </template>
  142. <script>
  143. import {
  144. mapState,
  145. mapMutations
  146. } from 'vuex';
  147. import uniList from '@/components/uni-list/uni-list.vue';
  148. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  149. import {
  150. orderData,
  151. getUserInfo,
  152. check,
  153. getUser
  154. } from '@/api/user.js';
  155. import {
  156. saveUrl,
  157. interceptor
  158. } from '@/utils/loginUtils.js';
  159. let startY = 0,
  160. moveY = 0,
  161. pageAtTop = true;
  162. export default {
  163. components: {
  164. uniList,
  165. uniListItem
  166. },
  167. data() {
  168. return {
  169. current: 2,
  170. id: '', //是否已签到
  171. store_name: '',
  172. achievement: '',
  173. code: '',
  174. text: '' //客服微信
  175. };
  176. },
  177. onShow() {
  178. // 判断是否已经登录
  179. // if (this.hasLogin) {
  180. // this.loadBaseData();
  181. // }
  182. this.loadBaseData();
  183. // uni.getS
  184. let a = uni.getStorageSync(
  185. 'jynickname'
  186. )
  187. if (a == 1 && this.userInfo.nickname == '微信用户') {
  188. uni.setStorageSync('jynickname', 2)
  189. uni.showModal({
  190. title: '提示',
  191. content: '您的昵称为默认昵称“微信用户”,是否立即修改?',
  192. complete(res) {
  193. if (res.confirm) {
  194. uni.navigateTo({
  195. url: '/pages/set/userinfo'
  196. })
  197. }
  198. }
  199. })
  200. }
  201. },
  202. filters: {
  203. phone(e) {
  204. var subStr1 = e.substr(0, 3);
  205. var subStr2 = e.substr(e.length - 4, 4);
  206. var subStr = subStr1 + '...' + subStr2;
  207. e = subStr;
  208. return e;
  209. }
  210. },
  211. onReady() {
  212. // 初始化获取页面宽度
  213. uni.createSelectorQuery()
  214. .select('.container')
  215. .fields({
  216. size: true
  217. },
  218. data => {
  219. // 计算最多下拉的高度
  220. this.userDowm = Math.floor((data.width / 750) * 185);
  221. // 计算最大触发修改高度事件
  222. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  223. }
  224. )
  225. .exec();
  226. },
  227. computed: {
  228. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  229. },
  230. methods: {
  231. ...mapMutations('user', ['setUserInfo']),
  232. qhx() {
  233. check({
  234. verify_code: this.code,
  235. is_confirm: 1 //1是核销,0是查看
  236. })
  237. .then(e => {
  238. this.$api.msg('核销成功');
  239. this.close();
  240. })
  241. .catch(e => {
  242. console.log(e);
  243. });
  244. },
  245. sao() {
  246. let obj = this;
  247. // #ifndef H5
  248. uni.scanCode({
  249. success(e) {
  250. obj.code = e.result;
  251. obj.$refs.popuphx.open();
  252. console.log(obj.$refs.popuphx);
  253. }
  254. });
  255. // #endif
  256. },
  257. comfirm(text) {
  258. console.log(text);
  259. const result = this.uniCopy(text);
  260. if (result === false) {
  261. uni.showToast({
  262. title: '不支持'
  263. });
  264. } else {
  265. uni.showToast({
  266. title: '复制成功',
  267. icon: 'none'
  268. });
  269. }
  270. this.$refs.popupkf.close();
  271. },
  272. uniCopy(content) {
  273. /**
  274. * 小程序端 和 app端的复制逻辑
  275. */
  276. //#ifndef H5
  277. uni.setClipboardData({
  278. data: content,
  279. success: function() {
  280. console.log('success');
  281. return true;
  282. }
  283. });
  284. //#endif
  285. /**
  286. * H5端的复制逻辑
  287. */
  288. // #ifdef H5
  289. if (!document.queryCommandSupported('copy')) {
  290. //为了兼容有些浏览器 queryCommandSupported 的判断
  291. // 不支持
  292. return false;
  293. }
  294. let textarea = document.createElement('textarea');
  295. textarea.value = content;
  296. textarea.readOnly = 'readOnly';
  297. document.body.appendChild(textarea);
  298. textarea.select(); // 选择对象
  299. textarea.setSelectionRange(0, content.length); //核心
  300. let result = document.execCommand('copy'); // 执行浏览器复制命令
  301. textarea.remove();
  302. return result;
  303. // #endif
  304. },
  305. // 加载初始数据
  306. loadBaseData() {
  307. getUser({})
  308. .then(({
  309. data
  310. }) => {
  311. console.log(data.nickname)
  312. this.setUserInfo(data);
  313. if(!data.phone) {
  314. uni.navigateTo({
  315. url: '/pages/set/phone'
  316. })
  317. }
  318. })
  319. .catch(e => {
  320. console.log(e);
  321. });
  322. },
  323. /**
  324. * 统一跳转接口,拦截未登录路由
  325. * navigator标签现在默认没有转场动画,所以用view
  326. */
  327. navTo(url) {
  328. console.log(url);
  329. if (!this.hasLogin) {
  330. // 保存地址
  331. saveUrl();
  332. // 登录拦截
  333. interceptor();
  334. } else {
  335. uni.navigateTo({
  336. url
  337. });
  338. }
  339. },
  340. close() {
  341. this.$refs.popuphx.close();
  342. this.code = '';
  343. },
  344. // 打开客服
  345. openKf() {
  346. this.$refs.popupkf.open();
  347. },
  348. // 关闭客服
  349. cancel() {
  350. this.$refs.popupkf.close();
  351. },
  352. // 打开绑定
  353. open() {
  354. this.$refs.gspass.open();
  355. },
  356. cast() {
  357. set_waiter({
  358. uid: this.id
  359. })
  360. .then(e => {
  361. this.$api.msg('绑定成功');
  362. this.$refs.gspass.close();
  363. this.id = '';
  364. })
  365. .catch(err => {
  366. this.$refs.gspass.close();
  367. this.id = '';
  368. });
  369. },
  370. cancelpass() {
  371. this.$refs.gspass.close();
  372. this.id = '';
  373. },
  374. shaoma() {
  375. uni.scanCode({
  376. success(e) {
  377. console.log(e, 'e++++++++++++')
  378. }
  379. });
  380. }
  381. }
  382. };
  383. </script>
  384. <style lang="scss">
  385. %flex-center {
  386. display: flex;
  387. flex-direction: column;
  388. justify-content: center;
  389. align-items: center;
  390. }
  391. %section {
  392. display: flex;
  393. justify-content: space-around;
  394. align-content: center;
  395. background: #fff;
  396. border-radius: 10rpx;
  397. }
  398. .container,
  399. page {
  400. min-height: 100%;
  401. height: auto;
  402. background-color: #fff;
  403. }
  404. .vheigh {
  405. height: var(--status-bar-height);
  406. background-color: #52C696;
  407. }
  408. .top-image {
  409. position: absolute;
  410. top: 0;
  411. left: 0;
  412. right: 0;
  413. height: 230rpx;
  414. image {
  415. width: 100%;
  416. height: 100%;
  417. }
  418. }
  419. .popup-box {
  420. width: 522rpx;
  421. height: 605rpx;
  422. background-color: #ffffff;
  423. border-radius: 20rpx;
  424. position: relative;
  425. .img {
  426. position: relative;
  427. top: -56rpx;
  428. left: 0;
  429. width: 522rpx;
  430. height: 132rpx;
  431. display: flex;
  432. justify-content: center;
  433. image {
  434. border-radius: 20rpx 20rpx 0 0;
  435. width: 450rpx;
  436. height: 132rpx;
  437. }
  438. }
  439. .mian {
  440. margin-top: -44rpx;
  441. display: flex;
  442. flex-direction: column;
  443. align-items: center;
  444. // padding: 32rpx 32rpx;
  445. background-color: #ffffff;
  446. border-radius: 0 0 20rpx 20rpx;
  447. text-align: center;
  448. .delivery {
  449. font-size: 40rpx;
  450. color: #333333;
  451. display: flex;
  452. align-items: center;
  453. flex-direction: column;
  454. image {
  455. margin-top: 48rpx;
  456. width: 172rpx;
  457. height: 160rpx;
  458. }
  459. }
  460. .nocancel {
  461. font-size: 32rpx;
  462. color: #333333;
  463. margin-top: 14rpx;
  464. }
  465. .comfirm-box {
  466. margin-top: 52rpx;
  467. display: flex;
  468. .cancel {
  469. display: flex;
  470. align-items: center;
  471. justify-content: center;
  472. width: 197rpx;
  473. height: 74rpx;
  474. border: 1px solid #dcc786;
  475. border-radius: 38rpx;
  476. font-size: 32rpx;
  477. color: #605128;
  478. }
  479. .comfirm {
  480. margin-left: 32rpx;
  481. display: flex;
  482. align-items: center;
  483. justify-content: center;
  484. width: 197rpx;
  485. height: 74rpx;
  486. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  487. border-radius: 38px;
  488. font-size: 32rpx;
  489. color: #605128;
  490. }
  491. }
  492. }
  493. }
  494. .user-box {
  495. position: relative;
  496. margin: -450rpx auto 0;
  497. width: 690rpx;
  498. border-radius: 20rpx;
  499. display: flex;
  500. flex-direction: column;
  501. align-items: center;
  502. padding: 54rpx 0 30rpx;
  503. color: #fff;
  504. .user-level {
  505. display: inline-block;
  506. // width: 161rpx;
  507. padding: 0 20rpx;
  508. height: 51rpx;
  509. background: #FFFFFF;
  510. border-radius: 25rpx;
  511. position: absolute;
  512. top: 85rpx;
  513. right: 0rpx;
  514. padding:0 20rpx;
  515. display: flex;
  516. align-items: center;
  517. image {
  518. width: 25rpx;
  519. }
  520. view {
  521. font-size: 25rpx;
  522. font-weight: bold;
  523. color: #FF6B2E;
  524. padding-left: 20rpx;
  525. }
  526. }
  527. .user-info {
  528. justify-content: flex-start;
  529. width: 100%;
  530. padding-left: 40rpx;
  531. .avatar {
  532. border-radius: 50%;
  533. width: 132rpx;
  534. height: 132rpx;
  535. background-color: #eee;
  536. margin-right: 18rpx;
  537. }
  538. .user-uid {
  539. padding-top: 10rpx;
  540. font-size: 24rpx;
  541. font-weight: 500;
  542. }
  543. }
  544. .user-name {
  545. width: 300rpx;
  546. margin-top: 14rpx;
  547. font-size: 30rpx;
  548. font-family: PingFang SC;
  549. font-weight: bold;
  550. }
  551. .user-money {
  552. width: 100%;
  553. margin-top: 50rpx;
  554. justify-content: center;
  555. .user-money-item {
  556. width: 50%;
  557. display: flex;
  558. flex-direction: column;
  559. justify-content: center;
  560. align-items: center;
  561. .user-money-num {
  562. font-size: 36rpx;
  563. font-family: PingFang SC;
  564. font-weight: bold;
  565. }
  566. .user-money-font {
  567. margin-top: 20rpx;
  568. font-size: 30rpx;
  569. font-weight: 500;
  570. }
  571. }
  572. .user-xian {
  573. width: 1px;
  574. height: 77rpx;
  575. background: #eeeeee;
  576. }
  577. }
  578. }
  579. .main-box {
  580. margin: 20rpx auto 0;
  581. width: 710rpx;
  582. background: #ffffff;
  583. border-radius: 20rpx;
  584. .title {
  585. display: flex;
  586. justify-content: space-between;
  587. align-items: center;
  588. padding: 24rpx;
  589. .title-left {
  590. display: flex;
  591. align-items: center;
  592. .title-icon {
  593. width: 32rpx;
  594. height: 32rpx;
  595. }
  596. .title-font {
  597. margin-left: 20rpx;
  598. font-size: 38rpx;
  599. font-weight: bold;
  600. color: #333333;
  601. }
  602. }
  603. .title-right {
  604. width: 14rpx;
  605. height: 24rpx;
  606. }
  607. }
  608. .main {
  609. padding: 20rpx 0 30rpx;
  610. .jg {
  611. width: 1px;
  612. height: 100rpx;
  613. background: #eeeeee;
  614. }
  615. .item {
  616. padding-bottom: 20rpx;
  617. width: 25%;
  618. display: flex;
  619. flex-direction: column;
  620. align-items: center;
  621. .item-num {
  622. font-size: 36rpx;
  623. font-family: PingFang SC;
  624. font-weight: bold;
  625. color: #333333;
  626. }
  627. .item-font {
  628. margin-top: 18rpx;
  629. font-size: 22rpx;
  630. font-family: PingFang SC;
  631. font-weight: 500;
  632. color: #666666;
  633. }
  634. }
  635. .oitem {
  636. width: 33%;
  637. display: flex;
  638. flex-direction: column;
  639. align-items: center;
  640. .oitem-image {
  641. width: 76rpx;
  642. height: 76rpx;
  643. }
  644. .oitem-font {
  645. margin-top: 20rpx;
  646. font-size: 30rpx;
  647. font-weight: 500;
  648. color: #333333;
  649. }
  650. }
  651. }
  652. }
  653. .user-list {
  654. width: 657rpx;
  655. height: 104rpx;
  656. background: #FFFFFF;
  657. border-bottom: 1px solid #EEEEEE;
  658. margin: auto;
  659. .left-img {
  660. width: 40rpx;
  661. height: 40rpx;
  662. }
  663. view {
  664. padding-left: 20rpx;
  665. flex-grow: 1;
  666. font-size: 32rpx;
  667. font-weight: bold;
  668. color: #5D5D5D;
  669. }
  670. .right-img {
  671. width: 13rpx;
  672. height: 23rpx;
  673. }
  674. }
  675. .user-top {
  676. background-color: #52C696;
  677. width: 750rpx;
  678. height: 529rpx;
  679. }
  680. </style>