完善店务员工工时与订单记录

This commit is contained in:
2026-07-24 14:23:13 +08:00
parent 3a543f1d69
commit eff4e73427
20 changed files with 440 additions and 225 deletions
@@ -1,6 +1,16 @@
const employeesApi = require('../../api/employees')
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
const EMPTY_FIELD_TEXT = '未填写'
function displayText(value) {
const text = String(value || '').trim()
return text || EMPTY_FIELD_TEXT
}
function buildRoleText(data) {
return Number(data.type) === 2 ? '店长' : '店员'
}
Page({
data: {
@@ -34,6 +44,12 @@ Page({
name,
shortName: name.slice(-1),
color: data.color || EMPLOYEE_COLORS[0],
roleText: buildRoleText(data),
accountText: displayText(data.account),
phoneText: displayText(data.phone),
contactPhoneText: displayText(data.contactPhone),
wechatIdText: displayText(data.wechatId),
identityText: displayText(data.identity),
monthOrders,
monthAmount,
avgAmount: monthOrders > 0 ? Math.round(monthAmount / monthOrders) : 0
@@ -11,7 +11,10 @@
<view wx:else class="avatar" style="background: {{employee.color}};">{{employee.shortName}}</view>
<view>
<text class="employee-name">{{employee.name}}</text>
<text class="tag" style="background: {{employee.color}}; color: #fff;">员工色</text>
<view class="head-tag-row">
<text class="tag" style="background: {{employee.color}}; color: #fff;">{{employee.roleText}}</text>
<text class="tag ghost">员工色</text>
</view>
</view>
</view>
@@ -30,10 +33,44 @@
</view>
</view>
<view wx:if="{{!loadError}}" class="section">
<view class="section-title">基础信息</view>
<view class="card info-card">
<view class="info-row">
<text class="info-label">姓名</text>
<text class="info-value">{{employee.name}}</text>
</view>
<view class="info-row">
<text class="info-label">角色</text>
<text class="info-value">{{employee.roleText}}</text>
</view>
<view class="info-row">
<text class="info-label">登录账号</text>
<text class="info-value">{{employee.accountText}}</text>
</view>
<view class="info-row">
<text class="info-label">手机号</text>
<text class="info-value">{{employee.phoneText}}</text>
</view>
<view class="info-row">
<text class="info-label">联系电话</text>
<text class="info-value">{{employee.contactPhoneText}}</text>
</view>
<view class="info-row">
<text class="info-label">微信号</text>
<text class="info-value">{{employee.wechatIdText}}</text>
</view>
<view class="info-row">
<text class="info-label">身份</text>
<text class="info-value">{{employee.identityText}}</text>
</view>
</view>
</view>
<view wx:if="{{!loadError}}" class="section">
<view class="menu-grid">
<view class="card menu-card" data-url="/pages/schedule-setting/index" bindtap="go">排班设置</view>
<view class="card menu-card" data-url="/pages/leave-management/index" bindtap="go">请假管理</view>
<view class="card menu-card" data-url="/pages/leave-management/index" bindtap="go">工时管理</view>
<view class="card menu-card" data-url="/pages/color-setting/index" bindtap="go">颜色设置</view>
<view class="card menu-card" data-url="/pages/employee-orders/index" bindtap="go">订单记录</view>
</view>
@@ -41,6 +41,18 @@
font-weight: 800;
}
.head-tag-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10rpx;
}
.tag.ghost {
background: #f2ede7;
color: #7b7168;
}
.stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
@@ -68,6 +80,45 @@
font-size: 20rpx;
}
.info-card {
padding: 8rpx 24rpx;
}
.info-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24rpx;
padding: 22rpx 0;
border-bottom: 1rpx solid #eee8df;
}
.info-row:last-child {
border-bottom: 0;
}
.info-label,
.info-value {
display: block;
}
.info-label {
flex: 0 0 auto;
color: #91897f;
font-size: 24rpx;
font-weight: 700;
}
.info-value {
flex: 1;
min-width: 0;
color: #302c27;
text-align: right;
font-size: 26rpx;
font-weight: 800;
overflow-wrap: anywhere;
}
.menu-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);