Files
JayuCloud/JY-Salon-WeChat/pages/planning/index.wxml
T

205 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<view class="page planning-page">
<view class="card control-card">
<view class="date-row">
<view class="date-side">
<button class="icon-btn small" bindtap="prevRange">‹</button>
</view>
<view class="date-center">
<text class="date-main">{{dateTitle}}</text>
<text class="date-sub">{{businessStartTime}}-{{businessEndTime}}</text>
</view>
<view class="date-side date-tools">
<button class="today-btn" bindtap="goToday">今</button>
<button class="icon-btn small" bindtap="nextRange">›</button>
</view>
</view>
<view class="segmented">
<view wx:for="{{viewModes}}" wx:key="value" class="segment {{viewMode === item.value ? 'active' : ''}}" data-mode="{{item.value}}" bindtap="switchView">{{item.label}}</view>
</view>
<scroll-view class="artist-filter" scroll-x enable-flex>
<view class="artist-chip {{!selectedArtistId ? 'active' : ''}}" data-id="" bindtap="selectArtist">全部员工</view>
<view wx:for="{{artists}}" wx:key="id" class="artist-chip {{selectedArtistId == item.id ? 'active' : ''}}" data-id="{{item.id}}" bindtap="selectArtist">
<view class="chip-dot" style="background: {{item.color}};"></view>
<text>{{item.name}}</text>
<text class="chip-count">{{item.rangeCount || 0}}</text>
</view>
</scroll-view>
</view>
<view wx:if="{{calendarError}}" class="calendar-error-card">
<view class="calendar-error-copy">
<text class="calendar-error-title">规划数据加载失败</text>
<text class="calendar-error-message">{{calendarError}}</text>
</view>
<button class="calendar-error-action" bindtap="loadCalendar">重试</button>
</view>
<block wx:if="{{!calendarError}}">
<view wx:if="{{viewMode === 'day'}}" class="section">
<view class="day-summary">
<view class="summary-item card">
<text class="summary-value">{{dayTotal}}</text>
<text class="summary-label">今日预约</text>
</view>
<view class="summary-item card">
<text class="summary-value">{{freeArtistCount}}</text>
<text class="summary-label">可插单员工</text>
</view>
<view class="summary-item card">
<text class="summary-value">{{pendingCount}}</text>
<text class="summary-label">待确认</text>
</view>
</view>
<scroll-view class="day-board card" scroll-y>
<view class="timeline-wrap" style="height: {{timelineHeight}}rpx;">
<view class="time-axis">
<view wx:for="{{hours}}" wx:key="value" class="time-label" style="top: {{item.top}}rpx;">{{item.label}}</view>
</view>
<scroll-view class="lane-scroll" scroll-x enable-flex>
<view class="lanes" style="height: {{timelineHeight}}rpx; width: {{laneWidth}}rpx;">
<view wx:for="{{dayLanes}}" wx:key="artistId" class="artist-lane" style="height: {{timelineHeight}}rpx; width: {{laneItemWidth}}rpx;">
<view class="lane-head">
<view class="chip-dot" style="background: {{item.color}};"></view>
<text>{{item.name}}</text>
</view>
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{block.statusClass}}" style="top: {{block.top}}rpx; height: {{block.height}}rpx; border-left-color: {{item.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" bindtap="openAppointment">
<text class="block-title">{{block.customerName}}</text>
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
<view wx:if="{{block.badges.length}}" class="block-badges">
<text wx:for="{{block.badges}}" wx:for-item="badge" wx:key="key" class="block-badge {{badge.type}}">{{badge.text}}</text>
</view>
<text class="block-status">{{block.statusText}}</text>
</view>
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">全天可约</view>
</view>
</view>
</scroll-view>
</view>
</scroll-view>
</view>
<view wx:if="{{viewMode === 'week'}}" class="section">
<scroll-view class="week-strip" scroll-x enable-flex>
<view wx:for="{{weekDays}}" wx:key="date" class="week-day-card card {{item.date === currentDateText ? 'active' : ''}} {{item.statusClass}}" data-date="{{item.date}}" bindtap="selectDate">
<text class="week-name">{{item.weekName}}</text>
<text class="week-date">{{item.day}}</text>
</view>
</scroll-view>
<view class="card week-grid">
<view class="week-grid-head">
<text>本周排班密度</text>
<text class="muted">{{weekRange}}</text>
</view>
<view wx:for="{{weekDays}}" wx:key="date" class="week-line">
<view class="week-line-date">{{item.weekName}} {{item.day}}</view>
<view class="week-line-bars {{item.totalCount === 0 ? 'empty' : ''}}">
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="key" class="week-count-bar {{count.statusClass}}" style="background: {{count.color}}; width: {{count.barWidth}}%;">
<text>{{count.shortName}}{{count.count}}</text>
</view>
</view>
</view>
</view>
</view>
<view wx:if="{{viewMode === 'month'}}" class="section">
<view class="month-toolbar">
<text class="month-toolbar-title">月历显示</text>
<view class="month-mode-switch">
<view wx:for="{{monthDisplayModes}}" wx:key="value" class="month-mode {{monthDisplayMode === item.value ? 'active' : ''}}" data-mode="{{item.value}}" bindtap="switchMonthDisplay">{{item.label}}</view>
</view>
<view wx:if="{{monthDisplayMode === 'rows'}}" class="row-name-switch {{monthRowLabelVisible ? 'active' : ''}}" bindtap="toggleMonthRowLabel">
<text>姓名</text>
<view class="switch-track"><view class="switch-thumb"></view></view>
</view>
</view>
<view class="month-card card">
<view class="month-week-head">
<text wx:for="{{weekLabels}}" wx:key="*this">{{item}}</text>
</view>
<view class="month-grid">
<view wx:for="{{monthDays}}" wx:key="date" class="month-cell {{item.isCurrentMonth ? '' : 'out-month'}} {{item.isToday ? 'today' : ''}} {{item.date === currentDateText ? 'selected' : ''}} {{emptyDateActionVisible && item.date === pendingEmptyDate ? 'action-target' : ''}} {{!item.isPast && item.shopRest ? 'is-rest' : ''}}" data-date="{{item.date}}" bindtap="selectDate">
<view class="month-cell-head">
<text class="month-day">{{item.day}}</text>
<text wx:if="{{!item.isPast && item.shopRest}}" class="day-mark rest">休</text>
<text wx:elif="{{!item.isPast && item.dayStatus === 'full'}}" class="day-mark full">满</text>
</view>
<view class="month-blocks">
<block wx:if="{{monthDisplayMode === 'blocks'}}">
<view wx:for="{{item.expandedBlocks}}" wx:for-item="block" wx:key="key" class="month-order-block {{block.statusClass}}" style="background: {{block.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" catchtap="openAppointment"></view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</block>
<block wx:else>
<view wx:for="{{item.rowBlocks}}" wx:for-item="block" wx:key="key" class="month-row-block {{monthRowLabelVisible ? 'named' : ''}} {{block.statusClass}}" style="background: {{block.color}};" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}" catchtap="openAppointment">
<text wx:if="{{monthRowLabelVisible}}" data-id="{{block.orderItemId || block.id}}" data-order-item-id="{{block.orderItemId || block.id}}">{{block.customerName}}</text>
</view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</block>
</view>
</view>
</view>
</view>
</view>
</block>
<button wx:if="{{canCreateAppointment && !calendarError}}" class="fab" bindtap="createAppointment">+</button>
<view wx:if="{{emptyDateActionVisible}}" class="empty-date-mask" catchtap="stopTap">
<view class="empty-date-sheet" catchtap="stopTap">
<view class="sheet-grabber"></view>
<view class="empty-date-head">
<view class="empty-date-title-wrap">
<text class="empty-date-title">{{pendingEmptyDateTitle}}</text>
<text class="empty-date-subtitle">当前日期暂无预约,可以直接创建预约或设为特殊日期</text>
</view>
<button class="empty-date-close" bindtap="closeEmptyDateAction">×</button>
</view>
<view class="empty-date-actions">
<button class="empty-date-action primary" bindtap="createAppointmentFromEmptyDate">
<view class="empty-date-action-icon">+</view>
<view class="empty-date-action-copy">
<text class="empty-date-action-title">以 {{pendingEmptyDateLabel}} 新建预约</text>
<text class="empty-date-action-desc">进入预约表单,并自动带入日期;员工沿用当前筛选</text>
</view>
</button>
</view>
<view class="empty-date-special">
<text class="empty-date-section-title">特殊日期</text>
<view class="empty-date-type-list">
<button wx:for="{{specialDateTypes}}" wx:key="value" class="empty-date-type {{item.tone}} {{item.active ? 'active' : ''}}" data-value="{{item.value}}" bindtap="selectEmptyDateSpecialType">
<view class="empty-date-action-icon">{{item.icon}}</view>
<view class="empty-date-action-copy">
<text class="empty-date-action-title">{{item.label}}</text>
<text class="empty-date-action-desc">{{item.desc}}</text>
</view>
<text class="empty-date-type-check">{{item.active ? '已选' : ''}}</text>
</button>
</view>
<view wx:if="{{pendingSpecialDateRequiresTime}}" class="empty-date-time-fields">
<picker mode="time" value="{{pendingSpecialDateStartTime}}" bindchange="onEmptyDateStartTimeChange">
<view class="empty-date-time-field">
<text class="empty-date-time-label">开始</text>
<text class="empty-date-time-value">{{pendingSpecialDateStartTime}}</text>
</view>
</picker>
<picker mode="time" value="{{pendingSpecialDateEndTime}}" bindchange="onEmptyDateEndTimeChange">
<view class="empty-date-time-field">
<text class="empty-date-time-label">结束</text>
<text class="empty-date-time-value">{{pendingSpecialDateEndTime}}</text>
</view>
</picker>
</view>
<button class="empty-date-save" loading="{{savingSpecialDate}}" bindtap="saveEmptyDateSpecialDate">
<text>保存{{pendingSpecialDateTypeLabel}}</text>
</button>
</view>
</view>
</view>
<view wx:if="{{loading || pageMaskVisible}}" class="planning-loading-mask" catchtap="stopTap">
<view class="planning-loading-card" catchtap="stopTap">
<view class="planning-loading-spinner"></view>
<text>{{pageMaskText || loadingText || '正在加载规划'}}</text>
</view>
</view>
</view>