user.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <view>
  3. <view class="user">
  4. <!-- <wike-skeleton :count="1" v-if="homeTemplate.length === 0" type="user"></wike-skeleton> -->
  5. <!-- 头部 -->
  6. <view class="user-wrap" :style="{ backgroundImage: `url(${'https://source.iduomi.cc/user_bg.jpg'})` }">
  7. <view class="setting iconfont icon31shezhi"></view>
  8. <view v-if="hasLogin" class="info">
  9. <image class="avatar" mode="aspectFill"
  10. :src="userInfo.avatar?userInfo.avatar:'/static/images/head.jpg'"></image>
  11. <view class="nickname">
  12. <text
  13. @click="copyText(userInfo.nickname?userInfo.nickname:'默认用户')">{{userInfo.nickname?userInfo.nickname:'默认用户'}}</text>
  14. <u-icon name="edit-pen" color="#18b566" size="20" @click="modify"></u-icon>
  15. </view>
  16. </view>
  17. <view v-else class="info" @click="getlogin">
  18. <image class="avatar" mode="aspectFill" src="/static/images/head.jpg"></image>
  19. <view class="nickname">点击立即登录/注册</view>
  20. </view>
  21. </view>
  22. <!-- 订单状态 -->
  23. <view class="order-status">
  24. <view class="status-wrap">
  25. <view class="cell" style="background: #000000d4;height: 112rpx;">
  26. <view class="cell-left">
  27. <i class="iconfont icon-yongjinguanli" style="color: #ffd465;"></i>
  28. <block>
  29. <view class="cell-text" style="color: #ffd465;font-size: 30rpx;font-weight: bold;">
  30. <!-- 佣金: {{userInfo.commission }} -->
  31. {{commissionMoney.toFixed(2)}}
  32. </view>
  33. </block>
  34. </view>
  35. <!-- <navigator class="b-btn"
  36. :url="hasLogin ? '/pages/user/commission/commission-log' : '/pages/user/signin'"
  37. @click="getroute">查看佣金</navigator> -->
  38. <view class="btnBox">
  39. <navigator class="b-btn"
  40. :url="hasLogin ? '/pages/user/commission/commission-log' : '/pages/user/signin'"
  41. @click="getroute">任务佣金</navigator>
  42. <navigator class="b-btn"
  43. :url="hasLogin ? '/pages/user/commission/commission-log2' : '/pages/user/signin'"
  44. @click="getroute">推广佣金</navigator>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 用户功能 -->
  50. <view class="com-item">
  51. <view class="com-wrap">
  52. <navigator class="cell" v-for="(item, index) in userList" :key="index"
  53. @click="toScoreRecord(item.url)">
  54. <view class="cell-left">
  55. <u-icon v-if="item.ques" name="question-circle-fill" :color="item.color" size="22"></u-icon>
  56. <i v-else class="iconfont" :class="item.iconName"
  57. :style="{color:item.icon=='grid-fill'?'rgb(255, 202, 40)':item.icon=='question-circle-fill'?'rgb(49, 201, 232)':item.icon=='setting-fill'?'rgb(90, 199, 37)':'#26B3A0'}"></i>
  58. <view class="cell-text">{{ item.title }}</view>
  59. </view>
  60. <u-icon name="arrow-right" color="#9e9e9e" size="18"></u-icon>
  61. </navigator>
  62. </view>
  63. </view>
  64. <!-- 用户服务 -->
  65. <view class="com-item">
  66. <view class="com-wrap">
  67. <view class="cell" @click="openKefu">
  68. <view class="cell-left">
  69. <u-icon name="server-fill" color="#26B3A0" size="22"></u-icon>
  70. <view class="cell-text">联系客服</view>
  71. </view>
  72. <u-icon name="arrow-right" color="#9e9e9e" size="18"></u-icon>
  73. </view>
  74. <navigator class="cell" v-for="(item, index) in serverList" :key="index" :url="item.path">
  75. <view class="cell-left">
  76. <u-icon :name="item.icon" color="#26B3A0" size="22"></u-icon>
  77. <view class="cell-text">{{ item.title }}</view>
  78. </view>
  79. <u-icon name="arrow-right" color="#9e9e9e" size="18"></u-icon>
  80. </navigator>
  81. </view>
  82. </view>
  83. <view class="com-item"><wike-ad></wike-ad></view>
  84. </view>
  85. <wike-tabbar :onTabbar="true" :isShowAnimate="true"></wike-tabbar>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. mapMutations,
  91. mapActions,
  92. mapState,
  93. mapGetters
  94. } from 'vuex';
  95. import {
  96. API_ROOT
  97. } from '@/common/request/request';
  98. import {
  99. userInfo
  100. } from '@/api/my/index.js'
  101. import {
  102. taskCount,
  103. recommendCount
  104. } from '@/api/my/index.js'
  105. let interstitialAd = null,
  106. timer,
  107. time2;
  108. export default {
  109. components: {},
  110. data() {
  111. return {
  112. // totalMoney: 0,
  113. commissionMoney: 0,
  114. tuskMoney: 0,
  115. userInfo: {},
  116. API_ROOT: API_ROOT,
  117. perfectResume: false, //简历是否完善
  118. tobheight: 45,
  119. platform: this.$platform.get(),
  120. showrealname: false,
  121. showworkermy: false,
  122. avatar: '',
  123. isLoading: true,
  124. // userInfo: {
  125. // headPicUrl: '/static/images/user/avatar.jpg',
  126. // nickName: '史蒂芬.林'
  127. // },
  128. orderStatusList: [{
  129. name: '待付款',
  130. icon: 'iconfont icon31daifukuan',
  131. status: 10
  132. },
  133. {
  134. name: '待发货',
  135. icon: 'iconfont icon31daifahuo',
  136. status: 30
  137. },
  138. {
  139. name: '待收货',
  140. icon: 'iconfont icon31daishouhuo',
  141. status: 40
  142. },
  143. {
  144. name: '待评价',
  145. icon: 'iconfont icon31daipingjia',
  146. status: 50
  147. },
  148. {
  149. name: '已完成',
  150. icon: 'iconfont icon31yiguanzhudianpu',
  151. status: 55
  152. }
  153. ],
  154. currentIndex: 0,
  155. list: [{
  156. icon: '/static/images/user/class-01.png',
  157. text: '我的电子券'
  158. },
  159. {
  160. icon: '/static/images/user/class-02.png',
  161. text: '退换/售后'
  162. },
  163. {
  164. icon: '/static/images/user/class-03.png',
  165. text: '我的积分'
  166. },
  167. {
  168. icon: '/static/images/user/class-04.png',
  169. text: '送礼提醒'
  170. }
  171. ],
  172. userList: [{
  173. title: '我的课程',
  174. icon: 'question-circle-fill',
  175. path: 'collect-list',
  176. // url: '/pages/user/score/index',
  177. url: '/pages/user/score/record/index',
  178. iconName: 'icon-kecheng'
  179. },
  180. {
  181. title: '我的任务',
  182. icon: 'question-circle-fill',
  183. path: 'collect-list',
  184. url: '/pages/user/work/index',
  185. iconName: 'icon-renwu'
  186. },
  187. {
  188. title: '账户余额',
  189. icon: 'question-circle-fill',
  190. path: 'collect-list',
  191. url: '/pages/user/commission/commission-log',
  192. iconName: 'icon-yue'
  193. },
  194. {
  195. title: '推广者中心',
  196. icon: 'grid-fill',
  197. path: 'collect-list',
  198. url: '/pages/user/commission/index',
  199. iconName: 'icon-tuandui'
  200. },
  201. {
  202. title: '问答记录',
  203. icon: 'question-circle-fill',
  204. path: 'collect-list',
  205. url: '/pages/user/takenotes/takenotes',
  206. iconName: 'icon-tuandui',
  207. ques: true,
  208. color: 'rgb(49, 201, 232)'
  209. },
  210. {
  211. title: '修改用户信息',
  212. icon: 'setting-fill',
  213. path: 'collect-list',
  214. url: '/pages/user/userinfo',
  215. iconName: 'icon-xiugaioryijian'
  216. }
  217. ],
  218. serverList: [
  219. // {
  220. // title: '联系客服',
  221. // icon: 'server-fill',
  222. // path: '/pages/user/public/kefu'
  223. // },
  224. {
  225. title: '系统设置',
  226. icon: 'setting-fill',
  227. path: '/pages/user/set/index'
  228. }
  229. ],
  230. commission_setting: {},
  231. showcarmi: false,
  232. carmi: ''
  233. };
  234. },
  235. computed: {
  236. ...mapGetters(['hasLogin']),
  237. // totalMoney() {
  238. // return this.commissionMoney + this.tuskMoney
  239. // }
  240. },
  241. async onShow() {
  242. if (uni.getStorageSync('clickStudyBtn')) {
  243. uni.removeStorageSync('clickStudyBtn')
  244. }
  245. if (uni.getStorageSync('myScoreId')) {
  246. uni.removeStorageSync('myScoreId')
  247. }
  248. let res = await userInfo()
  249. console.log('用户个人信息返回值', res);
  250. if (res.code == 0) {
  251. this.userInfo = res.data
  252. }
  253. let ress = await taskCount()
  254. if (ress.code == 0) {
  255. this.commissionMoney = Number(ress.data.cashing)
  256. console.log('我的--任务佣金汇总返回值', ress, this.commissionMoney);
  257. }
  258. },
  259. async onLoad() {
  260. if (!uni.getStorageSync('token')) {
  261. uni.redirectTo({
  262. url: '/pages/user/signin'
  263. })
  264. }
  265. let res1 = await recommendCount()
  266. if (res1.code == 0) {
  267. this.tuskMoney = Number(ress.data.cashing)
  268. // console.log('我的--推广佣金汇总返回值', res1, this.tuskMoney);
  269. }
  270. this.isLoading = false;
  271. if (!this.hasLogin) {
  272. uni.navigateTo({
  273. url: '/pages/user/signin'
  274. });
  275. }
  276. },
  277. onReady() {
  278. },
  279. onUnload() {
  280. },
  281. methods: {
  282. toScoreRecord(url) {
  283. uni.setStorageSync('from', 'user')
  284. uni.navigateTo({
  285. url
  286. })
  287. },
  288. openKefu() {
  289. window.open('https://work.weixin.qq.com/kfid/kfc807229b723286051')
  290. },
  291. getlogin() {
  292. // console.log(2222);
  293. uni.navigateTo({
  294. url: '/pages/user/signin'
  295. });
  296. },
  297. copyText(text) {
  298. uni.setClipboardData({
  299. data: text,
  300. success: function() {
  301. // console.log('success');
  302. uni.showToast({
  303. title: '用户名复制成功'
  304. });
  305. }
  306. });
  307. },
  308. modify() {
  309. uni.navigateTo({
  310. url: '/pages/user/userinfo'
  311. })
  312. },
  313. clickuimage(e) {
  314. uni.previewImage({
  315. urls: [e]
  316. })
  317. },
  318. getCommissionSetting() {
  319. this.$http('conf.getGroupConf', {
  320. group: 'system.commission'
  321. }).then(res => {
  322. if (res.code == 0) {
  323. uni.setNavigationBarTitle({
  324. title: this.appInfo.site_name
  325. });
  326. if (res.data.is_commission == 1) {
  327. let obj = {
  328. title: '我的团队',
  329. icon: 'grid-fill',
  330. path: 'address-list',
  331. url: '/pages/user/commission/index'
  332. };
  333. this.userList.splice(0, 0, obj);
  334. }
  335. if (this.appInfo.is_aipainting && this.appInfo.is_aipainting == 1) {
  336. let draw = {
  337. title: '绘画记录',
  338. icon: 'edit-pen-fill',
  339. path: 'address-list',
  340. url: '/pages/user/draw/draw'
  341. };
  342. this.userList.splice(1, 0, draw);
  343. }
  344. }
  345. });
  346. },
  347. getroute() {
  348. if (!this.hasLogin) {
  349. uni.setStorageSync('route', '/pages/user/user');
  350. }
  351. },
  352. exchange() {
  353. if (!this.hasLogin) {
  354. uni.navigateTo({
  355. url: '/pages/user/signin'
  356. });
  357. uni.setStorageSync('route', '/pages/user/user');
  358. return;
  359. }
  360. uni.showLoading({
  361. title: '卡密兑换中...'
  362. });
  363. this.$http('member.kami', {
  364. code: this.carmi
  365. }).then(res => {
  366. if (res.code == 0) {
  367. uni.showToast({
  368. title: '兑换成功'
  369. });
  370. this.getUserData();
  371. this.showcarmi = false;
  372. }
  373. });
  374. },
  375. getuserinfo() {
  376. uni.navigateTo({
  377. url: '/pages/user/userinfo'
  378. });
  379. },
  380. getPersonalRealNameInfo() {
  381. this.$http('vertify.getPersonalRealNameInfo').then(res => {
  382. if (res.code == 0) {
  383. this.showrealname = false;
  384. } else {
  385. this.showrealname = true;
  386. }
  387. });
  388. },
  389. workermy() {
  390. this.$http('worker.my').then(res => {
  391. if (res.code == 0) {
  392. if (res.data.name) {
  393. this.showworkermy = true;
  394. } else {
  395. this.showworkermy = false;
  396. }
  397. } else {
  398. this.showworkermy = false;
  399. }
  400. });
  401. },
  402. getfeedback() {
  403. uni.showModal({
  404. content: '请联系客服,提供您的宝贵意见',
  405. title: '提示',
  406. confirmText: '联系客服',
  407. confirmColor: '#00ca88',
  408. success(res) {
  409. if (res.confirm) {
  410. uni.navigateTo({
  411. url: '/pages/user/public/kefu'
  412. });
  413. }
  414. }
  415. });
  416. },
  417. showInterstitial() {
  418. time2 = setInterval(
  419. function() {
  420. interstitialAd.show().catch(err => {
  421. console.error(err);
  422. });
  423. },
  424. this.appInfo.gap ? this.appInfo.gap * 1000 : 12000
  425. );
  426. }
  427. }
  428. };
  429. </script>
  430. <style lang="scss">
  431. .btnBox {
  432. display: flex;
  433. justify-content: space-between;
  434. width: 45%;
  435. }
  436. page {
  437. background: #f2f2f2;
  438. }
  439. .btn-hover {
  440. background: #f2f2f2 !important;
  441. }
  442. .user {
  443. // height: 1800rpx;
  444. padding-bottom: 200rpx;
  445. .user-wrap {
  446. display: flex;
  447. justify-content: center;
  448. align-items: center;
  449. height: 56vw;
  450. padding: 30rpx;
  451. z-index: 9;
  452. // border-radius: 0 0 20% 20%;
  453. // background: url('https://mp-ea41a5d2-ea75-4ec6-aa57-ac841611f485.cdn.bspapp.com/cloudstorage/796de0fd-c730-40b8-9177-1250bb76d0a3.jpg') no-repeat;
  454. background-size: cover;
  455. .setting {
  456. color: #fff;
  457. position: absolute;
  458. top: 60rpx;
  459. left: 60rpx;
  460. font-size: 50rpx;
  461. }
  462. .info {
  463. position: absolute;
  464. text-align: center;
  465. .avatar {
  466. width: 150rpx;
  467. height: 150rpx;
  468. border-radius: 50%;
  469. border: 3px solid #fff;
  470. }
  471. .nickname {
  472. color: #fff;
  473. font-size: 30rpx;
  474. margin-top: 20rpx;
  475. font-weight: bold;
  476. display: flex;
  477. }
  478. }
  479. }
  480. .order-status {
  481. padding: 0 20rpx;
  482. margin-top: -8vw;
  483. .status-wrap {
  484. border-radius: 25rpx;
  485. overflow: hidden;
  486. .status-list {
  487. display: flex;
  488. justify-content: space-evenly;
  489. align-items: center;
  490. background: #fff;
  491. padding-top: 30rpx;
  492. padding-bottom: 30rpx;
  493. .status-item {
  494. flex: 1;
  495. display: flex;
  496. flex-direction: column;
  497. justify-content: center;
  498. align-items: center;
  499. .item-icon {
  500. line-height: 1;
  501. font-size: 65rpx;
  502. color: #bbb;
  503. }
  504. .item-text {
  505. font-size: 28rpx;
  506. color: #666;
  507. margin-top: 5rpx;
  508. }
  509. }
  510. }
  511. }
  512. }
  513. .com-item {
  514. padding-left: 20rpx;
  515. padding-right: 20rpx;
  516. margin-top: 20rpx;
  517. .com-wrap {
  518. border-radius: 25rpx;
  519. overflow: hidden;
  520. }
  521. }
  522. .cell {
  523. height: 110rpx;
  524. padding-left: 20rpx;
  525. padding-right: 20rpx;
  526. display: flex;
  527. justify-content: space-between;
  528. align-items: center;
  529. background: #fff;
  530. border-bottom: 1px solid #f8f8f8;
  531. &:active {
  532. background: #f2f2f2;
  533. }
  534. &:last-child {
  535. border-bottom: none !important;
  536. }
  537. .cell-left {
  538. display: flex;
  539. align-items: center;
  540. .cell-icon {
  541. width: 50rpx;
  542. height: 50rpx;
  543. }
  544. .cell-text {
  545. color: #666;
  546. font-size: 32rpx;
  547. margin-left: 20rpx;
  548. // font-size: 30rpx;
  549. }
  550. }
  551. .iconfont {
  552. font-size: 40rpx;
  553. color: #999;
  554. }
  555. }
  556. }
  557. .b-btn {
  558. // position: absolute;
  559. // right: 20upx;
  560. // top: 24upx;
  561. width: 132upx;
  562. height: 50upx;
  563. text-align: center;
  564. line-height: 50upx;
  565. font-size: 24upx;
  566. color: #36343c;
  567. border-radius: 30px;
  568. background: #ffd465;
  569. z-index: 1;
  570. }
  571. .carmimodal {
  572. width: 600rpx;
  573. border-radius: 20rpx;
  574. position: relative;
  575. .carmiclose {
  576. position: absolute;
  577. right: 15rpx;
  578. top: 15rpx;
  579. }
  580. .carmititle {
  581. background: #26b3a0;
  582. color: #fff;
  583. height: 120rpx;
  584. line-height: 120rpx;
  585. font-size: 32rpx;
  586. font-weight: bold;
  587. text-align: center;
  588. border-radius: 20rpx 20rpx 0 0;
  589. margin-bottom: 60rpx;
  590. }
  591. .carmiinput {
  592. margin: 30rpx;
  593. }
  594. .carmiexchange {
  595. margin: 80rpx 30rpx 90rpx 30rpx;
  596. background: #26b3a0;
  597. color: #fff;
  598. border-radius: 80rpx;
  599. height: 80rpx;
  600. line-height: 80rpx;
  601. text-align: center;
  602. }
  603. .kf_qrcode {
  604. // margin-left: 200rpx;
  605. margin-bottom: 30rpx;
  606. }
  607. }
  608. </style>