WMS_PDA/pages/packing/splitOrder.vue
2026-07-27 18:20:15 +08:00

1149 lines
29 KiB
Vue

<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 class="action-btn action-btn--split" @click="handleSplitOrder">
<text class="action-btn__text">拆单</text>
</view>
<view
v-if="subOrderList.length > 0"
class="action-btn action-btn--print"
@click="handlePrintAll"
>
<text class="action-btn__text">一键打印所有子面单</text>
</view>
</view>
</view>
<!-- 加载态 -->
<view v-if="loading" class="loading-state">
<u-loading-icon mode="circle" size="48"></u-loading-icon>
<text class="loading-state__text">{{ loadingText }}</text>
</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="{ fontSize: '36rpx', 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: '',
loading: false,
loadingText: '',
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;
}
this.scanKeyword = '';
this.currentWaybill = scanText;
this.queryOrder(scanText);
},
/* ===== 扫码/输入 ===== */
handleScanConfirm() {
const keyword = String(this.scanKeyword || '').trim();
if (!keyword) return;
this.scanKeyword = '';
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;
this.loading = true;
this.loadingText = '查询订单中...';
this.subOrderList = [];
try {
// 1. 查询待处理订单列表,按快递单号匹配
const listResponse = await this.$http('order.pendingOrder.list', {
pagination: {
page: 1,
pageSize: 20
},
where: {
waybill_codes: {
operator: 'eq',
type: 'text',
value: normalizedKeyword
}
},
sort: {
sortField: 'updated_at',
sortOrder: 'DESC'
}
});
if (listResponse?.flag === 'failure') {
const errMsg = String(listResponse?.message || listResponse?.msg || '订单查询失败');
uni.showToast({ title: errMsg, icon: 'none' });
this.speakVoice('无记录');
return;
}
const orderList = Array.isArray(listResponse?.data?.list) ? listResponse.data.list
: Array.isArray(listResponse?.data) ? listResponse.data
: [];
if (!orderList.length) {
uni.showToast({ title: '未查询到订单', icon: 'none' });
this.speakVoice('无记录');
return;
}
const matchedOrder = orderList.find(o =>
String(o.waybill_code || o.waybillCode || '').replace(/\s+/g, '') === normalizedKeyword
) || orderList[0];
const orderId = matchedOrder?.id || matchedOrder?.order_id || '';
if (!orderId) {
uni.showToast({ title: '未查询到订单', icon: 'none' });
this.speakVoice('无记录');
return;
}
this.orderId = orderId;
// 2. 获取订单详情(含子单信息)
const detailResponse = await this.$http('order.pendingOrder.detail', {
id: orderId,
ids: [orderId],
tableType: 'order'
});
if (detailResponse?.flag === 'failure') {
const errMsg = String(detailResponse?.message || detailResponse?.msg || '订单详情查询失败');
uni.showToast({ title: errMsg, icon: 'none' });
return;
}
const data = detailResponse?.data || detailResponse?.result || {};
this.orderInfo = this.normalizeOrderInfo(data);
this.subOrderList = this.normalizeSubOrders(data);
this.speakVoice('查询成功');
} catch (error) {
console.error('[splitOrder] 查询订单失败:', error);
uni.showToast({ title: '查询订单失败', icon: 'none' });
} finally {
this.loading = false;
}
},
normalizeOrderInfo(data) {
return {
id: data?.id || data?.order_id || '',
waybillCode: data?.waybill_code || data?.waybillCode || '',
orderNo: data?.order_no || data?.orderNo || ''
};
},
normalizeSubOrders(data) {
const list = Array.isArray(data?.sub_orders) ? data.sub_orders
: Array.isArray(data?.subOrders) ? data.subOrders
: Array.isArray(data?.children) ? data.children
: [];
return list.map(sub => ({
id: sub?.id || sub?.sub_order_id || sub?.order_id || '',
waybillCode: sub?.waybill_code || sub?.waybillCode || sub?.sub_waybill || ''
}));
},
/* ===== 拆单操作 ===== */
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;
this.loading = true;
this.loadingText = '分配子单号中...';
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 taskStatus = response?.data?.status || response?.status || '';
const taskMessage = response?.data?.message || response?.message || '拆单成功';
uni.showToast({ title: taskMessage, icon: 'success' });
this.speakVoice('拆单成功');
// 重新查询订单详情刷新子单列表
if (this.orderInfo?.id) {
try {
const detailResponse = await this.$http('order.pendingOrder.detail', {
id: this.orderInfo.id,
ids: [this.orderInfo.id],
tableType: 'order'
});
const data = detailResponse?.data || detailResponse?.result || {};
this.subOrderList = this.normalizeSubOrders(data);
} catch (e) {
console.warn('[splitOrder] 刷新子单列表失败:', e);
}
}
} catch (error) {
console.error('[splitOrder] 拆单失败:', error);
uni.showToast({ title: '拆单失败', icon: 'none' });
} finally {
this.loading = false;
}
},
/* ===== 单个子单打印 ===== */
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;
this.loading = true;
this.loadingText = '获取打印数据...';
try {
const printDataResponse = await this.$http('order.print.getOrderPrintData', {
order_ids: orderList.map(s => s.id)
});
const printPayload = this.extractOrderPrintPayload(printDataResponse);
const waveGroups = this.normalizeOrderPrintGroups(printPayload);
if (!waveGroups.length) {
uni.hideLoading();
uni.showToast({ title: '未获取到可打印数据', icon: 'none' });
return;
}
this.loadingText = '发送打印...';
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 {
this.loading = false;
}
},
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: 175rpx;
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 24rpx;
background: #ffffff;
border-radius: 12rpx;
flex-shrink: 0;
overflow: hidden;
}
.order-card__line {
display: flex;
align-items: center;
padding: 0 24rpx;
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 24rpx;
}
/* ===== 子单号区 ===== */
.order-card__sub-section {
padding: 12rpx 24rpx;
display: flex;
flex-direction: column;
gap: 12rpx;
}
.order-card__sub-list {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.order-card__sub-empty {
font-size: 30rpx;
color: #c0c4cc;
}
.sub-tag {
background: #f5f7fa;
border: 1rpx solid #dcdfe6;
border-radius: 8rpx;
padding: 16rpx 20rpx;
}
.sub-tag:active {
opacity: 0.7;
}
.sub-tag__text {
font-size: 30rpx;
color: #2979ff;
font-weight: 500;
}
/* ===== 操作按钮 ===== */
.order-card__actions {
display: flex;
flex-direction: column;
gap: 16rpx;
padding: 12rpx 24rpx 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;
}
/* ===== 空态 ===== */
.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;
}
/* ===== 加载态 ===== */
.loading-state {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.8);
gap: 16rpx;
z-index: 999;
}
.loading-state__text {
font-size: 28rpx;
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__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>