Files
SupplierSystem/miniprogram/components/inspection-panel/index.wxml
T
雨天 2f439026d3
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(验收): 入库补存放区域,默认取上次区域
Web 验收弹窗与小程序验收面板新增「存放区域」,随批次写入 inventory.storage_zone;独立进货走同一段 INSERT 一并覆盖。

默认值 = 该商品上次入库区域(同 SKU 最近一批非空区域):后端列表接口带 last_storage_zone,只拼在带 LIMIT 的列表查询上,不并入计数类查询。

区域为自由文本、无独立表:Web 复用 /inventory/storage-zones 候选 + 输入即新增;小程序原生 picker + 末尾「+ 新增区域」。不新增前端文案。称重台/Android 不做。

测试:server/tests/inspectionStorageZone.test.ts(8 例)、src/utils/inspectionStorageZone.contract.test.ts(13 例);npm run typecheck 通过;last_zone 片段已对本地库实跑。
2026-10-13 16:26:17 +08:00

208 lines
8.1 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.
<template name="inboundCard">
<view class="xd-row-card {{item.input_rating === '不合格' ? 'xd-row-card--danger' : ''}}">
<view class="card-r1">
<view
class="btn-return {{submittingId === item.id ? 'is-disabled' : ''}}"
data-id="{{item.id}}"
bindtap="markFailThenSubmit"
>退回</view>
<view class="card-title-wrap">
<text class="task-title">{{item.item_name || '未知商品'}}</text>
<text class="photo-hint {{item.photoRequired ? 'need' : 'skip'}}">{{item.photoRequired ? '须拍照' : '免拍照'}}</text>
<text wx:if="{{item.independent_inbound}}" class="photo-hint independent">独立入库</text>
<text class="task-meta">{{item.prepare_qty || 0}}{{item.unit || ''}}</text>
</view>
<view
class="btn-pass {{submittingId === item.id ? 'is-disabled' : ''}}"
data-id="{{item.id}}"
bindtap="submitPassInspection"
>确认入库</view>
</view>
<view class="card-r2">
<view class="r2-photo">
<view wx:if="{{item.photoUrls.length}}" class="photo-grid">
<view
wx:for="{{item.photoUrls}}"
wx:for-item="photoUrl"
wx:for-index="photoIndex"
wx:key="*this"
class="photo-thumb-wrap"
>
<image
class="photo-thumb"
src="{{photoUrl}}"
mode="aspectFit"
data-url="{{photoUrl}}"
bindtap="previewPhoto"
/>
<view
class="photo-del"
catchtap="deletePhoto"
data-id="{{item.id}}"
data-index="{{photoIndex}}"
>×</view>
</view>
</view>
<view class="btn-photo" data-id="{{item.id}}" bindtap="choosePhoto">拍照</view>
<view
wx:if="{{item.photoRequired && (analyzingId === item.id || item.aiDone)}}"
class="ai-verdict {{analyzingId === item.id ? 'pending' : (item.aiSource === 'vision_unavailable' ? 'warn' : (item.input_rating === '不合格' ? 'fail' : 'ok'))}}"
>
<text wx:if="{{analyzingId === item.id}}">分析中</text>
<text wx:elif="{{item.aiSource === 'vision_unavailable'}}">人工</text>
<text wx:else>{{item.input_rating === '不合格' ? '不合格' : '合格'}}</text>
</view>
</view>
<view class="r2-field">
<input
class="qty-input"
type="digit"
value="{{item.input_qty}}"
data-id="{{item.id}}"
bindinput="onQtyInput"
placeholder="实收"
/>
</view>
<picker
class="r2-field r2-picker"
mode="selector"
range="{{resultOptions}}"
value="{{item.input_rating === '不合格' ? 1 : 0}}"
data-id="{{item.id}}"
bindchange="onRatingChange"
>
<view class="rate-pick">{{item.input_rating || '合格'}}</view>
</picker>
<picker
wx:if="{{item.requires_prepackaged_check}}"
class="r2-picker"
mode="date"
fields="month"
value="{{item.production_month}}"
data-id="{{item.id}}"
bindchange="onProductionMonthChange"
>
<view class="rate-pick">{{item.production_month || '产月'}}</view>
</picker>
<picker
class="r2-picker"
mode="selector"
range="{{zoneRange}}"
value="{{item.zoneIndex}}"
data-id="{{item.id}}"
bindchange="onZoneChange"
>
<view class="rate-pick {{item.storage_zone ? '' : 'is-empty'}}">{{item.storage_zone || '区域'}}</view>
</picker>
</view>
</view>
</template>
<view class="page inspection-page {{embedded ? 'is-embedded' : ''}}">
<view wx:if="{{!hideProgress}}" class="kpi-card">
<view class="kpi-cell">
<view class="kpi-num xd-num">{{pendingCount}}</view>
<view class="kpi-label">待入库</view>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<view class="kpi-num xd-num">{{doneCount}}</view>
<view class="kpi-label">本批条数</view>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<view class="kpi-num xd-num">{{photoRequiredCount}}</view>
<view class="kpi-label">须拍照</view>
</view>
</view>
<view wx:if="{{!embedded}}" class="filter-pills">
<view
wx:for="{{sourceOptions}}"
wx:key="*this"
class="filter-pill {{sourceIndex === index ? 'on' : ''}}"
data-index="{{index}}"
bindtap="onSourcePillTap"
>{{item}}</view>
</view>
<view class="list-sheet">
<view class="batch-row">
<view class="batch-btn-wrap">
<button class="xd-btn-primary batch-btn" size="mini" bindtap="submitAllEligible" loading="{{batchSubmitting}}" disabled="{{batchSubmitting}}">
一键全部合格入库
</button>
</view>
<view wx:if="{{categoryChips.length}}" class="cat-grid">
<view
wx:for="{{categoryChips}}"
wx:key="name"
class="cat-cell {{categoryFilter === item.name ? 'is-active' : ''}}"
data-name="{{item.name}}"
bindtap="onCategoryTap"
>
<view class="cat-cell-name">{{item.name}}</view>
<view class="cat-cell-count">{{item.count}}</view>
</view>
</view>
</view>
<view class="date-axis">
<picker
mode="selector"
range="{{dateFieldOptions}}"
range-key="label"
value="{{dateFieldIndex}}"
bindchange="onDateFieldPick"
>
<view class="date-chip axis-pick">{{dateFieldLabel}} ▾</view>
</picker>
<picker mode="date" value="{{dateFrom || todayValue}}" bindchange="onCustomFromChange">
<view class="date-chip date-pick {{dateFrom ? 'on' : ''}}">{{dateFrom || '起始日'}} ▾</view>
</picker>
<picker mode="date" value="{{dateTo || dateFrom || todayValue}}" bindchange="onCustomToChange">
<view class="date-chip date-pick {{dateTo ? 'on' : ''}}">{{dateTo || '结束日'}} ▾</view>
</picker>
</view>
<view wx:if="{{error}}" class="text-error">{{error}}</view>
<view wx:if="{{loading}}" class="text-muted">加载中...</view>
<view wx:if="{{!loading && visibleRows.length === 0}}" class="text-muted empty">{{categoryFilter ? '该分类暂无待入库任务' : '当前类型暂无待入库任务'}}</view>
<block wx:if="{{!loading && visibleRows.length && foldSameSku}}">
<block wx:for="{{dayCategoryGroups}}" wx:key="groupKey" wx:for-item="group">
<view wx:if="{{group.showDayHeader}}" class="today-day-head">{{group.dayLabel}}</view>
<view wx:for="{{group.skuGroups}}" wx:key="key" wx:for-item="skuGroup" class="sku-group">
<view
wx:if="{{skuGroup.multi}}"
class="sku-group-head {{skuGroup.collapsed ? 'is-collapsed' : ''}}"
data-key="{{skuGroup.key}}"
bindtap="toggleSkuGroup"
>
<view class="sku-group-main">
<view class="sku-group-title">{{skuGroup.name}}</view>
<view class="sku-group-meta">
{{skuGroup.count}}单 · 应收 {{skuGroup.prepareSumText}}{{skuGroup.unit}} · 已填 {{skuGroup.actualSumText}}{{skuGroup.unit}}
</view>
</view>
<view class="sku-group-chevron">{{skuGroup.collapsed ? '展开' : '收起'}}</view>
</view>
<block wx:if="{{!skuGroup.multi || !skuGroup.collapsed}}">
<block wx:for="{{skuGroup.items}}" wx:for-item="item" wx:key="id">
<template is="inboundCard" data="{{item, submittingId, analyzingId, resultOptions, zoneRange}}" />
</block>
</block>
</view>
</block>
</block>
<block wx:elif="{{!loading && visibleRows.length}}">
<block wx:for="{{dayCategoryGroups}}" wx:key="groupKey" wx:for-item="group">
<view wx:if="{{group.showDayHeader}}" class="today-day-head">{{group.dayLabel}}</view>
<block wx:for="{{group.items}}" wx:key="id" wx:for-item="item">
<template is="inboundCard" data="{{item, submittingId, analyzingId, resultOptions, zoneRange}}" />
</block>
</block>
</block>
</view>
</view>