mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <template>
  2. <view class="content">
  3. <view class="hflex acenter jbetween user">
  4. <view class="hflex acenter" v-if="!login">
  5. <view class="avatar_box">
  6. <image src="https://ship.shipcc.cn/common/avatar1.png" mode="aspectFill" class="avatar"></image>
  7. </view>
  8. <view class="hflex acenter" @click="toLogin">
  9. <view class="text_style1">立即登录</view>
  10. <u-icon name="arrow-right" color="#000" size="10"></u-icon>
  11. </view>
  12. </view>
  13. <view class="hflex acenter" v-else>
  14. <view class="avatar_box">
  15. <image :src="user.headimg" mode="aspectFill" class="avatar"></image>
  16. <view class="auth">{{user.is_auth?'已实名':'未实名'}}</view>
  17. </view>
  18. <view class="vflex">
  19. <view class="hflex acenter">
  20. <view class="text_style1 text_hide" style="max-width: 300rpx;">{{user.nickname}}</view>
  21. <view class="setting" @click="toSetting">设置</view>
  22. </view>
  23. <view class="member_icon" v-if="user.is_vip == 0">
  24. <image src="/static/images/mine/vip_bg.png" style="width: 136rpx;height: 48rpx;"></image>
  25. <view class="vip_name">{{user.vip_name}}</view>
  26. </view>
  27. <view class="member_icon" v-if="user.is_vip == 1">
  28. <image src="/static/images/mine/vip_bg2.png" style="width: 136rpx;height: 48rpx;"></image>
  29. <view class="vip_name">{{user.vip_name}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="user_right" @click="toMessage">
  34. <image src="/static/images/mine/message.png" mode="aspectFill" class="message_icon"></image>
  35. <view class="message" v-if="message_num > 0">{{message_num}}</view>
  36. </view>
  37. </view>
  38. <view class="member hflex acenter jbetween" @click="toMember">
  39. <view class="vflex">
  40. <view class="hflex acenter">
  41. <image src="/static/images/mine/huiyuan.png" mode="widthFix" style="width: 40rpx;"></image>
  42. <view class="member_name">船百知会员</view>
  43. </view>
  44. <view class="member_detail" v-if="user.is_vip == 1">{{user.vip_datetime}}到期</view>
  45. <view class="member_detail" v-else>开通会员立享优惠</view>
  46. </view>
  47. <view class="hflex acenter jbetween member_btn">
  48. <view v-if="user.is_vip">立即续费</view>
  49. <view v-else>去开通</view>
  50. <image src="/static/images/mine/btn_right.png" mode="widthFix" style="width: 32rpx;margin-left: 14rpx;"></image>
  51. </view>
  52. </view>
  53. <view class="box hflex acenter jbetween">
  54. <view class="box_left vflex" @click="toWallet">
  55. <view class="left_title">我的余额</view>
  56. <view class="left_num" v-if="login">{{user.money ? user.money : 0}}</view>
  57. <view class="left_num" v-else>**</view>
  58. <view class="left_bottom">看看你的账户余额吧~</view>
  59. </view>
  60. <view class="box_right vflex" @click="toCollect">
  61. <view class="left_title">我的收藏</view>
  62. <view class="left_num" v-if="login">{{user.collection_count ? user.collection_count : 0}}</view>
  63. <view class="left_num" v-else>**</view>
  64. <view class="right_bottom">你收藏的宝藏都在这里</view>
  65. </view>
  66. </view>
  67. <view class="list">
  68. <view class="list_title">我的订单</view>
  69. <view class=" hflex acenter jbetween">
  70. <block v-for="(item,index) in order" :key="index">
  71. <view class="list_item vflex acenter" @click="toOrder(item.url)">
  72. <view class="img_box">
  73. <image :src="item.img" mode="widthFix" style="width: 56rpx;margin-bottom: 20rpx;"></image>
  74. <view class="img_num" v-if="item.num > 0">
  75. {{item.num}}
  76. </view>
  77. </view>
  78. <view>{{item.text}}</view>
  79. </view>
  80. </block>
  81. </view>
  82. </view>
  83. <view class="list">
  84. <view class="list_title">我的服务</view>
  85. <view class="hflex acenter fwrap">
  86. <block v-for="(item,index) in serviceList" :key="index">
  87. <view class="list_item1 vflex acenter" @click="toService(index)">
  88. <image :src="item.img" mode="widthFix" style="width: 60rpx;margin-bottom: 14rpx;"></image>
  89. <view>{{item.text}}</view>
  90. </view>
  91. </block>
  92. </view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import $api from '@/static/js/api.js'
  98. var that = ''
  99. const app = getApp()
  100. export default {
  101. data() {
  102. return {
  103. login: false,
  104. user: {},
  105. order: [
  106. {
  107. id: 1,
  108. img: 'https://ship.shipcc.cn/common/order1.png',
  109. text: '生产订单',
  110. url: '/page_shop/pages/order/production',
  111. num: 0,
  112. },
  113. {
  114. id: 2,
  115. img: 'https://ship.shipcc.cn/common/order2.png',
  116. text: '外协订单',
  117. url: '/page_shop/pages/order/outsourcing',
  118. num: 0,
  119. },
  120. {
  121. id: 3,
  122. img: 'https://ship.shipcc.cn/common/order3.png',
  123. text: '采购订单',
  124. url: '/page_shop/pages/order/purchase',
  125. num: 0,
  126. },
  127. {
  128. id: 4,
  129. img: 'https://ship.shipcc.cn/common/order4.png',
  130. text: '海运订单',
  131. num: 0,
  132. url: '/page_shop/pages/order/oceanShipping'
  133. },
  134. {
  135. id: 5,
  136. img: 'https://ship.shipcc.cn/common/order5.png',
  137. text: '维修订单',
  138. num: 0,
  139. url: '/page_shop/pages/order/repair'
  140. },
  141. ],
  142. serviceList: [
  143. {
  144. img: 'https://ship.shipcc.cn/common/service1.png',
  145. text: '加入人才库',
  146. url: '/page_shop/pages/service/joinPerson'
  147. },
  148. {
  149. img: 'https://ship.shipcc.cn/common/service2.png',
  150. text: '成为维修工',
  151. url: '/page_shop/pages/service/applyMaintenance'
  152. },
  153. {
  154. url: '/page_shop/pages/service/settledShipyard',
  155. img: 'https://ship.shipcc.cn/common/service3.png',
  156. text: '入驻船厂',
  157. },
  158. {
  159. url: '/page_shop/pages/service/settledMerchants',
  160. img: 'https://ship.shipcc.cn/common/service4.png',
  161. text: '入驻商家',
  162. },
  163. {
  164. url: '/page_shop/pages/setting/realname',
  165. img: 'https://ship.shipcc.cn/common/service5.png',
  166. text: '实名认证',
  167. },
  168. /* {
  169. url: '/page_shop/pages/service/release',
  170. img: 'https://ship.shipcc.cn/common/service6.png',
  171. text: '我的发布',
  172. }, */
  173. {
  174. url: '/page_shop/pages/service/demand',
  175. img: 'https://ship.shipcc.cn/common/service7.png',
  176. text: '我的需求',
  177. },
  178. {
  179. url: '/page_shop/pages/service/feed/feedback',
  180. img: 'https://ship.shipcc.cn/common/service8.png',
  181. text: '意见反馈',
  182. },
  183. ],
  184. message_num: 0
  185. }
  186. },
  187. onLoad() {
  188. that = this
  189. // that.getUser()
  190. },
  191. onShow() {
  192. that.isLogin()
  193. },
  194. onPullDownRefresh() {
  195. that.isLogin()
  196. /* that.getUser()
  197. that.getNum()
  198. that.getTotal() */
  199. },
  200. methods: {
  201. // 判断登录
  202. isLogin() {
  203. var token = uni.getStorageSync("token")
  204. if (token) {
  205. that.login = true
  206. that.getUser()
  207. that.getNum()
  208. that.getTotal()
  209. } else {
  210. that.login = false
  211. that.user = {}
  212. }
  213. },
  214. // 获取个人信息
  215. getUser() {
  216. $api.req({
  217. url: '/data/api.auth.Center/get',
  218. method: 'POST',
  219. }, function(res) {
  220. if(res.code == 1) {
  221. that.user = res.data
  222. uni.setStorageSync('maintenance', false)
  223. uni.setStorageSync('myUsername', res.data.huanxinID)
  224. uni.setStorageSync('openid1', res.data.openid1)
  225. uni.setStorageSync('phone', res.data.phone)
  226. if(that.user.maintenance) {
  227. if(that.user.maintenance.audit == 2) {
  228. uni.setStorageSync('maintenance', true)
  229. }
  230. }
  231. app.HXlogin()
  232. let option = {
  233. nickname: res.data.nickname,
  234. avatarurl: res.data.headimg,
  235. }
  236. uni.WebIM.conn.updateOwnUserInfo(option);
  237. } else {
  238. that.login = false
  239. that.user = {}
  240. }
  241. uni.stopPullDownRefresh();
  242. })
  243. },
  244. getNum() {
  245. $api.req({
  246. url: '/data/api.auth.Center/messagenoread',
  247. method: 'POST'
  248. }, function(res) {
  249. if(res.code == 1) {
  250. that.message_num = res.data.notice_count + res.data.message_count
  251. }
  252. })
  253. },
  254. getTotal() {
  255. $api.req({
  256. url: '/data/api.auth.UserPurchase/listNum',
  257. method: 'POST'
  258. }, function(res) {
  259. if(res.code == 1) {
  260. console.log(res);
  261. that.order[0].num = res.data.shengchan
  262. that.order[1].num = res.data.waixie
  263. that.order[2].num = res.data.caigou
  264. that.order[3].num = res.data.haiwai
  265. that.order[4].num = res.data.weixiu
  266. }
  267. })
  268. },
  269. // 去登陆
  270. toLogin() {
  271. $api.jump('/pages/login/password_login')
  272. },
  273. // 去设置
  274. toSetting() {
  275. $api.jump('/page_shop/pages/setting/setting')
  276. },
  277. // 去通知中心
  278. toMessage() {
  279. if(that.login) {
  280. $api.jump('/page_shop/pages/message/message')
  281. } else {
  282. $api.info('请先登录')
  283. $api.jump('/pages/login/password_login')
  284. }
  285. },
  286. // 去会员中心
  287. toMember() {
  288. if(that.login) {
  289. $api.jump('/page_shop/pages/member/index')
  290. } else {
  291. $api.info('请先登录')
  292. $api.jump('/pages/login/password_login')
  293. }
  294. },
  295. // 我的余额
  296. toWallet() {
  297. if(that.login) {
  298. $api.jump('/page_shop/pages/wallet/wallet')
  299. } else {
  300. $api.info('请先登录')
  301. $api.jump('/pages/login/password_login')
  302. }
  303. },
  304. // 我的收藏
  305. toCollect() {
  306. if(that.login) {
  307. $api.jump('/page_shop/pages/collect/collect')
  308. } else {
  309. $api.info('请先登录')
  310. $api.jump('/pages/login/password_login')
  311. }
  312. },
  313. // 我的订单
  314. toOrder(url) {
  315. if(that.login) {
  316. $api.jump(url)
  317. } else {
  318. $api.info('请先登录')
  319. $api.jump('/pages/login/password_login')
  320. }
  321. },
  322. // 我的服务
  323. toService(index) {
  324. var url = ''
  325. if(that.login) {
  326. switch(index) {
  327. case 0:
  328. url = that.serviceList[index].url;
  329. break;
  330. case 1:
  331. url = that.serviceList[index].url;
  332. break;
  333. case 2:
  334. url = that.serviceList[index].url;
  335. break;
  336. case 3:
  337. url = that.serviceList[index].url;
  338. break;
  339. case 4:
  340. if(that.user.is_auth == 1) {
  341. url = that.serviceList[index].url
  342. } else {
  343. url = '/page_shop/pages/setting/webview?url=' + encodeURIComponent('https://ship.shipcc.cn/aliH5/h5/#/?token=' + uni.getStorageSync('token').token)
  344. }
  345. break;
  346. case 5:
  347. url = that.serviceList[index].url;
  348. break;
  349. case 6:
  350. url = that.serviceList[index].url;
  351. break;
  352. case 7:
  353. url = that.serviceList[index].url;
  354. break;
  355. }
  356. $api.jump(url)
  357. } else {
  358. $api.info('请先登录')
  359. $api.jump('/pages/login/password_login')
  360. }
  361. }
  362. },
  363. }
  364. </script>
  365. <style lang="scss" scoped>
  366. .content {
  367. background:url('https://ship.shipcc.cn/common/bg.png') no-repeat;
  368. background-size: 100%;
  369. padding: 0 30rpx;
  370. .user {
  371. padding: 184rpx 0 0;
  372. width: 100%;
  373. margin: 24rpx 0;
  374. .avatar_box {
  375. width: 120rpx;
  376. height: 120rpx;
  377. border-radius: 50%;
  378. overflow: hidden;
  379. position: relative;
  380. .avatar {
  381. // box-shadow: 0 8rpx 20rpx 0 #c4d8df;
  382. // border: 4rpx solid #fff;
  383. width: 120rpx;
  384. height: 120rpx;
  385. border-radius: 50%;
  386. }
  387. .auth {
  388. position: absolute;
  389. bottom: 0;
  390. width: 120rpx;
  391. height: 30rpx;
  392. background: rgba(0,0,0,0.4);
  393. font-size: 20rpx;
  394. font-weight: 500;
  395. color: #FFFFFF;
  396. line-height: 30rpx;
  397. text-align: center;
  398. }
  399. }
  400. .text_style1 {
  401. color: #131415;
  402. font-size: 40rpx;
  403. margin: 0 6rpx 0 16rpx;
  404. }
  405. .member_icon {
  406. margin: 10rpx 0 0 16rpx;
  407. position: relative;
  408. .vip_name {
  409. position: absolute;
  410. top: 16rpx;
  411. left: 50rpx;
  412. font-size: 16rpx;
  413. font-weight: 500;
  414. color: #444444;
  415. line-height: 22rpx;
  416. }
  417. }
  418. .setting {
  419. margin-left: 12rpx;
  420. width: 64rpx;
  421. height: 32rpx;
  422. border-radius: 20rpx;
  423. border: 1rpx solid #526fff;
  424. text-align: center;
  425. line-height: 32rpx;
  426. font-size: 20rpx;
  427. color: #526fff;
  428. }
  429. .user_right {
  430. position: relative;
  431. .message_icon {
  432. width: 48rpx;
  433. height: 48rpx;
  434. }
  435. .message {
  436. position: absolute;
  437. right: -10rpx;
  438. top: 0;
  439. width: 36rpx;
  440. height: 24rpx;
  441. background-color: #fb3e32;
  442. border-radius: 12rpx 12rpx 12rpx 4rpx;
  443. font-size: 20rpx;
  444. color: #fff;
  445. text-align: center;
  446. }
  447. }
  448. }
  449. .member {
  450. width: 100%;
  451. height: 132rpx;
  452. background-color: #2b2b2b;
  453. border-radius: 16rpx;
  454. border: 1rpx solid ;
  455. box-sizing: border-box;
  456. padding: 20rpx;
  457. margin: 20rpx 0;
  458. .member_name {
  459. color: #fff;
  460. font-size: 32rpx;
  461. margin-left: 6rpx;
  462. }
  463. .member_detail {
  464. color: #fff;
  465. font-size: 22rpx;
  466. margin-top: 16rpx;
  467. }
  468. .member_btn {
  469. width: auto;
  470. height: 64rpx;
  471. background: linear-gradient(270deg,#feebc8 0%, #ffe3a4 100%);
  472. border-radius: 32rpx;
  473. box-sizing: border-box;
  474. padding: 28rpx;
  475. font-size: 24rpx;
  476. color: #572915;
  477. }
  478. }
  479. .box {
  480. width: 100%;
  481. margin-bottom: 20rpx;
  482. .box_left {
  483. background: url('https://ship.shipcc.cn/common/balance.png') no-repeat;
  484. background-size: 100%;
  485. box-sizing: border-box;
  486. padding: 16rpx 24rpx;
  487. width: 336rpx;
  488. height: 180rpx;
  489. .left_bottom {
  490. width: 264rpx;
  491. height: 32rpx;
  492. background: linear-gradient(270deg, rgba(234,245,255,0) 0%, #e3eeff 100%);
  493. padding: 0 12rpx;
  494. line-height: 32rpx;
  495. font-size: 20rpx;
  496. color: #4f64af;
  497. }
  498. }
  499. .box_right {
  500. background: url('https://ship.shipcc.cn/common/collect.png') no-repeat;
  501. background-size: 100%;
  502. box-sizing: border-box;
  503. padding: 16rpx 24rpx;
  504. width: 336rpx;
  505. height: 180rpx;
  506. .right_bottom {
  507. width: 264rpx;
  508. height: 32rpx;
  509. background: linear-gradient(270deg, rgba(227,255,255,0) 0%, #d4f1ff 100%);
  510. padding: 0 12rpx;
  511. line-height: 32rpx;
  512. font-size: 20rpx;
  513. color: #26b0ff;
  514. }
  515. }
  516. .left_title {
  517. font-size: 24rpx;
  518. color: #444;
  519. }
  520. .left_num {
  521. font-size: 48rpx;
  522. color: #444;
  523. margin: 6rpx 0 6rpx;
  524. }
  525. }
  526. .list {
  527. width: 100%;
  528. height: auto;
  529. background: #fff;
  530. border-radius: 20rpx;
  531. box-sizing: border-box;
  532. padding: 20rpx;
  533. margin-bottom: 20rpx;
  534. .list_title {
  535. font-size: 26rpx;
  536. color: #222;
  537. margin-bottom: 24rpx;
  538. font-weight: 600;
  539. }
  540. .list_item {
  541. width: 20%;
  542. font-size: 22rpx;
  543. color: #333;
  544. .img_box {
  545. position: relative;
  546. .img_num {
  547. position: absolute;
  548. top: -10rpx;
  549. right: -15rpx;
  550. width: 36rpx;
  551. height: 24rpx;
  552. background-color: #fb3e32;
  553. border-radius: 12rpx 12rpx 12rpx 4rpx;
  554. font-size: 20rpx;
  555. color: #fff;
  556. text-align: center;
  557. }
  558. }
  559. }
  560. .list_item1 {
  561. width: 25%;
  562. margin-bottom: 40rpx;
  563. font-size: 24rpx;
  564. color: #444;
  565. }
  566. }
  567. }
  568. </style>