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

211 lines
13 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 wx:if="{{phoneBannerVisible}}" class="phone-banner">
<view class="phone-banner-track" bindtap="openAccountSettings"><text>绑定手机号,便于账号安全验证与重要通知</text><text>点击前往账号设置</text></view>
<view class="phone-banner-close" catchtap="dismissPhoneBanner">×</view>
</view>
<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">{{businessHoursText}}</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 wx:if="{{!selectedArtistId && rangeUnassignedCount > 0}}" class="unassigned-notice" bindtap="openNearestUnassigned">
<view class="chip-dot unassigned-dot"></view>
<text>有 {{rangeUnassignedCount}} 个预约待分配美甲师</text>
<text class="unassigned-link">立即处理 ›</text>
</view>
</view>
<view wx:if="{{!businessHoursConfigured && !calendarError}}" class="business-hours-notice">
<view class="business-hours-notice-copy"><text class="business-hours-notice-title">门店营业时间未设置</text><text class="business-hours-notice-desc">设置后才能安排普通预约,历史订单与补录不受影响。</text></view>
<button wx:if="{{canManageShopSettings}}" class="business-hours-action" bindtap="openShopSettings">去设置</button>
</view>
<view wx:if="{{profilePromptVisible}}" class="profile-prompt-mask">
<view class="profile-prompt">
<text class="profile-prompt-title">完善你的工作名片</text><text class="profile-prompt-desc">头像和昵称会用于门店协作展示,可暂时跳过。</text>
<button class="wechat-avatar" open-type="chooseAvatar" bindchooseavatar="chooseWechatAvatar" disabled="{{profileSaving}}">
<image class="wechat-avatar-image {{profileForm.avatar ? 'is-real' : 'is-default'}}" src="{{profileForm.avatar || '/assets/images/default-user-avatar.png'}}" mode="aspectFill" binderror="onProfileAvatarError"></image>
<view class="wechat-avatar-hint">{{profileSaving ? '上传中' : '点击更换'}}</view>
</button>
<input class="wechat-nickname" type="nickname" value="{{profileForm.nickname}}" bindinput="onNicknameInput" placeholder="填写微信昵称" />
<button class="profile-save" loading="{{profileSaving}}" bindtap="saveWechatProfile">保存资料</button><button class="profile-skip" bindtap="skipProfilePrompt">暂时跳过</button>
</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 wx:if="{{historicalBackfillItems.length}}" class="card historical-backfill-card">
<view class="section-title">历史补单</view>
<view wx:for="{{historicalBackfillItems}}" wx:key="orderItemId" class="historical-backfill-row" data-id="{{item.orderItemId}}" bindtap="openAppointment">
<view><text>{{item.customerName || '散客'}} · {{item.productTitle}}</text><text class="muted">{{item.artistName}} · {{item.startTime || '时间未记录'}}</text></view>
<text>{{item.statusText}} · ¥{{item.amount}}</text>
</view>
</view>
<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 class="summary-item card unassigned-summary">
<text class="summary-value">{{unassignedCount}}</text>
<text class="summary-label">待分配</text>
</view>
</view>
<view wx:if="{{!businessHoursConfigured && !hasTimedAppointments}}" class="day-board card business-hours-empty">
<text class="business-hours-empty-title">预约时间轴暂不可用</text>
<text class="business-hours-empty-desc">请先设置门店营业时间,再安排普通预约。</text>
</view>
<scroll-view wx:else 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: {{item.width || laneItemWidth}}rpx;">
<view class="lane-head">
<view class="chip-dot" style="background: {{item.color}};"></view>
<text>{{item.name}}</text>
<text wx:if="{{item.isUnassigned}}" class="lane-unassigned-tag">不占档期</text>
</view>
<view wx:for="{{hours}}" wx:for-item="hour" wx:key="value" class="hour-line" style="top: {{hour.top}}rpx;"></view>
<view wx:for="{{item.blocks}}" wx:for-item="block" wx:key="orderItemId" class="appointment-block {{item.isUnassigned ? 'unassigned-block' : ''}} {{block.status === 0 ? 'pending' : ''}} {{block.compact ? 'compact' : ''}}" style="top: {{block.top}}rpx; left: {{block.left}}rpx; width: {{block.width}}rpx; height: {{block.height}}rpx; border-left-color: {{item.color}};" data-id="{{block.orderItemId}}" bindtap="openAppointment">
<text class="block-title">{{block.customerName}}</text>
<text class="block-meta">{{block.timeText}} · {{block.productTitle}}</text>
<view class="block-footer">
<text class="block-status">{{block.statusText}}</text>
<view class="block-actions" catchtap="stopTap">
<text wx:if="{{!block.historicalBackfill && block.status === 0 && block.assignmentStatus !== 'UNASSIGNED'}}" data-id="{{block.orderItemId}}" data-status="1" catchtap="quickUpdateStatus">确认</text>
<text wx:if="{{!block.historicalBackfill}}" data-id="{{block.orderItemId}}" catchtap="quickTransfer">{{block.assignmentStatus === 'UNASSIGNED' ? '分配' : '改派'}}</text>
<text wx:if="{{!block.historicalBackfill || block.status === 4}}" data-id="{{block.orderItemId}}" catchtap="quickCancel">取消</text>
<text wx:if="{{block.historicalBackfill && block.status === 4}}" data-id="{{block.orderItemId}}" data-status="2" catchtap="quickUpdateStatus">完成</text>
</view>
</view>
</view>
<view wx:if="{{item.blocks.length === 0}}" class="lane-empty">{{item.emptyText || '全天可约'}}</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' : ''}}" data-date="{{item.date}}" bindtap="selectWeekDate" aria-label="查看{{item.date}}日程">
<text class="week-name">{{item.weekName}}</text>
<text class="week-date">{{item.day}}</text>
<text class="week-total">{{item.totalCount}}单</text>
<text wx:if="{{item.unassignedCount > 0}}" class="week-unassigned-count">待分配 {{item.unassignedCount}}</text>
<view class="week-bars {{item.totalCount === 0 ? 'empty' : ''}}">
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="artistId" class="week-bar" style="background: {{count.color}}; width: {{count.width}}%;"></view>
</view>
</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="artistId" class="week-count-bar" 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-toolbar-controls">
<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>
<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.date === currentDateText ? 'selected' : ''}}" data-date="{{item.date}}" bindtap="selectMonthDate" aria-label="查看{{item.date}}日程">
<view class="month-cell-head">
<text class="month-day">{{item.day}}</text>
<view class="month-cell-badges">
<text wx:if="{{item.unassignedCount > 0}}" class="month-unassigned-count">待 {{item.unassignedCount}}</text>
<text wx:if="{{!item.isPast && item.dayStatus === 'full'}}" class="day-mark full">满</text>
<text wx:elif="{{!item.isPast && item.dayStatus === 'rest'}}" class="day-mark rest">休</text>
</view>
</view>
<view wx:if="{{monthDisplayMode === 'count'}}" class="month-bars">
<view wx:for="{{item.artistCounts}}" wx:for-item="count" wx:key="artistId" wx:if="{{count.count > 0}}" class="month-artist-bar" style="background: {{count.color}};">
<text>{{count.shortName}}{{count.count}}</text>
</view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</view>
<view wx:else class="month-blocks">
<block wx:if="{{monthDisplayMode === 'blocks'}}">
<view wx:for="{{item.expandedBlocks}}" wx:for-item="block" wx:key="key" class="month-order-block" style="background: {{block.color}};"></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' : ''}}" style="background: {{block.color}};">
<text wx:if="{{monthRowLabelVisible}}">{{block.artistName}}</text>
</view>
<view wx:if="{{item.totalCount === 0}}" class="month-empty">空</view>
</block>
</view>
</view>
</view>
</view>
</view>
</block>
<button wx:if="{{canCreateAppointment && businessHoursConfigured && !calendarError}}" class="fab" bindtap="createAppointment">+</button>
</view>