Files
SupplierSystem/miniprogram/pages/home/home.wxml
T
雨天 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

453 lines
18 KiB
Plaintext

<view class="home-page xd-page-pad {{needLogin ? 'home-page--guest' : ''}}">
<view class="home-atmosphere" aria-hidden="true"></view>
<view
wx:if="{{!needLogin && (kpiVisible || showPurchaseProgress || showPreparationProgress || showOrderProgress || showAdminPrepProgress || showPrepAmendProgress || showInspectionProgress || showProcessingProgress || showPickingProgress || showDeliveryProgress || showWarehouseStats || showModuleTitleBar || gridModules.length)}}"
id="homeTopDock"
class="home-progress-sticky"
>
<view
wx:if="{{kpiVisible || showPurchaseProgress || showPreparationProgress || showOrderProgress || showAdminPrepProgress || showPrepAmendProgress || showInspectionProgress || showProcessingProgress || showPickingProgress || showDeliveryProgress || showWarehouseStats || showModuleTitleBar}}"
class="home-progress-dock xd-home-topbar"
>
<!-- 非采购内嵌:保留原首页 KPI(如供应商待供货 / 管理员改价待审) -->
<view wx:if="{{kpiVisible}}" class="kpi-card">
<view class="kpi-main">
<view class="kpi-label">{{kpiMainLabel}}</view>
<view class="kpi-value-row">
<text class="kpi-value xd-num">{{kpiMainValue}}</text>
<text class="kpi-unit">{{kpiMainUnit}}</text>
</view>
</view>
<view class="kpi-side">
<view wx:if="{{kpiSide1Label}}" class="kpi-side-item">
<text class="kpi-side-label">{{kpiSide1Label}}</text>
<text class="kpi-side-value xd-num">{{kpiSide1Value}}</text>
</view>
<view wx:if="{{kpiSide2Label}}" class="kpi-side-item">
<text class="kpi-side-label">{{kpiSide2Label}}</text>
<text class="kpi-side-value xd-num">{{kpiSide2Value}}</text>
</view>
</view>
</view>
<!-- 自采列表模块才显示采购进度 -->
<view wx:if="{{showPurchaseProgress}}" class="purchase-progress-card">
<view class="kpi-left">
<text class="kpi-label">采购进度</text>
<text class="kpi-date">{{purchaseHeroDate || '今天'}}</text>
</view>
<view class="kpi-right">
<text class="kpi-label">已完成</text>
<text class="kpi-progress xd-num">{{purchaseCompletedCount}} / {{purchaseTotalCount}}</text>
</view>
</view>
<!-- 供应商:供货录入模块才显示供货进度(与采购进度互斥,管理员并集时不得叠两条) -->
<view wx:if="{{showPreparationProgress}}" class="purchase-progress-card prep-progress-card">
<view class="prep-progress-main">
<view class="kpi-left">
<text class="kpi-label">供货进度</text>
<text class="kpi-date">{{prepHeroDate || '今天'}}</text>
</view>
<view class="kpi-right">
<text class="kpi-label">已完成</text>
<text class="kpi-progress xd-num">{{prepCompletedCount}} / {{prepTotalCount}}</text>
</view>
</view>
<view wx:if="{{supplierCategoryLabels.length}}" class="prep-category-row">
<view
wx:for="{{supplierCategoryLabels}}"
wx:key="name"
class="prep-category-pill {{item.primary ? 'is-primary' : ''}}"
>{{item.name}}</view>
</view>
</view>
<!-- 仓库管理:库存批次 / 可用总量 / 可用货值(文字在上、数字在下) -->
<view wx:if="{{showWarehouseStats}}" class="delivery-progress-card warehouse-stats-card">
<view class="kpi-cell">
<text class="kpi-label">库存批次</text>
<text class="kpi-num xd-num">{{warehouseBatchCount}}</text>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<text class="kpi-label">可用总量</text>
<text class="kpi-num xd-num">{{warehouseAvailableQtyText}}</text>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<text class="kpi-label">可用货值</text>
<text class="kpi-num xd-num">¥{{warehouseAvailableValueText}}</text>
</view>
</view>
<view wx:if="{{showModuleTitleBar}}" class="delivery-progress-card module-title-card">
<text class="module-title-text">{{homeModuleTitle}}</text>
</view>
<view wx:if="{{showPrepAmendProgress}}" class="delivery-progress-card order-progress-card">
<view
class="kpi-cell {{prepAmendStatusGroup === 'pending' ? 'is-selected' : ''}}"
data-value="pending"
bindtap="onPrepAmendStatusTap"
>
<text class="kpi-num xd-num">{{prepAmendPendingCount}}</text>
<text class="kpi-label">待审</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell {{prepAmendStatusGroup === 'reviewed' ? 'is-selected' : ''}}"
data-value="reviewed"
bindtap="onPrepAmendStatusTap"
>
<text class="kpi-num xd-num">{{prepAmendReviewedTodayCount}}</text>
<text class="kpi-label">已审</text>
</view>
</view>
<!-- 管理员/运营:订单列表进度置顶(身兼仓管/分拣时不再叠入库、分拣条) -->
<view wx:if="{{showOrderProgress}}" class="delivery-progress-card order-progress-card">
<view
class="kpi-cell {{orderStatusGroup === 'pending' ? 'is-selected' : ''}}"
data-value="pending"
bindtap="onOrderStatusTap"
>
<text class="kpi-num xd-num">{{orderPendingCount}}</text>
<text class="kpi-label">待处理</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell {{orderStatusGroup === 'processing' ? 'is-selected' : ''}}"
data-value="processing"
bindtap="onOrderStatusTap"
>
<text class="kpi-num xd-num">{{orderProcessingCount}}</text>
<text class="kpi-label">履约中</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell {{orderStatusGroup === 'completed' ? 'is-selected' : ''}}"
data-value="completed"
bindtap="onOrderStatusTap"
>
<text class="kpi-num xd-num">{{orderCompletedCount}}</text>
<text class="kpi-label">已完成</text>
</view>
</view>
<view wx:if="{{showAdminPrepProgress}}" class="delivery-progress-card order-progress-card">
<view
class="kpi-cell {{adminPrepStatusFilter === '10' ? 'is-selected' : ''}}"
data-value="10"
bindtap="onAdminPrepStatusTap"
>
<text class="kpi-num xd-num">{{adminPrepPendingCount}}</text>
<text class="kpi-label">待备货</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell {{adminPrepStatusFilter === '20' ? 'is-selected' : ''}}"
data-value="20"
bindtap="onAdminPrepStatusTap"
>
<text class="kpi-num xd-num">{{adminPrepPreparingCount}}</text>
<text class="kpi-label">备货中</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell {{adminPrepStatusFilter === '30' ? 'is-selected' : ''}}"
data-value="30"
bindtap="onAdminPrepStatusTap"
>
<text class="kpi-num xd-num">{{adminPrepCompletedCount}}</text>
<text class="kpi-label">已完成</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell {{adminPrepStatusFilter === '40' ? 'is-selected' : ''}}"
data-value="40"
bindtap="onAdminPrepStatusTap"
>
<text class="kpi-num xd-num">{{adminPrepExceptionCount}}</text>
<text class="kpi-label">异常</text>
</view>
</view>
<!-- 仓管/检验员:订单入库来源筛选置顶 -->
<view wx:if="{{showInspectionProgress}}" class="delivery-progress-card order-progress-card">
<view
class="kpi-cell kpi-cell--text {{inspectionSourceFilter === 'all' ? 'is-selected' : ''}}"
data-value="all"
bindtap="onInspectionSourceTap"
>
<text class="kpi-label">全部入库</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell kpi-cell--text {{inspectionSourceFilter === 'supplier' ? 'is-selected' : ''}}"
data-value="supplier"
bindtap="onInspectionSourceTap"
>
<text class="kpi-label">供应商入库</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell kpi-cell--text {{inspectionSourceFilter === 'purchase' ? 'is-selected' : ''}}"
data-value="purchase"
bindtap="onInspectionSourceTap"
>
<text class="kpi-label">自采入库</text>
</view>
</view>
<view wx:if="{{showProcessingProgress}}" class="delivery-progress-card order-progress-card">
<view
class="kpi-cell kpi-cell--text {{processingTabFilter === 'work' ? 'is-selected' : ''}}"
data-value="work"
bindtap="onProcessingTabTap"
>
<text class="kpi-label">加工作业</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell kpi-cell--text {{processingTabFilter === 'inspect' ? 'is-selected' : ''}}"
data-value="inspect"
bindtap="onProcessingTabTap"
>
<text class="kpi-label">加工验收</text>
</view>
<view class="kpi-divider"></view>
<view
class="kpi-cell kpi-cell--text {{processingTabFilter === 'done' ? 'is-selected' : ''}}"
data-value="done"
bindtap="onProcessingTabTap"
>
<text class="kpi-label">加工历史</text>
</view>
</view>
<!-- 分拣员:分拣进度置顶(切换模块时也常显) -->
<view wx:if="{{showPickingProgress}}" class="delivery-progress-card">
<view class="kpi-cell">
<text class="kpi-num xd-num">{{pickingTaskCount}}</text>
<text class="kpi-label">我的任务</text>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<text class="kpi-num xd-num">{{pickingPickedCount}}</text>
<text class="kpi-label">已确认</text>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<text class="kpi-num xd-num">{{pickingPendingCount}}</text>
<text class="kpi-label">待分拣</text>
</view>
</view>
<!-- 配送员:仅配送任务模块显示配送进度 -->
<view wx:if="{{showDeliveryProgress}}" class="delivery-progress-card">
<view class="kpi-cell">
<text class="kpi-num xd-num">{{deliveryTaskCount}}</text>
<text class="kpi-label">{{deliveryTaskLabel}}</text>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<text class="kpi-num xd-num">{{deliveryDeliveringCount}}</text>
<text class="kpi-label">配送中</text>
</view>
<view class="kpi-divider"></view>
<view class="kpi-cell">
<text class="kpi-num xd-num">{{deliveryCompletedCount}}</text>
<text class="kpi-label">已完成</text>
</view>
</view>
</view>
<view
wx:if="{{gridModules.length}}"
class="home-module-dock"
>
<view
class="module-grid"
style="--xd-module-grid-size: {{moduleGridSize}}; --xd-module-grid-gap: {{moduleGridGap}}; --xd-module-grid-pad: {{moduleGridPad}}; padding-left: {{moduleGridSide}}; padding-right: {{moduleGridSide}};"
>
<view
wx:for="{{gridModules}}"
wx:key="id"
class="grid-card {{item.isActive ? 'is-active' : ''}}"
data-id="{{item.id}}"
data-page="{{item.page}}"
bindtap="onModuleTap"
>
<view
wx:if="{{item.badge > 0}}"
class="menu-badge grid-badge"
>{{item.badge > 99 ? '99+' : item.badge}}</view>
<view class="grid-title xd-module-grid-title">{{item.title}}</view>
</view>
</view>
</view>
</view>
<view
wx:if="{{!needLogin && (kpiVisible || showPurchaseProgress || showPreparationProgress || showOrderProgress || showAdminPrepProgress || showPrepAmendProgress || showInspectionProgress || showProcessingProgress || showPickingProgress || showDeliveryProgress || showWarehouseStats || showModuleTitleBar || gridModules.length)}}"
class="home-top-dock-spacer"
style="height: {{homeTopDockHeightPx}}px;"
/>
<view
wx:if="{{!needLogin && showHomeWorkspace}}"
class="home-purchase-embed anim-rise anim-rise--delay-2"
style="--xd-module-grid-side: {{moduleGridSide}};"
>
<purchase-today-panel
wx:if="{{activeHomeModuleId === 'purchase'}}"
id="purchaseHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
permissions="{{permissions}}"
isSuperAdmin="{{isSuperAdmin}}"
bind:progresschange="onPurchaseProgressChange"
bind:badgechange="onPurchaseBadgeChange"
/>
<prep-amend-panel
wx:if="{{activeHomeModuleId === 'prep-amend-review'}}"
id="prepAmendHomePanel"
embedded="{{true}}"
homeStatusGroup="{{prepAmendStatusGroup}}"
bind:progresschange="onPrepAmendProgressChange"
bind:badgechange="onPrepAmendBadgeChange"
/>
<supplier-status-panel
wx:if="{{activeHomeModuleId === 'supplier-status'}}"
embedded="{{true}}"
/>
<product-trace-panel
wx:if="{{activeHomeModuleId === 'product-trace'}}"
embedded="{{true}}"
style="--xd-module-grid-side: {{moduleGridSide}};"
/>
<cost-management-panel
wx:if="{{activeHomeModuleId === 'cost-management'}}"
/>
<delivery-panel
wx:if="{{activeHomeModuleId === 'delivery'}}"
id="deliveryHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
bind:progresschange="onDeliveryProgressChange"
bind:badgechange="onDeliveryBadgeChange"
/>
<preparation-panel
wx:if="{{activeHomeModuleId === 'preparation'}}"
id="preparationHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
initialTab="active"
bind:progresschange="onPreparationProgressChange"
bind:badgechange="onPreparationBadgeChange"
/>
<preparation-panel
wx:if="{{activeHomeModuleId === 'prep-history'}}"
id="prepHistoryHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
initialTab="archived"
/>
<preparation-panel
wx:if="{{activeHomeModuleId === 'prep-price-amend'}}"
id="prepPriceAmendHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
initialTab="price_amend"
bind:badgechange="onPrepPriceAmendBadgeChange"
/>
<bid-panel
wx:if="{{activeHomeModuleId === 'bid'}}"
id="bidHomePanel"
embedded="{{true}}"
bind:badgechange="onBidBadgeChange"
/>
<quality-reports-panel
wx:if="{{activeHomeModuleId === 'quality-reports'}}"
id="qualityReportsHomePanel"
embedded="{{true}}"
bind:badgechange="onQualityReportsBadgeChange"
/>
<inspection-panel
wx:if="{{activeHomeModuleId === 'inspection'}}"
id="inspectionHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
homeSourceFilter="{{inspectionSourceFilter}}"
bind:progresschange="onInspectionProgressChange"
bind:badgechange="onInspectionBadgeChange"
/>
<stock-inbound-panel
wx:if="{{activeHomeModuleId === 'stock-inbound'}}"
id="stockInboundHomePanel"
embedded="{{true}}"
/>
<processing-panel
wx:if="{{activeHomeModuleId === 'processing'}}"
id="processingHomePanel"
embedded="{{true}}"
homeTabFilter="{{processingTabFilter}}"
bind:badgechange="onProcessingBadgeChange"
bind:tabchange="onProcessingTabChange"
/>
<warehouse-panel
wx:if="{{activeHomeModuleId === 'warehouse'}}"
id="warehouseHomePanel"
embedded="{{true}}"
bind:statschange="onWarehouseStatsChange"
/>
<picking-panel
wx:if="{{activeHomeModuleId === 'picking'}}"
id="pickingHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
bind:progresschange="onPickingProgressChange"
bind:badgechange="onPickingBadgeChange"
/>
<order-manage-panel
wx:if="{{activeHomeModuleId === 'order-manage'}}"
id="orderManageHomePanel"
embedded="{{true}}"
homeStatusGroup="{{orderStatusGroup}}"
bind:progresschange="onOrderProgressChange"
bind:badgechange="onOrderManageBadgeChange"
/>
<admin-preparations-panel
wx:if="{{activeHomeModuleId === 'admin-preparations'}}"
id="adminPreparationsHomePanel"
embedded="{{true}}"
homeStatusFilter="{{adminPrepStatusFilter}}"
bind:progresschange="onAdminPrepProgressChange"
bind:badgechange="onAdminPrepBadgeChange"
/>
<purchase-today-panel
wx:if="{{activeHomeModuleId === 'admin-purchase'}}"
id="adminPurchaseHomePanel"
embedded="{{true}}"
hideProgress="{{true}}"
listScope="all"
permissions="{{permissions}}"
isSuperAdmin="{{isSuperAdmin}}"
bind:progresschange="onPurchaseProgressChange"
bind:badgechange="onPurchaseBadgeChange"
/>
<order-entry-panel
wx:if="{{activeHomeModuleId === 'order-entry'}}"
id="orderEntryHomePanel"
embedded="{{true}}"
/>
</view>
<view wx:if="{{needLogin}}" class="login-cta">
<van-empty custom-class="login-empty" description="请登录使用工作台" />
<van-button
type="primary"
color="#059669"
round
block
custom-class="login-cta-btn"
bind:click="goLogin"
>
去登录
</van-button>
</view>
<app-tab-bar wx:if="{{!needLogin}}" active="home" />
</view>