index.vue 9.3 KB

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