mine.vue 14 KB

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