my.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <view class="container">
  3. <view class="vheigh"></view>
  4. <view class="top-image">
  5. <image src="../../static/img/userBg.png" mode=""></image>
  6. </view>
  7. <view class="" style="height: 142rpx;"></view>
  8. <view class="user-box">
  9. <image class="avatar" :src="userInfo.avatar" mode="" v-if="userInfo.avatar"></image>
  10. <image class="avatar" src="../../static/error/missing-face.png" mode="" v-else></image>
  11. <view class="user-name">{{ userInfo.nickname || '游客' }}</view>
  12. <view class="user-phone">{{ userInfo.phone || '******' }}</view>
  13. <view class="user-money flex">
  14. <view class="user-money-item" @click="navTo('/pages/money/balance')">
  15. <view class="user-money-num">{{ userInfo.now_money || 0 }}</view>
  16. <view class="user-money-font">我的余额</view>
  17. </view>
  18. <view class="user-xian"></view>
  19. <view class="user-money-item" @click="navTo('/pages/money/wallet')">
  20. <view class="user-money-num">{{ userInfo.commissionCount || 0 }}</view>
  21. <view class="user-money-font">我的佣金</view>
  22. </view>
  23. <view class="user-xian"></view>
  24. <view class="user-money-item" @click="navTo('/pages/user/extension')">
  25. <view class="user-money-num">{{ userInfo.spread_count || 0 }}</view>
  26. <view class="user-money-font">我的推广</view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="shop flex" @click="becomeVip()" v-if="userInfo.is_receiver == 0">
  31. <view class="shop-bg">
  32. <image src="../../static/img/usertitle.png" mode=""></image>
  33. </view>
  34. <view class="shop-left">申请成为接单员{{ type == 0 ? '(审核中)' : type == -1 ? '(审核失败)' : '' }}</view>
  35. <view class="shop-right">立即申请</view>
  36. </view>
  37. <view v-if="userInfo.is_receiver == 1">
  38. <view class="shop flex" @click="navTo('/pages/jdr/center')">
  39. <view class="shop-bg">
  40. <image src="../../static/img/usertitle.png" mode=""></image>
  41. </view>
  42. <view class="shop-left">接单中心</view>
  43. <view class="shop-right">立即进入</view>
  44. </view>
  45. <view class="main-box">
  46. <view class="title flex" @click="navTo('/pages/jdr/order?state=0')">
  47. <view class="title-left">
  48. <image class="title-icon" src="../../static/icon/user2.png" mode=""></image>
  49. <view class="title-font">我的接单</view>
  50. </view>
  51. <image class="title-right" src="../../static/icon/jt.png" mode=""></image>
  52. </view>
  53. <view class="main flex">
  54. <view class="oitem" @click="navTo('/pages/jdr/order?state=0')">
  55. <image class="oitem-image" src="../../static/icon/user3.png" mode=""></image>
  56. <view class="oitem-font">进行中</view>
  57. </view>
  58. <view class="oitem" @click="navTo('/pages/jdr/order?state=1')">
  59. <image class="oitem-image" src="../../static/icon/user4.png" mode=""></image>
  60. <view class="oitem-font">待确认</view>
  61. </view>
  62. <view class="oitem" @click="navTo('/pages/jdr/order?state=2')">
  63. <image class="oitem-image" src="../../static/icon/user5.png" mode=""></image>
  64. <view class="oitem-font">已完成</view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 我的工具 -->
  70. <view class="my-tool flex" @click="navTo('/pages/user/shareQrCode')">
  71. <view class="my-tool-left">
  72. <image class="my-tool-image1" src="../../static/icon/u1.png" mode=""></image>
  73. <view class="my-tool-font">推广海报</view>
  74. </view>
  75. <image class="my-tool-right" src="../../static/icon/jt.png" mode=""></image>
  76. </view>
  77. <view class="my-tool flex" @click="navTo('/pages/user/coupon')">
  78. <view class="my-tool-left">
  79. <image class="my-tool-image2" src="../../static/icon/u2.png" mode=""></image>
  80. <view class="my-tool-font">我的卡券</view>
  81. </view>
  82. <image class="my-tool-right" src="../../static/icon/jt.png" mode=""></image>
  83. </view>
  84. <view class="my-tool flex" @click="openPopup">
  85. <view class="my-tool-left">
  86. <image class="my-tool-image4" src="../../static/icon/u3.png" mode=""></image>
  87. <view class="my-tool-font">意见反馈</view>
  88. </view>
  89. <image class="my-tool-right" src="../../static/icon/jt.png" mode=""></image>
  90. </view>
  91. <view class="my-tool flex" @click="navTo('/pages/set/userinfo')">
  92. <view class="my-tool-left">
  93. <image class="my-tool-image5" src="../../static/icon/u4.png" mode=""></image>
  94. <view class="my-tool-font">设置</view>
  95. </view>
  96. <image class="my-tool-right" src="../../static/icon/jt.png" mode=""></image>
  97. </view>
  98. <!-- #ifdef H5 -->
  99. <view class="ipc" @click="tiao()">
  100. <view class="com">
  101. 台州道可特林网络科技有限公司
  102. </view>
  103. <view class="ipc-font">
  104. 浙ICP备17054590号-3
  105. </view>
  106. </view>
  107. <!-- #endif -->
  108. <uni-popup ref="popup" type="center">
  109. <view class="popup-box">
  110. <view class="img">
  111. <image src="../../static/img/img009.png" mode=""></image>
  112. </view>
  113. <view class="mian">
  114. <view class="delivery">
  115. <view class="title">已经为您定制专属客服</view>
  116. <image src="../../static/img/img010.png" mode=""></image>
  117. </view>
  118. <view class="nocancel">客服VX:{{ text }}</view>
  119. <view class="comfirm-box">
  120. <view class="cancel" @click="cancel">取消</view>
  121. <view class="comfirm" @click="comfirm(text)">复制微信</view>
  122. </view>
  123. </view>
  124. </view>
  125. </uni-popup>
  126. </view>
  127. </template>
  128. <script>
  129. import uniCopy from '@/utils/uni-copy.js';
  130. import {
  131. mapState,
  132. mapMutations
  133. } from 'vuex';
  134. import uniList from '@/components/uni-list/uni-list.vue';
  135. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  136. import {
  137. orderData,
  138. getUserInfo,
  139. user_apply
  140. } from '@/api/user.js';
  141. import {
  142. saveUrl,
  143. interceptor
  144. } from '@/utils/loginUtils.js';
  145. export default {
  146. components: {
  147. uniList,
  148. uniListItem
  149. },
  150. data() {
  151. return {
  152. type: 1,
  153. text: '', // 客服
  154. total: '',
  155. remarks: ''
  156. };
  157. },
  158. onShow() {
  159. // 判断是否已经登录
  160. if (this.hasLogin) {
  161. this.loadBaseData();
  162. }
  163. },
  164. computed: {
  165. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  166. },
  167. methods: {
  168. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  169. // 加载初始数据
  170. loadBaseData() {
  171. getUserInfo({})
  172. .then(({
  173. data
  174. }) => {
  175. this.setUserInfo(data);
  176. // 获取用户数据完毕后在获取订单数据防止多次跳转到登录页
  177. orderData({})
  178. .then(({
  179. data
  180. }) => {
  181. this.setOrderInfo(data);
  182. })
  183. .catch(e => {
  184. this.setOrderInfo({
  185. complete_count: 0, //完成
  186. received_count: 0, //待收货
  187. unshipped_count: 0, //待发货
  188. order_count: 0, //订单总数
  189. unpaid_count: 0 //待付款
  190. });
  191. });
  192. })
  193. .catch(e => {
  194. console.log(e);
  195. });
  196. user_apply({}).then(({
  197. data
  198. }) => {
  199. if (data != []) {
  200. this.type = data[0].status;
  201. this.remarks = data[0].remarks;
  202. }
  203. console.log(data);
  204. });
  205. },
  206. /**
  207. * 统一跳转接口,拦截未登录路由
  208. * navigator标签现在默认没有转场动画,所以用view
  209. */
  210. navTo(url) {
  211. if (!this.hasLogin) {
  212. // 保存地址
  213. saveUrl();
  214. // 登录拦截
  215. interceptor();
  216. } else {
  217. uni.navigateTo({
  218. url
  219. });
  220. }
  221. },
  222. tiao() {
  223. window.location.href = 'https://beian.miit.gov.cn/#/Integrated/index'
  224. },
  225. openPopup() {
  226. this.$refs.popup.open();
  227. },
  228. // 客服弹窗 - 复制微信
  229. comfirm(value) {
  230. let content = value; //需要复制的内容
  231. console.log('复制的内容:', content);
  232. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  233. const result = uniCopy({
  234. content
  235. });
  236. if (result === false) {
  237. uni.showToast({
  238. title: '不支持'
  239. });
  240. } else {
  241. uni.showToast({
  242. title: '复制成功',
  243. icon: 'none'
  244. });
  245. }
  246. this.$refs.popup.close();
  247. },
  248. becomeVip() {
  249. if (this.type == 0) {
  250. uni.showModal({
  251. title: '提示',
  252. content: '正在审核中,请耐心等待。'
  253. });
  254. }
  255. if (this.type == -1) {
  256. uni.showModal({
  257. title: '提示',
  258. content: '审核失败,失败原因:' + this.remarks + '。是否重新提交',
  259. success: function(res) {
  260. if (res.confirm) {
  261. uni.navigateTo({
  262. url: '/pages/user/becomeVip'
  263. });
  264. } else if (res.cancel) {
  265. uni.navigateTo({
  266. url: '/pages/user/becomeVip'
  267. });
  268. }
  269. }
  270. });
  271. }
  272. if (this.type == 1) {
  273. uni.navigateTo({
  274. url: '/pages/user/becomeVip'
  275. });
  276. }
  277. },
  278. // 客服弹窗 - 取消
  279. cancel() {
  280. this.$refs.popup.close();
  281. }
  282. }
  283. };
  284. </script>
  285. <style lang="scss">
  286. page,
  287. .container {
  288. min-height: 100%;
  289. height: auto;
  290. background: #ffffff;
  291. }
  292. .vheigh {
  293. height: var(--status-bar-height);
  294. background-color: $base-color;
  295. }
  296. .top-image {
  297. position: absolute;
  298. top: 0;
  299. left: 0;
  300. right: 0;
  301. height: 428rpx;
  302. image {
  303. width: 100%;
  304. height: 100%;
  305. }
  306. }
  307. .user-box {
  308. position: relative;
  309. z-index: 2;
  310. width: 690rpx;
  311. margin: 0 auto;
  312. background: #ffffff;
  313. box-shadow: 0px 4rpx 13rpx 0px rgba(229, 229, 229, 0.46);
  314. border-radius: 20rpx;
  315. display: flex;
  316. flex-direction: column;
  317. align-items: center;
  318. padding: 0 0 30rpx;
  319. line-height: 1;
  320. .avatar {
  321. position: relative;
  322. top: -66rpx;
  323. border-radius: 50%;
  324. width: 132rpx;
  325. height: 132rpx;
  326. }
  327. .user-name {
  328. position: relative;
  329. top: -66rpx;
  330. margin-top: 14rpx;
  331. font-size: 30rpx;
  332. font-family: PingFang SC;
  333. font-weight: bold;
  334. color: #333333;
  335. }
  336. .user-phone {
  337. position: relative;
  338. top: -66rpx;
  339. margin-top: 14rpx;
  340. font-size: 28rpx;
  341. font-family: PingFang SC;
  342. font-weight: bold;
  343. color: #666666;
  344. }
  345. .user-money {
  346. width: 100%;
  347. justify-content: center;
  348. .user-money-item {
  349. width: 50%;
  350. display: flex;
  351. flex-direction: column;
  352. justify-content: center;
  353. align-items: center;
  354. .user-money-num {
  355. font-size: 36rpx;
  356. font-family: PingFang SC;
  357. font-weight: bold;
  358. color: #333333;
  359. }
  360. .user-money-font {
  361. margin-top: 20rpx;
  362. font-size: 22rpx;
  363. font-family: PingFang SC;
  364. font-weight: 500;
  365. color: #666666;
  366. }
  367. }
  368. .user-xian {
  369. width: 1px;
  370. height: 77rpx;
  371. background: #eeeeee;
  372. }
  373. }
  374. }
  375. .shop {
  376. width: 690rpx;
  377. height: 90rpx;
  378. margin: 18rpx auto 0;
  379. position: relative;
  380. padding: 0 20rpx 0 70rpx;
  381. .shop-bg {
  382. position: absolute;
  383. left: 0;
  384. right: 0;
  385. top: 0;
  386. width: 690rpx;
  387. height: 90rpx;
  388. image {
  389. width: 100%;
  390. height: 100%;
  391. }
  392. }
  393. .shop-left {
  394. position: relative;
  395. z-index: 2;
  396. font-size: 30rpx;
  397. font-family: PingFang SC;
  398. font-weight: bolder;
  399. color: #6a4714;
  400. }
  401. .shop-right {
  402. position: relative;
  403. z-index: 2;
  404. width: 148rpx;
  405. height: 50rpx;
  406. background: linear-gradient(-90deg, #8c5f1d 0%, #8c5f1c 77%, #875916 99%);
  407. border-radius: 25rpx;
  408. line-height: 50rpx;
  409. text-align: center;
  410. font-size: 28rpx;
  411. font-family: PingFang SC;
  412. font-weight: 500;
  413. color: #f0e1c9;
  414. }
  415. }
  416. .main-box {
  417. margin: 20rpx auto 0;
  418. width: 710rpx;
  419. background: #ffffff;
  420. box-shadow: 0px 4rpx 14rpx 0px rgba(229, 229, 229, 0.46);
  421. border-radius: 20rpx;
  422. .title {
  423. display: flex;
  424. justify-content: space-between;
  425. align-items: center;
  426. padding: 24rpx;
  427. border-bottom: 1px solid #eeeeee;
  428. .title-left {
  429. display: flex;
  430. align-items: center;
  431. .title-icon {
  432. width: 32rpx;
  433. height: 32rpx;
  434. }
  435. .title-font {
  436. margin-left: 20rpx;
  437. font-size: 28rpx;
  438. font-family: PingFang SC;
  439. font-weight: bold;
  440. color: #333333;
  441. }
  442. }
  443. .title-right {
  444. width: 14rpx;
  445. height: 24rpx;
  446. }
  447. }
  448. .main {
  449. padding: 50rpx 0 30rpx;
  450. .jg {
  451. width: 1px;
  452. height: 100rpx;
  453. background: #eeeeee;
  454. }
  455. .item {
  456. padding-bottom: 20rpx;
  457. width: 25%;
  458. display: flex;
  459. flex-direction: column;
  460. align-items: center;
  461. .item-num {
  462. font-size: 36rpx;
  463. font-family: PingFang SC;
  464. font-weight: bold;
  465. color: #333333;
  466. }
  467. .item-font {
  468. margin-top: 18rpx;
  469. font-size: 22rpx;
  470. font-family: PingFang SC;
  471. font-weight: 500;
  472. color: #666666;
  473. }
  474. }
  475. .oitem {
  476. width: 33%;
  477. display: flex;
  478. flex-direction: column;
  479. align-items: center;
  480. .oitem-image {
  481. height: 40rpx;
  482. width: 42rpx;
  483. }
  484. .oitem-font {
  485. margin-top: 20rpx;
  486. font-size: 24rpx;
  487. font-family: PingFang SC;
  488. font-weight: 500;
  489. color: #333333;
  490. }
  491. }
  492. }
  493. }
  494. .my-tool {
  495. width: 690rpx;
  496. background: #ffffff;
  497. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  498. border-radius: 28rpx;
  499. padding: 34rpx 24rpx;
  500. margin: 15rpx auto 0;
  501. .my-tool-left {
  502. display: flex;
  503. align-items: center;
  504. .my-tool-image1 {
  505. width: 41rpx;
  506. height: 35rpx;
  507. }
  508. .my-tool-image2 {
  509. width: 43rpx;
  510. height: 40rpx;
  511. }
  512. .my-tool-image3 {
  513. width: 42rpx;
  514. height: 37rpx;
  515. }
  516. .my-tool-image4 {
  517. width: 38rpx;
  518. height: 40rpx;
  519. }
  520. .my-tool-image5 {
  521. width: 42rpx;
  522. height: 39rpx;
  523. }
  524. .my-tool-font {
  525. font-size: 29rpx;
  526. font-family: PingFang SC;
  527. font-weight: bold;
  528. color: #5d5d5d;
  529. margin-left: 14rpx;
  530. }
  531. }
  532. .my-tool-right {
  533. width: 18rpx;
  534. height: 22rpx;
  535. }
  536. }
  537. .popup-box {
  538. width: 522rpx;
  539. height: 605rpx;
  540. background-color: #ffffff;
  541. border-radius: 20rpx;
  542. position: relative;
  543. .img {
  544. position: relative;
  545. top: -56rpx;
  546. left: 0;
  547. width: 522rpx;
  548. height: 132rpx;
  549. display: flex;
  550. justify-content: center;
  551. image {
  552. border-radius: 20rpx 20rpx 0 0;
  553. width: 450rpx;
  554. height: 132rpx;
  555. }
  556. }
  557. .mian {
  558. margin-top: -44rpx;
  559. display: flex;
  560. flex-direction: column;
  561. align-items: center;
  562. // padding: 32rpx 32rpx;
  563. background-color: #ffffff;
  564. border-radius: 0 0 20rpx 20rpx;
  565. text-align: center;
  566. .delivery {
  567. font-size: 40rpx;
  568. color: #333333;
  569. display: flex;
  570. align-items: center;
  571. flex-direction: column;
  572. .title {}
  573. image {
  574. margin-top: 48rpx;
  575. width: 172rpx;
  576. height: 160rpx;
  577. }
  578. }
  579. .nocancel {
  580. font-size: 32rpx;
  581. color: #333333;
  582. margin-top: 14rpx;
  583. }
  584. .comfirm-box {
  585. margin-top: 52rpx;
  586. display: flex;
  587. // margin-bottom: 32rpx;
  588. // justify-content: space-around;
  589. .cancel {
  590. display: flex;
  591. align-items: center;
  592. justify-content: center;
  593. width: 197rpx;
  594. height: 74rpx;
  595. border: 1px solid #dcc786;
  596. border-radius: 38rpx;
  597. font-size: 32rpx;
  598. color: #605128;
  599. }
  600. .comfirm {
  601. margin-left: 32rpx;
  602. display: flex;
  603. align-items: center;
  604. justify-content: center;
  605. width: 197rpx;
  606. height: 74rpx;
  607. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  608. border-radius: 38px;
  609. font-size: 32rpx;
  610. color: #605128;
  611. }
  612. }
  613. }
  614. }
  615. .ipc {
  616. position: absolute;
  617. bottom: 40rpx;
  618. text-align: center;
  619. margin-top: 40rpx;
  620. width: 100%;
  621. .ipc-font {
  622. color: blue;
  623. text-decoration: underline
  624. }
  625. }
  626. </style>