爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
5.1 KiB

2 weeks ago
2 weeks ago
2 weeks ago
6 days ago
2 weeks ago
6 days ago
2 weeks ago
2 weeks ago
6 days ago
2 weeks ago
  1. <template>
  2. <view class="staff-detail-container">
  3. <!-- 顶部导航栏 -->
  4. <view class="navbar" :style="navbarStyle">
  5. <view class="nav-left" @tap="goBack">
  6. <uni-icons type="back" size="24" color="#222" />
  7. </view>
  8. <view class="nav-title">员工管理详情</view>
  9. <view class="nav-right">
  10. <!-- <uni-icons type="more-filled" size="24" color="#222" style="margin-right: 16rpx;" />
  11. <uni-icons type="scan" size="24" color="#222" /> -->
  12. </view>
  13. </view>
  14. <view class="main-content">
  15. <view class="info-card">
  16. <view class="card-title">个人信息</view>
  17. <view class="info-row">
  18. <text class="label">姓名</text>
  19. <text class="value">{{ staff.name }}</text>
  20. </view>
  21. <view class="divider"></view>
  22. <view class="info-row">
  23. <text class="label">电话</text>
  24. <text class="value">{{ staff.phone }}</text>
  25. </view>
  26. <view class="divider"></view>
  27. <view class="info-row">
  28. <text class="label">角色</text>
  29. <text class="value">{{ staff.role }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="bottom-bar">
  34. <button class="action-btn danger" @tap="removeStaff">解除员工</button>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import pullRefreshMixin from '../mixins/pullRefreshMixin.js'
  40. export default {
  41. mixins: [pullRefreshMixin],
  42. data() {
  43. return {
  44. staff: {
  45. name: '冯启彬',
  46. phone: '18899102278',
  47. role: '质检员',
  48. },
  49. statusBarHeight: 0,
  50. }
  51. },
  52. computed: {
  53. navbarStyle() {
  54. return `padding-top: ${this.statusBarHeight}px;`;
  55. }
  56. },
  57. onLoad(options) {
  58. uni.getSystemInfo({
  59. success: (res) => {
  60. this.statusBarHeight = res.statusBarHeight || 20;
  61. }
  62. });
  63. // eventChannel 传递员工信息
  64. const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel();
  65. if (eventChannel) {
  66. eventChannel.on('staffDetail', (staff) => {
  67. this.staff = Object.assign({}, this.staff, staff);
  68. });
  69. }
  70. },
  71. methods: {
  72. goBack() {
  73. uni.navigateBack();
  74. },
  75. removeStaff() {
  76. if (!this.staff.id) {
  77. uni.showToast({ title: '缺少员工ID', icon: 'none' });
  78. return;
  79. }
  80. this.$api && this.$api('removeMember', { id: this.staff.id }, res => {
  81. if (res && res.code === 200) {
  82. uni.showToast({ title: '已解除员工', icon: 'none' });
  83. setTimeout(() => {
  84. uni.$emit('refreshStaffList');
  85. uni.navigateBack();
  86. }, 500);
  87. } else {
  88. uni.showToast({ title: '操作失败', icon: 'none' });
  89. }
  90. });
  91. },
  92. refreshData() {
  93. // TODO: 实现员工详情刷新逻辑,如重新请求接口
  94. },
  95. async onRefresh() {
  96. await this.refreshData && this.refreshData()
  97. }
  98. },
  99. onPullDownRefresh() {
  100. this.refreshData && this.refreshData()
  101. uni.stopPullDownRefresh()
  102. }
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .staff-detail-container {
  107. min-height: 100vh;
  108. background: #f7f7f7;
  109. padding-bottom: 160rpx;
  110. }
  111. .navbar {
  112. position: fixed;
  113. top: 0;
  114. left: 0;
  115. width: 100vw;
  116. height: 100rpx;
  117. background: #fff;
  118. z-index: 10;
  119. display: flex;
  120. align-items: flex-end;
  121. justify-content: space-between;
  122. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  123. padding: 0 32rpx;
  124. .nav-left {
  125. flex: 0 0 48rpx;
  126. display: flex;
  127. align-items: center;
  128. height: 100%;
  129. }
  130. .nav-title {
  131. flex: 1;
  132. text-align: center;
  133. font-size: 36rpx;
  134. font-weight: bold;
  135. color: #222;
  136. line-height: 100rpx;
  137. }
  138. .nav-right {
  139. flex: 0 0 80rpx;
  140. display: flex;
  141. align-items: center;
  142. justify-content: flex-end;
  143. height: 100%;
  144. }
  145. }
  146. .main-content {
  147. margin-top: calc(120rpx + var(--status-bar-height));
  148. margin-bottom: 40rpx;
  149. }
  150. .info-card {
  151. background: #fff;
  152. border-radius: 40rpx;
  153. margin: 0 32rpx 32rpx 32rpx;
  154. padding: 40rpx 36rpx 36rpx 36rpx;
  155. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  156. }
  157. .card-title {
  158. font-size: 32rpx;
  159. font-weight: bold;
  160. color: #222;
  161. margin-bottom: 32rpx;
  162. }
  163. .info-row {
  164. display: flex;
  165. align-items: center;
  166. min-height: 60rpx;
  167. margin-bottom: 0;
  168. .label {
  169. font-size: 26rpx;
  170. color: #b3b3b3;
  171. width: 110rpx;
  172. font-weight: 400;
  173. }
  174. .value {
  175. font-size: 30rpx;
  176. color: #222;
  177. font-weight: 500;
  178. flex: 1;
  179. word-break: break-all;
  180. }
  181. }
  182. .divider {
  183. height: 2rpx;
  184. background: #f3f3f3;
  185. margin: 18rpx 0 18rpx 0;
  186. border: none;
  187. }
  188. .bottom-bar {
  189. position: fixed;
  190. left: 0;
  191. right: 0;
  192. bottom: 0;
  193. display: flex;
  194. justify-content: center;
  195. align-items: center;
  196. background: #f7f7f7;
  197. padding-bottom: env(safe-area-inset-bottom);
  198. padding-top: 24rpx;
  199. padding-bottom: 24rpx;
  200. z-index: 20;
  201. }
  202. .action-btn {
  203. flex: 1;
  204. margin: 0 32rpx;
  205. height: 80rpx;
  206. border-radius: 40rpx;
  207. font-size: 30rpx;
  208. font-weight: 500;
  209. border: 2rpx solid #ffd36d;
  210. background: #fffbe6;
  211. color: #ffb800;
  212. box-shadow: 0 2rpx 8rpx rgba(255, 156, 0, 0.03);
  213. }
  214. .action-btn.danger {
  215. color: #ffb800;
  216. border: 2rpx solid #ffd36d;
  217. background: #fffbe6;
  218. }
  219. </style>