Files
SupplierSystem/miniprogram/components/preparation-panel/index.wxml
T
Ubuntu de14fb01f0
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
feat: 供应商系统 2026-11 阶段成果(分公司模板/真还原预览、商品远程搜索、主系统联调、加工幂等修复)
- 分公司类型模板:超管配置隐藏路由/菜单 + 中文文案覆盖,仅对挂类型的分公司生效(后端 service/routes、前端 Provider/守卫/配置页)
- 超管模板 iframe 真还原预览:28 个业务页注册、白名单点选编辑、空/示例数据 fixture、白名单漂移检测工具
- 商品/SKU 下拉远程搜索:服务端关键词搜索 + 前端 useRemoteOptionSearch/SearchableSelect 接入(订单/采购/商品等页)
- 主系统联调:子系统主动解绑主系统授权(幂等重试/本地兜底)、追加修改 price_amend 视图代理与 amend-price 转发
- 修复:仓内加工重复建单幂等(已完成需求单 guard、order 任务一商品一单 guard)
- 修复:出入库记录只取前 100 条 → 服务端分页 + 真实总数
- 其它:库存/订单若干修复、分公司管理响应式布局、i18n 文案、设计文档与回归测试
2026-11-07 20:10:48 +08:00

357 lines
16 KiB
Plaintext

