feat: 补货页重构 + 蓝牙秤主动读轮询 + 版本升级至 1.0.139
- 分拣缺货补货页(replenishShorts)整体重构 - 头部布局重排,货主/商品名称字段对调 - 搜索框改用 u-search,新增"搜索"按钮 - 货主抽屉改为底部弹窗(round 圆角),选中项换图标 - 底部翻页改用 pagination 组件 - 状态标签新增蓝色填充样式(primary-fill) - 全局字号、间距等样式优化 - 蓝牙电子秤(bluetoothScale)新增主动读轮询 - 发现可读特征值(readables)并随设备保存 - 连接后无 notify 推送时,周期 read 获取重量 - 解析时区分 read 与 notify 数据来源,共用解析路径 - 断开连接时清理轮询定时器 - 首页快捷操作(edit-quick-actions)图标名校验 - 非法图标名统一回退为 grid - 头部标题等字号调整 - 分页组件(pagination)总数样式优化,数字蓝色加粗 - 版本号 1.0.137 → 1.0.139 (manifest + package)
This commit is contained in:
parent
a5cedd525f
commit
422231132e
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wms-pda",
|
||||
"version": "1.0.137",
|
||||
"version": "1.0.139",
|
||||
"private": true,
|
||||
"description": "天豹云仓 WMS_PDA(uni-app Vue2 + @vue/cli 4.5)",
|
||||
"scripts": {
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
<!-- 总数显示(可选) -->
|
||||
<view v-if="showTotal" class="total-info">
|
||||
总数:{{ total }}
|
||||
总数:<text class="total-info__num">{{ total }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -219,7 +219,14 @@ export default {
|
||||
.total-info {
|
||||
margin-left: 40rpx;
|
||||
color: #909399;
|
||||
font-size: 30rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.total-info__num {
|
||||
margin-left: 4rpx;
|
||||
color: #2979ff;
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -153,6 +153,11 @@ let discoveredDeviceIds = new Set();
|
||||
let dataWatchdogTimer = null;
|
||||
let lastConnectedAt = 0;
|
||||
let watchdogRetries = 0;
|
||||
// 读轮询兜底:部分电子秤不主动 notify(或 notify 特征无 CCCD 描述符),只能主动 read 取重量;
|
||||
// read 结果同样由 onBLECharacteristicValueChange 回调上报,复用 parseIncoming 解析
|
||||
let readPollDelayTimer = null;
|
||||
let readPollTimer = null;
|
||||
let readPolling = false;
|
||||
|
||||
const SCAN_TIMEOUT_MS = 12000;
|
||||
|
||||
@ -184,6 +189,22 @@ function clearDataWatchdog() {
|
||||
}
|
||||
}
|
||||
|
||||
function clearReadPollDelay() {
|
||||
if (readPollDelayTimer) {
|
||||
clearTimeout(readPollDelayTimer);
|
||||
readPollDelayTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function clearReadPoll() {
|
||||
clearReadPollDelay();
|
||||
if (readPollTimer) {
|
||||
clearInterval(readPollTimer);
|
||||
readPollTimer = null;
|
||||
}
|
||||
readPolling = false;
|
||||
}
|
||||
|
||||
// 连接成功后启动看门狗:若 3 秒内未收到任何数据,说明通知订阅未生效(安卓 GATT 缓存等),强制重连一次
|
||||
function startDataWatchdog(commit, state, dispatch) {
|
||||
clearDataWatchdog();
|
||||
@ -202,6 +223,43 @@ function startDataWatchdog(commit, state, dispatch) {
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// 连接成功后短暂等待仍无推送数据时,启动读轮询:周期读取所有可读特征,
|
||||
// read 返回值经 onBLECharacteristicValueChange → parseIncoming 解析(与 notify 共用同一条解析路径)
|
||||
function startReadPolling(deviceId, readables, commit, state) {
|
||||
clearReadPoll();
|
||||
if (!readables || !readables.length) return;
|
||||
readPolling = true;
|
||||
// 先等 1500ms:若期间 notify 已推送数据,parseIncoming 会 clearReadPoll,不再启动轮询
|
||||
readPollDelayTimer = setTimeout(() => {
|
||||
if (!state.currentDevice || state.currentDevice.id !== deviceId) return;
|
||||
if (state.connectionStatus !== 'connected') return;
|
||||
if (state.lastDataTime && state.lastDataTime >= lastConnectedAt) return; // 已有数据,无需轮询
|
||||
commit('ADD_LOG', { type: 'info', message: '未收到推送数据,启动读轮询获取重量...' });
|
||||
let readInFlight = false;
|
||||
const tick = () => {
|
||||
if (readInFlight) return;
|
||||
if (!state.currentDevice || state.currentDevice.id !== deviceId) return;
|
||||
if (state.connectionStatus !== 'connected') return;
|
||||
readInFlight = true;
|
||||
let pending = readables.length;
|
||||
const onComplete = () => {
|
||||
pending -= 1;
|
||||
if (pending <= 0) readInFlight = false;
|
||||
};
|
||||
readables.forEach(ch => {
|
||||
uni.readBLECharacteristicValue({
|
||||
deviceId,
|
||||
serviceId: ch.serviceId,
|
||||
characteristicId: ch.characteristicId,
|
||||
complete: onComplete
|
||||
});
|
||||
});
|
||||
};
|
||||
tick();
|
||||
readPollTimer = setInterval(tick, 400);
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
// ---------------- 模块定义 ----------------
|
||||
|
||||
const state = () => ({
|
||||
@ -355,6 +413,18 @@ function parseIncoming(commit, state, res) {
|
||||
commit('RAW_DATA', { text, hex, time: Date.now() });
|
||||
// 收到任意数据即说明通知订阅生效,清除“已连接但无数据”看门狗
|
||||
clearDataWatchdog();
|
||||
// 数据来源判定:来自可读特征(主动 read 返回)则保持读轮询继续;来自 notify 推送则停止读轮询
|
||||
const fromReadable =
|
||||
state.currentDevice &&
|
||||
Array.isArray(state.currentDevice.readables) &&
|
||||
state.currentDevice.readables.some(
|
||||
ch => String(ch.characteristicId || '').toUpperCase() === String(res.characteristicId || '').toUpperCase()
|
||||
);
|
||||
if (fromReadable) {
|
||||
clearReadPollDelay();
|
||||
} else {
|
||||
clearReadPoll();
|
||||
}
|
||||
watchdogRetries = 0;
|
||||
|
||||
const parsed = parseWeight(text);
|
||||
@ -380,9 +450,10 @@ function shortUuid(uuid) {
|
||||
async function discoverNotifyCharacteristics(deviceId, commit) {
|
||||
const [srvErr, srvRes] = await uni.getBLEDeviceServices({ deviceId });
|
||||
if (srvErr || !srvRes || !srvRes.services || !srvRes.services.length) {
|
||||
return { characteristics: [], error: new Error('未发现设备服务') };
|
||||
return { characteristics: [], readables: [], error: new Error('未发现设备服务') };
|
||||
}
|
||||
const characteristics = [];
|
||||
const readables = [];
|
||||
for (const service of srvRes.services) {
|
||||
const [chErr, chRes] = await uni.getBLEDeviceCharacteristics({
|
||||
deviceId,
|
||||
@ -401,9 +472,12 @@ async function discoverNotifyCharacteristics(deviceId, commit) {
|
||||
if (props.notify || props.indicate) {
|
||||
characteristics.push({ serviceId: service.uuid, characteristicId: ch.uuid });
|
||||
}
|
||||
if (props.read) {
|
||||
readables.push({ serviceId: service.uuid, characteristicId: ch.uuid });
|
||||
}
|
||||
}
|
||||
}
|
||||
return { characteristics, error: null };
|
||||
return { characteristics, readables, error: null };
|
||||
}
|
||||
|
||||
// 服务发现重试:部分安卓机型在切换同名设备后 getBLEDeviceServices 会短暂返回空/旧缓存,
|
||||
@ -418,7 +492,7 @@ async function discoverNotifyCharacteristicsWithRetry(deviceId, commit, retries
|
||||
await delay(500);
|
||||
}
|
||||
}
|
||||
return { characteristics: [], error: lastError || new Error('未找到可订阅的重量数据特征') };
|
||||
return { characteristics: [], readables: [], error: lastError || new Error('未找到可订阅的重量数据特征') };
|
||||
}
|
||||
|
||||
// 订阅全部可订阅特征,返回成功订阅数量
|
||||
@ -721,7 +795,8 @@ const actions = {
|
||||
commit('SET_CURRENT_DEVICE', {
|
||||
id: state.currentDevice.id,
|
||||
name: state.currentDevice.name || '未知设备',
|
||||
characteristics: discovered.characteristics
|
||||
characteristics: discovered.characteristics,
|
||||
readables: discovered.readables || []
|
||||
});
|
||||
|
||||
clearReconnectTimer();
|
||||
@ -732,6 +807,7 @@ const actions = {
|
||||
dispatch('stopScan');
|
||||
commit('ADD_LOG', { type: 'success', message: `已恢复连接: ${state.currentDevice.name || state.currentDevice.id}` });
|
||||
startDataWatchdog(commit, state, dispatch);
|
||||
startReadPolling(state.currentDevice.id, discovered.readables, commit, state);
|
||||
return true;
|
||||
} catch (e) {
|
||||
commit('SET_RECONNECTING', false);
|
||||
@ -768,6 +844,7 @@ const actions = {
|
||||
clearReconnectTimer();
|
||||
clearDisconnectDebounceTimer();
|
||||
clearDataWatchdog();
|
||||
clearReadPoll();
|
||||
watchdogRetries = 0;
|
||||
manualDisconnect = false;
|
||||
|
||||
@ -818,7 +895,8 @@ const actions = {
|
||||
commit('SET_CURRENT_DEVICE', {
|
||||
id: device.deviceId,
|
||||
name: device.name || '未知设备',
|
||||
characteristics: discovered.characteristics
|
||||
characteristics: discovered.characteristics,
|
||||
readables: discovered.readables || []
|
||||
});
|
||||
saveHistoryDevice({ deviceId: device.deviceId, name: device.name || '' });
|
||||
manualDisconnect = false;
|
||||
@ -829,6 +907,7 @@ const actions = {
|
||||
dispatch('stopScan');
|
||||
commit('ADD_LOG', { type: 'warning', message: `设备已处于连接状态,已重新订阅重量数据: ${device.name || device.deviceId}` });
|
||||
startDataWatchdog(commit, state, dispatch);
|
||||
startReadPolling(device.deviceId, discovered.readables, commit, state);
|
||||
return true;
|
||||
}
|
||||
if (connErr) throw connErr;
|
||||
@ -844,7 +923,8 @@ const actions = {
|
||||
commit('SET_CURRENT_DEVICE', {
|
||||
id: device.deviceId,
|
||||
name: device.name || '未知设备',
|
||||
characteristics: discovered.characteristics
|
||||
characteristics: discovered.characteristics,
|
||||
readables: discovered.readables || []
|
||||
});
|
||||
saveHistoryDevice({ deviceId: device.deviceId, name: device.name || '' });
|
||||
clearReconnectTimer();
|
||||
@ -856,6 +936,7 @@ const actions = {
|
||||
dispatch('stopScan');
|
||||
commit('ADD_LOG', { type: 'success', message: `连接成功: ${device.name || device.deviceId}` });
|
||||
startDataWatchdog(commit, state, dispatch);
|
||||
startReadPolling(device.deviceId, discovered.readables, commit, state);
|
||||
return true;
|
||||
} catch (e) {
|
||||
manualDisconnect = false;
|
||||
@ -884,6 +965,7 @@ const actions = {
|
||||
connectLock = true;
|
||||
connectLockAt = Date.now();
|
||||
try {
|
||||
clearReadPoll();
|
||||
manualDisconnect = true;
|
||||
try {
|
||||
await uni.closeBLEConnection({ deviceId: device.id });
|
||||
@ -913,6 +995,7 @@ const actions = {
|
||||
clearDisconnectDebounceTimer();
|
||||
clearScanStopTimer();
|
||||
clearDataWatchdog();
|
||||
clearReadPoll();
|
||||
watchdogRetries = 0;
|
||||
commit('SET_RECONNECTING', false);
|
||||
commit('SET_RECONNECT_MESSAGE', '已手动断开连接');
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
"name" : "WMS_PDA",
|
||||
"appid" : "__UNI__0B3DAD3",
|
||||
"description" : "多平台快速开发的UI框架",
|
||||
"versionName" : "1.0.137",
|
||||
"versionCode" : 1000137,
|
||||
"versionName" : "1.0.139",
|
||||
"versionCode" : 1000139,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"statusbar" : {
|
||||
|
||||
@ -102,6 +102,11 @@
|
||||
|
||||
<script>
|
||||
import { pinyin } from 'pinyin-pro'
|
||||
import uviewIcons from '@/uni_modules/uview-ui/components/u-icon/icons.js'
|
||||
|
||||
const VALID_UVIEW_ICON_NAMES = new Set(
|
||||
Object.keys(uviewIcons || {}).map(key => String(key).replace(/^uicon-/, ''))
|
||||
)
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -183,6 +188,15 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
resolveIconName(rawIcon) {
|
||||
const text = String(rawIcon ?? '').trim();
|
||||
if (!text || text === 'undefined' || text === 'null') {
|
||||
return 'grid';
|
||||
}
|
||||
|
||||
const iconName = text.replace(/^uicon-/, '');
|
||||
return VALID_UVIEW_ICON_NAMES.has(iconName) ? iconName : 'grid';
|
||||
},
|
||||
async loadAllActions() {
|
||||
let user = null;
|
||||
try {
|
||||
@ -215,7 +229,7 @@
|
||||
id: menu.id || menu.menuId || menu.component || menu.meta?.title || '',
|
||||
name: menu.meta?.title || '未命名菜单',
|
||||
component: menu.component || '',
|
||||
icon: menu.meta?.icon || '',
|
||||
icon: this.resolveIconName(menu.meta?.icon),
|
||||
color: colorPool[Math.floor(Math.random() * colorPool.length)],
|
||||
parentName
|
||||
}));
|
||||
@ -461,8 +475,8 @@
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
@ -516,7 +530,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
color: #666;
|
||||
background: #f4f5f7;
|
||||
border-radius: 10rpx;
|
||||
@ -544,7 +558,7 @@
|
||||
}
|
||||
|
||||
.parent-nav-item {
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 1.4;
|
||||
word-break: break-all;
|
||||
}
|
||||
@ -663,7 +677,7 @@
|
||||
|
||||
.group-section {
|
||||
.group-title {
|
||||
font-size: 30rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
padding: 18rpx 4rpx 10rpx;
|
||||
@ -715,7 +729,7 @@
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: normal;
|
||||
color: #333;
|
||||
text-align: left;
|
||||
|
||||
@ -2,17 +2,15 @@
|
||||
<view class="replenish-shorts-page">
|
||||
<view class="status-bar"></view>
|
||||
<view class="page-header">
|
||||
<view class="header-side header-side--left">
|
||||
<view class="header-side__btn" @click="handleBack">
|
||||
<u-icon name="arrow-left" size="18" color="#303133"></u-icon>
|
||||
</view>
|
||||
<view class="back-btn" @click="handleBack">
|
||||
<u-icon name="arrow-left" size="18" color="#333"></u-icon>
|
||||
</view>
|
||||
<text class="header-title">分拣缺货补货</text>
|
||||
<view class="header-side header-side--right">
|
||||
<view class="header-side__btn header-side__btn--store" @click="openStoreDrawer">
|
||||
<text class="header-side__btn-text">货主</text>
|
||||
<view v-if="selectedStoreIds.length" class="header-side__btn-badge">{{ selectedStoreIds.length }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="header-title">分拣缺货补货</text>
|
||||
<view class="header-side header-side--right">
|
||||
<view class="header-btn-refresh" @click="handleRefresh">刷新</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -20,38 +18,40 @@
|
||||
<!-- 汇总统计栏 -->
|
||||
<view v-if="summary" class="summary-bar">
|
||||
<view class="summary-bar__item">
|
||||
<text class="summary-bar__item-label">SKU总数</text>
|
||||
<text class="summary-bar__item-value">{{ getSummaryVal(summary.total_skus) }}</text>
|
||||
<text class="summary-bar__item-label">SKU总数</text>
|
||||
</view>
|
||||
<view class="summary-bar__item">
|
||||
<text class="summary-bar__item-label">缺货SKU</text>
|
||||
<text class="summary-bar__item-value summary-bar__item-value--warning">{{ getSummaryVal(summary.total_shortage_skus) }}</text>
|
||||
<text class="summary-bar__item-label">缺货SKU</text>
|
||||
</view>
|
||||
<view class="summary-bar__item">
|
||||
<text class="summary-bar__item-label">建议补货总量</text>
|
||||
<text class="summary-bar__item-value summary-bar__item-value--primary">{{ formatQty(summary.total_replenishment_needed) }}</text>
|
||||
<text class="summary-bar__item-label">建议补货总量</text>
|
||||
</view>
|
||||
<view class="summary-bar__item">
|
||||
<text class="summary-bar__item-label">真实缺货SKU</text>
|
||||
<text class="summary-bar__item-value summary-bar__item-value--danger">{{ getSummaryVal(summary.total_true_shortage_skus) }}</text>
|
||||
<text class="summary-bar__item-label">真实缺货SKU</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-bar">
|
||||
<view class="search-bar__input-wrap">
|
||||
<u-icon name="search" size="20" color="#909399"></u-icon>
|
||||
<input
|
||||
class="search-bar__input"
|
||||
type="text"
|
||||
<u-search
|
||||
v-model="searchKeyword"
|
||||
placeholder="输入商品名称/条码搜索..."
|
||||
placeholder-style="color: #c0c4cc; font-size: 34rpx;"
|
||||
confirm-type="search"
|
||||
/>
|
||||
<text v-if="searchKeyword" class="search-bar__clear" @click="searchKeyword = ''">
|
||||
<u-icon name="close-circle-fill" size="20" color="#c0c4cc"></u-icon>
|
||||
</text>
|
||||
placeholder="输入商品名称/条码搜索"
|
||||
bg-color="#f5f5f5"
|
||||
shape="round"
|
||||
:show-action="false"
|
||||
@search="handleSearchAction"
|
||||
@clear="handleSearchAction"
|
||||
></u-search>
|
||||
<view class="search-bar__actions">
|
||||
<view class="search-bar__btn" @click="handleSearchAction">
|
||||
<text class="search-bar__btn__text">搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -96,15 +96,15 @@
|
||||
<text class="card-metric__value" :class="replenishStatusClass(item)">{{ replenishStatusText(item.replenishment_status) }}</text>
|
||||
</view>
|
||||
<view class="card-metric card-metric--1">
|
||||
<text class="card-metric__label">货主</text>
|
||||
<view class="card-metric__divider"></view>
|
||||
<text class="card-metric__value card-metric__value--name">{{ item.store_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="card-metric card-metric--0">
|
||||
<text class="card-metric__label">商品名称</text>
|
||||
<view class="card-metric__divider"></view>
|
||||
<text class="card-metric__value card-metric__value--name">{{ item.stock_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="card-metric card-metric--0">
|
||||
<text class="card-metric__label">货主名称</text>
|
||||
<view class="card-metric__divider"></view>
|
||||
<text class="card-metric__value card-metric__value--name">{{ item.store_name || '-' }}</text>
|
||||
</view>
|
||||
<view class="card-metric card-metric--1">
|
||||
<text class="card-metric__label">商品条码</text>
|
||||
<view class="card-metric__divider"></view>
|
||||
@ -152,39 +152,31 @@
|
||||
<view class="safe-area-bottom"></view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部统计栏 -->
|
||||
<view v-if="summary" class="bottom-bar">
|
||||
<view class="bottom-bar__pagination">
|
||||
<template v-if="hasSearch">
|
||||
<text class="bottom-bar__text">共 {{ filteredList.length }} 条(搜索结果)</text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view
|
||||
class="pagination-btn"
|
||||
:class="{ 'pagination-btn--disabled': page <= 1 }"
|
||||
@click="goPrevPage"
|
||||
>
|
||||
上一页
|
||||
</view>
|
||||
<text class="bottom-bar__text">
|
||||
第 {{ page }}/{{ totalPages }} 页,共 {{ getSummaryVal(summary.total_skus) }} 条
|
||||
</text>
|
||||
<view
|
||||
class="pagination-btn"
|
||||
:class="{ 'pagination-btn--disabled': page >= totalPages }"
|
||||
@click="goNextPage"
|
||||
>
|
||||
下一页
|
||||
</view>
|
||||
</template>
|
||||
<!-- 底部分页 -->
|
||||
<view v-if="summary" class="pagination-wrap">
|
||||
<view v-if="hasSearch" class="bottom-bar__search-info">
|
||||
<text class="bottom-bar__text">共 {{ filteredList.length }} 条(搜索结果)</text>
|
||||
</view>
|
||||
<pagination
|
||||
v-else
|
||||
:pageNum.sync="page"
|
||||
:pageSize="pageSize"
|
||||
:total="total"
|
||||
:showTotal="true"
|
||||
:prevText="'上一页'"
|
||||
:nextText="'下一页'"
|
||||
:showFirstLast="true"
|
||||
:firstText="'首页'"
|
||||
:lastText="'末页'"
|
||||
@change="handlePageChange"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 货主抽屉弹窗 -->
|
||||
<!-- 货主底部弹窗 -->
|
||||
<view class="store-drawer-layer">
|
||||
<u-popup :show="storeDrawerVisible" mode="left" :closeable="false" border-radius="0" :safeAreaInsetTop="true" bg-color="transparent" @close="handleStoreDrawerClose">
|
||||
<view class="store-drawer">
|
||||
<u-popup :show="storeDrawerVisible" mode="bottom" round="20" :closeable="false" :safe-area-inset-bottom="true" :close-on-click-overlay="true" @close="handleStoreDrawerClose">
|
||||
<view class="store-drawer">
|
||||
<view class="store-drawer__header">
|
||||
<text class="store-drawer__title">选择货主</text>
|
||||
<view class="store-drawer__close" @click="handleStoreDrawerClose">
|
||||
@ -194,14 +186,22 @@
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<view class="store-drawer__search">
|
||||
<u-input
|
||||
v-model="storeSearchText"
|
||||
placeholder="输入货主名称搜索"
|
||||
:border="'none'"
|
||||
prefixIcon="search"
|
||||
prefixIconStyle="color: #909399; font-size: 18px"
|
||||
clearable
|
||||
></u-input>
|
||||
<view class="store-drawer__search-wrap">
|
||||
<u-search
|
||||
v-model="storeSearchText"
|
||||
placeholder="输入货主名称搜索"
|
||||
bg-color="#f5f5f5"
|
||||
shape="round"
|
||||
:show-action="false"
|
||||
@search="handleSearchAction"
|
||||
@clear="handleSearchAction"
|
||||
></u-search>
|
||||
<view class="store-drawer__search-actions">
|
||||
<view class="store-drawer__search-btn" @click="handleSearchAction">
|
||||
<text class="store-drawer__search-btn__text">搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="storeLoading" class="store-drawer__loading">
|
||||
@ -217,7 +217,11 @@
|
||||
@click="toggleStore(store)"
|
||||
>
|
||||
<text class="store-drawer__item-name">{{ getStoreName(store) }}</text>
|
||||
<u-icon v-if="isStoreSelected(store)" name="checkbox-mark" color="#07c160" size="20"></u-icon>
|
||||
<u-icon
|
||||
:name="isStoreSelected(store) ? 'checkmark-circle-fill' : 'checkmark-circle'"
|
||||
:color="isStoreSelected(store) ? '#07c160' : '#c8c9cc'"
|
||||
size="22"
|
||||
></u-icon>
|
||||
</view>
|
||||
<u-empty v-if="filteredStores.length === 0" mode="data" text="暂无货主"></u-empty>
|
||||
</scroll-view>
|
||||
@ -226,7 +230,6 @@
|
||||
<view class="store-drawer__footer">
|
||||
<view class="store-drawer__footer-info">
|
||||
<text class="store-drawer__footer-text">已选 {{ pendingSelectedStoreIds.length }} 个货主</text>
|
||||
<text v-if="pendingSelectedStoreIds.length" class="store-drawer__footer-clear" @click="clearStoreSelection">清空</text>
|
||||
</view>
|
||||
<view class="store-drawer__footer-btns">
|
||||
<view class="store-drawer__footer-btn store-drawer__footer-btn--reset" @click="resetStoreSelection">重置</view>
|
||||
@ -263,9 +266,6 @@
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
totalPages() {
|
||||
return Math.max(1, Math.ceil(this.total / this.pageSize));
|
||||
},
|
||||
hasSearch() {
|
||||
return Boolean(this.searchKeyword.trim());
|
||||
},
|
||||
@ -403,9 +403,6 @@
|
||||
this.pendingSelectedStoreIds.push(id);
|
||||
}
|
||||
},
|
||||
clearStoreSelection() {
|
||||
this.pendingSelectedStoreIds = [];
|
||||
},
|
||||
resetStoreSelection() {
|
||||
this.pendingSelectedStoreIds = [];
|
||||
this.storeSearchText = '';
|
||||
@ -420,6 +417,12 @@
|
||||
handleStoreDrawerClose() {
|
||||
this.storeDrawerVisible = false;
|
||||
},
|
||||
handleSearchAction() {
|
||||
// 列表已随关键字实时过滤,这里只收起键盘
|
||||
if (typeof uni !== 'undefined' && uni.hideKeyboard) {
|
||||
uni.hideKeyboard();
|
||||
}
|
||||
},
|
||||
handleBack() {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
},
|
||||
@ -429,14 +432,10 @@
|
||||
this.fetchData();
|
||||
uni.showToast({ title: '已刷新', icon: 'none' });
|
||||
},
|
||||
goNextPage() {
|
||||
if (this.page >= this.totalPages || this.loading) return;
|
||||
this.page += 1;
|
||||
this.fetchData();
|
||||
},
|
||||
goPrevPage() {
|
||||
if (this.page <= 1 || this.loading) return;
|
||||
this.page -= 1;
|
||||
handlePageChange(page) {
|
||||
const targetPage = Number(page) || 1;
|
||||
if (targetPage === this.page || this.loading) return;
|
||||
this.page = targetPage;
|
||||
this.fetchData();
|
||||
},
|
||||
getSummaryVal(val) {
|
||||
@ -459,7 +458,7 @@
|
||||
replenishStatusClass(item) {
|
||||
const status = item.replenishment_status;
|
||||
if (status === 'replenishable') {
|
||||
return 'card-metric__value--primary';
|
||||
return 'card-metric__value--primary-fill';
|
||||
}
|
||||
if (status === 'true_shortage') {
|
||||
return 'card-metric__value--danger';
|
||||
@ -524,32 +523,38 @@
|
||||
}
|
||||
|
||||
.page-header {
|
||||
position: relative;
|
||||
height: 88rpx;
|
||||
padding: 0 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #ebeef5;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-side {
|
||||
min-width: 112rpx;
|
||||
.back-btn {
|
||||
flex-shrink: 0;
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.header-side--left {
|
||||
justify-content: flex-start;
|
||||
.header-side {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-side .header-side__btn + .header-btn-refresh {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.header-side__btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
padding: 12rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
background: #f5f7fa;
|
||||
@ -558,18 +563,18 @@
|
||||
.header-side__btn--store {
|
||||
background: #07c160;
|
||||
padding: 12rpx 28rpx;
|
||||
margin-left: 32rpx;
|
||||
}
|
||||
|
||||
.header-side__btn--store .header-side__btn-text {
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.header-side__btn-badge {
|
||||
min-width: 28rpx;
|
||||
height: 28rpx;
|
||||
padding: 0 6rpx;
|
||||
margin-left: 6rpx;
|
||||
border-radius: 14rpx;
|
||||
background: #ff4d4f;
|
||||
color: #ffffff;
|
||||
@ -591,7 +596,6 @@
|
||||
|
||||
.header-title {
|
||||
flex: 1;
|
||||
padding: 0 16rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
@ -612,7 +616,7 @@
|
||||
padding: 14rpx 28rpx;
|
||||
background: #2979ff;
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
font-size: 36rpx;
|
||||
border-radius: 8rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
@ -623,18 +627,19 @@
|
||||
align-items: stretch;
|
||||
padding: 16rpx 16rpx;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #ebeef5;
|
||||
gap: 8rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.summary-bar__item + .summary-bar__item {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.summary-bar__item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6rpx;
|
||||
padding: 12rpx 8rpx;
|
||||
background: #f5f7fa;
|
||||
border-radius: 12rpx;
|
||||
@ -646,6 +651,7 @@
|
||||
color: #303133;
|
||||
line-height: 1.2;
|
||||
font-variant-numeric: tabular-nums;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.summary-bar__item-value--danger {
|
||||
@ -668,38 +674,60 @@
|
||||
|
||||
/* ===== 搜索框 ===== */
|
||||
.search-bar {
|
||||
padding: 12rpx 16rpx;
|
||||
padding: 20rpx;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #ebeef5;
|
||||
border-bottom: 1rpx solid #f2f2f2;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.search-bar__input-wrap {
|
||||
position: relative;
|
||||
|
||||
::v-deep .u-search {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content {
|
||||
padding-right: 110rpx;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content__input {
|
||||
font-size: 34rpx;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content__close {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.search-bar__actions {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
height: 68rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
background: #f5f7fa;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.search-bar__input {
|
||||
flex: 1;
|
||||
font-size: 34rpx;
|
||||
color: #303133;
|
||||
height: 48rpx;
|
||||
line-height: 48rpx;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.search-bar__clear {
|
||||
.search-bar__btn {
|
||||
height: 68rpx;
|
||||
padding: 0 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 6rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
&__text {
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
color: #2979ff;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.88;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== 页面主体 ===== */
|
||||
@ -761,7 +789,10 @@
|
||||
padding: 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.card-item + .card-item {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.card-item {
|
||||
@ -788,11 +819,12 @@
|
||||
}
|
||||
|
||||
.card-metric__label {
|
||||
font-size: 30rpx;
|
||||
font-size: 34rpx;
|
||||
color: #303133;
|
||||
line-height: 1;
|
||||
flex-shrink: 0;
|
||||
width: 150rpx;
|
||||
width: 190rpx;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-metric__divider {
|
||||
@ -804,7 +836,7 @@
|
||||
}
|
||||
|
||||
.card-metric__value {
|
||||
font-size: 32rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
line-height: 1.4;
|
||||
@ -817,21 +849,47 @@
|
||||
|
||||
.card-metric__value--code {
|
||||
font-weight: 700;
|
||||
font-size: 34rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.card-metric__value--name {
|
||||
font-weight: 400;
|
||||
font-size: 30rpx;
|
||||
font-size: 36rpx;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.card-metric__value--danger {
|
||||
flex: 0 0 auto;
|
||||
align-self: center;
|
||||
min-width: 96rpx;
|
||||
max-width: 100%;
|
||||
background-color: #f56c6c;
|
||||
color: #ffffff;
|
||||
padding: 18rpx 12rpx;
|
||||
margin: -18rpx 0;
|
||||
border-radius: 0 6rpx 6rpx 0;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 10rpx;
|
||||
line-height: 1.2;
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.card-metric__value--primary-fill {
|
||||
flex: 0 0 auto;
|
||||
align-self: center;
|
||||
min-width: 96rpx;
|
||||
max-width: 100%;
|
||||
background-color: #2979ff;
|
||||
color: #ffffff;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 10rpx;
|
||||
line-height: 1.2;
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.card-metric__value--primary {
|
||||
@ -849,7 +907,7 @@
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
line-height: 1.4;
|
||||
font-size: 28rpx;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.card-metric__value--spaces-qty {
|
||||
@ -884,19 +942,19 @@
|
||||
height: 20rpx;
|
||||
}
|
||||
|
||||
/* ===== 底部统计栏 ===== */
|
||||
.bottom-bar {
|
||||
/* ===== 底部分页 ===== */
|
||||
.pagination-wrap {
|
||||
flex-shrink: 0;
|
||||
padding: 24rpx 24rpx;
|
||||
padding: 12rpx 12rpx 0;
|
||||
background: #ffffff;
|
||||
border-top: 1rpx solid #ebeef5;
|
||||
border-top: 1rpx solid #f2f2f2;
|
||||
}
|
||||
|
||||
.bottom-bar__pagination {
|
||||
.bottom-bar__search-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 24rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.bottom-bar__text {
|
||||
@ -904,22 +962,7 @@
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.pagination-btn {
|
||||
padding: 18rpx 36rpx;
|
||||
font-size: 30rpx;
|
||||
color: #2979ff;
|
||||
background: #f0f5ff;
|
||||
border-radius: 8rpx;
|
||||
line-height: 1;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.pagination-btn--disabled {
|
||||
color: #c0c4cc;
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
/* ===== 货主抽屉 ===== */
|
||||
/* ===== 货主底部弹窗 ===== */
|
||||
.store-drawer-layer {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@ -927,15 +970,16 @@
|
||||
width: 0;
|
||||
height: 0;
|
||||
overflow: visible;
|
||||
z-index: 9999;
|
||||
z-index: 10076;
|
||||
}
|
||||
|
||||
.store-drawer {
|
||||
width: 560rpx;
|
||||
height: calc(100vh - var(--status-bar-height));
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 70vh;
|
||||
background: #ffffff;
|
||||
border-radius: 20px 20px 0 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.store-drawer__header {
|
||||
@ -944,7 +988,6 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1rpx solid #ebeef5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@ -956,7 +999,7 @@
|
||||
}
|
||||
|
||||
.store-drawer__title {
|
||||
font-size: 32rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #303133;
|
||||
}
|
||||
@ -967,17 +1010,19 @@
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.store-drawer__loading-text {
|
||||
font-size: 26rpx;
|
||||
margin-top: 16rpx;
|
||||
font-size: 34rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.store-drawer__list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 16rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.store-drawer__search {
|
||||
@ -986,13 +1031,64 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.store-drawer__search-wrap {
|
||||
position: relative;
|
||||
|
||||
::v-deep .u-search {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content {
|
||||
padding-right: 110rpx;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content__input {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
::v-deep .u-search__content__close {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.store-drawer__search-actions {
|
||||
position: absolute;
|
||||
right: 24rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
height: 68rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.store-drawer__search-btn {
|
||||
height: 68rpx;
|
||||
padding: 0 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
|
||||
&__text {
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
color: #2979ff;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.88;
|
||||
}
|
||||
}
|
||||
|
||||
.store-drawer__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
border-bottom: 1rpx solid #f0f2f5;
|
||||
padding: 26rpx 28rpx;
|
||||
margin-bottom: 16rpx;
|
||||
background: #f6f8fb;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.store-drawer__item--active {
|
||||
@ -1000,7 +1096,10 @@
|
||||
}
|
||||
|
||||
.store-drawer__item-name {
|
||||
font-size: 30rpx;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-right: 16rpx;
|
||||
font-size: 34rpx;
|
||||
color: #303133;
|
||||
line-height: 1.4;
|
||||
word-break: break-all;
|
||||
@ -1021,18 +1120,16 @@
|
||||
}
|
||||
|
||||
.store-drawer__footer-text {
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.store-drawer__footer-clear {
|
||||
font-size: 26rpx;
|
||||
color: #2979ff;
|
||||
}
|
||||
|
||||
.store-drawer__footer-btns {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.store-drawer__footer-btn + .store-drawer__footer-btn {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.store-drawer__footer-btn {
|
||||
@ -1042,7 +1139,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8rpx;
|
||||
font-size: 30rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user