优化店务小程序预约作品交互

This commit is contained in:
2026-07-21 12:09:28 +08:00
parent 75d38dc352
commit 7f9f9e74a6
11 changed files with 627 additions and 88 deletions
+17 -11
View File
@@ -7,6 +7,7 @@ Page({
id: '',
employee: {},
loadError: '',
deleteConfirmVisible: false,
deletingEmployee: false
},
@@ -54,21 +55,25 @@ Page({
if (this.data.deletingEmployee) {
return
}
wx.showModal({
title: '删除员工',
content: '确定要删除该员工吗?该操作只移除当前店铺员工关系,不会删除登录账号。',
confirmText: '删除',
confirmColor: '#BF4949',
success: (result) => {
if (result.confirm) {
this.confirmDeleteEmployee()
}
}
})
this.setData({ deleteConfirmVisible: true })
},
closeDeleteConfirm() {
if (this.data.deletingEmployee) {
return
}
this.setData({ deleteConfirmVisible: false })
},
stopTap() {
},
async confirmDeleteEmployee() {
if (this.data.deletingEmployee) {
return
}
if (!this.data.id) {
wx.showToast({ title: '缺少员工 ID,无法删除', icon: 'none' })
return
}
this.setData({ deletingEmployee: true })
@@ -77,6 +82,7 @@ Page({
if (!success) {
throw new Error('员工不存在或已被删除')
}
this.setData({ deleteConfirmVisible: false })
wx.showToast({ title: '员工已删除', icon: 'success' })
setTimeout(() => {
wx.navigateBack()
@@ -40,10 +40,48 @@
</view>
<view wx:if="{{!loadError}}" class="card delete-card">
<view>
<text class="delete-title">删除员工</text>
<text class="delete-desc">删除后该员工会从当前店铺员工列表移除,登录账号仍会保留。</text>
<view class="delete-shell">
<view class="delete-icon">!</view>
<view class="delete-copy">
<view class="delete-title-row">
<text class="delete-title">删除员工</text>
<text class="delete-badge">危险操作</text>
</view>
<text class="delete-desc">只会解除该员工与当前店铺的关系,登录账号和历史订单会继续保留。</text>
</view>
</view>
<view class="delete-facts">
<view class="delete-fact">
<text class="delete-fact-label">员工列表</text>
<text class="delete-fact-value">移除</text>
</view>
<view class="delete-fact">
<text class="delete-fact-label">登录账号</text>
<text class="delete-fact-value">保留</text>
</view>
</view>
<button class="delete-btn" loading="{{deletingEmployee}}" disabled="{{deletingEmployee}}" bindtap="requestDeleteEmployee">删除员工</button>
</view>
<view wx:if="{{deleteConfirmVisible}}" class="delete-confirm-mask" bindtap="closeDeleteConfirm">
<view class="delete-confirm-panel" catchtap="stopTap">
<view class="delete-confirm-icon">!</view>
<text class="delete-confirm-title">确认删除员工</text>
<text class="delete-confirm-desc">删除后该员工会从当前店铺员工列表移除,但登录账号不会被删除。</text>
<view class="delete-confirm-facts">
<view class="delete-confirm-fact">
<text>员工列表</text>
<text>移除</text>
</view>
<view class="delete-confirm-fact">
<text>登录账号</text>
<text>保留</text>
</view>
</view>
<view class="delete-confirm-actions">
<button class="delete-confirm-cancel" disabled="{{deletingEmployee}}" bindtap="closeDeleteConfirm">取消</button>
<button class="delete-confirm-submit" loading="{{deletingEmployee}}" disabled="{{deletingEmployee}}" bindtap="confirmDeleteEmployee">确认删除</button>
</view>
</view>
<button class="delete-btn" loading="{{deletingEmployee}}" bindtap="requestDeleteEmployee">删除员工</button>
</view>
</view>
+242 -13
View File
@@ -85,16 +85,54 @@
}
.delete-card {
margin-top: 24rpx;
padding: 28rpx;
border-color: rgba(191, 73, 73, 0.18);
background: linear-gradient(180deg, #fffdf8 0%, #fff5f2 100%);
}
.delete-shell {
display: flex;
align-items: flex-start;
gap: 18rpx;
}
.delete-icon,
.delete-confirm-icon {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
margin-top: 24rpx;
padding: 24rpx;
justify-content: center;
flex: 0 0 auto;
width: 54rpx;
height: 54rpx;
border: 1rpx solid rgba(191, 73, 73, 0.2);
border-radius: 50%;
background: #fff0f0;
color: #bf4949;
font-size: 32rpx;
font-weight: 900;
line-height: 1;
}
.delete-copy {
flex: 1;
min-width: 0;
}
.delete-title-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12rpx;
}
.delete-title,
.delete-desc {
.delete-desc,
.delete-fact-label,
.delete-fact-value,
.delete-confirm-title,
.delete-confirm-desc,
.delete-confirm-fact text {
display: block;
}
@@ -105,20 +143,211 @@
}
.delete-desc {
margin-top: 10rpx;
color: #7b6f66;
font-size: 24rpx;
line-height: 1.55;
}
.delete-badge {
display: inline-flex;
align-items: center;
min-height: 36rpx;
padding: 0 14rpx;
border-radius: 999rpx;
background: rgba(191, 73, 73, 0.1);
color: #bf4949;
font-size: 20rpx;
font-weight: 900;
}
.delete-facts {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12rpx;
margin: 22rpx 0;
}
.delete-fact {
min-width: 0;
padding: 16rpx;
border: 1rpx solid rgba(191, 73, 73, 0.1);
border-radius: 16rpx;
background: rgba(255, 253, 248, 0.78);
}
.delete-fact-label {
color: #8e8077;
font-size: 21rpx;
font-weight: 700;
}
.delete-fact-value {
margin-top: 8rpx;
color: #91897f;
font-size: 22rpx;
line-height: 1.5;
color: #bf4949;
font-size: 26rpx;
font-weight: 900;
}
.delete-btn {
flex: 0 0 auto;
min-width: 172rpx;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 100%;
min-width: 0;
max-width: 100%;
min-height: 78rpx;
margin: 0;
border: 0;
border-radius: 999rpx;
border-radius: 14px;
background: #BF4949;
color: #fff;
font-size: 26rpx;
font-weight: 900;
box-shadow: 0 12rpx 24rpx rgba(191, 73, 73, 0.22);
}
.delete-btn[disabled],
.delete-confirm-submit[disabled],
.delete-confirm-cancel[disabled] {
opacity: 0.72;
}
.delete-btn::after {
border: 0;
}
.delete-confirm-mask {
position: fixed;
inset: 0;
z-index: 90;
display: flex;
align-items: center;
justify-content: center;
padding: 40rpx;
background: rgba(18, 15, 12, 0.48);
animation: deleteMaskIn 180ms ease both;
}
.delete-confirm-panel {
box-sizing: border-box;
width: 100%;
max-width: 632rpx;
padding: 36rpx 30rpx 30rpx;
border: 1rpx solid rgba(191, 73, 73, 0.14);
border-radius: 28rpx;
background: #fffdf8;
box-shadow: 0 24rpx 56rpx rgba(41, 31, 23, 0.2);
animation: deleteConfirmIn 200ms ease both;
}
.delete-confirm-icon {
width: 66rpx;
height: 66rpx;
margin: 0 auto 20rpx;
font-size: 38rpx;
}
.delete-confirm-title {
color: #302c27;
text-align: center;
font-size: 34rpx;
font-weight: 900;
}
.delete-confirm-desc {
margin-top: 14rpx;
color: #756a62;
text-align: center;
font-size: 24rpx;
font-weight: 800;
line-height: 1.6;
}
.delete-confirm-facts {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12rpx;
margin-top: 26rpx;
}
.delete-confirm-fact {
padding: 16rpx;
border-radius: 16rpx;
background: #f8f1ea;
}
.delete-confirm-fact text:first-child {
color: #8f8278;
font-size: 21rpx;
font-weight: 700;
}
.delete-confirm-fact text:last-child {
margin-top: 8rpx;
color: #bf4949;
font-size: 26rpx;
font-weight: 900;
}
.delete-confirm-actions {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 14rpx;
margin-top: 28rpx;
min-width: 0;
overflow: hidden;
}
.delete-confirm-cancel,
.delete-confirm-submit {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 100%;
min-width: 0;
max-width: 100%;
min-height: 76rpx;
margin: 0;
padding: 0 12rpx;
border-radius: 14px;
font-size: 26rpx;
font-weight: 900;
}
.delete-confirm-cancel::after,
.delete-confirm-submit::after {
border: 0;
}
.delete-confirm-cancel {
border: 1rpx solid #e1d8ce;
background: #fffdf8;
color: #514b44;
}
.delete-confirm-submit {
background: #BF4949;
color: #fff;
box-shadow: 0 12rpx 24rpx rgba(191, 73, 73, 0.2);
}
@keyframes deleteMaskIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes deleteConfirmIn {
from {
opacity: 0;
transform: translateY(20rpx) scale(0.98);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}