mine.vue 12 KB

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