文件
yjyf/yjyf-app/components/AppointTimeDrawer.vue
MiAn fafddceaf2 feat: 新增发票抬头、晒单、钱包日志等模型及后台管理功能
- 新增 invoice_title、showcase、wallet_log 模型及对应语言包
- 新增后台控制器、视图及搜索字段配置
- 修复服务类目删除保护逻辑
- 优化后台登录页面文案及样式
- 新增前端角色切换逻辑及页面拦截
- 新增 SVG 图标及样式变量
- 修复接口权限及下拉框默认值问题
2026-11-11 17:02:35 +08:00

247 行
5.1 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="drawer-mask" v-if="visible" @tap="close">
<view class="drawer-sheet" @tap.stop>
<!-- 1. 顶部日期选择条(1:1 复刻 frame_020:左大号日期 + 右日历图标「选择日期」) -->
<view class="date-header-row">
<text class="dh-date-val">{{ selectedDate }}</text>
<picker mode="date" :value="selectedDate" :start="todayStr" @change="onDateChange">
<view class="dh-picker-btn clickable-hover">
<image class="dh-cal-icon" src="/static/icons/calendar-orange.svg" mode="aspectFit" />
<text class="dh-cal-txt">选择日期</text>
</view>
</picker>
</view>
<!-- 2. 2x2 时段网格卡片(1:1 复刻 frame_020:上午/中午/下午/晚上 + 具体时间段) -->
<view class="slot-grid">
<view
class="slot-card clickable-hover"
v-for="item in slotList"
:key="item.name"
:class="{ active: selectedSlot === item.name }"
@tap="selectedSlot = item.name"
>
<text class="slot-name">{{ item.name }}</text>
<text class="slot-range">{{ item.range }}</text>
</view>
</view>
<!-- 3. 底部说明区(1:1 复刻 frame_020) -->
<view class="explain-box">
<text class="exp-title">说明:</text>
<text class="exp-desc">期望上门时间仅供师傅参考,具体上门时间由师傅接单后和客户预约为准。</text>
</view>
<!-- 4. 底部通栏橙色确定按钮 -->
<view class="drawer-foot">
<view class="confirm-btn clickable-hover" @tap="handleConfirm">
<text class="cb-txt">确定</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref, watch } from 'vue';
const props = defineProps({
visible: { type: Boolean, default: false },
date: { type: String, default: '' },
slot: { type: String, default: '' }
});
const emit = defineEmits(['update:visible', 'confirm']);
const slotList = [
{ name: '上午', range: '07:00~10:59' },
{ name: '中午', range: '11:00~13:59' },
{ name: '下午', range: '14:00~17:59' },
{ name: '晚上', range: '18:00~20:59' }
];
const now = new Date();
const todayStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
const selectedDate = ref(todayStr);
const selectedSlot = ref('晚上');
watch(() => props.visible, (v) => {
if (v) {
selectedDate.value = props.date || todayStr;
selectedSlot.value = props.slot || '晚上';
}
}, { immediate: true });
function onDateChange(e) {
if (e && e.detail && e.detail.value) {
selectedDate.value = e.detail.value;
}
}
function close() {
emit('update:visible', false);
}
function handleConfirm() {
emit('confirm', {
date: selectedDate.value,
slot: selectedSlot.value,
display: `${selectedDate.value} ${selectedSlot.value}`
});
close();
}
</script>
<style scoped>
.drawer-mask {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.55);
z-index: 999;
display: flex;
flex-direction: column;
justify-content: flex-end;
animation: drawerFadeIn 0.2s ease-out;
}
@keyframes drawerFadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.drawer-sheet {
background: #FFFFFF;
border-radius: 28rpx 28rpx 0 0;
overflow: hidden;
padding: 0 0 calc(env(safe-area-inset-bottom));
box-sizing: border-box;
animation: drawerSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes drawerSlideUp {
from { transform: translateY(100%); }
to { transform: translateY(0); }
}
.date-header-row {
display: flex;
align-items: center;
justify-content: space-between;
height: 108rpx;
padding: 0 36rpx;
border-bottom: 1rpx solid #F0F0F2;
}
.dh-date-val {
font-size: 38rpx;
font-weight: 700;
color: #1F1F1F;
}
.dh-picker-btn {
display: flex;
align-items: center;
gap: 10rpx;
}
.dh-cal-icon {
width: 34rpx;
height: 34rpx;
}
.dh-cal-txt {
font-size: 30rpx;
color: #1F1F1F;
}
.slot-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 28rpx;
padding: 40rpx 36rpx;
border-bottom: 1rpx solid #F0F0F2;
}
.slot-card {
height: 156rpx;
border-radius: 12rpx;
background: #F7F7F7;
border: 2rpx solid #E5E5E5;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12rpx;
transition: all 0.18s ease;
}
.slot-card.active {
background: #FFF7F0;
border-color: #F0710D;
}
.slot-name {
font-size: 32rpx;
font-weight: 500;
color: #1F1F1F;
line-height: 1;
}
.slot-card.active .slot-name {
color: #F0710D;
}
.slot-range {
font-size: 26rpx;
color: #666666;
line-height: 1;
}
.slot-card.active .slot-range {
color: #F0710D;
}
.explain-box {
padding: 36rpx 36rpx 80rpx;
display: flex;
flex-direction: column;
gap: 12rpx;
}
.exp-title {
font-size: 28rpx;
font-weight: 700;
color: #1F1F1F;
}
.exp-desc {
font-size: 28rpx;
color: #444444;
line-height: 1.5;
}
.drawer-foot {
padding: 0;
}
.confirm-btn {
height: 96rpx;
background: #F0710D;
display: flex;
align-items: center;
justify-content: center;
}
.cb-txt {
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
line-height: 1;
}
.clickable-hover:active {
opacity: 0.85;
}
</style>