user.vue 14 KB

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