mine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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.collect_num ? user.collect_num : 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(item.url)">
  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. } else {
  203. that.user = {}
  204. }
  205. })
  206. },
  207. // 去登陆
  208. toLogin() {
  209. $api.jump('/pages/login/code_login')
  210. },
  211. // 去设置
  212. toSetting() {
  213. $api.jump('/page_mine/pages/setting/setting')
  214. },
  215. // 去通知中心
  216. toMessage() {
  217. if(that.login) {
  218. $api.jump('/page_mine/pages/message/message')
  219. } else {
  220. $api.info('请先登录')
  221. }
  222. },
  223. // 去会员中心
  224. toMember() {
  225. if(that.login) {
  226. $api.jump('/page_mine/pages/member/index')
  227. } else {
  228. $api.info('请先登录')
  229. }
  230. },
  231. // 我的余额
  232. toWallet() {
  233. if(that.login) {
  234. $api.jump('/page_mine/pages/wallet/wallet')
  235. } else {
  236. $api.info('请先登录')
  237. }
  238. },
  239. // 我的收藏
  240. toCollect() {
  241. if(that.login) {
  242. $api.jump('/page_mine/pages/collect/collect')
  243. } else {
  244. $api.info('请先登录')
  245. }
  246. },
  247. // 我的订单
  248. toOrder(url) {
  249. if(that.login) {
  250. $api.jump(url)
  251. } else {
  252. $api.info('请先登录')
  253. }
  254. },
  255. // 我的服务
  256. toService(url) {
  257. if(that.login) {
  258. $api.jump(url)
  259. } else {
  260. $api.info('请先登录')
  261. }
  262. }
  263. },
  264. }
  265. </script>
  266. <style lang="scss" scoped>
  267. .content {
  268. background:url('/static/images/mine/bg.png') no-repeat;
  269. background-size: 100%;
  270. padding: 0 30rpx;
  271. .user {
  272. padding: 184rpx 0 0;
  273. width: 100%;
  274. margin: 24rpx 0;
  275. .avatar_box {
  276. width: 130rpx;
  277. height: 120rpx;
  278. border-radius: 50%;
  279. overflow: hidden;
  280. position: relative;
  281. .avatar {
  282. box-shadow: 0 8rpx 20rpx 0 #c4d8df;
  283. border: 4rpx solid #fff;
  284. width: 120rpx;
  285. height: 120rpx;
  286. border-radius: 50%;
  287. }
  288. .auth {
  289. position: absolute;
  290. bottom: 0;
  291. width: 130rpx;
  292. height: 30rpx;
  293. background: rgba(0,0,0,0.4);
  294. font-size: 20rpx;
  295. font-weight: 500;
  296. color: #FFFFFF;
  297. line-height: 30rpx;
  298. text-align: center;
  299. }
  300. }
  301. .text_style1 {
  302. color: #131415;
  303. font-size: 40rpx;
  304. margin: 0 6rpx 0 16rpx;
  305. }
  306. .member_icon {
  307. margin: 10rpx 0 0 16rpx;
  308. position: relative;
  309. .vip_name {
  310. position: absolute;
  311. top: 16rpx;
  312. left: 50rpx;
  313. font-size: 16rpx;
  314. font-weight: 500;
  315. color: #444444;
  316. line-height: 22rpx;
  317. }
  318. }
  319. .setting {
  320. margin-left: 12rpx;
  321. width: 64rpx;
  322. height: 32rpx;
  323. border-radius: 20rpx;
  324. border: 1rpx solid #526fff;
  325. text-align: center;
  326. line-height: 32rpx;
  327. font-size: 20rpx;
  328. color: #526fff;
  329. }
  330. .user_right {
  331. position: relative;
  332. .message_icon {
  333. width: 48rpx;
  334. height: 48rpx;
  335. }
  336. .message {
  337. position: absolute;
  338. right: -10rpx;
  339. top: 0;
  340. width: 36rpx;
  341. height: 24rpx;
  342. background-color: #fb3e32;
  343. border-radius: 12rpx 12rpx 12rpx 4rpx;
  344. font-size: 20rpx;
  345. color: #fff;
  346. text-align: center;
  347. }
  348. }
  349. }
  350. .member {
  351. width: 100%;
  352. height: 132rpx;
  353. background-color: #2b2b2b;
  354. border-radius: 16rpx;
  355. border: 1rpx solid ;
  356. box-sizing: border-box;
  357. padding: 20rpx;
  358. margin: 20rpx 0;
  359. .member_name {
  360. color: #fff;
  361. font-size: 32rpx;
  362. margin-left: 6rpx;
  363. }
  364. .member_detail {
  365. color: #fff;
  366. font-size: 22rpx;
  367. margin-top: 16rpx;
  368. }
  369. .member_btn {
  370. width: auto;
  371. height: 64rpx;
  372. background: linear-gradient(270deg,#feebc8 0%, #ffe3a4 100%);
  373. border-radius: 32rpx;
  374. box-sizing: border-box;
  375. padding: 28rpx;
  376. font-size: 24rpx;
  377. color: #572915;
  378. }
  379. }
  380. .box {
  381. width: 100%;
  382. margin-bottom: 20rpx;
  383. .box_left {
  384. background: url('/static/images/mine/balance.png') no-repeat;
  385. background-size: 100%;
  386. box-sizing: border-box;
  387. padding: 16rpx 24rpx;
  388. width: 336rpx;
  389. height: 180rpx;
  390. .left_bottom {
  391. width: 264rpx;
  392. height: 32rpx;
  393. background: linear-gradient(270deg, rgba(234,245,255,0) 0%, #e3eeff 100%);
  394. padding: 0 12rpx;
  395. line-height: 32rpx;
  396. font-size: 20rpx;
  397. color: #4f64af;
  398. }
  399. }
  400. .box_right {
  401. background: url('/static/images/mine//collect.png') no-repeat;
  402. background-size: 100%;
  403. box-sizing: border-box;
  404. padding: 16rpx 24rpx;
  405. width: 336rpx;
  406. height: 180rpx;
  407. .right_bottom {
  408. width: 264rpx;
  409. height: 32rpx;
  410. background: linear-gradient(270deg, rgba(227,255,255,0) 0%, #d4f1ff 100%);
  411. padding: 0 12rpx;
  412. line-height: 32rpx;
  413. font-size: 20rpx;
  414. color: #26b0ff;
  415. }
  416. }
  417. .left_title {
  418. font-size: 24rpx;
  419. color: #444;
  420. }
  421. .left_num {
  422. font-size: 48rpx;
  423. color: #444;
  424. margin: 6rpx 0 6rpx;
  425. }
  426. }
  427. .list {
  428. width: 100%;
  429. height: auto;
  430. background: #fff;
  431. border-radius: 20rpx;
  432. box-sizing: border-box;
  433. padding: 20rpx;
  434. margin-bottom: 20rpx;
  435. .list_title {
  436. font-size: 26rpx;
  437. color: #222;
  438. margin-bottom: 24rpx;
  439. font-weight: 600;
  440. }
  441. .list_item {
  442. width: 20%;
  443. font-size: 22rpx;
  444. color: #333;
  445. }
  446. .list_item1 {
  447. width: 25%;
  448. margin-bottom: 40rpx;
  449. font-size: 24rpx;
  450. color: #444;
  451. }
  452. }
  453. }
  454. </style>