mine.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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"></image>
  14. </view>
  15. <view class="info-box">
  16. <text class="nickname">张经理</text>
  17. <view class="tags-row">
  18. <text class="customer-tag">授权客户: 广东铝材实业</text>
  19. </view>
  20. <text class="phone-text">138-8888-8888</text>
  21. </view>
  22. <!-- 新增:右侧设置图标 -->
  23. <view class="settings-btn" @click="goToSettings">
  24. <image class="settings-icon" :src="assets.mineSettings" mode="aspectFit"></image>
  25. </view>
  26. </view>
  27. <!-- 1. 未登录状态卡片 -->
  28. <view class="user-card unlogged" v-else @click="goToLogin">
  29. <view class="avatar-box gray-avatar">
  30. <image class="avatar-img" src="https://img.icons8.com/material-outlined/100/cccccc/user.png" mode="aspectFit"></image>
  31. </view>
  32. <view class="info-box">
  33. <text class="nickname login-hint">未登录</text>
  34. <text class="phone-text">点击此处登录,体验完整功能</text>
  35. </view>
  36. <image class="arrow-icon-right" :src="assets.mineArrow"></image>
  37. </view>
  38. <!-- 2. 我的订单 (线性图标) -->
  39. <view class="section-card">
  40. <view class="section-header">
  41. <text class="section-title">我的订单</text>
  42. <view class="more-link" @click="goToOrderList(0)">
  43. <text>全部</text>
  44. <image class="arrow-icon" :src="assets.mineArrow"></image>
  45. </view>
  46. </view>
  47. <view class="stat-grid">
  48. <view class="stat-item" v-for="(item, index) in orderStates" :key="index" @click="goToOrderList(index + 1)">
  49. <image class="stat-icon" :src="item.icon" mode="aspectFit"></image>
  50. <text class="stat-label">{{ item.label }}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 3. 功能菜单列表 (线性图标) -->
  55. <view class="section-card menu-card">
  56. <view class="menu-item" v-for="(menu, index) in menuList" :key="index" @click="handleMenuClick(menu)">
  57. <view class="menu-left">
  58. <image class="menu-icon" :src="menu.icon" mode="aspectFit"></image>
  59. <text class="menu-label">{{ menu.label }}</text>
  60. </view>
  61. <image class="arrow-icon-right" :src="assets.mineArrow"></image>
  62. </view>
  63. </view>
  64. <!-- 4. 退出登录按钮 (仅登录后显示) -->
  65. <view class="logout-section" v-if="isLogin">
  66. <button class="logout-btn" @click="handleLogout">退出登录</button>
  67. </view>
  68. <view class="bottom-placeholder"></view>
  69. </view>
  70. </scroll-view>
  71. <erp-tab-bar active="mine"></erp-tab-bar>
  72. </view>
  73. </template>
  74. <script>
  75. import ErpTabBar from '@/components/erp-tab-bar/erp-tab-bar.vue';
  76. import assets from '@/utils/assets.js';
  77. export default {
  78. components: {
  79. ErpTabBar
  80. },
  81. data() {
  82. return {
  83. assets,
  84. isLogin: false, // 控制登录状态
  85. orderStates: [
  86. { label: '待审核', icon: assets.minePendingReview },
  87. { label: '待签批', icon: assets.minePendingSign },
  88. { label: '生产中', icon: assets.mineProducing },
  89. { label: '已完成', icon: assets.mineCompleted }
  90. ],
  91. menuList: [
  92. { label: '用户协议', icon: assets.mineProtocol, id: 'agreement' },
  93. { label: '隐私政策', icon: assets.minePrivacy, id: 'privacy' },
  94. { label: '投诉与建议', icon: assets.mineComplaint, id: 'complaint' },
  95. { label: '联系客服', icon: assets.mineService, id: 'service' }
  96. ]
  97. }
  98. },
  99. onShow() {
  100. // 页面显示时检查登录状态
  101. this.isLogin = !!uni.getStorageSync('isLogin');
  102. },
  103. methods: {
  104. goToLogin() {
  105. uni.navigateTo({ url: '/pages/login/login?redirect=' + encodeURIComponent('/pages/mine/mine') });
  106. },
  107. // 跳转至设置页面
  108. goToSettings() {
  109. if(this.isLogin) {
  110. uni.navigateTo({
  111. url: '/pages/mine/settings'
  112. });
  113. }
  114. },
  115. // 新增:跳转至订单列表
  116. goToOrderList(status) {
  117. if(!this.isLogin) {
  118. return this.goToLogin();
  119. }
  120. uni.navigateTo({
  121. url: `/pages/order/list?tab=${status}`
  122. });
  123. },
  124. handleLogout() {
  125. uni.showModal({
  126. title: '退出提示',
  127. content: '确认退出当前账号吗?',
  128. confirmColor: '#C1001C',
  129. success: (res) => {
  130. if (res.confirm) {
  131. uni.removeStorageSync('isLogin');
  132. this.isLogin = false;
  133. }
  134. }
  135. });
  136. },
  137. // 新增:菜单点击处理
  138. handleMenuClick(menu) {
  139. if (menu.id === 'agreement') {
  140. uni.navigateTo({ url: '/pages/mine/agreement' });
  141. } else if (menu.id === 'privacy') {
  142. uni.navigateTo({ url: '/pages/mine/privacy' });
  143. } else if (menu.id === 'complaint') {
  144. uni.navigateTo({ url: '/pages/mine/complaint' });
  145. } else if (menu.id === 'service') {
  146. uni.showModal({
  147. title: '联系客服',
  148. content: '客服电话:138-8888-8888',
  149. confirmText: '立即拨打',
  150. confirmColor: '#C1001C',
  151. cancelColor: '#999999',
  152. success: (res) => {
  153. if (res.confirm) {
  154. uni.makePhoneCall({
  155. phoneNumber: '13888888888'
  156. });
  157. }
  158. }
  159. });
  160. }
  161. }
  162. }
  163. }
  164. </script>
  165. <style scoped>
  166. .mine-page { width: 100%; height: 100vh; background: #f7f8fa; position: relative; display: flex; flex-direction: column; overflow: hidden; }
  167. .mine-scroll { width: 100%; height: 100%; }
  168. /* 隐藏滚动条 */
  169. .mine-scroll ::-webkit-scrollbar { width: 0 !important; height: 0 !important; color: transparent !important; display: none !important; }
  170. /* 顶部定制背景:高级渐变蓝 + 柔和弧度 */
  171. .header-bg-shape {
  172. position: absolute;
  173. top: 0;
  174. left: 0;
  175. width: 100%;
  176. height: 380rpx;
  177. background: linear-gradient(135deg, #C1001C 0%, #FF4D4F 100%);
  178. border-bottom-left-radius: 60rpx;
  179. border-bottom-right-radius: 60rpx;
  180. z-index: 1;
  181. box-shadow: 0 10rpx 30rpx rgba(193, 0, 28, 0.15);
  182. }
  183. .header-bg-gradient {
  184. width: 100%;
  185. height: 100%;
  186. background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 100%);
  187. border-bottom-left-radius: 60rpx;
  188. border-bottom-right-radius: 60rpx;
  189. }
  190. /* 标题栏已恢复为原生,此处仅需正常的容器内边距即可 */
  191. .content-wrapper { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; padding: 40rpx 30rpx 0; box-sizing: border-box; }
  192. /* 用户信息卡片 */
  193. .user-card { background: #fff; border-radius: 32rpx; padding: 50rpx 40rpx; display: flex; align-items: center; margin-bottom: 30rpx; margin-top: 20rpx; box-shadow: 0 16rpx 40rpx rgba(0, 0, 0, 0.05); }
  194. .user-card.unlogged { cursor: pointer; }
  195. .avatar-box { width: 130rpx; height: 130rpx; border-radius: 65rpx; background: #f5f6f7; margin-right: 30rpx; overflow: hidden; border: 4rpx solid #fff; box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.05); }
  196. .gray-avatar { background: #f0f0f0; display: flex; align-items: center; justify-content: center; }
  197. .avatar-img { width: 100%; height: 100%; }
  198. .info-box { flex: 1; display: flex; flex-direction: column; justify-content: center; }
  199. .nickname { font-size: 40rpx; font-weight: bold; color: #1a1a1a; margin-bottom: 12rpx; }
  200. .login-hint { color: #333; }
  201. .tags-row { display: flex; align-items: center; margin-bottom: 12rpx; }
  202. .customer-tag { font-size: 24rpx; color: #C1001C; background: rgba(193, 0, 28, 0.1); padding: 6rpx 16rpx; border-radius: 8rpx; font-weight: 500; }
  203. .phone-text { font-size: 26rpx; color: #999; }
  204. /* 设置图标 & 右侧箭头 */
  205. .settings-btn { width: 60rpx; height: 60rpx; display: flex; align-items: center; justify-content: center; }
  206. .settings-icon { width: 44rpx; height: 44rpx; opacity: 0.6; }
  207. .arrow-icon-right { width: 24rpx; height: 24rpx; opacity: 0.4; }
  208. /* 通用卡片样式 */
  209. .section-card { background: #fff; border-radius: 24rpx; padding: 40rpx 30rpx; margin-bottom: 30rpx; box-shadow: 0 8rpx 30rpx rgba(0,0,0,0.02); }
  210. /* 订单统计区块 */
  211. .section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40rpx; }
  212. .section-title { font-size: 32rpx; font-weight: bold; color: #333; }
  213. .more-link { display: flex; align-items: center; font-size: 26rpx; color: #999; }
  214. .arrow-icon { width: 20rpx; height: 20rpx; opacity: 0.5; margin-left: 6rpx; position: relative; top: 2rpx; }
  215. .stat-grid { display: flex; justify-content: space-around; }
  216. .stat-item { display: flex; flex-direction: column; align-items: center; }
  217. .stat-icon { width: 56rpx; height: 56rpx; margin-bottom: 16rpx; opacity: 0.8; }
  218. .stat-label { font-size: 26rpx; color: #666; }
  219. /* 菜单列表区块 */
  220. .menu-card { padding: 10rpx 30rpx; }
  221. .menu-item { display: flex; justify-content: space-between; align-items: center; padding: 36rpx 0; border-bottom: 1rpx solid #f5f6f7; }
  222. .menu-item:last-child { border-bottom: none; }
  223. .menu-left { display: flex; align-items: center; }
  224. .menu-icon { width: 44rpx; height: 44rpx; margin-right: 20rpx; opacity: 0.7; }
  225. .menu-label { font-size: 30rpx; color: #333; }
  226. /* 退出登录 */
  227. .logout-section { margin-top: 40rpx; }
  228. .logout-btn { width: 100%; height: 96rpx; background: #fff; color: #ff5e5e; border-radius: 24rpx; display: flex; align-items: center; justify-content: center; font-size: 32rpx; font-weight: bold; border: none; box-shadow: 0 4rpx 20rpx rgba(255, 94, 94, 0.05); transition: all 0.2s; }
  229. .logout-btn:active { background: #fff0f0; }
  230. button::after { border: none; }
  231. .bottom-placeholder { height: 180rpx; }
  232. </style>