index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <view class="mine-page">
  3. <erp-nav-bar title="个人中心" :show-back="false" bg-color="#C1001C" title-color="#ffffff" />
  4. <scroll-view class="mine-scroll" scroll-y enable-back-to-top :show-scrollbar="false" :enhanced="true">
  5. <!-- 顶部大气定制背景 (带柔和渐变与底部圆角弧度) -->
  6. <view class="header-bg-shape">
  7. <view class="header-bg-gradient"></view>
  8. </view>
  9. <!-- 整体内容下移 -->
  10. <view class="content-wrapper">
  11. <!-- 1. 登录状态卡片 -->
  12. <view class="user-card" v-if="isLogin">
  13. <view class="avatar-box">
  14. <image class="avatar-img" src="https://img.icons8.com/color/144/user.png" mode="aspectFill">
  15. </image>
  16. </view>
  17. <view class="info-box">
  18. <text class="nickname">张经理</text>
  19. <view class="tags-row">
  20. <text class="customer-tag">授权客户: 广东铝材实业</text>
  21. </view>
  22. <text class="phone-text">138-8888-8888</text>
  23. </view>
  24. <!-- 新增:右侧设置图标 -->
  25. <view class="settings-btn" @click="goToSettings">
  26. <image class="settings-icon" :src="assets.mineSettings" mode="aspectFit"></image>
  27. </view>
  28. </view>
  29. <!-- 1. 未登录状态卡片 -->
  30. <view class="user-card unlogged" v-else @click="goToLogin">
  31. <view class="avatar-box gray-avatar">
  32. <image class="avatar-img" src="https://img.icons8.com/material-outlined/100/cccccc/user.png"
  33. mode="aspectFit"></image>
  34. </view>
  35. <view class="info-box">
  36. <text class="nickname login-hint">未登录</text>
  37. <text class="phone-text">点击此处登录,体验完整功能</text>
  38. </view>
  39. <image class="arrow-icon-right" :src="assets.mineArrow"></image>
  40. </view>
  41. <!-- 2. 我的订单 (线性图标) -->
  42. <view class="section-card">
  43. <view class="section-header">
  44. <text class="section-title">我的订单</text>
  45. <view class="more-link" @click="goToOrderList(0)">
  46. <text>全部</text>
  47. <image class="arrow-icon" :src="assets.mineArrow"></image>
  48. </view>
  49. </view>
  50. <view class="stat-grid">
  51. <view class="stat-item" v-for="(item, index) in orderStates" :key="index"
  52. @click="goToOrderList(index + 1)">
  53. <image class="stat-icon" :src="item.icon" mode="aspectFit"></image>
  54. <text class="stat-label">{{ item.label }}</text>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 3. 功能菜单列表 (线性图标) -->
  59. <view class="section-card menu-card">
  60. <view class="menu-item" v-for="(menu, index) in menuList" :key="index"
  61. @click="handleMenuClick(menu)">
  62. <view class="menu-left">
  63. <image class="menu-icon" :src="menu.icon" mode="aspectFit"></image>
  64. <text class="menu-label">{{ menu.label }}</text>
  65. </view>
  66. <image class="arrow-icon-right" :src="assets.mineArrow"></image>
  67. </view>
  68. </view>
  69. <!-- 4. 退出登录按钮 (仅登录后显示) -->
  70. <view class="logout-section" v-if="isLogin">
  71. <button class="logout-btn" @click="handleLogout">退出登录</button>
  72. </view>
  73. <view class="bottom-placeholder"></view>
  74. </view>
  75. </scroll-view>
  76. <erp-tab-bar active="mine"></erp-tab-bar>
  77. </view>
  78. </template>
  79. <script>
  80. import ErpTabBar from '@/components/erp-tab-bar.vue';
  81. import ErpNavBar from '@/components/erp-nav-bar.vue';
  82. import assets from '@/utils/assets.js';
  83. export default {
  84. components: { ErpTabBar, ErpNavBar },
  85. data() {
  86. return {
  87. assets,
  88. isLogin: false, // 控制登录状态
  89. orderStates: [
  90. { label: '待审核', icon: assets.minePendingReview },
  91. { label: '待签批', icon: assets.minePendingSign },
  92. { label: '生产中', icon: assets.mineProducing },
  93. { label: '已完成', icon: assets.mineCompleted }
  94. ],
  95. menuList: [
  96. { label: '用户协议', icon: assets.mineProtocol, id: 'agreement' },
  97. { label: '隐私政策', icon: assets.minePrivacy, id: 'privacy' },
  98. { label: '投诉与建议', icon: assets.mineComplaint, id: 'complaint' },
  99. { label: '联系客服', icon: assets.mineService, id: 'service' }
  100. ]
  101. }
  102. },
  103. onShow() {
  104. // 页面显示时检查登录状态
  105. this.isLogin = !!uni.getStorageSync('isLogin');
  106. },
  107. methods: {
  108. goToLogin() {
  109. uni.reLaunch({ url: '/pages/login/index' });
  110. },
  111. // 跳转至设置页面
  112. goToSettings() {
  113. if (this.isLogin) {
  114. uni.navigateTo({
  115. url: '/pages/mine/settings/index'
  116. });
  117. }
  118. },
  119. // 新增:跳转至订单列表
  120. goToOrderList(status) {
  121. if (!this.isLogin) {
  122. return this.goToLogin();
  123. }
  124. uni.navigateTo({
  125. url: `/pages/order/list/index?tab=${status}`
  126. });
  127. },
  128. handleLogout() {
  129. uni.showModal({
  130. title: '退出提示',
  131. content: '确认退出当前账号吗?',
  132. confirmColor: '#C1001C',
  133. success: (res) => {
  134. if (res.confirm) {
  135. uni.removeStorageSync('isLogin');
  136. this.isLogin = false;
  137. }
  138. }
  139. });
  140. },
  141. // 新增:菜单点击处理
  142. handleMenuClick(menu) {
  143. if (menu.id === 'agreement') {
  144. uni.navigateTo({ url: '/pages/mine/agreement/index' });
  145. } else if (menu.id === 'privacy') {
  146. uni.navigateTo({ url: '/pages/mine/privacy/index' });
  147. } else if (menu.id === 'complaint') {
  148. uni.navigateTo({ url: '/pages/mine/complaint/index' });
  149. } else if (menu.id === 'service') {
  150. uni.showModal({
  151. title: '联系客服',
  152. content: '客服电话:138-8888-8888',
  153. confirmText: '立即拨打',
  154. confirmColor: '#C1001C',
  155. cancelColor: '#999999',
  156. success: (res) => {
  157. if (res.confirm) {
  158. uni.makePhoneCall({
  159. phoneNumber: '13888888888'
  160. });
  161. }
  162. }
  163. });
  164. }
  165. }
  166. }
  167. }
  168. </script>
  169. <style scoped>
  170. .mine-page {
  171. width: 100%;
  172. height: 100vh;
  173. background: #f7f8fa;
  174. position: relative;
  175. display: flex;
  176. flex-direction: column;
  177. overflow: hidden;
  178. }
  179. .mine-scroll {
  180. width: 100%;
  181. height: 100%;
  182. }
  183. /* 隐藏滚动条 */
  184. .mine-scroll ::-webkit-scrollbar {
  185. width: 0 !important;
  186. height: 0 !important;
  187. color: transparent !important;
  188. display: none !important;
  189. }
  190. /* 顶部定制背景:高级渐变蓝 + 柔和弧度 */
  191. .header-bg-shape {
  192. position: absolute;
  193. top: 0;
  194. left: 0;
  195. width: 100%;
  196. height: 380rpx;
  197. background: linear-gradient(135deg, #C1001C 0%, #FF4D4F 100%);
  198. border-bottom-left-radius: 60rpx;
  199. border-bottom-right-radius: 60rpx;
  200. z-index: 1;
  201. box-shadow: 0 10rpx 30rpx rgba(193, 0, 28, 0.15);
  202. }
  203. .header-bg-gradient {
  204. width: 100%;
  205. height: 100%;
  206. background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 100%);
  207. border-bottom-left-radius: 60rpx;
  208. border-bottom-right-radius: 60rpx;
  209. }
  210. /* 标题栏已恢复为原生,此处仅需正常的容器内边距即可 */
  211. .content-wrapper {
  212. position: relative;
  213. z-index: 2;
  214. flex: 1;
  215. display: flex;
  216. flex-direction: column;
  217. padding: 40rpx 30rpx 0;
  218. box-sizing: border-box;
  219. }
  220. /* 用户信息卡片 */
  221. .user-card {
  222. background: #fff;
  223. border-radius: 32rpx;
  224. padding: 50rpx 40rpx;
  225. display: flex;
  226. align-items: center;
  227. margin-bottom: 30rpx;
  228. margin-top: 20rpx;
  229. box-shadow: 0 16rpx 40rpx rgba(0, 0, 0, 0.05);
  230. }
  231. .user-card.unlogged {
  232. cursor: pointer;
  233. }
  234. .avatar-box {
  235. width: 130rpx;
  236. height: 130rpx;
  237. border-radius: 65rpx;
  238. background: #f5f6f7;
  239. margin-right: 30rpx;
  240. overflow: hidden;
  241. border: 4rpx solid #fff;
  242. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  243. }
  244. .gray-avatar {
  245. background: #f0f0f0;
  246. display: flex;
  247. align-items: center;
  248. justify-content: center;
  249. }
  250. .avatar-img {
  251. width: 100%;
  252. height: 100%;
  253. }
  254. .info-box {
  255. flex: 1;
  256. display: flex;
  257. flex-direction: column;
  258. justify-content: center;
  259. }
  260. .nickname {
  261. font-size: 40rpx;
  262. font-weight: bold;
  263. color: #1a1a1a;
  264. margin-bottom: 12rpx;
  265. }
  266. .login-hint {
  267. color: #333;
  268. }
  269. .tags-row {
  270. display: flex;
  271. align-items: center;
  272. margin-bottom: 12rpx;
  273. }
  274. .customer-tag {
  275. font-size: 24rpx;
  276. color: #C1001C;
  277. background: rgba(193, 0, 28, 0.1);
  278. padding: 6rpx 16rpx;
  279. border-radius: 8rpx;
  280. font-weight: 500;
  281. }
  282. .phone-text {
  283. font-size: 26rpx;
  284. color: #999;
  285. }
  286. /* 设置图标 & 右侧箭头 */
  287. .settings-btn {
  288. width: 60rpx;
  289. height: 60rpx;
  290. display: flex;
  291. align-items: center;
  292. justify-content: center;
  293. }
  294. .settings-icon {
  295. width: 44rpx;
  296. height: 44rpx;
  297. opacity: 0.6;
  298. }
  299. .arrow-icon-right {
  300. width: 24rpx;
  301. height: 24rpx;
  302. opacity: 0.4;
  303. }
  304. /* 通用卡片样式 */
  305. .section-card {
  306. background: #fff;
  307. border-radius: 24rpx;
  308. padding: 40rpx 30rpx;
  309. margin-bottom: 30rpx;
  310. box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.02);
  311. }
  312. /* 订单统计区块 */
  313. .section-header {
  314. display: flex;
  315. justify-content: space-between;
  316. align-items: center;
  317. margin-bottom: 40rpx;
  318. }
  319. .section-title {
  320. font-size: 32rpx;
  321. font-weight: bold;
  322. color: #333;
  323. }
  324. .more-link {
  325. display: flex;
  326. align-items: center;
  327. font-size: 26rpx;
  328. color: #999;
  329. }
  330. .arrow-icon {
  331. width: 20rpx;
  332. height: 20rpx;
  333. opacity: 0.5;
  334. margin-left: 6rpx;
  335. position: relative;
  336. top: 2rpx;
  337. }
  338. .stat-grid {
  339. display: flex;
  340. justify-content: space-around;
  341. }
  342. .stat-item {
  343. display: flex;
  344. flex-direction: column;
  345. align-items: center;
  346. }
  347. .stat-icon {
  348. width: 56rpx;
  349. height: 56rpx;
  350. margin-bottom: 16rpx;
  351. opacity: 0.8;
  352. }
  353. .stat-label {
  354. font-size: 26rpx;
  355. color: #666;
  356. }
  357. /* 菜单列表区块 */
  358. .menu-card {
  359. padding: 10rpx 30rpx;
  360. }
  361. .menu-item {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. padding: 36rpx 0;
  366. border-bottom: 1rpx solid #f5f6f7;
  367. }
  368. .menu-item:last-child {
  369. border-bottom: none;
  370. }
  371. .menu-left {
  372. display: flex;
  373. align-items: center;
  374. }
  375. .menu-icon {
  376. width: 44rpx;
  377. height: 44rpx;
  378. margin-right: 20rpx;
  379. opacity: 0.7;
  380. }
  381. .menu-label {
  382. font-size: 30rpx;
  383. color: #333;
  384. }
  385. /* 退出登录 */
  386. .logout-section {
  387. margin-top: 40rpx;
  388. }
  389. .logout-btn {
  390. width: 100%;
  391. height: 96rpx;
  392. background: #fff;
  393. color: #ff5e5e;
  394. border-radius: 24rpx;
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. font-size: 32rpx;
  399. font-weight: bold;
  400. border: none;
  401. box-shadow: 0 4rpx 20rpx rgba(255, 94, 94, 0.05);
  402. transition: all 0.2s;
  403. }
  404. .logout-btn:active {
  405. background: #fff0f0;
  406. }
  407. button::after {
  408. border: none;
  409. }
  410. .bottom-placeholder {
  411. height: 180rpx;
  412. }
  413. </style>