WMS_PDA/pages/packing/splitOrder.vue

1166 lines
30 KiB
Vue
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>
<view class="split-order-page">
<!-- 顶部栏 -->
<view class="top-bar">
<view class="status-bar"></view>
<view class="header">
<view class="header-left">
<view class="header-left__back" @click="handleBack">
<u-icon name="arrow-left" size="36rpx" color="#303133"></u-icon>
</view>
<view class="header-left__divider"></view>
<view class="manual-toggle-btn"
:class="{ 'manual-toggle-btn--active': manualInputOpen }"
@click="toggleManualInput"
>
<text class="manual-toggle-btn__text">{{ manualInputOpen ? '关闭手动输入' : '手动输入' }}</text>
</view>
</view>
<text class="header-title">拆单</text>
<view class="header-right" @click="handlePrinterSettings">
<text class="header-printer-text" :class="{ 'header-printer-text--bound': !!printerName }">
{{ printerName || '未绑定' }}
</text>
</view>
</view>
</view>
<!-- 无权限态 -->
<view v-if="!hasPermission" class="no-permission">
<u-icon name="lock" size="64" color="#c0c4cc"></u-icon>
<text class="no-permission-text">无权限</text>
</view>
<template v-else>
<!-- 搜索/输入区 -->
<view class="search-area">
<view v-if="manualInputOpen" class="scan-section">
<view class="scan-row">
<input
class="scan-input"
v-model="scanKeyword"
:focus="inputFocus"
placeholder="扫描/输入快递单号"
placeholder-style="color:#c0c4cc;font-size:32rpx"
@confirm="handleScanConfirm"
/>
<view v-if="!isBroadcastMode" class="scan-camera-btn" @click="handleCameraScan">
<u-icon name="scan" size="34rpx" color="#2979ff"></u-icon>
</view>
</view>
</view>
</view>
<!-- 订单信息卡 -->
<view class="order-card">
<!-- 快递号行 -->
<view class="order-card__line">
<text class="order-card__label order-card__label--waybill">快递号</text>
<text class="order-card__text">{{ currentWaybill }}</text>
</view>
<view class="order-card__divider"></view>
<!-- 子单号区 -->
<view class="order-card__sub-section">
<text class="order-card__label order-card__label--sub">子单号</text>
<view class="order-card__sub-list">
<view
v-for="(sub, index) in subOrderList"
:key="sub.id || index"
class="sub-tag"
@click="handlePrintSingle(sub)"
>
<text class="sub-tag__text">{{ sub.waybillCode }}</text>
</view>
<text v-if="subOrderList.length === 0" class="order-card__sub-empty"></text>
</view>
</view>
<view class="order-card__divider"></view>
<!-- 操作按钮 -->
<view class="order-card__actions">
<view v-show="!!currentWaybill" class="action-btn action-btn--split" @click="handleSplitOrder">
<text class="action-btn__text">拆单</text>
</view>
<view
v-show="subOrderList.length > 0"
class="action-btn action-btn--print"
@click="handlePrintAll"
>
<text class="action-btn__text">一键打印所有子面单</text>
</view>
</view>
</view>
<!-- 弹性填充,吸收卡片高度变化,防止页面抖动 -->
<view class="flex-filler"></view>
</template>
<!-- 拆单数量弹窗 -->
<u-popup :show="showSplitPopup" mode="center" :closeable="false" border-radius="20" :z-index="10090" style="flex: none">
<view class="split-popup">
<view class="split-popup__title">拆单数量</view>
<view class="split-popup__input-wrap">
<u-input
v-model="splitQuantity"
type="number"
placeholder="请输入拆单数量"
:clearable="false"
:customStyle="{ height: '100rpx', lineHeight: '100rpx', textAlign: 'center', background: '#f5f5f5', borderRadius: '12rpx', padding: '0 20rpx' }"
></u-input>
</view>
<view class="split-popup__actions">
<view class="split-popup__btn split-popup__btn--cancel" @click="showSplitPopup = false">
<text class="split-popup__btn-text">取消</text>
</view>
<view class="split-popup__btn split-popup__btn--confirm" @click="confirmSplit">
<text class="split-popup__btn-text">确定</text>
</view>
</view>
</view>
</u-popup>
<!-- 打印台设置弹窗 -->
<u-popup :show="showPopup" mode="bottom" :closeable="true" border-radius="20" :z-index="10090" @close="showPopup = false" style="flex: none">
<view class="print-popup">
<scroll-view scroll-y class="print-popup-scroll">
<view class="print-popup-title">打印台绑定</view>
<view class="print-row print-row--station">
<text class="print-label">打印台</text>
<view class="print-station-input-wrap">
<u-input
v-model="printStationInputKeyword"
placeholder="请输入或扫描打印台编号"
:clearable="true"
:customStyle="{ fontSize: '28rpx', height: '80rpx', lineHeight: '80rpx', padding: '0 20rpx', background: '#fafafa', borderRadius: '10rpx' }"
@input="handlePrintStationInput"
@focus="handlePrintStationInputFocus"
@blur="handlePrintStationInputBlur"
@confirm="handlePrintStationInputConfirm"
></u-input>
<view v-if="showPrintStationDropdown && printStationFilteredList.length > 0" class="print-station-dropdown">
<scroll-view scroll-y class="print-station-dropdown-scroll">
<view
v-for="station in printStationFilteredList"
:key="station.id"
class="print-station-option print-station-option--row"
:class="{ 'print-station-option--active': station.id === printerId }"
@mousedown.stop="handlePrintStationSelect(station)"
>
<text class="station-option-name">{{ station.name }}</text>
<text v-if="station.customBarcode" class="station-option-code">{{ station.customBarcode }}</text>
</view>
</scroll-view>
</view>
<view v-if="showPrintStationDropdown && printStationInputKeyword && printStationFilteredList.length === 0" class="print-station-dropdown">
<view class="print-station-option print-station-option--empty">未匹配到打印台</view>
</view>
</view>
</view>
</scroll-view>
</view>
</u-popup>
</view>
</template>
<script>
import voice from '@/core/utils/voice';
export default {
data() {
return {
hasPermission: true,
isBroadcastMode: false,
manualInputOpen: false,
inputFocus: false,
scanKeyword: '',
currentWaybill: '',
orderId: null,
orderInfo: null,
subOrderList: [],
// 打印台绑定
printerName: '',
printerId: '',
printStationList: [],
printStationInputKeyword: '',
showPrintStationDropdown: false,
showPopup: false,
// 拆单弹窗
showSplitPopup: false,
splitQuantity: ''
};
},
computed: {
printStationFilteredList() {
const list = Array.isArray(this.printStationList) ? this.printStationList : [];
const keyword = this.normalizeKeyword(this.printStationInputKeyword);
if (!keyword) return list;
return list.filter(station => {
const name = String(station.name || '').toLowerCase();
const id = String(station.id || '').toLowerCase();
const barcode = String(station.customBarcode || '').toLowerCase();
const kw = keyword.toLowerCase();
return name.includes(kw) || id.includes(kw) || barcode.includes(kw);
});
}
},
onLoad(options) {
this.isBroadcastMode = options?.broadcast === 'true' || options?.broadcast === true;
this.checkPermission();
this.loadPrintStations(1, false);
this.safeDispatchBroadcast('setCallbacks', {
onResult: this.handleBroadcastResult
});
this.safeDispatchBroadcast('start');
},
onShow() {
this.safeDispatchBroadcast('setCallbacks', {
onResult: this.handleBroadcastResult
});
this.safeDispatchBroadcast('resume');
},
onHide() {
this.safeDispatchBroadcast('pause');
},
onUnload() {
this.safeDispatchBroadcast('stop');
},
methods: {
checkPermission() {
// TODO: 检查拆单权限
this.hasPermission = true;
},
handleBack() {
uni.navigateBack({ delta: 1 });
},
speakVoice(text) {
voice.speak(text, { minInterval: 800 });
},
normalizeKeyword(value) {
return String(value || '').replace(/\s+/g, '');
},
normalizeScanResult(scanResult) {
if (!scanResult) return '';
if (typeof scanResult === 'string') return this.normalizeKeyword(scanResult);
if (typeof scanResult.result === 'string') return this.normalizeKeyword(scanResult.result);
if (Array.isArray(scanResult.result)) {
const firstResult = scanResult.result.find(item => item);
if (typeof firstResult === 'string') return this.normalizeKeyword(firstResult);
if (firstResult && typeof firstResult.data === 'string') return this.normalizeKeyword(firstResult.data);
}
if (typeof scanResult.data === 'string') return this.normalizeKeyword(scanResult.data);
return '';
},
safeDispatchBroadcast(action, payload) {
try {
const task = this.$store.dispatch(`broadcast/${action}`, payload);
if (task && typeof task.catch === 'function') {
task.catch(error => {
console.warn(`[splitOrder] broadcast/${action} 调用失败:`, error);
});
}
} catch (error) {
console.warn(`[splitOrder] broadcast/${action} 调用异常:`, error);
}
},
/* ===== 广播扫描结果处理 ===== */
handleBroadcastResult(result) {
const scanText = this.normalizeScanResult(result);
console.log('[splitOrder] handleBroadcastResult 扫描结果:', scanText);
if (!scanText) return;
if (this.showPopup) {
this.printStationInputKeyword = scanText;
this.handlePrintStationInput(scanText);
return;
}
if (!this.printerId) {
// 未绑定打印台 → 扫描值尝试匹配打印台,匹配失败不弹窗
const keyword = this.normalizeKeyword(scanText);
const list = Array.isArray(this.printStationList) ? this.printStationList : [];
const matched = list.find(station =>
String(station.customBarcode || '').toLowerCase() === keyword.toLowerCase()
|| String(station.name).toLowerCase() === keyword.toLowerCase()
|| String(station.id).toLowerCase() === keyword.toLowerCase()
);
if (matched) {
this.printerId = String(matched.id);
this.printerName = String(matched.name || '');
uni.showToast({ title: `已绑定打印台:${matched.name}`, icon: 'success' });
this.speakVoice('已绑定打印台');
} else {
this.speakVoice('未绑定打印台');
}
return;
}
// 已绑定打印台 → 走快递号查询
this.currentWaybill = scanText;
this.queryOrder(scanText);
},
/* ===== 扫码/输入 ===== */
handleScanConfirm() {
const keyword = String(this.scanKeyword || '').trim();
if (!keyword) return;
this.currentWaybill = keyword;
this.queryOrder(keyword);
},
handleCameraScan() {
uni.scanCode({
onlyFromCamera: true,
scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
success: (res) => {
const code = String(res?.result || '').trim();
if (!code) return;
this.currentWaybill = code;
this.queryOrder(code);
},
fail: () => {}
});
},
toggleManualInput() {
this.manualInputOpen = !this.manualInputOpen;
if (this.manualInputOpen) {
this.$nextTick(() => {
this.inputFocus = true;
});
}
},
/* ===== 查询订单 ===== */
async queryOrder(keyword) {
const normalizedKeyword = this.normalizeKeyword(keyword);
if (!normalizedKeyword) return;
uni.showLoading({ title: '查询订单中...' });
try {
// 1. 调用 common.toOrder 按快递单号获取订单ID
const toOrderRes = await this.$http('common.toOrder', {
waybill_code: normalizedKeyword
});
if (toOrderRes?.flag === 'failure') {
const errMsg = String(toOrderRes?.message || toOrderRes?.msg || '订单查询失败');
uni.showToast({ title: errMsg, icon: 'none' });
this.speakVoice('无记录');
this.subOrderList = [];
return;
}
const orderId = Number(toOrderRes?.order_id);
if (!orderId || orderId <= 0) {
uni.showToast({ title: '未查询到订单', icon: 'none' });
this.speakVoice('无记录');
this.subOrderList = [];
return;
}
this.orderId = orderId;
// 2. 获取订单详情(含子单信息)
const detailResponse = await this.$http('order.detail', {
id: orderId,
ids: [orderId],
tableType: 'dispatch'
});
if (detailResponse?.flag === 'failure') {
const errMsg = String(detailResponse?.message || detailResponse?.msg || '订单详情查询失败');
uni.showToast({ title: errMsg, icon: 'none' });
this.subOrderList = [];
return;
}
const data = detailResponse?.data || detailResponse?.result || {};
this.orderInfo = this.normalizeOrderInfo(data);
this.subOrderList = this.normalizeSubOrders(data);
} catch (error) {
console.error('[splitOrder] 查询订单失败:', error);
uni.showToast({ title: '查询订单失败', icon: 'none' });
this.subOrderList = [];
} finally {
uni.hideLoading();
this.scanKeyword = '';
}
},
normalizeOrderInfo(data) {
const detail = data?.detail || {};
const expresses = Array.isArray(data?.expresses) ? data.expresses : [];
const mainExpress = expresses.find(e => String(e.business_key) === '1') || expresses[0] || {};
return {
id: detail?.id || '',
waybillCode: mainExpress?.waybill_code || '',
orderNo: detail?.delivery_order_code || ''
};
},
normalizeSubOrders(data) {
const expresses = Array.isArray(data?.expresses) ? data.expresses : [];
// 异步任务模式:business_key 从 2 开始为子单号
const subExpresses = expresses.filter(e => Number(e.business_key) >= 2);
return subExpresses.map(exp => ({
id: exp?.id || '',
waybillCode: exp?.waybill_code || ''
}));
},
/* ===== 拆单操作 ===== */
handleSplitOrder() {
if (!this.orderInfo) {
uni.showToast({ title: '请先查询订单', icon: 'none' });
return;
}
this.splitQuantity = '';
this.showSplitPopup = true;
},
async confirmSplit() {
const qty = Number(this.splitQuantity);
if (!qty || qty < 1) {
uni.showToast({ title: '请输入有效数量', icon: 'none' });
return;
}
if (!this.orderId) {
uni.showToast({ title: '请先查询订单', icon: 'none' });
return;
}
this.showSplitPopup = false;
uni.showLoading({ title: '分配子单号中...' });
try {
const response = await this.$http('order.pendingOrder.allocateSubOrderNumber', {
order_id: Number(this.orderId),
sub_order_count: qty
});
if (response?.flag === 'failure') {
const errMsg = String(response?.message || response?.msg || '拆单失败');
uni.showToast({ title: errMsg, icon: 'none' });
this.speakVoice('拆单失败');
return;
}
const taskMessage = response?.data?.message || response?.message || '拆单成功';
this.speakVoice('拆单成功');
// 分配子单号为异步任务,轮询等待子单号生成
if (this.orderId) {
let retryCount = 0;
const maxRetries = 10;
let subOrders = [];
while (retryCount < maxRetries) {
await new Promise(resolve => setTimeout(resolve, 1500));
retryCount += 1;
uni.showLoading({ title: `等待子单号生成中...(${retryCount}/${maxRetries})` });
try {
const detailResponse = await this.$http('order.detail', {
id: this.orderId,
ids: [this.orderId],
tableType: 'dispatch'
});
const data = detailResponse?.data || detailResponse?.result || {};
subOrders = this.normalizeSubOrders(data);
if (subOrders.length > 0) {
this.orderInfo = this.normalizeOrderInfo(data);
this.subOrderList = subOrders;
break;
}
} catch (e) {
console.warn('[splitOrder] 轮询子单号失败:', e);
}
}
if (subOrders.length === 0) {
// 最后一次尝试,获取当前数据
try {
const detailResponse = await this.$http('order.detail', {
id: this.orderId,
ids: [this.orderId],
tableType: 'dispatch'
});
const data = detailResponse?.data || detailResponse?.result || {};
this.orderInfo = this.normalizeOrderInfo(data);
this.subOrderList = this.normalizeSubOrders(data);
} catch (e) {
console.warn('[splitOrder] 刷新子单列表失败:', e);
}
}
uni.showToast({ title: taskMessage, icon: 'success' });
} else {
uni.showToast({ title: taskMessage, icon: 'success' });
}
} catch (error) {
console.error('[splitOrder] 拆单失败:', error);
uni.showToast({ title: '拆单失败', icon: 'none' });
} finally {
uni.hideLoading();
}
},
/* ===== 单个子单打印 ===== */
handlePrintSingle(sub) {
if (!this.printerId) {
uni.showToast({ title: '未绑定打印台,请先绑定', icon: 'none' });
this.speakVoice('未绑定打印台');
return;
}
this.doPrint([sub]);
},
/* ===== 一键打印所有子面单 ===== */
handlePrintAll() {
if (!this.subOrderList.length) {
uni.showToast({ title: '暂无子单可打印', icon: 'none' });
return;
}
if (!this.printerId) {
uni.showToast({ title: '未绑定打印台,请先绑定', icon: 'none' });
this.speakVoice('未绑定打印台');
return;
}
this.doPrint(this.subOrderList);
},
/* ===== 通用打印 ===== */
async doPrint(orderList) {
if (!orderList || !orderList.length) return;
uni.showLoading({ title: '获取打印数据...' });
try {
const printDataResponse = await this.$http('order.print.getPrintDataByWaybillCodes', {
waybill_codes: orderList.map(s => s.waybillCode)
});
const printPayload = this.extractOrderPrintPayload(printDataResponse);
const waveGroups = this.normalizeOrderPrintGroups(printPayload);
if (!waveGroups.length) {
uni.hideLoading();
uni.showToast({ title: '未获取到可打印数据', icon: 'none' });
return;
}
uni.showLoading({ title: '发送打印...' });
const requestCode = this.buildPrintRequestCode();
const sendResponse = await this.$http('print.send', {
type: 'express',
printStationId: this.printerId,
requestCode,
data: { waveGroups }
});
const success = sendResponse?.flag !== 'failure' && sendResponse?.code !== '500' && sendResponse?.code !== 500;
if (!success) {
throw new Error(sendResponse?.message || sendResponse?.msg || '打印发送失败');
}
uni.showToast({ title: `已发送 ${orderList.length} 个面单`, icon: 'success' });
this.speakVoice('打印成功');
} catch (error) {
const message = String(error?.message || error?.msg || error?.errMsg || '打印失败');
uni.showToast({ title: message, icon: 'none' });
} finally {
uni.hideLoading();
}
},
extractOrderPrintPayload(response) {
const candidates = [response?.data?.data, response?.data, response?.result, response];
for (let i = 0; i < candidates.length; i += 1) {
const current = candidates[i];
if (current && typeof current === 'object') return current;
}
return {};
},
normalizeOrderPrintGroups(payload) {
const groups = Array.isArray(payload?.waveGroups) ? payload.waveGroups : [];
if (groups.length) return groups;
if (payload && typeof payload === 'object') return [payload];
return [];
},
buildPrintRequestCode() {
const timePart = Date.now().toString(36);
const randomPart = Math.random().toString(36).slice(2, 10);
return `PRINT_${timePart}_${randomPart}`;
},
/* ===== 打印台绑定 ===== */
buildPrintRecordParams(page = 1) {
return {
page: Math.max(1, Number(page || 1)),
pageSize: 20,
where: {}
};
},
extractPrintRecordList(response) {
const list = response?.data?.list || response?.data?.data?.list;
return Array.isArray(list) ? list : [];
},
normalizePrintStations(list) {
return list
.map(item => {
const source = item && typeof item === 'object' ? item : {};
const id = String(source.id ?? source.print_station_id ?? source.printStationId ?? '').trim();
const name = String(source.name || source.station_name || source.print_station_name || '').trim();
const customBarcode = String(source.custom_barcode || '').trim();
return { id, name, customBarcode };
})
.filter(item => !!item.id && !!item.name);
},
async loadPrintStations(page = 1, autoAssign = false) {
try {
const response = await this.$http('print.getList', this.buildPrintRecordParams(page));
const list = this.extractPrintRecordList(response);
const stations = this.normalizePrintStations(list);
this.printStationList = stations;
if (autoAssign && stations.length && !this.printerId) {
this.printerId = stations[0]?.id || '';
this.printerName = stations[0]?.name || '';
}
} catch (error) {
console.warn('[splitOrder] 加载打印台列表失败:', error);
}
},
matchPrintStation(text) {
if (!text || !Array.isArray(this.printStationList) || !this.printStationList.length) {
uni.showToast({ title: '暂无可用打印台', icon: 'none' });
this.speakVoice('暂无打印台');
return;
}
const kw = text.toLowerCase();
const matched = this.printStationList.find(station =>
String(station.customBarcode || '').toLowerCase() === kw
|| String(station.name).toLowerCase() === kw
|| String(station.id).toLowerCase() === kw
);
if (matched) {
this.printerId = String(matched.id);
this.printerName = String(matched.name || '');
uni.showToast({ title: `已绑定打印台:${matched.name}`, icon: 'success' });
this.speakVoice('已绑定打印台');
} else {
uni.showToast({ title: '未匹配到打印台', icon: 'none' });
this.speakVoice('未绑定打印台');
}
},
handlePrinterSettings() {
this.printStationInputKeyword = '';
this.showPopup = true;
if (!this.printStationList.length) {
this.loadPrintStations(1, false);
}
},
handlePrintStationInput(value) {
const keyword = this.normalizeKeyword(value);
this.showPrintStationDropdown = false;
if (!keyword) return;
const exactMatch = this.printStationFilteredList.find(station => {
const kw = keyword.toLowerCase();
return String(station.name).toLowerCase() === kw
|| String(station.id).toLowerCase() === kw
|| String(station.customBarcode || '').toLowerCase() === kw;
});
if (exactMatch) {
this.handlePrintStationSelect(exactMatch);
}
},
handlePrintStationSelect(station) {
this.printerId = String(station?.id || '');
this.printerName = String(station?.name || '');
this.showPrintStationDropdown = false;
this.showPopup = false;
uni.showToast({ title: `已绑定打印台:${station.name}`, icon: 'success' });
this.speakVoice('已绑定打印台');
},
handlePrintStationInputConfirm() {
const keyword = this.normalizeKeyword(this.printStationInputKeyword);
if (!keyword) return;
if (this.printStationFilteredList.length > 0) {
this.handlePrintStationSelect(this.printStationFilteredList[0]);
}
},
handlePrintStationInputFocus() {
this.showPrintStationDropdown = false;
},
handlePrintStationInputBlur() {
setTimeout(() => {
this.showPrintStationDropdown = false;
}, 200);
}
}
};
</script>
<style lang="scss" scoped>
.split-order-page {
height: 100vh;
background: #f8f9fa;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* ===== 顶部栏 ===== */
.top-bar {
background: #ffffff;
flex-shrink: 0;
}
.status-bar {
height: var(--status-bar-height, 44rpx);
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.header-left {
display: flex;
align-items: center;
gap: 12rpx;
min-width: 100rpx;
}
.header-left__back {
display: flex;
align-items: center;
justify-content: center;
width: 56rpx;
height: 56rpx;
}
.header-left__divider {
width: 1rpx;
height: 32rpx;
background: #dcdfe6;
}
.header-title {
flex: 1;
padding: 0 16rpx;
font-size: 32rpx;
font-weight: bold;
color: #333;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.header-right {
min-width: 100rpx;
display: flex;
justify-content: flex-end;
}
.header-printer-text {
font-size: 28rpx;
color: #909399;
padding: 4rpx 12rpx;
border: 1rpx solid #dcdfe6;
border-radius: 6rpx;
white-space: nowrap;
}
.header-printer-text--bound {
color: #07c160;
border-color: #07c160;
}
/* ===== 手动输入开关按钮 ===== */
.manual-toggle-btn {
display: flex;
align-items: center;
justify-content: center;
width: 210rpx;
height: 52rpx;
background: #2979ff;
border-radius: 8rpx;
}
.manual-toggle-btn--active {
background: #fa8c16;
}
.manual-toggle-btn__text {
font-size: 28rprx;
color: #ffffff;
white-space: nowrap;
}
/* ===== 无权限 ===== */
.no-permission {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20rpx;
}
.no-permission-text {
font-size: 36rpx;
color: #909399;
}
/* ===== 搜索区 ===== */
.search-area {
padding: 20rpx 24rpx;
flex-shrink: 0;
}
.scan-section {
margin-bottom: 0;
}
.scan-row {
display: flex;
align-items: center;
gap: 12rpx;
}
.scan-input {
flex: 1;
height: 80rpx;
background: #f5f5f5;
border: 2rpx solid #dcdfe6;
border-radius: 12rpx;
padding: 0 20rpx;
font-size: 32rpx;
color: #303133;
}
.scan-camera-btn {
flex-shrink: 0;
width: 72rpx;
height: 72rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f0f7ff;
border: 2rpx solid #2979ff;
border-radius: 12rpx;
}
.scan-camera-btn:active {
opacity: 0.7;
}
/* ===== 订单信息卡 ===== */
.order-card {
margin: 0 12rpx;
background: #ffffff;
border-radius: 12rpx;
flex-shrink: 0;
overflow: hidden;
min-height: 300rpx;
}
.order-card__line {
display: flex;
align-items: center;
padding: 0 12rpx;
height: 88rpx;
}
.order-card__label {
width: 30%;
flex-shrink: 0;
padding: 16rpx 0;
border-radius: 6rpx;
font-size: 34rpx;
text-align: center;
}
.order-card__label--waybill {
background: #2979ff;
color: #ffffff;
}
.order-card__label--sub {
background: #2979ff;
color: #ffffff;
}
.order-card__text {
flex: 1;
text-align: center;
font-size: 36rpx;
color: #303133;
word-break: break-all;
}
.order-card__divider {
height: 1rpx;
background: #f2f3f5;
margin: 0 12rpx;
}
/* ===== 子单号区 ===== */
.order-card__sub-section {
padding: 12rpx 12rpx;
display: flex;
flex-direction: column;
gap: 12rpx;
min-height: 100rpx;
}
.order-card__sub-list {
display: flex;
flex-direction: column;
gap: 12rpx;
align-items: center;
}
.order-card__sub-empty {
font-size: 30rpx;
color: #c0c4cc;
}
.sub-tag {
width: 100%;
background: #f5f7fa;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 20rpx 36rpx;
text-align: center;
}
.sub-tag:active {
opacity: 0.7;
}
.sub-tag__text {
font-size: 36rpx;
color: #2979ff;
font-weight: 500;
}
/* ===== 操作按钮 ===== */
.order-card__actions {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 12rpx 12rpx 12rpx;
}
.action-btn {
text-align: center;
padding: 22rpx 0;
border-radius: 12rpx;
}
.action-btn:active {
opacity: 0.8;
}
.action-btn--split {
background: #e74c3c;
}
.action-btn--print {
background: #2979ff;
}
.action-btn--disabled {
opacity: 0.5;
}
.action-btn__text {
font-size: 32rpx;
color: #ffffff;
font-weight: 600;
}
/* ===== 弹性填充 ===== */
.flex-filler {
flex: 1;
min-height: 0;
}
/* ===== 空态 ===== */
.empty-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20rpx;
}
.empty-state__text {
font-size: 30rpx;
color: #909399;
}
/* ===== 拆单数量弹窗 ===== */
.split-popup {
width: 560rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 40rpx 32rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.split-popup__title {
font-size: 36rpx;
font-weight: 600;
color: #303133;
margin-bottom: 32rpx;
}
.split-popup__input-wrap {
width: 100%;
margin-bottom: 32rpx;
}
.split-popup__input-wrap ::v-deep .u-input__content__field-wrapper__field {
font-size: 48rpx !important;
text-align: center !important;
}
.split-popup__actions {
width: 100%;
display: flex;
gap: 20rpx;
}
.split-popup__btn {
flex: 1;
text-align: center;
padding: 22rpx 0;
border-radius: 12rpx;
}
.split-popup__btn:active {
opacity: 0.8;
}
.split-popup__btn--cancel {
background: #f5f5f5;
border: 1rpx solid #dcdfe6;
}
.split-popup__btn--confirm {
background: #2979ff;
}
.split-popup__btn-text {
font-size: 32rpx;
font-weight: 500;
}
.split-popup__btn--cancel .split-popup__btn-text {
color: #606266;
}
.split-popup__btn--confirm .split-popup__btn-text {
color: #ffffff;
}
/* ===== 打印台设置弹窗 ===== */
.print-popup {
height: 70vh;
background: #ffffff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
display: flex;
flex-direction: column;
}
.print-popup-scroll {
flex: 1;
padding: 48rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
}
.print-popup-title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
margin-bottom: 36rpx;
}
.print-row {
display: flex;
align-items: flex-start;
padding: 28rpx 0;
border-bottom: 1rpx solid #f2f3f5;
}
.print-row--station {
position: relative;
}
.print-row--station .print-label {
padding-top: 10rpx;
}
.print-label {
min-width: 130rpx;
width: 130rpx;
font-size: 36rpx;
line-height: 40rpx;
color: #909399;
}
.print-station-input-wrap {
flex: 1;
min-width: 0;
position: relative;
}
.print-station-dropdown {
position: absolute;
left: 0;
right: 0;
top: 100%;
max-height: 600rpx;
background: #ffffff;
border: 1rpx solid #ebeef5;
border-radius: 10rpx;
z-index: 10091;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
display: flex;
flex-direction: column;
}
.print-station-dropdown-scroll {
flex: 1;
max-height: 600rpx;
}
.print-station-option {
padding: 16rpx 20rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #303133;
}
.print-station-option + .print-station-option {
border-top: 1rpx solid #f2f3f5;
}
.print-station-option--active {
color: #2979ff;
}
.print-station-option--row {
display: flex;
align-items: center;
}
.station-option-name {
font-size: 36rpx;
color: #303133;
}
.station-option-code {
font-size: 32rpx;
color: #909399;
margin-left: 12rpx;
}
</style>