<view class="preparation-panel {{embedded ? 'is-embedded' : ''}}">
<!-- 今日摘要(进行中);首页内嵌时 hideProgress 由首页顶部承接 -->
<view wx:if="{{tab === 'active' && !hideProgress}}" class="hero-card">
<view class="hero-main">
<view class="hero-col">
<text class="hero-label">{{heroLabel}}</text>
<text class="hero-date">{{heroDate}}</text>
</view>
<view class="hero-col hero-col--end">
<text class="hero-status-label">已完成</text>
<text class="hero-progress">{{completedCount}} / {{totalCount}}</text>
</view>
</view>
</view>
<!-- 次级入口:仅薄壳页保留;首页已拆成独立工作模块 -->
<view wx:if="{{!embedded}}" class="action-row">
<view
class="action-pill {{tab === 'archived' ? 'action-pill--on' : ''}}"
data-tab="archived"
bindtap="switchTab"
>
<text class="action-pill-icon action-pill-icon--history">◷</text>
<text>历史订单</text>
</view>
<view
wx:if="{{priceAmendEnabled}}"
class="action-pill {{tab === 'price_amend' ? 'action-pill--on' : ''}}"
data-tab="price_amend"
bindtap="switchTab"
>
<text class="action-pill-icon action-pill-icon--amend">✎</text>
<text>追加修改价格</text>
</view>
<view
wx:if="{{tab !== 'active'}}"
class="action-pill"
data-tab="active"
bindtap="switchTab"
>
<text>返回今日</text>
</view>
<view wx:if="{{tab !== 'active'}}" class="action-pill" bindtap="loadCurrentTab">
<text>刷新</text>
</view>
</view>
<view wx:if="{{tab === 'active' && !confirmRequired}}" class="hint-banner">
分公司已关闭「供货确认」:任务已进入库列表,无需点完成;如需改量价可联系管理员
</view>
<view wx:elif="{{tab === 'price_amend'}}" class="hint-banner">
<block wx:if="{{priceAmendWindowHours > 0}}">完成供货后 {{priceAmendWindowHours}} 小时内可改价 · 修改后需管理员确认</block>
<block wx:else>完成供货后可追加改价 · 修改后需管理员确认</block>
</view>
<!-- 历史筛选 -->
<view wx:if="{{tab === 'archived'}}" class="archive-panel">
<view class="period-row">
<view
wx:for="{{periodOptions}}"
wx:key="key"
class="period-chip {{archivePeriod === item.key ? 'active' : ''}}"
data-period="{{item.key}}"
bindtap="pickArchivePeriod"
>{{item.label}}</view>
</view>
<view class="range-row" wx:if="{{archivePeriod === 'custom'}}">
<picker mode="date" value="{{archiveFrom}}" end="{{archiveTo}}" bindchange="onArchiveFromChange">
<view class="range-picker">
<text class="range-label">开始</text>
<text class="range-value">{{archiveFrom || '请选择'}}</text>
</view>
</picker>
<text class="range-sep">至</text>
<picker mode="date" value="{{archiveTo}}" start="{{archiveFrom}}" bindchange="onArchiveToChange">
<view class="range-picker">
<text class="range-label">结束</text>
<text class="range-value">{{archiveTo || '请选择'}}</text>
</view>
</picker>
</view>
<view class="archive-toolbar">
<view wx:if="{{archivePeriodLabel}}" class="period-summary">
当前周期:{{archivePeriodLabel}}
<text wx:if="{{archiveSummary}}" class="period-count"> · {{archiveSummary}}</text>
</view>
<view class="export-actions">
<view
class="export-btn export-btn--ghost {{printing ? 'is-disabled' : ''}}"
bindtap="printArchiveList"
>{{printing ? '打印中' : '打印'}}</view>
<view
class="export-btn {{exporting ? 'is-disabled' : ''}}"
bindtap="exportArchiveExcel"
>{{exporting ? '导出中' : '导出 Excel'}}</view>
</view>
</view>
</view>
<view wx:if="{{error}}" class="state-error">{{error}}</view>
<view wx:if="{{loading}}" class="state-muted">加载中...</view>
<view wx:if="{{!loading && dayGroups.length === 0}}" class="state-empty">
<block wx:if="{{tab === 'active'}}">暂无进行中的供货任务</block>
<block wx:elif="{{tab === 'archived'}}">该周期暂无历史订单记录</block>
<block wx:else>暂无可改价记录(完成供货后时限内才可改)</block>
<view wx:if="{{tab === 'active' && !error}}" class="empty-hint">可在工作模块「历史订单」查看已完成记录;若刚分配任务,请下拉刷新</view>
</view>
<view wx:for="{{dayGroups}}" wx:key="dayKey" wx:for-item="group" class="day-group">
<view
wx:if="{{tab !== 'active' || dayGroups.length > 1}}"
class="day-header"
bindtap="toggleDayGroup"
data-day="{{group.dayKey}}"
>
<view class="day-header-main">
<text class="day-chevron">{{group.collapsed ? '▶' : '▼'}}</text>
<view>
<view class="day-title">{{group.dayLabel}}</view>
<view wx:if="{{tab !== 'price_amend'}}" class="day-sub">
{{group.dayKey}}
<text wx:if="{{tab === 'active'}}"> · 待处理 {{group.pendingCount}} 项</text>
<text wx:else> · {{group.items.length}} 项</text>
</view>
</view>
</view>
<view class="day-header-side">
<text wx:if="{{tab === 'archived' && group.totalAmountText}}" class="day-total-amount">合计 ¥{{group.totalAmountText}}</text>
<view class="day-badge">{{group.items.length}} 项</view>
</view>
</view>
<!-- 历史表格 -->
<view wx:if="{{!group.collapsed && tab === 'archived'}}" class="archive-table">
<view class="archive-tr archive-tr--head">
<text class="archive-td archive-td--name">商品名</text>
<text class="archive-td archive-td--qty">数量</text>
<text class="archive-td archive-td--price">单价</text>
<text class="archive-td archive-td--total">合计</text>
</view>
<view wx:for="{{group.items}}" wx:for-item="item" wx:key="id" class="archive-tr">
<text class="archive-td archive-td--name" user-select>{{item.item_name || item.display_name || '商品'}}<text wx:if="{{item.orderItemRemark}}" class="task-remark"> {{item.orderItemRemark}}</text></text>
<text class="archive-td archive-td--qty">{{item.prepare_qty || 0}} {{item.unit || ''}}</text>
<text class="archive-td archive-td--price">¥{{item.purchase_price || 0}}</text>
<text class="archive-td archive-td--total">¥{{item.total_price_text}}</text>
</view>
</view>
<!-- 进行中 / 改价卡片 -->
<view wx:if="{{(!group.collapsed || (tab === 'active' && dayGroups.length === 1)) && tab !== 'archived'}}" class="day-items">
<view wx:for="{{group.items}}" wx:for-item="item" wx:key="id" class="task-card {{tab === 'price_amend' ? 'task-card--amend' : ''}}">
<block wx:if="{{tab === 'price_amend'}}">
<view class="amend-row">
<view class="amend-row-name">
<text class="task-title">{{item.item_name || item.display_name || '商品'}}</text>
<text wx:if="{{item.orderItemRemark}}" class="task-remark">{{item.orderItemRemark}}</text>
<text wx:if="{{item.customerQtyText || item.receivedQtyText}}" class="amend-qty-ref">客户 {{item.customerQtyText || '—'}} · 实收 {{item.receivedQtyText || '—'}}</text>
</view>
<picker
mode="selector"
range="{{item.unitOptions}}"
value="{{item.unitIndex}}"
data-id="{{item.id}}"
bindchange="onUnitChange"
>
<view class="unit-picker unit-picker--row">{{item.unit || '个'}} ▾</view>
</picker>
<view class="input-with-unit amend-row-num">
<input
class="input"
type="digit"
value="{{item.prepare_qty_input}}"
data-id="{{item.id}}"
data-field="prepare_qty_input"
bindinput="onFieldInput"
/>
<text class="unit-tag">{{item.unit || '个'}}</text>
</view>
<view class="input-with-unit amend-row-num amend-row-num--price">
<input
class="input"
type="digit"
value="{{item.purchase_price_input}}"
data-id="{{item.id}}"
data-field="purchase_price_input"
bindinput="onFieldInput"
/>
<text class="unit-tag">元</text>
</view>
<view
class="btn-amend btn-amend--row {{submitting ? 'is-disabled' : ''}}"
data-id="{{item.id}}"
bindtap="saveAmendPrice"
>{{item.amendPending ? '更新' : item.amendRejected ? '重提' : '提交'}}</view>
</view>
<view class="status-line" wx:if="{{item.return_code || item.amendStatusLabel}}">
<text wx:if="{{item.return_code}}" class="text-error">验收退回</text>
<text wx:if="{{item.return_reason}}"> · {{item.return_reason}}</text>
<text wx:if="{{item.amendStatusLabel}}" class="{{item.amendPending ? 'text-warn' : item.amendRejected ? 'text-error' : ''}}">
<text wx:if="{{item.return_code}}"> · </text>{{item.amendStatusLabel}}
</text>
<text wx:if="{{item.amendRejected && item.amendRemark}}"> · {{item.amendRemark}}</text>
</view>
</block>
<block wx:else>
<view class="task-head">
<view class="task-head-actions" wx:if="{{tab === 'active' && item.prepare_status < 30}}">
<view
wx:if="{{confirmRequired}}"
class="btn-done {{submitting ? 'is-disabled' : ''}}"
data-id="{{item.id}}"
bindtap="completePreparation"
>完成</view>
<text wx:else class="head-hint">已入库</text>
</view>
<view class="task-head-actions" wx:elif="{{tab === 'active' && item.prepare_status >= 30}}">
<view class="btn-done btn-done--static">完成</view>
</view>
<view class="task-head-left">
<view class="task-title-row">
<view
wx:if="{{tab === 'active' && item.requires_quality_report}}"
class="btn-report {{item.quality_report_expired ? 'is-expired' : (item.report_covered ? 'is-covered' : '')}} {{submitting ? 'is-disabled' : ''}}"
data-id="{{item.id}}"
bindtap="onReportTap"
>{{item.quality_report_expired ? '已过期' : '报告'}}</view>
<text class="task-title">{{item.item_name || item.display_name || '商品'}}</text>
<text wx:if="{{item.orderItemRemark}}" class="task-remark">{{item.orderItemRemark}}</text>
<text wx:if="{{item.processing_method}}" class="processing-tag">{{item.processing_method}}</text>
<text wx:if="{{item.priceHintText}}" class="price-hint">{{item.priceHintText}}</text>
<view
wx:if="{{tab === 'active' && item.prepare_status === 10}}"
class="btn-stockout {{submitting ? 'is-disabled' : ''}}"
data-id="{{item.id}}"
bindtap="markStockout"
>缺货</view>
</view>
</view>
</view>
<view class="field-grid" wx:if="{{tab === 'active' && item.prepare_status < 30}}">
<view class="field-block field-block--unit">
<picker
mode="selector"
range="{{item.unitOptions}}"
value="{{item.unitIndex}}"
data-id="{{item.id}}"
bindchange="onUnitChange"
>
<view class="unit-picker">{{item.unit || '个'}} ▾</view>
</picker>
</view>
<view class="field-block field-block--num">
<view class="input-with-unit">
<input
class="input"
type="digit"
value="{{item.prepare_qty_input}}"
data-id="{{item.id}}"
data-field="prepare_qty_input"
bindinput="onFieldInput"
/>
<text class="unit-tag">{{item.unit || '个'}}</text>
</view>
</view>
<view class="field-block field-block--num">
<view class="input-with-unit">
<input
class="input"
type="digit"
value="{{item.purchase_price_input}}"
data-id="{{item.id}}"
data-field="purchase_price_input"
bindinput="onFieldInput"
/>
<text class="unit-tag">元</text>
</view>
</view>
</view>
<view wx:if="{{item.prepare_status >= 30}}" class="done-summary">
数量 {{item.prepare_qty || 0}} {{item.unit || ''}} · ¥{{item.purchase_price || 0}}/{{item.unit || '个'}}
</view>
<view class="status-line" wx:if="{{item.return_code}}">
<text class="text-error">验收退回</text>
<text wx:if="{{item.return_reason}}"> · {{item.return_reason}}</text>
</view>
</block>
</view>
</view>
</view>
<!-- 占位:底栏脱离文档流后,避免改量/改价后末行被挡住 -->
<view
wx:if="{{tab === 'active' && confirmRequired && totalCount > 0}}"
class="bottom-bar-slot {{embedded ? 'bottom-bar-slot--embedded' : ''}}"
/>
<!-- 底栏:portal 挂到页面根,相对视口固定在 tab 上方 -->
<root-portal enable="{{true}}">
<view wx:if="{{tab === 'active' && confirmRequired && totalCount > 0 && !reportSheetVisible}}" class="bottom-bar {{embedded ? 'bottom-bar--embedded' : ''}}">
<view class="bottom-left">
<view class="bottom-total-label">今日总额</view>
<view class="bottom-total-value">¥ {{todayTotalText}}</view>
<view class="bottom-done-hint">{{completedCount}} 项已完成</view>
</view>
<view
class="bottom-submit {{submitting || pendingCount === 0 ? 'is-disabled' : ''}}"
bindtap="submitTodaySupply"
>提交今日供货</view>
</view>
</root-portal>
<canvas type="2d" id="printCanvas" class="print-canvas"></canvas>
<ble-printer-sheet id="blePicker" />
<root-portal enable="{{true}}">
<view
wx:if="{{reportSheetVisible}}"
class="report-sheet-mask"
catchtouchmove="preventSheetClose"
catchtap="preventSheetClose"
>
<view class="report-sheet {{embedded ? 'report-sheet--embedded' : ''}}" catchtap="preventSheetClose">
<text class="report-sheet-title">{{reportSheetTitle}}</text>
<text wx:if="{{reportSheetMeta}}" class="report-sheet-meta {{reportSheetExpired ? 'is-expired' : ''}}">{{reportSheetMeta}}</text>
<view class="report-sheet-files" wx:if="{{reportSheetFiles.length}}">
<view
wx:for="{{reportSheetFiles}}"
wx:key="url"
class="report-sheet-file"
data-index="{{index}}"
bindtap="onReportFileTap"
>
<image wx:if="{{!item.isPdf}}" class="report-sheet-thumb" src="{{item.url}}" mode="aspectFill" />
<view wx:else class="report-sheet-pdf">PDF</view>
</view>
</view>
<scroll-view wx:if="{{reportSheetHits.length}}" scroll-y class="report-sheet-list">
<view
wx:for="{{reportSheetHits}}"
wx:key="id"
class="report-sheet-row"
data-id="{{item.id}}"
bindtap="onReportHitTap"
>
<view class="report-sheet-check {{item.checked ? 'is-on' : ''}}"></view>
<text class="report-sheet-name">{{item.name}}</text>
</view>
</scroll-view>
<view class="report-sheet-actions">
<view class="report-sheet-btn {{reportSheetBusy ? 'is-disabled' : ''}}" bindtap="onReportSheetCancel">取消</view>
<view class="report-sheet-btn report-sheet-btn--ok {{reportSheetBusy ? 'is-disabled' : ''}}" bindtap="onReportSheetConfirm">{{reportSheetMode === 'view' ? '替换' : '确认'}}</view>
</view>
</view>
</view>
</root-portal>
</view>