Files
雨天 482c7c1e89
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(小程序): 新增仓库管理内嵌面板与授权
首页 Tab 内嵌仓库管理面板:批次/可用/成本价/报告/入库时间

默认仅看可用,顶部统计库存批次、可用总量、可用货值

批量上传按 Web 流程:上传→识别→候选→人工确认,编辑可直传

新增权限码 warehouse_manage,默认赋予仓管,不映射 Web 菜单

6 条移动端薄路由,全部复用 Web 同一批 service

修复首页未转发 onReachBottom 导致内嵌列表只有第 1 页

修复录单员获授权后点仓库管理回弹(漏传 permissions)
2026-10-25 13:47:33 +08:00

195 lines
9.0 KiB
Plaintext
Raw Permalink 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="warehouse-panel {{embedded ? 'is-embedded' : ''}}">
<!-- 搜索 -->
<view class="toolbar">
<input
class="search-input"
placeholder="搜索商品名 / 编码 / 批次号"
value="{{search}}"
bindinput="onSearchInput"
bindconfirm="onSearchConfirm"
confirm-type="search"
/>
</view>
<!-- 筛选 + 批量上传:同一行(条件在左、总数靠右、操作在最右) -->
<view class="filter-row">
<view class="chips">
<view class="chip {{onlyAvailable ? 'is-on' : ''}}" catchtap="toggleOnlyAvailable">仅有可用</view>
<view class="chip {{onlyMissingReport ? 'is-on' : ''}}" catchtap="toggleOnlyMissingReport">缺报告</view>
</view>
<text class="total">{{totalText}}</text>
<button
class="upload-btn {{uploading ? 'is-disabled' : ''}}"
loading="{{uploading}}"
bindtap="openUploadSheet"
>批量上传报告</button>
</view>
<!-- 表格:表头 + 行(列对齐) -->
<view class="table">
<view class="tr thead">
<view class="td td-product">商品</view>
<view class="td td-qty">可用</view>
<view class="td td-cost">成本价</view>
<view class="td td-report">报告</view>
</view>
<view wx:if="{{loading}}" class="table-hint">加载中…</view>
<view wx:elif="{{!rows.length}}" class="table-hint">没有符合条件的批次</view>
<view
wx:for="{{rows}}"
wx:key="id"
class="tr"
bindtap="onRowTap"
data-id="{{item.id}}"
>
<view class="td td-product">
<text class="name {{item.report_missing ? 'is-missing' : ''}}">{{item.sku_name}}</text>
<text class="sub">{{item.batch_no}}{{item.category_name ? ' · ' + item.category_name : ''}}</text>
<text class="sub">入库 {{item.inbound_at || '—'}}</text>
</view>
<view class="td td-qty">{{item.available_text}}</view>
<view class="td td-cost {{item.cost_missing ? 'is-missing' : ''}}">{{item.cost_missing ? '未设置' : '¥' + item.cost_text}}</view>
<view class="td td-report" catchtap="openReports" data-id="{{item.id}}">
<text class="{{item.report_missing ? 'is-missing' : 'is-ok'}}">{{item.report_missing ? '缺少' : item.report_count + ' 个'}}</text>
</view>
</view>
</view>
<view wx:if="{{loadingMore}}" class="hint">加载更多…</view>
<view wx:elif="{{rows.length && !hasMore}}" class="hint">没有更多了</view>
<view wx:else class="hint">点行可改成本价 / 可用数量 · 点报告列看该批次报告</view>
</view>
<!-- 弹层必须 root-portal:首页 .home-*-embed 的 transform 会困住 position:fixed,
弹层会跟着页面滚动、也盖不住底部 tab 栏。
每个弹层单独一个 root-portal(单子节点)——一个 portal 塞多个弹层会让 portal 不生效,
与加工 / 分拣面板同款做法。 -->
<!-- 批量上传报告:上传 → 识别 → 匹配 → 确认 -->
<root-portal enable="{{true}}">
<view wx:if="{{uploadOpen}}" class="sheet-mask" catchtouchmove="noop" bindtap="closeUploadSheet">
<view class="sheet" catchtap="noop">
<view class="sheet-head">
<view class="sheet-head-text">
<view class="sheet-title">批量上传报告</view>
</view>
<view class="sheet-close" catchtap="closeUploadSheet">×</view>
</view>
<scroll-view scroll-y class="sheet-body" show-scrollbar="{{false}}">
<view class="upload-files">
<view wx:for="{{uploadFiles}}" wx:key="path" class="upload-file">
<text class="upload-file-name">{{item.name}}</text>
<text class="upload-file-del" catchtap="removeUploadFile" data-index="{{index}}">×</text>
</view>
<view class="upload-chip" catchtap="pickUploadFiles">{{uploadFiles.length ? '继续添加' : '选择文件'}}</view>
</view>
<view class="upload-primary {{uploadParsing ? 'is-disabled' : ''}}" catchtap="parseUploadFiles">{{uploadParsing ? (uploadText || '识别中…') : '上传并识别'}}</view>
<view wx:for="{{uploadReports}}" wx:key="id" wx:for-item="report" class="match-group">
<view class="match-title">{{report.title}}{{report.report_no ? ' · ' + report.report_no : ''}}</view>
<view wx:for="{{report.matches}}" wx:key="product_name" wx:for-item="match" class="match-item">
<view class="match-product">
<text class="match-name">{{match.product_name || '未识别商品名'}}</text>
<text class="match-status {{match.status === 'none' ? 'is-missing' : ''}}">{{match.status_text}}</text>
</view>
<view wx:for="{{match.candidates}}" wx:key="key" wx:for-item="can" class="match-candidate {{can.selected ? 'is-on' : ''}}" catchtap="toggleUploadCandidate" data-key="{{can.key}}">
<view class="check {{can.selected ? 'is-on' : ''}}"></view>
<view class="match-candidate-text">
<text class="match-candidate-label">{{can.label}}</text>
<text class="match-candidate-meta">{{can.meta}}</text>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="sheet-actions">
<view class="btn ghost" catchtap="closeUploadSheet">取消</view>
<view class="btn primary {{uploadConfirming || !uploadSelectedCount ? 'is-disabled' : ''}}" catchtap="confirmUploadMatches">{{uploadConfirming ? '确认中…' : '确认匹配(' + uploadSelectedCount + ')'}}</view>
</view>
</view>
</view>
</root-portal>
<!-- 修改弹窗:点行直接弹,可用数量 / 成本价一次改完 + 报告入口 -->
<root-portal enable="{{true}}">
<view wx:if="{{editItem}}" class="sheet-mask is-center" catchtouchmove="noop" bindtap="closeEdit">
<view class="sheet is-center" catchtap="noop">
<view class="sheet-head">
<view class="sheet-head-text">
<view class="sheet-title">{{editItem.sku_name}}</view>
<view class="sheet-sub">{{editItem.batch_no}}{{editItem.category_name ? ' · ' + editItem.category_name : ''}}{{editItem.storage_zone ? ' · 区域 ' + editItem.storage_zone : ''}}</view>
</view>
<view class="sheet-close" catchtap="closeEdit">×</view>
</view>
<view class="sheet-body">
<view class="sheet-field">
<text class="sheet-label">可用数量(本批次)</text>
<input class="sheet-input" type="digit" value="{{editAvailable}}" bindinput="onEditAvailableInput" />
</view>
<view class="sheet-field">
<text class="sheet-label">成本价(本批次)</text>
<input class="sheet-input" type="digit" value="{{editCost}}" bindinput="onEditCostInput" />
</view>
<view class="sheet-link">
<view class="sheet-link-main" catchtap="openReportsFromEdit">
<text class="sheet-link-label">批次报告</text>
<text class="sheet-link-value {{editItem.report_missing ? 'is-missing' : 'is-ok'}}">{{editItem.report_missing ? '缺少' : editItem.report_count + ' 个'}} ›</text>
</view>
<view class="upload-chip {{uploading ? 'is-disabled' : ''}}" catchtap="onUploadFromEdit">{{uploading ? '上传中…' : '上传'}}</view>
</view>
</view>
<view class="sheet-actions">
<view class="btn ghost" catchtap="closeEdit">取消</view>
<view class="btn primary {{editSaving ? 'is-disabled' : ''}}" catchtap="submitEditSheet">{{editSaving ? '保存中…' : '保存'}}</view>
</view>
</view>
</view>
</root-portal>
<!-- 批次报告列表 -->
<root-portal enable="{{true}}">
<view wx:if="{{reportItem}}" class="sheet-mask" catchtouchmove="noop" bindtap="closeReports">
<view class="sheet" catchtap="noop">
<view class="sheet-head">
<view class="sheet-head-text">
<view class="sheet-title">批次报告</view>
<view class="sheet-sub">{{reportItem.sku_name}} · {{reportItem.batch_no}}</view>
</view>
<view class="sheet-close" catchtap="closeReports">×</view>
</view>
<view class="report-toolbar">
<text class="report-toolbar-hint">本批次报告</text>
<view class="upload-chip {{uploading ? 'is-disabled' : ''}}" catchtap="onUploadFromReports">{{uploading ? '上传中…' : '上传报告'}}</view>
</view>
<scroll-view scroll-y class="sheet-body" show-scrollbar="{{false}}">
<view wx:if="{{reportsLoading}}" class="sheet-empty">加载中…</view>
<view wx:elif="{{!reports.length}}" class="sheet-empty">该批次还没有报告</view>
<view wx:else class="report-list">
<view wx:for="{{reports}}" wx:key="id" class="report-row">
<view class="report-info">
<text class="report-type">{{item.type_label}}</text>
<text class="report-meta">{{item.report_no ? item.report_no + ' · ' : ''}}{{item.uploaded_at}}</text>
</view>
<text class="report-delete" catchtap="onDeleteReport" data-id="{{item.id}}">删除</text>
</view>
</view>
</scroll-view>
<view class="sheet-actions">
<view class="btn ghost" catchtap="closeReports">关闭</view>
</view>
</view>
</view>
</root-portal>