feat:产品入库模块

master
黄伟杰 4 days ago
parent 9e6807292c
commit c94787285f

@ -0,0 +1,73 @@
import request from '@/utils/request'
export function createProductInbound(data) {
return request({
url: '/admin-api/erp/stock-in/create',
method: 'post',
data: { ...data, inType: '产品入库' }
})
}
export function getProductInboundPage(params = {}) {
return request({
url: '/admin-api/erp/stock-in/page',
method: 'get',
params: { ...params, inType: '产品入库' }
})
}
export function getProductInboundDetail(id) {
return request({
url: '/admin-api/erp/stock-in/get',
method: 'get',
params: { id }
})
}
export function submitProductInbound(data) {
return request({
url: '/admin-api/erp/stock-in/submit',
method: 'put',
data
})
}
export function auditProductInbound(data) {
return request({
url: '/admin-api/erp/stock-in/audit',
method: 'put',
data
})
}
export function getTaskPage(params = {}) {
return request({
url: '/admin-api/mes/task/page',
method: 'get',
params
})
}
export function getTaskDefaultPackagingSchemes(taskId) {
return request({
url: '/admin-api/mes/task/task-detail/default-packaging-schemes',
method: 'get',
params: { taskId }
})
}
export function getPalletPage(params = {}) {
return request({
url: '/admin-api/erp/pallet/page',
method: 'get',
params
})
}
export function createPallet(data) {
return request({
url: '/admin-api/erp/pallet/create',
method: 'post',
data
})
}

@ -1390,5 +1390,141 @@ export default {
validatorRepairStatusRequired: 'Repair result is required',
validatorFinishDateRequired: 'Finish date is required',
validatorConfirmDateRequired: 'Confirm date is required'
},
productInbound: {
moduleName: 'Product Inbound',
createTitle: 'New Product Inbound',
detailTitle: 'Product Inbound Detail',
selectProductTitle: 'Select Product',
selectTaskTitle: 'Select Task Order',
selectTaskProductTitle: 'Select Task Product',
selectPalletTitle: 'Select Pallet',
createPalletTitle: 'New Pallet',
all: 'All',
reset: 'Reset',
clear: 'Clear',
loading: 'Loading...',
loadingMore: 'Loading more...',
noMoreData: 'No more data',
confirm: 'Confirm',
cancel: 'Cancel',
back: 'Back',
submit: 'OK',
submitting: 'Submitting...',
tip: 'Tip',
choose: 'Please select',
yes: 'Yes',
no: 'No',
statusPending: 'Pending Inbound',
statusAuditing: 'Pending Review',
statusStored: 'Stored',
statusRejected: 'Rejected',
searchDocumentPlaceholder: 'Enter document No.',
searchProductPlaceholder: 'Search product name/code/spec',
searchTaskPlaceholder: 'Search task order No.',
searchTaskProductPlaceholder: 'Search product name/code',
searchPalletPlaceholder: 'Search pallet code',
productInfo: 'Product Info',
inboundInfo: 'Inbound Info',
inboundTime: 'Inbound Time',
selectInboundTime: 'Select inbound time',
operator: 'Operator',
selectOperator: 'Select operator',
inboundQuantity: 'Inbound Quantity',
reviewer: 'Reviewer',
auditor: 'Auditor',
documentNo: 'Document No.',
inboundType: 'Inbound Type',
remark: 'Remark',
remarkPlaceholder: 'Enter remark',
attachment: 'Attachment',
chooseFile: 'Choose File',
itemList: 'Inbound List',
addProduct: 'Add Product',
product: 'Product',
pallet: 'Pallet',
packageCount: 'Packages',
pieceCount: 'Pieces',
inboundPackageCount: 'Inbound Packages',
inboundPieceCount: 'Inbound Pieces',
palletQuantity: 'Pallets',
taskOrder: 'Task Order',
taskProduct: 'Task Product',
emptyAddProduct: 'Please add a product',
emptyInboundList: 'No product inbound orders',
emptyItemList: 'No inbound items',
confirmInbound: 'Confirm Inbound',
inboundSuccess: 'Inbound successful',
saveFailed: 'Save failed',
loadFailed: 'Load failed',
detailLoadFailed: 'Failed to load detail',
operationFailed: 'Operation failed',
submitAudit: 'Submit Review',
auditPass: 'Approve',
auditReject: 'Reject',
auditPassSuccess: 'Approved',
auditRejectSuccess: 'Rejected',
submitAuditSuccess: 'Review submitted',
submitFailed: 'Submit failed',
selectAuditor: 'Select auditor',
selectInboundStatus: 'Select Inbound Status',
confirmAuditPass: 'Confirm approving this product inbound order?',
confirmAuditReject: 'Confirm rejecting this product inbound order?',
noDetailId: 'No detail ID',
completeProductPalletInfo: 'Complete product and pallet information',
addProductFirst: 'Please add a product first',
taskInfo: 'Task Info',
relatedTask: 'Related Task Order',
selectTask: 'Select task order',
selectTaskProduct: 'Select task product',
selectProduct: 'Select product',
selectPallet: 'Select pallet',
selectPalletFirst: 'Select pallet first',
selectTaskFirst: 'Select task order first',
selectProductFirst: 'Select product first',
emptyTaskProducts: 'No products for this task order',
completePalletInfo: 'Complete pallet warehouse/location/packages',
productAdded: 'Product added',
taskProductLoadFailed: 'Failed to load task products',
workOrderNo: 'Work Order No.',
code: 'Code',
packagingScheme: 'Packaging Scheme',
palletPackageQuantity: 'Packages per Pallet',
packageQuantity: 'Pieces per Package',
selectedPalletCount: '{count} pallet(s) selected',
selectedCount: '{count} selected',
packageUnit: '{count} pkg',
pieceUnit: '{count} pcs',
warehouse: 'Warehouse',
area: 'Area',
location: 'Location',
deliveryDate: 'Delivery Date',
emptyTask: 'No task orders',
emptyProduct: 'No product data',
emptyTaskProduct: 'No task products',
emptyPallet: 'No pallets',
spec: 'Spec',
unit: 'Unit',
palletCode: 'Pallet Code',
palletType: 'Pallet Type',
palletStatus: 'Pallet Status',
autoCode: 'Auto Code',
length: 'Length',
width: 'Width',
height: 'Height',
productCount: 'Packages',
ratedLoadWeight: 'Rated Load',
enterPalletCode: 'Enter pallet code',
selectPalletType: 'Select pallet type',
selectPalletStatus: 'Select pallet status',
enterPackageCount: 'Enter packages',
selectWarehouse: 'Select warehouse',
selectArea: 'Select area',
selectUnit: 'Select unit',
selectWarehouseFirst: 'Select warehouse first',
emptyArea: 'No areas',
enterRatedLoadWeight: 'Enter rated load',
createSuccess: 'Created successfully',
createPalletFailed: 'Failed to create pallet'
}
}

@ -136,6 +136,14 @@ const literalMap = {
'新增保养': 'moldMaintain.addTitle',
'更换压网': 'moldPressureNet.moduleName',
'压网历史': 'moldPressureNet.historyTitle'
, '产品入库': 'productInbound.moduleName',
'新增产品入库': 'productInbound.createTitle',
'产品入库详情': 'productInbound.detailTitle',
'选择产品': 'productInbound.selectProductTitle',
'选择托盘': 'productInbound.selectPalletTitle',
'新增托盘': 'productInbound.createPalletTitle',
'选择任务单': 'productInbound.selectTaskTitle',
'选择任务产品': 'productInbound.selectTaskProductTitle'
}
export function getCurrentLocale() {

@ -1394,6 +1394,142 @@ export default {
validatorFinishDateRequired: '请选择完成日期',
validatorConfirmDateRequired: '请选择验收日期'
},
productInbound: {
moduleName: '产品入库',
createTitle: '新增产品入库',
detailTitle: '产品入库详情',
selectProductTitle: '选择产品',
selectTaskTitle: '选择任务单',
selectTaskProductTitle: '选择任务产品',
selectPalletTitle: '选择托盘',
createPalletTitle: '新增托盘',
all: '全部',
reset: '重置',
clear: '清空',
loading: '加载中...',
loadingMore: '加载更多...',
noMoreData: '没有更多数据',
confirm: '确认',
cancel: '取消',
back: '返回',
submit: '确定',
submitting: '提交中...',
tip: '提示',
choose: '请选择',
yes: '是',
no: '否',
statusPending: '待入库',
statusAuditing: '待审核',
statusStored: '已入库',
statusRejected: '已驳回',
searchDocumentPlaceholder: '请输入单据编号',
searchProductPlaceholder: '搜索产品名称/编码/规格',
searchTaskPlaceholder: '搜索任务单号',
searchTaskProductPlaceholder: '搜索产品名称/编码',
searchPalletPlaceholder: '搜索托盘码',
productInfo: '产品信息',
inboundInfo: '入库信息',
inboundTime: '入库时间',
selectInboundTime: '请选择入库时间',
operator: '经办人',
selectOperator: '请选择经办人',
inboundQuantity: '入库数量',
reviewer: '审核人',
auditor: '审核人',
documentNo: '单据编号',
inboundType: '入库类型',
remark: '备注',
remarkPlaceholder: '请输入备注',
attachment: '附件',
chooseFile: '选择文件',
itemList: '入库清单',
addProduct: '添加产品',
product: '产品',
pallet: '托盘',
packageCount: '包数',
pieceCount: '个数',
inboundPackageCount: '入库包数',
inboundPieceCount: '入库个数',
palletQuantity: '托盘数量',
taskOrder: '任务单',
taskProduct: '任务产品',
emptyAddProduct: '请添加产品',
emptyInboundList: '暂无产品入库单',
emptyItemList: '暂无入库清单',
confirmInbound: '确认入库',
inboundSuccess: '入库成功',
saveFailed: '保存失败',
loadFailed: '加载失败',
detailLoadFailed: '详情加载失败',
operationFailed: '操作失败',
submitAudit: '提交审核',
auditPass: '审核通过',
auditReject: '审核驳回',
auditPassSuccess: '审核通过',
auditRejectSuccess: '已驳回',
submitAuditSuccess: '提交审核成功',
submitFailed: '提交失败',
selectAuditor: '请选择审核人',
selectInboundStatus: '选择入库状态',
confirmAuditPass: '确认审核通过该产品入库单?',
confirmAuditReject: '确认驳回该产品入库单?',
noDetailId: '暂无详情ID',
completeProductPalletInfo: '请完善产品和托盘信息',
addProductFirst: '请先添加产品',
taskInfo: '任务信息',
relatedTask: '关联任务单',
selectTask: '请选择任务单',
selectTaskProduct: '请选择任务产品',
selectProduct: '请选择产品',
selectPallet: '请选择托盘',
selectPalletFirst: '请先选择托盘',
selectTaskFirst: '请先选择任务单',
selectProductFirst: '请先选择产品',
emptyTaskProducts: '当前任务单暂无产品',
completePalletInfo: '请完善托盘仓库/库位/包数',
productAdded: '已添加产品',
taskProductLoadFailed: '任务产品加载失败',
workOrderNo: '工单号',
code: '编码',
packagingScheme: '包装方案',
palletPackageQuantity: '每托包数',
packageQuantity: '每包个数',
selectedPalletCount: '已选择 {count} 个托盘',
selectedCount: '已选 {count} 个',
packageUnit: '{count} 包',
pieceUnit: '{count} 个',
warehouse: '仓库',
area: '库区',
location: '库位',
deliveryDate: '交付日期',
emptyTask: '暂无任务单',
emptyProduct: '暂无产品数据',
emptyTaskProduct: '暂无任务产品',
emptyPallet: '暂无托盘',
spec: '规格',
unit: '单位',
palletCode: '托盘码',
palletType: '托盘类型',
palletStatus: '托盘状态',
autoCode: '自动编码',
length: '长',
width: '宽',
height: '高',
productCount: '包数',
ratedLoadWeight: '额定载重',
enterPalletCode: '请输入托盘码',
selectPalletType: '请选择托盘类型',
selectPalletStatus: '请选择托盘状态',
enterPackageCount: '请输入包数',
selectWarehouse: '请选择仓库',
selectArea: '请选择库区',
selectUnit: '请选择单位',
selectWarehouseFirst: '请先选择仓库',
emptyArea: '暂无库区',
enterRatedLoadWeight: '请输入额定载重',
createSuccess: '新增成功',
createPalletFailed: '新增托盘失败'
},
sparepartInbound: {
moduleName: '备件入库',
tabPending: '待入库',

@ -395,6 +395,69 @@
"navigationStyle": "custom"
}
},
{
"path": "productInbound/index",
"style": {
"navigationBarTitleText": "产品入库",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/create",
"style": {
"navigationBarTitleText": "新增产品入库",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/detail",
"style": {
"navigationBarTitleText": "产品入库详情",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/productSelect",
"style": {
"navigationBarTitleText": "选择产品",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/productConfirm",
"style": {
"navigationBarTitleText": "新增产品入库",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/palletSelect",
"style": {
"navigationBarTitleText": "选择托盘",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/palletCreate",
"style": {
"navigationBarTitleText": "新增托盘",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/taskSelect",
"style": {
"navigationBarTitleText": "选择任务单",
"navigationStyle": "custom"
}
},
{
"path": "productInbound/taskProductSelect",
"style": {
"navigationBarTitleText": "选择任务产品",
"navigationStyle": "custom"
}
},
{
"path": "sparepartOutbound/index",
"style": {

@ -63,7 +63,7 @@ const selectedId = ref('')
const searchText = ref('')
const userList = ref([])
const loading = ref(false)
const fromSource = ref('moldRepair') // moldRepair | sparepartInbound | sparepartOutbound
const fromSource = ref('moldRepair') // moldRepair | sparepartInbound | sparepartOutbound | productInbound
let searchTimer = null
const pageTitle = computed(() => {
@ -124,7 +124,11 @@ function handleConfirm() {
return
}
// 使 globalData key
const keyMap = { sparepartInbound: '_sparepartInboundUserSelectResult', sparepartOutbound: '_sparepartOutboundUserSelectResult' }
const keyMap = {
sparepartInbound: '_sparepartInboundUserSelectResult',
sparepartOutbound: '_sparepartOutboundUserSelectResult',
productInbound: '_productInboundUserSelectResult'
}
const key = keyMap[fromSource.value] || '_moldRepairUserSelectResult'
getApp().globalData[key] = {
field: field.value === 'confirmBy' ? 'confirmBy' : 'acceptedBy',

@ -0,0 +1,365 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.createTitle')" />
<scroll-view scroll-y class="detail-scroll">
<view class="content-section">
<view class="section-card">
<view class="section-header">
<view class="section-icon">
<uni-icons type="compose" size="24" color="#1f7cff"></uni-icons>
</view>
<text class="section-title">{{ t('productInbound.inboundInfo') }}</text>
</view>
<view class="form-field">
<text class="form-label">{{ t('productInbound.inboundTime') }}<text class="required-star">*</text></text>
<picker mode="date" :value="inboundDate" @change="handleDateChange">
<view class="select-field">
<text :class="['select-text', inboundDate ? '' : 'placeholder']">{{ inboundDate || t('productInbound.selectInboundTime') }}</text>
<uni-icons type="calendar" size="18" color="#9ca3af"></uni-icons>
</view>
</picker>
</view>
<view class="form-field">
<text class="form-label">{{ t('productInbound.operator') }}<text class="required-star">*</text></text>
<view class="select-field" @click="goSelectOperator">
<text :class="['select-text', selectedOperatorName ? '' : 'placeholder']">{{ selectedOperatorName || t('productInbound.selectOperator') }}</text>
<uni-icons type="right" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
<view class="form-field">
<text class="form-label">{{ t('productInbound.remark') }}</text>
<textarea v-model="remark" class="form-textarea" :placeholder="t('productInbound.remarkPlaceholder')" placeholder-class="placeholder-text" maxlength="500" />
</view>
<view class="form-field">
<text class="form-label">{{ t('productInbound.attachment') }}</text>
<view class="attachment-upload" @click="handleAddAttachment">
<uni-icons type="paperclip" size="20" color="#1f7cff"></uni-icons>
<text>{{ t('productInbound.chooseFile') }}</text>
</view>
<view v-if="attachmentList.length" class="attachment-list">
<view v-for="(file, idx) in attachmentList" :key="idx" class="attachment-item">
<view class="attachment-main">
<uni-icons type="paperclip" size="16" color="#64748b"></uni-icons>
<text class="attachment-name">{{ file.name }}</text>
</view>
<view class="attachment-delete" @click="removeAttachment(idx)">
<uni-icons type="closeempty" size="18" color="#ef4444"></uni-icons>
</view>
</view>
</view>
</view>
</view>
<view class="section-card">
<view class="section-header list-header">
<view class="section-title-wrap">
<view class="section-icon">
<uni-icons type="list" size="24" color="#1f7cff"></uni-icons>
</view>
<text class="section-title">{{ t('productInbound.itemList') }}</text>
</view>
<view class="add-product-btn" @click="handleAddProduct">
<uni-icons type="plusempty" size="16" color="#1f7cff"></uni-icons>
<text>{{ t('productInbound.addProduct') }}</text>
</view>
</view>
<view v-if="itemList.length" class="summary-strip">
<view class="summary-item">
<text class="summary-value">{{ itemList.length }}</text>
<text class="summary-label">{{ t('productInbound.product') }}</text>
</view>
<view class="summary-item">
<text class="summary-value">{{ totalPalletCount }}</text>
<text class="summary-label">{{ t('productInbound.pallet') }}</text>
</view>
<view class="summary-item">
<text class="summary-value">{{ totalInputCount }}</text>
<text class="summary-label">{{ t('productInbound.packageCount') }}</text>
</view>
<view class="summary-item">
<text class="summary-value">{{ totalPieceCount }}</text>
<text class="summary-label">{{ t('productInbound.pieceCount') }}</text>
</view>
</view>
<view v-if="itemList.length" class="item-list">
<view v-for="(item, idx) in itemList" :key="idx" class="item-card">
<view class="image-box">
<image v-if="getItemImage(item)" :src="getItemImage(item)" class="item-image" mode="aspectFill" />
<uni-icons v-else type="image" size="34" color="#cbd5e1"></uni-icons>
</view>
<view class="item-info">
<view class="item-header">
<text class="item-name">{{ textValue(item.productName) }}</text>
<view class="delete-btn" @click="removeItem(idx)">
<uni-icons type="trash" size="18" color="#ef4444"></uni-icons>
</view>
</view>
<view class="info-grid">
<view class="info-cell">
<text class="info-label">{{ t('productInbound.inboundPackageCount') }}</text>
<text class="info-value">{{ textValue(item.inputCount) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.inboundPieceCount') }}</text>
<text class="info-value">{{ textValue(item.count) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.palletQuantity') }}</text>
<text class="info-value">{{ getPalletCount(item) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.taskOrder') }}</text>
<text class="info-value">{{ item.relateTask ? textValue(item.taskCode) : t('productInbound.no') }}</text>
</view>
</view>
</view>
</view>
</view>
<view v-else class="empty-card" @click="handleAddProduct">
<uni-icons type="plusempty" size="30" color="#94a3b8"></uni-icons>
<text>{{ t('productInbound.emptyAddProduct') }}</text>
</view>
</view>
</view>
</scroll-view>
<view class="action-bar">
<view class="action-btn back-btn" @click="handleCancel">{{ t('productInbound.cancel') }}</view>
<view class="action-btn submit-btn" @click="handleSubmit">{{ t('productInbound.confirmInbound') }}</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { createProductInbound } from '@/api/mes/productInbound'
const { t } = useI18n()
const itemList = ref([])
const inboundDate = ref(formatDate(new Date()))
const selectedOperatorId = ref(null)
const selectedOperatorName = ref('')
const remark = ref('')
const attachmentList = ref([])
const totalPalletCount = computed(() => itemList.value.reduce((sum, item) => sum + getPalletCount(item), 0))
const totalInputCount = computed(() => itemList.value.reduce((sum, item) => sum + (Number(item.inputCount) || 0), 0))
const totalPieceCount = computed(() => itemList.value.reduce((sum, item) => sum + (Number(item.count) || 0), 0))
function formatDate(date) {
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
const d = String(date.getDate()).padStart(2, '0')
return `${y}-${m}-${d}`
}
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
function handleDateChange(e) {
inboundDate.value = e.detail.value
}
function handleAddProduct() {
uni.navigateTo({ url: '/pages_function/pages/productInbound/productConfirm' })
}
function goSelectOperator() {
getApp().globalData._productInboundUserFrom = 'inbound'
uni.navigateTo({ url: '/pages_function/pages/moldRepair/userSelect?field=operator&from=productInbound' })
}
function getItemImage(item) {
const images = item.images || item._product?.images
if (!images) return ''
if (Array.isArray(images)) return String(images[0] || '')
return String(images).split(',')[0]?.trim() || ''
}
function getPalletCount(item) {
return Array.isArray(item.pallets) ? item.pallets.length : 0
}
function removeItem(idx) {
itemList.value.splice(idx, 1)
getApp().globalData._productInboundItems = [...itemList.value]
}
function handleCancel() {
getApp().globalData._productInboundItems = []
uni.navigateBack()
}
function handleAddAttachment() {
// #ifdef APP-PLUS
plus.gallery.pick(
(res) => {
const files = (res?.files || []).map((f) => ({
name: f.name || 'unknown',
size: f.size || 0,
path: f
}))
attachmentList.value.push(...files)
},
() => {},
{ filter: 'all', multiple: true, maximum: 9 - attachmentList.value.length }
)
// #endif
// #ifndef APP-PLUS
uni.chooseImage({
count: 9 - attachmentList.value.length,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
res.tempFilePaths.forEach((path) => {
const parts = path.split('/')
attachmentList.value.push({ name: parts[parts.length - 1] || 'image.jpg', size: 0, path })
})
}
})
// #endif
}
function removeAttachment(idx) {
attachmentList.value.splice(idx, 1)
}
function buildInTime() {
const now = new Date()
const [y, m, d] = inboundDate.value.split('-').map(Number)
return new Date(y, m - 1, d, now.getHours(), now.getMinutes(), now.getSeconds()).getTime()
}
function normalizeItemsForSubmit() {
return itemList.value.map((item) => ({
warehouseId: item.warehouseId,
areaId: item.areaId,
productId: item.productId,
productName: item.productName,
productBarCode: item.productBarCode,
productUnitName: item.productUnitName,
inputUnitType: item.inputUnitType || '个',
inputCount: item.inputCount,
count: item.count,
relateTask: item.relateTask === true || item.relateTask === 1 || item.relateTask === '1',
taskId: item.relateTask ? item.taskId : null,
taskDetailIds: item.taskDetailIds,
packagingSchemeRelationId: item.packagingSchemeRelationId,
packagingSchemeId: item.packagingSchemeId,
packagingSchemeName: item.packagingSchemeName,
packageQuantity: item.packageQuantity,
palletPackageQuantity: item.palletPackageQuantity,
palletTotalQuantity: item.palletTotalQuantity,
pallets: Array.isArray(item.pallets) ? item.pallets : []
}))
}
async function handleSubmit() {
if (!itemList.value.length) {
uni.showToast({ title: t('productInbound.addProductFirst'), icon: 'none' })
return
}
if (!inboundDate.value) {
uni.showToast({ title: t('productInbound.selectInboundTime'), icon: 'none' })
return
}
if (!selectedOperatorId.value) {
uni.showToast({ title: t('productInbound.selectOperator'), icon: 'none' })
return
}
const invalid = itemList.value.find((item) => !item.productId || !Array.isArray(item.pallets) || item.pallets.length === 0)
if (invalid) {
uni.showToast({ title: t('productInbound.completeProductPalletInfo'), icon: 'none' })
return
}
const items = normalizeItemsForSubmit()
const totalCount = items.reduce((sum, item) => sum + (Number(item.count) || 0), 0)
const submitData = {
isCode: true,
inTime: buildInTime(),
inType: '产品入库',
stockUserId: String(selectedOperatorId.value),
status: 0,
totalCount,
totalPrice: 0,
remark: remark.value,
items
}
if (attachmentList.value.length) {
submitData.attachments = attachmentList.value.map((f) => f.path || f)
}
uni.showLoading({ title: t('productInbound.submitting'), mask: true })
try {
await createProductInbound(submitData)
uni.hideLoading()
getApp().globalData._productInboundItems = []
uni.showToast({ title: t('productInbound.inboundSuccess'), icon: 'success' })
setTimeout(() => uni.navigateBack(), 1200)
} catch (e) {
uni.hideLoading()
const msg = e?.message || e?.data?.msg || e?.response?.data?.msg || t('productInbound.saveFailed')
uni.showToast({ title: String(msg).substring(0, 50), icon: 'none' })
}
}
onShow(() => {
const items = getApp().globalData?._productInboundItems
if (Array.isArray(items)) itemList.value = [...items]
const userResult = getApp().globalData?._productInboundUserSelectResult
if (userResult) {
selectedOperatorId.value = userResult.user.id
selectedOperatorName.value = userResult.user.nickname || userResult.user.userName || userResult.user.name || ''
getApp().globalData._productInboundUserSelectResult = null
}
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; }
.detail-scroll { height: calc(100vh - 172rpx); }
.content-section { padding: 20rpx 24rpx 28rpx; }
.section-card { background: #ffffff; border-radius: 20rpx; padding: 24rpx; margin-bottom: 20rpx; border: 1rpx solid #eef2f7; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.section-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 22rpx; padding-bottom: 18rpx; border-bottom: 1rpx solid #f1f5f9; }
.section-icon { width: 40rpx; height: 40rpx; border-radius: 10rpx; background: #eff6ff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.section-title { font-size: 32rpx; font-weight: 600; color: #1f2937; }
.section-title-wrap { display: flex; align-items: center; gap: 12rpx; min-width: 0; }
.list-header { justify-content: space-between; gap: 16rpx; }
.form-field { display: flex; flex-direction: column; gap: 12rpx; }
.form-field + .form-field { margin-top: 24rpx; }
.form-label { font-size: 26rpx; color: #4b5563; font-weight: 500; }
.required-star { color: #ef4444; font-size: 28rpx; margin-left: 4rpx; }
.select-field { display: flex; align-items: center; justify-content: space-between; padding: 0 24rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; }
.select-text { flex: 1; min-width: 0; font-size: 28rpx; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.placeholder, .placeholder-text { color: #9ca3af; }
.form-textarea { width: 100%; min-height: 120rpx; background: #f8fafc; border-radius: 14rpx; padding: 18rpx 24rpx; font-size: 28rpx; color: #374151; box-sizing: border-box; }
.attachment-upload { height: 76rpx; border-radius: 14rpx; border: 1rpx dashed #bfdbfe; background: #eff6ff; color: #1f7cff; display: flex; align-items: center; justify-content: center; gap: 10rpx; font-size: 26rpx; font-weight: 600; }
.attachment-list { margin-top: 12rpx; display: flex; flex-direction: column; gap: 10rpx; }
.attachment-item { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; padding: 16rpx 18rpx; background: #f8fafc; border-radius: 12rpx; }
.attachment-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10rpx; }
.attachment-name { flex: 1; min-width: 0; font-size: 24rpx; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-delete { width: 44rpx; height: 44rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.add-product-btn { height: 60rpx; padding: 0 18rpx; border-radius: 999rpx; border: 1rpx solid #bfdbfe; background: #eff6ff; color: #1f7cff; font-size: 24rpx; font-weight: 600; display: flex; align-items: center; gap: 8rpx; flex-shrink: 0; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); background: #f8fafc; border: 1rpx solid #e8eef6; border-radius: 16rpx; overflow: hidden; margin-bottom: 18rpx; }
.summary-item { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6rpx; padding: 16rpx 8rpx; border-right: 1rpx solid #eef2f7; }
.summary-item:last-child { border-right: 0; }
.summary-value { max-width: 100%; font-size: 30rpx; font-weight: 700; color: #1f4b79; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-label { font-size: 22rpx; color: #8a94a6; }
.item-list { display: flex; flex-direction: column; gap: 18rpx; }
.item-card { display: flex; gap: 18rpx; padding: 20rpx; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 18rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.image-box { width: 128rpx; height: 128rpx; border-radius: 16rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.item-image { width: 100%; height: 100%; }
.item-info { flex: 1; min-width: 0; }
.item-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 14rpx; }
.item-name { flex: 1; min-width: 0; font-size: 30rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delete-btn { width: 48rpx; height: 48rpx; border-radius: 24rpx; background: #fef2f2; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12rpx; }
.info-cell { min-width: 0; display: flex; flex-direction: column; gap: 4rpx; }
.info-label { font-size: 22rpx; color: #9ca3af; }
.info-value { font-size: 26rpx; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-card { min-height: 220rpx; border: 2rpx dashed #d7dde8; border-radius: 18rpx; background: #f8fafc; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14rpx; color: #94a3b8; font-size: 27rpx; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 18rpx; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.action-btn { flex: 1; height: 84rpx; border-radius: 16rpx; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.back-btn { background: #eef2f7; color: #475569; }
.submit-btn { background: #1f4b79; color: #ffffff; }
</style>

@ -0,0 +1,404 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.detailTitle')" />
<scroll-view scroll-y class="detail-scroll">
<view class="content-section">
<view class="section-card">
<view class="section-header">
<view class="section-icon">
<uni-icons type="compose" size="24" color="#1f7cff"></uni-icons>
</view>
<text class="section-title">{{ t('productInbound.inboundInfo') }}</text>
<text :class="['status-tag', statusClass(detail.status)]">{{ statusText(detail.status) }}</text>
</view>
<view v-if="loading" class="loading-card">{{ t('productInbound.loading') }}</view>
<template v-else>
<view class="readonly-grid">
<view class="readonly-item">
<text class="readonly-label">{{ t('productInbound.documentNo') }}</text>
<text class="readonly-value">{{ textValue(detail.no) }}</text>
</view>
<view class="readonly-item">
<text class="readonly-label">{{ t('productInbound.inboundType') }}</text>
<text class="readonly-value">{{ textValue(detail.inType) }}</text>
</view>
<view class="readonly-item">
<text class="readonly-label">{{ t('productInbound.inboundTime') }}</text>
<text class="readonly-value">{{ formatDateTime(detail.inTime || detail.createTime) }}</text>
</view>
<view class="readonly-item">
<text class="readonly-label">{{ t('productInbound.operator') }}</text>
<text class="readonly-value">{{ textValue(getStockUserName(detail)) }}</text>
</view>
<view class="readonly-item">
<text class="readonly-label">{{ t('productInbound.inboundQuantity') }}</text>
<text class="readonly-value highlight">{{ textValue(detail.totalCount) }}</text>
</view>
<view class="readonly-item">
<text class="readonly-label">{{ t('productInbound.reviewer') }}</text>
<text class="readonly-value">{{ textValue(detail.auditUserName) }}</text>
</view>
</view>
<view class="form-field">
<text class="form-label">{{ t('productInbound.remark') }}</text>
<view class="readonly-box">{{ textValue(detail.remark) }}</view>
</view>
<view v-if="attachmentList.length" class="form-field">
<text class="form-label">{{ t('productInbound.attachment') }}</text>
<view class="attachment-list">
<view v-for="(file, idx) in attachmentList" :key="idx" class="attachment-item">
<uni-icons type="paperclip" size="16" color="#64748b"></uni-icons>
<text class="attachment-name">{{ textValue(getAttachmentName(file, idx)) }}</text>
</view>
</view>
</view>
</template>
</view>
<view class="section-card">
<view class="section-header list-header">
<view class="section-title-wrap">
<view class="section-icon">
<uni-icons type="list" size="24" color="#1f7cff"></uni-icons>
</view>
<text class="section-title">{{ t('productInbound.itemList') }}</text>
</view>
</view>
<view v-if="itemList.length" class="summary-strip">
<view class="summary-item">
<text class="summary-value">{{ itemList.length }}</text>
<text class="summary-label">{{ t('productInbound.product') }}</text>
</view>
<view class="summary-item">
<text class="summary-value">{{ totalPalletCount }}</text>
<text class="summary-label">{{ t('productInbound.pallet') }}</text>
</view>
<view class="summary-item">
<text class="summary-value">{{ totalInputCount }}</text>
<text class="summary-label">{{ t('productInbound.packageCount') }}</text>
</view>
<view class="summary-item">
<text class="summary-value">{{ totalPieceCount }}</text>
<text class="summary-label">{{ t('productInbound.pieceCount') }}</text>
</view>
</view>
<view v-if="itemList.length" class="item-list">
<view v-for="(item, idx) in itemList" :key="item.id || idx" class="item-card">
<view class="item-header">
<text class="item-name">{{ textValue(item.productName) }}</text>
<text class="item-code">{{ textValue(item.productBarCode || item.productCode) }}</text>
</view>
<view class="info-grid">
<view class="info-cell">
<text class="info-label">{{ t('productInbound.inboundPackageCount') }}</text>
<text class="info-value">{{ textValue(getItemInputCount(item)) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.inboundPieceCount') }}</text>
<text class="info-value">{{ textValue(getItemPieceCount(item)) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.taskOrder') }}</text>
<text class="info-value">{{ isRelatedTask(item) ? textValue(item.taskCode || item.taskName) : t('productInbound.no') }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.packagingScheme') }}</text>
<text class="info-value">{{ textValue(item.packagingSchemeName) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.palletPackageQuantity') }}</text>
<text class="info-value">{{ textValue(item.palletPackageQuantity) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.packageQuantity') }}</text>
<text class="info-value">{{ textValue(item.packageQuantity) }}</text>
</view>
</view>
<view v-if="getPallets(item).length" class="pallet-list">
<view v-for="(pallet, pIndex) in getPallets(item)" :key="pallet.palletId || pallet.id || pIndex" class="pallet-card">
<view class="pallet-top">
<text class="pallet-code">{{ textValue(getPalletCode(pallet)) }}</text>
<text class="pallet-count">{{ t('productInbound.packageUnit', { count: textValue(pallet.packageCount) }) }}</text>
</view>
<view class="pallet-grid">
<view class="pallet-cell">
<text class="pallet-label">{{ t('productInbound.warehouse') }}</text>
<text class="pallet-value">{{ textValue(getWarehouseDisplay(pallet, item)) }}</text>
</view>
<view class="pallet-cell">
<text class="pallet-label">{{ t('productInbound.location') }}</text>
<text class="pallet-value">{{ textValue(getAreaDisplay(pallet, item)) }}</text>
</view>
<view class="pallet-cell">
<text class="pallet-label">{{ t('productInbound.pieceCount') }}</text>
<text class="pallet-value">{{ textValue(getPalletPieceCount(pallet, item)) }}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-else class="empty-card">{{ loading ? t('productInbound.loading') : t('productInbound.emptyItemList') }}</view>
</view>
</view>
</scroll-view>
<view class="action-bar">
<view class="action-btn back-btn" @click="handleBack">{{ t('productInbound.back') }}</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getProductInboundDetail } from '@/api/mes/productInbound'
import { getWarehouseAreaSimpleList, getWarehouseSimpleList, getSimpleUserList } from '@/api/mes/moldget'
const { t } = useI18n()
const detailId = ref(null)
const detail = ref({})
const loading = ref(false)
const userOptions = ref([])
const warehouseOptions = ref([])
const warehouseAreaMap = ref({})
const itemList = computed(() => normalizeItems(detail.value))
const attachmentList = computed(() => normalizeAttachments(detail.value))
const totalPalletCount = computed(() => itemList.value.reduce((sum, item) => sum + getPallets(item).length, 0))
const totalInputCount = computed(() => itemList.value.reduce((sum, item) => sum + (Number(getItemInputCount(item)) || 0), 0))
const totalPieceCount = computed(() => itemList.value.reduce((sum, item) => sum + (Number(getItemPieceCount(item)) || 0), 0))
function normalizeResponse(res) {
return res && res.data !== undefined ? res.data : res
}
function normalizeItems(row) {
const list = row?.items || row?.itemList || row?.stockInItems || row?.stockInItemList || []
return Array.isArray(list) ? list : []
}
function normalizeAttachments(row) {
const raw = row?.fileUrl || row?.attachments || row?.attachmentList || row?.files
if (!raw) return []
if (Array.isArray(raw)) return raw
return String(raw).split(',').map((item) => item.trim()).filter(Boolean)
}
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
function formatDateTime(value) {
if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) {
const [year, month, day] = value
return `${year}-${pad(month)}-${pad(day)}`
}
const raw = typeof value === 'string' && /^\d+$/.test(value) ? Number(value) : value
const date = new Date(raw)
if (Number.isNaN(date.getTime())) return String(value)
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
}
function pad(n) {
return String(n).padStart(2, '0')
}
function statusText(s) {
const map = {
0: t('productInbound.statusPending'),
10: t('productInbound.statusAuditing'),
20: t('productInbound.statusStored'),
1: t('productInbound.statusRejected')
}
const num = Number(s)
return map[num] || textValue(s)
}
function statusClass(s) {
const num = Number(s)
if (num === 0) return 'text-primary'
if (num === 10) return 'text-warning'
if (num === 20) return 'text-success'
if (num === 1) return 'text-danger'
return ''
}
function getStockUserName(row) {
if (row?.stockUserName) return row.stockUserName
const userId = row?.stockUserId
return userOptions.value.find((item) => String(item.value) === String(userId))?.label || userId
}
function getAttachmentName(file, index) {
if (file?.name) return file.name
const text = String(file?.url || file?.path || file || '')
const name = text.split('/').pop()
return name || `${t('productInbound.attachment')}${index + 1}`
}
function isRelatedTask(item) {
const v = item?.relateTask ?? item?.relatedTask
return v === true || v === 1 || v === '1'
}
function getItemInputCount(item) {
return item?.inputCount ?? item?.packageCount ?? item?.count
}
function getItemPieceCount(item) {
return item?.count ?? ((Number(item?.inputCount) || 0) * (Number(item?.packageQuantity) || 1))
}
function getPallets(item) {
if (Array.isArray(item?.pallets)) return item.pallets
if (item?.palletId || item?.palletCode) {
return [{
palletId: item.palletId,
palletCode: item.palletCode,
packageCount: item.packageCount ?? item.inputCount,
warehouseId: item.warehouseId,
warehouseName: item.warehouseName,
areaId: item.areaId,
areaName: item.areaName,
count: item.count
}]
}
return []
}
function getPalletCode(pallet) {
return pallet?.palletCode || pallet?.code || pallet?.pallet?.code || pallet?.palletId || ''
}
function getPalletPieceCount(pallet, item) {
return pallet?.count ?? ((Number(pallet?.packageCount) || 0) * (Number(item?.packageQuantity) || 1))
}
function getWarehouseDisplay(pallet, item) {
const id = pallet?.warehouseId ?? item?.warehouseId
return pallet?.warehouseName || item?.warehouseName || warehouseOptions.value.find((w) => String(w.value) === String(id))?.label || id
}
function getAreaDisplay(pallet, item) {
const warehouseId = pallet?.warehouseId ?? item?.warehouseId
const areaId = pallet?.areaId ?? item?.areaId
const areas = warehouseAreaMap.value[String(warehouseId)] || []
return pallet?.areaName || item?.areaName || areas.find((a) => String(a.value) === String(areaId))?.label || areaId
}
async function loadUsers() {
try {
const res = await getSimpleUserList()
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
userOptions.value = data.map((u) => ({
value: u.id || u.userId,
label: u.nickname || u.userName || u.name || String(u.id || '')
}))
} catch (e) {}
}
async function loadWarehouses() {
try {
const res = await getWarehouseSimpleList()
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseOptions.value = data.map((w) => ({ value: w.id, label: w.name || String(w.id || '') }))
} catch (e) {}
}
async function loadAreasForWarehouse(warehouseId) {
if (!warehouseId || warehouseAreaMap.value[String(warehouseId)]) return
try {
const res = await getWarehouseAreaSimpleList(warehouseId)
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseAreaMap.value = {
...warehouseAreaMap.value,
[String(warehouseId)]: data.map((a) => ({ value: a.id, label: a.name || a.areaName || String(a.id || '') }))
}
} catch (e) {
warehouseAreaMap.value = { ...warehouseAreaMap.value, [String(warehouseId)]: [] }
}
}
async function loadAreasForDetail() {
const ids = new Set()
itemList.value.forEach((item) => {
if (item.warehouseId) ids.add(item.warehouseId)
getPallets(item).forEach((pallet) => {
const id = pallet.warehouseId ?? item.warehouseId
if (id) ids.add(id)
})
})
await Promise.all(Array.from(ids).map((id) => loadAreasForWarehouse(id)))
}
async function loadDetail() {
if (!detailId.value) return
loading.value = true
try {
const res = await getProductInboundDetail(detailId.value)
detail.value = normalizeResponse(res) || {}
await loadAreasForDetail()
} catch (e) {
uni.showToast({ title: t('productInbound.detailLoadFailed'), icon: 'none' })
} finally {
loading.value = false
}
}
function handleBack() {
uni.navigateBack()
}
onLoad(async (options) => {
detailId.value = options?.id || null
await Promise.all([loadUsers(), loadWarehouses()])
await loadDetail()
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; }
.detail-scroll { height: calc(100vh - 172rpx); }
.content-section { padding: 20rpx 24rpx 28rpx; }
.section-card { background: #ffffff; border-radius: 20rpx; padding: 24rpx; margin-bottom: 20rpx; border: 1rpx solid #eef2f7; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.section-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 22rpx; padding-bottom: 18rpx; border-bottom: 1rpx solid #f1f5f9; }
.section-icon { width: 40rpx; height: 40rpx; border-radius: 10rpx; background: #eff6ff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.section-title { font-size: 32rpx; font-weight: 600; color: #1f2937; }
.section-title-wrap { display: flex; align-items: center; gap: 12rpx; min-width: 0; }
.list-header { justify-content: space-between; gap: 16rpx; }
.status-tag { margin-left: auto; flex-shrink: 0; padding: 8rpx 18rpx; border-radius: 999rpx; font-size: 22rpx; line-height: 1; background: #e2e8f0; color: #64748b; }
.status-tag.text-success { color: #15803d; background: #dcfce7; }
.status-tag.text-danger { color: #dc2626; background: #fee2e2; }
.status-tag.text-warning { color: #d97706; background: #fef3c7; }
.status-tag.text-primary { color: #1d4ed8; background: #dbeafe; }
.loading-card, .empty-card { min-height: 180rpx; border: 2rpx dashed #d7dde8; border-radius: 18rpx; background: #f8fafc; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 27rpx; }
.readonly-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 14rpx; overflow: hidden; }
.readonly-item { min-width: 0; display: flex; flex-direction: column; gap: 8rpx; padding: 18rpx 20rpx; border-right: 1rpx solid #f1f5f9; border-bottom: 1rpx solid #f1f5f9; }
.readonly-item:nth-child(2n) { border-right: 0; }
.readonly-label { font-size: 23rpx; color: #8a94a6; }
.readonly-value { font-size: 27rpx; color: #334155; line-height: 1.35; word-break: break-all; }
.readonly-value.highlight { color: #1f4b79; font-weight: 700; }
.form-field { display: flex; flex-direction: column; gap: 12rpx; margin-top: 24rpx; }
.form-label { font-size: 26rpx; color: #4b5563; font-weight: 500; }
.readonly-box { min-height: var(--app-form-control-height, 70rpx); padding: 18rpx 24rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; font-size: 28rpx; color: #374151; line-height: 1.45; }
.attachment-list { display: flex; flex-direction: column; gap: 10rpx; }
.attachment-item { display: flex; align-items: center; gap: 10rpx; padding: 16rpx 18rpx; background: #f8fafc; border-radius: 12rpx; }
.attachment-name { flex: 1; min-width: 0; font-size: 24rpx; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); background: #f8fafc; border: 1rpx solid #e8eef6; border-radius: 16rpx; overflow: hidden; margin-bottom: 18rpx; }
.summary-item { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6rpx; padding: 16rpx 8rpx; border-right: 1rpx solid #eef2f7; }
.summary-item:last-child { border-right: 0; }
.summary-value { max-width: 100%; font-size: 30rpx; font-weight: 700; color: #1f4b79; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-label { font-size: 22rpx; color: #8a94a6; }
.item-list { display: flex; flex-direction: column; gap: 18rpx; }
.item-card { padding: 20rpx; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 18rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.item-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 14rpx; }
.item-name { flex: 1; min-width: 0; font-size: 30rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-code { flex-shrink: 0; max-width: 240rpx; font-size: 24rpx; color: #8a94a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12rpx; }
.info-cell { min-width: 0; display: flex; flex-direction: column; gap: 4rpx; }
.info-label { font-size: 22rpx; color: #9ca3af; }
.info-value { font-size: 26rpx; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pallet-list { margin-top: 18rpx; display: flex; flex-direction: column; gap: 12rpx; }
.pallet-card { padding: 16rpx 18rpx; background: #f8fafc; border: 1rpx solid #e8eef6; border-radius: 14rpx; }
.pallet-top { display: flex; align-items: center; justify-content: space-between; gap: 12rpx; margin-bottom: 12rpx; }
.pallet-code { flex: 1; min-width: 0; font-size: 27rpx; color: #1f2937; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pallet-count { flex-shrink: 0; font-size: 24rpx; color: #1f4b79; font-weight: 600; }
.pallet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10rpx; }
.pallet-cell { min-width: 0; display: flex; flex-direction: column; gap: 4rpx; }
.pallet-label { font-size: 21rpx; color: #9ca3af; }
.pallet-value { font-size: 24rpx; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 18rpx; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.action-btn { flex: 1; height: 84rpx; border-radius: 16rpx; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.back-btn { background: #1f4b79; color: #ffffff; }
</style>

@ -0,0 +1,510 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.moduleName')" />
<view class="filter-bar">
<view class="keyword-box">
<input
id="product-inbound-keyword-input"
v-model="searchKeyword"
class="keyword-input"
type="text"
:placeholder="t('productInbound.searchDocumentPlaceholder')"
placeholder-class="placeholder"
:focus="keywordFocus"
confirm-type="search"
@blur="keywordFocus = false"
@confirm="handleSearch"
/>
</view>
<view class="status-box" @click="openStatusPicker">
<text class="status-box-text">{{ selectedStatusLabel || t('productInbound.all') }}</text>
<uni-icons type="bottom" size="14" color="#9ca3af" />
</view>
<view class="reset-filter-btn" @click="resetFilters">{{ t('productInbound.reset') }}</view>
</view>
<scroll-view
scroll-y
class="list-scroll"
:scroll-top="scrollTop"
:lower-threshold="80"
@scroll="onScroll"
@scrolltolower="loadMore"
>
<view class="list-wrap">
<view v-for="item in list" :key="item.id" class="task-card" @click="openDetail(item)">
<view class="card-header">
<view class="header-main">
<text class="task-no">{{ textValue(item.no) }}</text>
<text :class="['record-tag', statusClass(item.status)]">{{ statusText(item.status) }}</text>
</view>
</view>
<view class="card-body">
<view class="row">
<text class="label">{{ t('productInbound.productInfo') }}</text>
<text class="value">{{ textValue(item.productNames || item.productName) }}</text>
</view>
<view class="row">
<text class="label">{{ t('productInbound.inboundTime') }}</text>
<text class="value">{{ formatDateTime(item.inTime || item.createTime) }}</text>
</view>
<view class="row">
<text class="label">{{ t('productInbound.operator') }}</text>
<text class="value">{{ textValue(item.stockUserName || item.creatorName || item.creator) }}</text>
</view>
<view class="row">
<text class="label">{{ t('productInbound.inboundQuantity') }}</text>
<text class="value highlight">{{ textValue(item.totalCount) }}</text>
</view>
<view class="row">
<text class="label">{{ t('productInbound.reviewer') }}</text>
<text class="value">{{ textValue(item.auditUserName) }}</text>
</view>
</view>
<view v-if="Number(item.status) === 0" class="card-actions">
<view class="action-btn submit-btn" @click.stop="openSubmitAudit(item)">{{ t('productInbound.submitAudit') }}</view>
</view>
<view v-if="Number(item.status) === 10" class="card-actions">
<view class="action-btn approve-btn" @click.stop="handleApprove(item)">{{ t('productInbound.auditPass') }}</view>
<view class="action-btn reject-btn" @click.stop="handleReject(item)">{{ t('productInbound.auditReject') }}</view>
</view>
</view>
<view v-if="loading && pageNo === 1" class="hint">{{ t('productInbound.loading') }}</view>
<view v-else-if="!list.length" class="hint">{{ t('productInbound.emptyInboundList') }}</view>
<view v-else-if="loadingMore" class="hint">{{ t('productInbound.loadingMore') }}</view>
<view v-else-if="finished" class="hint">{{ t('productInbound.noMoreData') }}</view>
</view>
</scroll-view>
<view v-if="showGoTop" class="go-top-btn" @click="goTop">
<uni-icons type="arrow-up" size="20" color="#1f4b79" />
</view>
<view class="add-btn" @click="goAdd">
<text class="add-icon">+</text>
</view>
<view v-if="showAuditModal" class="modal-overlay" @click="closeAuditModal">
<view class="modal-card" @click.stop>
<view class="modal-header">
<text class="modal-title">{{ t('productInbound.submitAudit') }}</text>
<text class="modal-close" @click="closeAuditModal">x</text>
</view>
<view class="modal-body">
<view class="modal-field">
<text class="modal-label"><text class="required">*</text>{{ t('productInbound.auditor') }}</text>
<view class="modal-dropdown" @click="toggleAuditorDropdown">
<text :class="{ placeholder: !selectedAuditor }">{{ selectedAuditor ? selectedAuditor.label : t('productInbound.choose') }}</text>
<text class="dropdown-arrow">v</text>
<view v-if="showAuditorDropdown" class="dropdown-panel">
<scroll-view scroll-y class="dropdown-scroll">
<view
v-for="u in auditorOptions"
:key="u.value"
class="dropdown-item"
:class="{ active: selectedAuditor?.value === u.value }"
@click.stop="selectAuditor(u)"
>
<text class="dropdown-item-text">{{ u.label }}</text>
<uni-icons v-if="selectedAuditor?.value === u.value" class="dropdown-check" type="checkmarkempty" size="16" color="#2563eb"></uni-icons>
</view>
</scroll-view>
</view>
</view>
</view>
<view class="modal-field">
<text class="modal-label">{{ t('productInbound.remark') }}</text>
<textarea v-model="auditRemark" class="modal-textarea" :placeholder="t('productInbound.remarkPlaceholder')" placeholder-class="textarea-placeholder" :maxlength="200" />
</view>
</view>
<view class="modal-footer">
<view class="modal-btn cancel-btn" @click="closeAuditModal">{{ t('productInbound.cancel') }}</view>
<view class="modal-btn confirm-btn" @click="confirmSubmitAudit">{{ t('productInbound.submit') }}</view>
</view>
</view>
</view>
<uni-popup ref="statusPickerRef" type="bottom" background-color="#fff">
<view class="picker-content">
<view class="picker-header">
<text class="picker-title">{{ t('productInbound.selectInboundStatus') }}</text>
<view class="picker-clear" @click="resetStatus">
<text class="picker-clear-text">{{ t('productInbound.clear') }}</text>
</view>
</view>
<scroll-view scroll-y class="picker-list">
<view
v-for="option in statusOptions"
:key="String(option.value)"
class="picker-item"
@click="selectStatus(option)"
>
<text class="picker-text">{{ option.label }}</text>
<uni-icons v-if="selectedStatus === option.value" class="picker-check" type="checkmarkempty" size="18" color="#1f61ff"></uni-icons>
</view>
</scroll-view>
</view>
</uni-popup>
<sv-focus-no-keyboard ref="focusNoKeyboardRef"></sv-focus-no-keyboard>
</view>
</template>
<script setup>
import { computed, nextTick, ref } from 'vue'
import { onReady, onShow, onUnload } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { auditProductInbound, getProductInboundPage, submitProductInbound } from '@/api/mes/productInbound'
import { getSimpleUserList } from '@/api/mes/moldget'
const { t } = useI18n()
const selectedStatus = ref('')
const searchKeyword = ref('')
const statusPickerRef = ref(null)
const statusOptions = computed(() => [
{ label: t('productInbound.all'), value: '' },
{ label: t('productInbound.statusPending'), value: '0' },
{ label: t('productInbound.statusAuditing'), value: '10' },
{ label: t('productInbound.statusStored'), value: '20' }
])
const selectedStatusLabel = computed(() => {
const current = statusOptions.value.find((item) => item.value === selectedStatus.value)
return current ? current.label : ''
})
const list = ref([])
const loading = ref(false)
const loadingMore = ref(false)
const finished = ref(false)
const pageNo = ref(1)
const pageSize = ref(10)
const scrollTop = ref(0)
const showGoTop = ref(false)
const keywordFocus = ref(false)
const focusNoKeyboardRef = ref(null)
const keywordInputSelector = '#product-inbound-keyword-input input, input#product-inbound-keyword-input'
let searchTimer = null
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
function formatDateTime(value) {
if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) {
const [year, month, day] = value
const pad = (n) => String(n).padStart(2, '0')
return `${year}-${pad(month)}-${pad(day)}`
}
const date = new Date(Number(value))
if (Number.isNaN(date.getTime())) return String(value)
const pad = (n) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
}
function statusText(s) {
const map = {
0: t('productInbound.statusPending'),
10: t('productInbound.statusAuditing'),
20: t('productInbound.statusStored'),
1: t('productInbound.statusRejected')
}
const num = Number(s)
return map[num] || textValue(s)
}
function statusClass(s) {
const num = Number(s)
if (num === 0) return 'text-primary'
if (num === 10) return 'text-warning'
if (num === 20) return 'text-success'
if (num === 1) return 'text-danger'
return ''
}
function normalizePageData(res) {
const root = res && res.data !== undefined ? res.data : res
const candidateList = root?.list || root?.rows || root?.records || root?.data?.list || root?.data?.rows || []
const candidateTotal = root?.total ?? root?.data?.total ?? (Array.isArray(candidateList) ? candidateList.length : 0)
return {
list: Array.isArray(candidateList) ? candidateList : [],
total: Number(candidateTotal || 0)
}
}
async function fetchList(reset) {
if (reset) {
pageNo.value = 1
finished.value = false
}
if (pageNo.value === 1) loading.value = true
else loadingMore.value = true
try {
const res = await getProductInboundPage({
pageNo: pageNo.value,
pageSize: pageSize.value,
no: searchKeyword.value.trim() || undefined,
status: selectedStatus.value || undefined
})
const page = normalizePageData(res)
list.value = reset ? page.list : [...list.value, ...page.list]
finished.value = list.value.length >= page.total || page.list.length < pageSize.value
} catch (e) {
if (!reset) pageNo.value = Math.max(1, pageNo.value - 1)
uni.showToast({ title: t('productInbound.loadFailed'), icon: 'none' })
} finally {
loading.value = false
loadingMore.value = false
}
}
async function handleSearch() {
clearSearchTimer()
uni.hideKeyboard()
await fetchList(true)
}
function activateKeywordFocus() {
keywordFocus.value = false
nextTick(() => {
keywordFocus.value = true
})
}
function focusKeywordNoKeyboard() {
nextTick(() => {
setTimeout(() => {
focusNoKeyboardRef.value?.focus(keywordInputSelector)
}, 80)
})
}
async function resetFilters() {
clearSearchTimer()
searchKeyword.value = ''
selectedStatus.value = ''
activateKeywordFocus()
await fetchList(true)
}
function openStatusPicker() {
statusPickerRef.value?.open()
}
async function selectStatus(option) {
selectedStatus.value = option.value
statusPickerRef.value?.close()
await fetchList(true)
}
async function resetStatus() {
selectedStatus.value = ''
statusPickerRef.value?.close()
await fetchList(true)
}
async function loadMore() {
if (loading.value || loadingMore.value || finished.value) return
pageNo.value += 1
await fetchList(false)
}
async function handleApprove(item) {
if (!item?.id) return
uni.showModal({
title: t('productInbound.tip'),
content: t('productInbound.confirmAuditPass'),
confirmColor: '#16a34a',
success: async (res) => {
if (!res.confirm) return
try {
await auditProductInbound({ id: item.id, status: 20 })
uni.showToast({ title: t('productInbound.auditPassSuccess'), icon: 'success' })
fetchList(true)
} catch (e) {
uni.showToast({ title: t('productInbound.operationFailed'), icon: 'none' })
}
}
})
}
async function handleReject(item) {
if (!item?.id) return
uni.showModal({
title: t('productInbound.tip'),
content: t('productInbound.confirmAuditReject'),
confirmColor: '#dc2626',
success: async (res) => {
if (!res.confirm) return
try {
await auditProductInbound({ id: item.id, status: 1 })
uni.showToast({ title: t('productInbound.auditRejectSuccess'), icon: 'success' })
fetchList(true)
} catch (e) {
uni.showToast({ title: t('productInbound.operationFailed'), icon: 'none' })
}
}
})
}
const showAuditModal = ref(false)
const currentAuditItem = ref(null)
const auditorOptions = ref([])
const selectedAuditor = ref(null)
const showAuditorDropdown = ref(false)
const auditRemark = ref('')
function openSubmitAudit(item) {
currentAuditItem.value = item
selectedAuditor.value = null
auditRemark.value = ''
showAuditModal.value = true
loadAuditorOptions()
}
function closeAuditModal() {
showAuditModal.value = false
currentAuditItem.value = null
showAuditorDropdown.value = false
}
function toggleAuditorDropdown() {
showAuditorDropdown.value = !showAuditorDropdown.value
}
function selectAuditor(u) {
selectedAuditor.value = u
showAuditorDropdown.value = false
}
async function loadAuditorOptions() {
if (auditorOptions.value.length) return
try {
const res = await getSimpleUserList()
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
auditorOptions.value = data.map((u) => ({
value: u.id || u.userId,
label: u.nickname || u.userName || u.name || String(u.id || '')
}))
} catch (e) {
console.error('loadAuditorOptions error', e)
}
}
async function confirmSubmitAudit() {
if (!selectedAuditor.value) {
uni.showToast({ title: t('productInbound.selectAuditor'), icon: 'none' })
return
}
if (!currentAuditItem.value?.id) return
try {
uni.showLoading({ title: t('productInbound.submitting'), mask: true })
await submitProductInbound({
id: currentAuditItem.value.id,
auditUserId: selectedAuditor.value.value,
remark: auditRemark.value || undefined
})
uni.hideLoading()
uni.showToast({ title: t('productInbound.submitAuditSuccess'), icon: 'success' })
closeAuditModal()
fetchList(true)
} catch (e) {
uni.hideLoading()
uni.showToast({ title: t('productInbound.submitFailed'), icon: 'none' })
}
}
function onScroll(event) {
showGoTop.value = (event?.detail?.scrollTop || 0) > 600
}
function goTop() {
scrollTop.value = 0
}
function goAdd() {
uni.navigateTo({ url: '/pages_function/pages/productInbound/create' })
}
function openDetail(item) {
if (!item?.id) {
uni.showToast({ title: t('productInbound.noDetailId'), icon: 'none' })
return
}
uni.navigateTo({ url: `/pages_function/pages/productInbound/detail?id=${encodeURIComponent(String(item.id))}` })
}
function clearSearchTimer() {
if (searchTimer) {
clearTimeout(searchTimer)
searchTimer = null
}
}
onReady(() => {
focusKeywordNoKeyboard()
})
onShow(() => fetchList(true))
onUnload(() => clearSearchTimer())
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f4f5f7; }
.filter-bar { display: grid; grid-template-columns: minmax(0, 1fr) 150rpx 96rpx; align-items: center; gap: 14rpx; padding: 18rpx 28rpx 20rpx; }
.keyword-box,
.status-box,
.reset-filter-btn { height: var(--app-form-control-height, 70rpx); background: #ffffff; border: 1rpx solid #d9dde5; box-sizing: border-box; display: flex; align-items: center; }
.keyword-box { padding: 0 20rpx; }
.keyword-input { width: 100%; font-size: 26rpx; color: #374151; }
.status-box { justify-content: space-between; padding: 0 18rpx; }
.status-box-text,
.placeholder { font-size: 26rpx; }
.status-box-text { color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reset-filter-btn { justify-content: center; font-size: 24rpx; color: #4b5563; }
.list-scroll { height: calc(100vh - 194rpx); }
.list-wrap { padding: 0 24rpx 60rpx; }
.task-card { margin-top: 20rpx; padding: 28rpx; background: #fff; border-radius: 22rpx; box-shadow: 0 8rpx 28rpx rgba(15, 23, 42, 0.06); }
.card-header { margin-bottom: 18rpx; }
.header-main { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; }
.task-no { flex: 1; min-width: 0; font-size: 32rpx; font-weight: 700; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-tag { flex-shrink: 0; padding: 8rpx 18rpx; border-radius: 999rpx; font-size: 22rpx; line-height: 1; background: #e2e8f0; color: #64748b; }
.card-body .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20rpx; margin-top: 12rpx; }
.card-body .row:first-child { margin-top: 0; }
.label { width: 140rpx; font-size: 25rpx; color: #94a3b8; flex-shrink: 0; }
.value { flex: 1; text-align: right; font-size: 27rpx; color: #334155; line-height: 1.5; }
.value.highlight { color: #1f4b79; font-weight: 600; }
.card-actions { display: flex; gap: 16rpx; margin-top: 20rpx; padding-top: 20rpx; border-top: 1rpx solid #f0f0f0; }
.action-btn { flex: 1; height: 64rpx; line-height: 64rpx; text-align: center; border-radius: 10rpx; font-size: 26rpx; font-weight: 500; }
.approve-btn { background: #dcfce7; color: #16a34a; }
.reject-btn { background: #fee2e2; color: #dc2626; }
.submit-btn { background: #dbeafe; color: #1d4ed8; }
.record-tag.text-success { color: #15803d; background: #dcfce7; }
.record-tag.text-danger { color: #dc2626; background: #fee2e2; }
.record-tag.text-warning { color: #d97706; background: #fef3c7; }
.record-tag.text-primary { color: #1d4ed8; background: #dbeafe; }
.hint { padding: 36rpx 0; text-align: center; color: #94a3b8; font-size: 26rpx; }
.go-top-btn { position: fixed; right: 28rpx; bottom: calc(140rpx + env(safe-area-inset-bottom)); width: 92rpx; height: 92rpx; border-radius: 46rpx; background: rgba(255, 255, 255, 0.96); box-shadow: 0 8rpx 24rpx rgba(15, 23, 42, 0.12); display: flex; align-items: center; justify-content: center; }
.add-btn { position: fixed; right: 28rpx; bottom: calc(56rpx + env(safe-area-inset-bottom)); width: 92rpx; height: 92rpx; border-radius: 46rpx; background: #1f4b79; box-shadow: 0 14rpx 30rpx rgba(24, 63, 108, 0.24); display: flex; align-items: center; justify-content: center; }
.add-icon { color: #fff; font-size: 64rpx; line-height: 1; margin-top: -4rpx; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal-card { width: 640rpx; background: #fff; border-radius: 20rpx; box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 32rpx 32rpx 20rpx; border-bottom: 1rpx solid #f0f0f0; }
.modal-title { font-size: 32rpx; font-weight: 700; color: #1a1a1a; }
.modal-close { font-size: 36rpx; color: #999; padding: 8rpx; }
.modal-body { padding: 28rpx 32rpx; }
.modal-field { margin-bottom: 28rpx; }
.modal-field:last-child { margin-bottom: 0; }
.modal-label { font-size: 28rpx; color: #374151; font-weight: 500; margin-bottom: 14rpx; display: block; }
.required { color: #ef4444; }
.modal-dropdown { position: relative; display: flex; align-items: center; justify-content: space-between; height: 80rpx; padding: 0 24rpx; background: #f8fafc; border: 1rpx solid #e0e0e0; border-radius: 12rpx; font-size: 28rpx; color: #374151; }
.placeholder { color: #bbb; }
.dropdown-arrow { font-size: 20rpx; color: #999; }
.modal-textarea { width: 100%; min-height: var(--app-textarea-field-height, 100rpx); padding: 20rpx; background: #f8fafc; border: 1rpx solid #e0e0e0; border-radius: 12rpx; font-size: 27rpx; color: #374151; box-sizing: border-box; }
.dropdown-panel { position: absolute; top: 100%; left: 0; right: 0; z-index: 200; margin-top: 4rpx; background: #fff; border: 1rpx solid #e0e0e0; border-radius: 12rpx; box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.1); overflow: hidden; }
.dropdown-scroll { height: 300rpx; }
.dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 20rpx 24rpx; border-bottom: 1rpx solid #f0f0f0; }
.dropdown-item.active { background: #f0f5ff; }
.dropdown-item-text { font-size: 27rpx; color: #333; }
.dropdown-check { font-size: 28rpx; color: #2563eb; font-weight: 700; }
.modal-footer { display: flex; gap: 18rpx; padding: 24rpx 32rpx; border-top: 1rpx solid #f0f0f0; }
.modal-btn { flex: 1; height: 80rpx; line-height: 80rpx; text-align: center; border-radius: 14rpx; font-size: 30rpx; font-weight: 600; }
.cancel-btn { background: #f0f0f0; color: #6b7280; }
.confirm-btn { background: #1f4b79; color: #fff; }
.picker-content { padding: 24rpx 24rpx 36rpx; border-radius: 28rpx 28rpx 0 0; }
.picker-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20rpx; }
.picker-title { color: #1f2d3d; font-size: 30rpx; font-weight: 700; }
.picker-clear-text { color: #1f61ff; font-size: 26rpx; }
.picker-list { max-height: 480rpx; }
.picker-item { display: flex; align-items: center; justify-content: space-between; padding: 26rpx 6rpx; border-bottom: 1rpx solid #edf1f6; }
.picker-text { color: #243447; font-size: 28rpx; }
.picker-check { color: #1f61ff; font-size: 30rpx; }
</style>

@ -0,0 +1,338 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.createPalletTitle')" />
<scroll-view scroll-y class="form-scroll">
<view class="form-card">
<view class="form-item">
<text class="form-label">{{ t('productInbound.palletCode') }}<text v-if="!formData.isCode" class="required-star">*</text></text>
<view class="code-row">
<input
v-model="formData.code"
class="form-input code-input"
:placeholder="t('productInbound.enterPalletCode')"
:disabled="formData.isCode"
/>
<view :class="['code-switch', formData.isCode ? 'active' : '']" @click="toggleAutoCode">
<text class="switch-text">{{ t('productInbound.autoCode') }}</text>
</view>
</view>
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.palletType') }} <text class="required-star">*</text></text>
<picker mode="selector" :range="palletTypeOptions" range-key="label" :value="getPickerIndex(palletTypeOptions, formData.palletType)" @change="onPalletTypeChange">
<view :class="['form-picker', isEmptyValue(formData.palletType) ? 'placeholder' : '']">
{{ isEmptyValue(formData.palletType) ? t('productInbound.selectPalletType') : getOptionLabel(palletTypeOptions, formData.palletType) }}
</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.palletStatus') }}<text class="required-star">*</text></text>
<picker mode="selector" :range="palletStatusOptions" range-key="label" :value="getPickerIndex(palletStatusOptions, formData.status)" @change="onPalletStatusChange">
<view :class="['form-picker', isEmptyValue(formData.status) ? 'placeholder' : '']">
{{ isEmptyValue(formData.status) ? t('productInbound.selectPalletStatus') : getOptionLabel(palletStatusOptions, formData.status) }}
</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.spec') }}</text>
<view class="spec-row">
<input v-model="formData.length" class="form-input spec-input" type="number" :placeholder="t('productInbound.length')" />
<text class="spec-separator">x</text>
<input v-model="formData.width" class="form-input spec-input" type="number" :placeholder="t('productInbound.width')" />
<text class="spec-separator">x</text>
<input v-model="formData.height" class="form-input spec-input" type="number" :placeholder="t('productInbound.height')" />
</view>
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.productCount') }}</text>
<input v-model="formData.productCount" class="form-input" type="number" :placeholder="t('productInbound.enterPackageCount')" />
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.warehouse') }}</text>
<picker mode="selector" :range="warehouseOptions" range-key="label" :value="getPickerIndex(warehouseOptions, formData.warehouseId)" @change="onWarehouseChange">
<view :class="['form-picker', isEmptyValue(formData.warehouseId) ? 'placeholder' : '']">
{{ isEmptyValue(formData.warehouseId) ? t('productInbound.selectWarehouse') : getOptionLabel(warehouseOptions, formData.warehouseId) }}
</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.area') }}</text>
<picker mode="selector" :range="currentAreaOptions" range-key="label" :value="getPickerIndex(currentAreaOptions, formData.areaId)" @change="onAreaChange">
<view :class="['form-picker', isEmptyValue(formData.areaId) ? 'placeholder' : '']">
{{ getAreaPickerText() }}
</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.ratedLoadWeight') }}</text>
<input v-model="formData.ratedLoadWeight" class="form-input" type="digit" :placeholder="t('productInbound.enterRatedLoadWeight')" />
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.unit') }}</text>
<picker mode="selector" :range="unitOptions" range-key="label" :value="getPickerIndex(unitOptions, formData.unit)" @change="onUnitChange">
<view :class="['form-picker', isEmptyValue(formData.unit) ? 'placeholder' : '']">
{{ isEmptyValue(formData.unit) ? t('productInbound.selectUnit') : getOptionLabel(unitOptions, formData.unit) }}
</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">{{ t('productInbound.remark') }}</text>
<textarea v-model="formData.remark" class="form-textarea" :placeholder="t('productInbound.remarkPlaceholder')" :maxlength="200" />
</view>
</view>
</scroll-view>
<view class="bottom-bar">
<view class="cancel-btn" @click="goBack">{{ t('productInbound.cancel') }}</view>
<view :class="['submit-btn', submitting ? 'disabled' : '']" @click="submitForm">
{{ submitting ? t('productInbound.submitting') : t('productInbound.createPalletTitle') }}
</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { createPallet } from '@/api/mes/productInbound'
import { getProductUnitSimpleList } from '@/api/erp/productInfo'
import { getWarehouseAreaSimpleList, getWarehouseSimpleList } from '@/api/mes/moldget'
import { DICT_TYPE, initAllDict } from '@/utils/dict'
import useDictStore from '@/store/modules/dict'
const { t } = useI18n()
const dictStore = useDictStore()
const productId = ref(null)
const defaultPackageCount = ref(1)
const submitting = ref(false)
const warehouseOptions = ref([])
const warehouseAreaMap = ref({})
const palletTypeOptions = ref([])
const palletStatusOptions = ref([])
const unitOptions = ref([])
const formData = ref(getDefaultForm())
const currentAreaOptions = computed(() => {
if (!formData.value.warehouseId) return []
return warehouseAreaMap.value[String(formData.value.warehouseId)] || []
})
onLoad((options) => {
productId.value = options?.productId || null
defaultPackageCount.value = Number(options?.packageCount) || 1
formData.value.productCount = defaultPackageCount.value
})
function getDefaultForm() {
return {
code: '',
isCode: true,
palletType: '',
status: '',
length: '',
width: '',
height: '',
ratedLoadWeight: '',
unit: '',
warehouseId: '',
areaId: '',
productCount: defaultPackageCount.value || 1,
remark: ''
}
}
function normalizeList(res) {
const root = res && res.data !== undefined ? res.data : res
return Array.isArray(root) ? root : (root?.list || root?.rows || root?.records || [])
}
function normalizeOptions(list) {
return (list || []).map((item) => ({
label: String(item.label || item.name || ''),
value: item.value ?? item.id ?? ''
})).filter((item) => item.label !== '')
}
function isEmptyValue(v) {
return v === undefined || v === null || v === ''
}
function getPickerIndex(options, value) {
const index = (options || []).findIndex((item) => String(item.value) === String(value))
return index >= 0 ? index : 0
}
function getOptionLabel(options, value) {
return (options || []).find((item) => String(item.value) === String(value))?.label || ''
}
function toPayloadValue(value) {
if (isEmptyValue(value)) return undefined
const num = Number(value)
return Number.isNaN(num) ? value : num
}
function toPayloadNumber(value) {
if (isEmptyValue(value)) return undefined
const num = Number(value)
return Number.isNaN(num) ? undefined : num
}
function syncDictOptions() {
palletTypeOptions.value = normalizeOptions(dictStore.getDict(DICT_TYPE.STORAGE_PALLET_TYPES) || [])
palletStatusOptions.value = normalizeOptions(dictStore.getDict(DICT_TYPE.STORAGE_PALLET_STATUS) || [])
}
function getAreaPickerText() {
if (!formData.value.warehouseId) return t('productInbound.selectWarehouseFirst')
if (!currentAreaOptions.value.length) return t('productInbound.emptyArea')
return isEmptyValue(formData.value.areaId) ? t('productInbound.selectArea') : getOptionLabel(currentAreaOptions.value, formData.value.areaId)
}
function buildSpecification() {
const length = String(formData.value.length || '').trim()
const width = String(formData.value.width || '').trim()
const height = String(formData.value.height || '').trim()
if (!length && !width && !height) return undefined
return `${length}x${width}x${height}`
}
function toggleAutoCode() {
formData.value.isCode = !formData.value.isCode
if (formData.value.isCode) {
formData.value.code = ''
}
}
function onPalletTypeChange(e) {
const item = palletTypeOptions.value[Number(e.detail.value)]
formData.value.palletType = item?.value ?? ''
}
function onPalletStatusChange(e) {
const item = palletStatusOptions.value[Number(e.detail.value)]
formData.value.status = item?.value ?? ''
}
async function onWarehouseChange(e) {
const item = warehouseOptions.value[Number(e.detail.value)]
formData.value.warehouseId = item?.value ?? ''
formData.value.areaId = ''
if (formData.value.warehouseId) {
await loadAreasForWarehouse(formData.value.warehouseId)
}
}
function onAreaChange(e) {
const item = currentAreaOptions.value[Number(e.detail.value)]
formData.value.areaId = item?.value ?? ''
}
function onUnitChange(e) {
const item = unitOptions.value[Number(e.detail.value)]
formData.value.unit = item?.value ?? ''
}
function validateForm() {
if (!formData.value.isCode && !String(formData.value.code || '').trim()) {
uni.showToast({ title: t('productInbound.enterPalletCode'), icon: 'none' })
return false
}
if (isEmptyValue(formData.value.palletType)) {
uni.showToast({ title: t('productInbound.selectPalletType'), icon: 'none' })
return false
}
if (isEmptyValue(formData.value.status)) {
uni.showToast({ title: t('productInbound.selectPalletStatus'), icon: 'none' })
return false
}
return true
}
async function loadWarehouses() {
try {
const res = await getWarehouseSimpleList()
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseOptions.value = data.map((w) => ({ value: w.id, label: w.name || String(w.id || '') }))
} catch (e) {}
}
async function loadAreasForWarehouse(warehouseId) {
if (!warehouseId || warehouseAreaMap.value[String(warehouseId)]) return
try {
const res = await getWarehouseAreaSimpleList(warehouseId)
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseAreaMap.value = {
...warehouseAreaMap.value,
[String(warehouseId)]: data.map((a) => ({ value: a.id, label: a.name || a.areaName || String(a.id || '') }))
}
} catch (e) {
warehouseAreaMap.value = { ...warehouseAreaMap.value, [String(warehouseId)]: [] }
}
}
async function loadUnitOptions() {
try {
const res = await getProductUnitSimpleList()
const data = normalizeList(res)
unitOptions.value = data.map((item) => ({ value: item.name, label: item.name || String(item.id || '') })).filter((item) => item.value)
} catch (e) {
unitOptions.value = []
}
}
async function submitForm() {
if (submitting.value || !validateForm()) return
submitting.value = true
try {
await createPallet({
code: formData.value.isCode ? undefined : String(formData.value.code || '').trim(),
isCode: formData.value.isCode,
palletType: toPayloadValue(formData.value.palletType),
specification: buildSpecification(),
ratedLoadWeight: toPayloadNumber(formData.value.ratedLoadWeight),
unit: formData.value.unit || undefined,
status: toPayloadValue(formData.value.status),
warehouseId: toPayloadValue(formData.value.warehouseId),
areaId: toPayloadValue(formData.value.areaId),
productId: toPayloadValue(productId.value),
productCount: toPayloadNumber(formData.value.productCount),
remark: String(formData.value.remark || '').trim() || undefined
})
uni.showToast({ title: t('productInbound.createSuccess'), icon: 'success' })
setTimeout(() => {
uni.navigateBack()
}, 450)
} catch (e) {
uni.showToast({ title: t('productInbound.createPalletFailed'), icon: 'none' })
} finally {
submitting.value = false
}
}
function goBack() {
if (submitting.value) return
uni.navigateBack()
}
onShow(async () => {
await initAllDict()
syncDictOptions()
await Promise.all([loadWarehouses(), loadUnitOptions()])
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; padding-bottom: calc(122rpx + env(safe-area-inset-bottom)); }
.form-scroll { height: calc(100vh - 122rpx); }
.form-card { margin: 18rpx 24rpx; padding: 24rpx; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 20rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.form-item { margin-bottom: 22rpx; }
.form-label { display: block; font-size: 25rpx; color: #5f6b7a; margin-bottom: 10rpx; }
.required-star { color: #e34d59; }
.form-input { height: var(--app-form-control-height, 70rpx); min-height: var(--app-form-control-height, 70rpx); padding: 0 20rpx; border-radius: 12rpx; background: #f5f7fa; font-size: 28rpx; color: #30363d; box-sizing: border-box; }
.form-textarea { width: 100%; min-height: var(--app-textarea-field-height, 100rpx); padding: 18rpx 20rpx; border-radius: 12rpx; background: #f5f7fa; font-size: 28rpx; color: #30363d; box-sizing: border-box; }
.form-picker { height: var(--app-form-control-height, 70rpx); min-height: var(--app-form-control-height, 70rpx); padding: 0 20rpx; border-radius: 12rpx; background: #f5f7fa; font-size: 28rpx; color: #30363d; display: flex; align-items: center; box-sizing: border-box; }
.form-picker.placeholder { color: #999; }
.code-row { display: flex; align-items: center; gap: 12rpx; }
.code-input { flex: 1; min-width: 0; }
.code-switch { height: var(--app-form-control-height, 70rpx); padding: 0 16rpx; background: #f5f7fa; border-radius: 12rpx; border: 1rpx solid transparent; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.code-switch.active { background: #eef6ff; border-color: #c9ddf6; }
.switch-text { font-size: 23rpx; color: #1a3a5c; white-space: nowrap; }
.spec-row { display: flex; align-items: center; gap: 10rpx; }
.spec-input { flex: 1; min-width: 0; text-align: center; padding: 0 8rpx; }
.spec-separator { color: #9ca3af; font-size: 24rpx; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 180rpx 1fr; gap: 18rpx; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.cancel-btn { height: 84rpx; border-radius: 16rpx; background: #eef2f7; color: #475569; display: flex; align-items: center; justify-content: center; font-size: 28rpx; font-weight: 600; }
.submit-btn { height: 84rpx; border-radius: 16rpx; background: #1f4b79; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.submit-btn.disabled { opacity: 0.72; }
</style>

@ -0,0 +1,238 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.selectPalletTitle')" />
<view class="search-bar">
<view class="search-input-wrap">
<uni-icons type="search" size="18" color="#9ca3af"></uni-icons>
<input
v-model="searchText"
class="search-input"
:placeholder="t('productInbound.searchPalletPlaceholder')"
placeholder-class="search-placeholder"
confirm-type="search"
@confirm="loadPallets"
/>
<view v-if="searchText" class="search-clear" @click="clearSearch">
<uni-icons type="closeempty" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
</view>
<scroll-view v-if="palletList.length" scroll-y class="pallet-list">
<view
v-for="item in palletList"
:key="item.id"
:class="['pallet-card', isSelected(item) ? 'active' : '']"
@click="togglePallet(item)"
>
<view class="pallet-header">
<view class="pallet-title-wrap">
<view class="pallet-name-row">
<text class="pallet-code">{{ textValue(getPalletCode(item)) }}</text>
<text class="type-tag">{{ getPalletTypeLabel(item) }}</text>
<text class="status-tag">{{ getPalletStatusLabel(item) }}</text>
</view>
<text class="pallet-product">{{ textValue(item.productName) }}</text>
</view>
<view class="check-badge">
<uni-icons v-if="isSelected(item)" type="checkmarkempty" size="16" color="#ffffff"></uni-icons>
</view>
</view>
<view class="info-grid">
<view class="info-cell">
<text class="info-label">{{ t('productInbound.warehouse') }}</text>
<text class="info-value">{{ textValue(getWarehouseName(item.warehouseId)) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.area') }}</text>
<text class="info-value">{{ textValue(getAreaName(item.warehouseId, item.areaId)) }}</text>
</view>
</view>
</view>
</scroll-view>
<view v-else class="empty-wrap">
<uni-icons type="info" size="30" color="#cbd5e1"></uni-icons>
<text>{{ loading ? t('productInbound.loading') : t('productInbound.emptyPallet') }}</text>
</view>
<view class="add-btn" @click="openCreatePallet">
<text class="add-icon">+</text>
</view>
<view class="action-bar">
<view class="selected-count">{{ t('productInbound.selectedCount', { count: selectedPallets.length }) }}</view>
<view :class="['action-btn', selectedPallets.length ? '' : 'action-btn-disabled']" @click="handleConfirm">{{ t('productInbound.confirm') }}</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getPalletPage } from '@/api/mes/productInbound'
import { getWarehouseAreaSimpleList, getWarehouseSimpleList } from '@/api/mes/moldget'
import { DICT_TYPE, getDictLabel, initAllDict } from '@/utils/dict'
const { t } = useI18n()
const productId = ref(null)
const defaultPackageCount = ref(1)
const palletList = ref([])
const selectedPallets = ref([])
const searchText = ref('')
const loading = ref(false)
const warehouseOptions = ref([])
const warehouseAreaMap = ref({})
onLoad((options) => {
productId.value = options?.productId || null
defaultPackageCount.value = Number(options?.packageCount) || 1
const selected = getApp().globalData?._productInboundSelectedPallets
selectedPallets.value = Array.isArray(selected) ? selected.map((item) => ({ ...item })) : []
})
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
function normalizeList(res) {
const root = res && res.data !== undefined ? res.data : res
return Array.isArray(root) ? root : (root?.list || root?.rows || root?.records || [])
}
function getPalletCode(pallet) {
return pallet?.code || pallet?.palletCode || ''
}
function getPalletTypeLabel(pallet) {
const fallback = textValue(pallet?.palletTypeName || pallet?.typeName || pallet?.palletType)
return getDictLabel(DICT_TYPE.STORAGE_PALLET_TYPES, pallet?.palletType, fallback)
}
function getPalletStatusLabel(pallet) {
const fallback = textValue(pallet?.statusName || pallet?.statusLabel || pallet?.status)
return getDictLabel(DICT_TYPE.STORAGE_PALLET_STATUS, pallet?.status, fallback)
}
function isSelected(pallet) {
return selectedPallets.value.some((item) => String(item.id) === String(pallet.id))
}
function togglePallet(pallet) {
if (isSelected(pallet)) {
selectedPallets.value = selectedPallets.value.filter((item) => String(item.id) !== String(pallet.id))
return
}
selectedPallets.value.push({
...pallet,
packageCount: pallet.productCount || pallet.packageCount || defaultPackageCount.value
})
}
function clearSearch() {
searchText.value = ''
loadPallets()
}
function openCreatePallet() {
const query = [
`productId=${encodeURIComponent(productId.value || '')}`,
`packageCount=${encodeURIComponent(defaultPackageCount.value || 1)}`
].join('&')
uni.navigateTo({ url: `/pages_function/pages/productInbound/palletCreate?${query}` })
}
function getWarehouseName(id) {
return warehouseOptions.value.find((item) => String(item.value) === String(id))?.label || ''
}
function getAreaName(warehouseId, areaId) {
const areas = warehouseAreaMap.value[String(warehouseId)] || []
return areas.find((item) => String(item.value) === String(areaId))?.label || ''
}
async function loadWarehouses() {
try {
const res = await getWarehouseSimpleList()
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseOptions.value = data.map((w) => ({ value: w.id, label: w.name || String(w.id || '') }))
} catch (e) {}
}
async function loadAreasForWarehouse(warehouseId) {
if (!warehouseId || warehouseAreaMap.value[String(warehouseId)]) return
try {
const res = await getWarehouseAreaSimpleList(warehouseId)
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseAreaMap.value = {
...warehouseAreaMap.value,
[String(warehouseId)]: data.map((a) => ({ value: a.id, label: a.name || a.areaName || String(a.id || '') }))
}
} catch (e) {
warehouseAreaMap.value = { ...warehouseAreaMap.value, [String(warehouseId)]: [] }
}
}
async function loadAreasForPallets(pallets) {
const ids = Array.from(new Set((pallets || []).map((p) => p.warehouseId).filter(Boolean)))
await Promise.all(ids.map((id) => loadAreasForWarehouse(id)))
}
async function loadPallets() {
loading.value = true
try {
const res = await getPalletPage({
pageNo: 1,
pageSize: 100,
code: searchText.value.trim() || undefined,
productId: productId.value || undefined
})
palletList.value = normalizeList(res)
await loadAreasForPallets([...palletList.value, ...selectedPallets.value])
} catch (e) {
uni.showToast({ title: t('productInbound.loadFailed'), icon: 'none' })
} finally {
loading.value = false
}
}
function handleConfirm() {
if (!selectedPallets.value.length) {
uni.showToast({ title: t('productInbound.selectPallet'), icon: 'none' })
return
}
getApp().globalData._productInboundPalletSelectResult = selectedPallets.value
getApp().globalData._productInboundSelectedPallets = []
uni.navigateBack()
}
onShow(async () => {
await initAllDict()
await loadWarehouses()
await loadPallets()
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; padding-bottom: calc(138rpx + env(safe-area-inset-bottom)); }
.search-bar { padding: 18rpx 24rpx; background: #ffffff; box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.03); }
.search-input-wrap { display: flex; align-items: center; gap: 12rpx; height: var(--app-form-control-height, 70rpx); padding: 0 22rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; }
.search-input { flex: 1; min-width: 0; font-size: 28rpx; color: #374151; }
.search-placeholder { color: #9ca3af; }
.search-clear { width: 44rpx; height: 44rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pallet-list { height: calc(100vh - 312rpx); }
.pallet-card { margin: 18rpx 24rpx 0; padding: 24rpx; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 20rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.pallet-card.active { border-color: #bfdbfe; background: #f9fbff; box-shadow: 0 8rpx 22rpx rgba(31, 124, 255, 0.08); }
.pallet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18rpx; }
.pallet-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8rpx; }
.pallet-name-row { display: flex; align-items: center; gap: 10rpx; min-width: 0; }
.pallet-code { min-width: 0; font-size: 30rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-tag, .status-tag { max-width: 140rpx; padding: 5rpx 12rpx; border-radius: 999rpx; font-size: 22rpx; line-height: 1.3; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-tag { background: #eef2ff; color: #4f46e5; }
.status-tag { background: #ecfdf5; color: #059669; }
.pallet-product { font-size: 24rpx; color: #8a94a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-badge { width: 36rpx; height: 36rpx; border-radius: 18rpx; border: 1rpx solid #d1d5db; background: #ffffff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pallet-card.active .check-badge { border-color: #1f7cff; background: #1f7cff; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14rpx; margin-top: 20rpx; padding-top: 18rpx; border-top: 1rpx solid #f1f5f9; }
.info-cell { min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.info-label { font-size: 23rpx; color: #9ca3af; }
.info-value { font-size: 27rpx; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-wrap { height: calc(100vh - 312rpx); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14rpx; color: #94a3b8; font-size: 27rpx; }
.add-btn { position: fixed; right: 28rpx; bottom: calc(154rpx + env(safe-area-inset-bottom)); width: 96rpx; height: 96rpx; border-radius: 48rpx; background: linear-gradient(135deg, #1a3a5c 0%, #2d5a87 100%); display: flex; align-items: center; justify-content: center; box-shadow: 0 8rpx 24rpx rgba(26, 58, 92, 0.32); z-index: 98; }
.add-icon { color: #ffffff; font-size: 56rpx; line-height: 1; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 180rpx 1fr; gap: 18rpx; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.selected-count { height: 84rpx; border-radius: 16rpx; background: #eef2f7; color: #475569; display: flex; align-items: center; justify-content: center; font-size: 27rpx; font-weight: 600; }
.action-btn { height: 84rpx; border-radius: 16rpx; background: #1f4b79; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.action-btn-disabled { background: #94a3b8; }
</style>

@ -0,0 +1,494 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.createTitle')" />
<scroll-view scroll-y class="detail-scroll">
<view class="content-section">
<view class="section-card">
<view class="section-header">
<view class="section-icon">
<uni-icons type="paperplane" size="24" color="#1f7cff"></uni-icons>
</view>
<text class="section-title">{{ t('productInbound.taskInfo') }}</text>
</view>
<view class="form-field">
<text class="form-label">{{ t('productInbound.relatedTask') }}<text class="required-star">*</text></text>
<view class="segment-control">
<view :class="['segment-item', relateTask ? 'active' : '']" @click="setRelateTask(true)">{{ t('productInbound.yes') }}</view>
<view :class="['segment-item', !relateTask ? 'active' : '']" @click="setRelateTask(false)">{{ t('productInbound.no') }}</view>
</view>
</view>
<view v-if="relateTask" class="form-field">
<text class="form-label">{{ t('productInbound.taskOrder') }}<text class="required-star">*</text></text>
<view :class="['select-field', taskCode ? 'selected' : '']" @click="goSelectTask">
<view class="select-content">
<text :class="taskCode ? 'select-value' : 'select-placeholder'">{{ taskCode || t('productInbound.selectTask') }}</text>
</view>
<uni-icons type="right" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
<view v-if="relateTask && taskId" class="form-field">
<text class="form-label">{{ t('productInbound.taskProduct') }}<text class="required-star">*</text></text>
<view :class="['select-field', selectedTaskProduct ? 'selected' : '']" @click="goSelectTaskProduct">
<view class="select-content">
<text :class="selectedTaskProduct ? 'select-value' : 'select-placeholder'">{{ selectedTaskProduct ? textValue(selectedTaskProduct.productName) : t('productInbound.selectTaskProduct') }}</text>
</view>
<uni-icons type="right" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
<view v-if="!relateTask" class="form-field">
<text class="form-label">{{ t('productInbound.product') }}<text class="required-star">*</text></text>
<view :class="['select-field', productName ? 'selected' : '']" @click="goSelectProduct">
<view class="select-content">
<text :class="productName ? 'select-value' : 'select-placeholder'">{{ productName || t('productInbound.selectProduct') }}</text>
<text v-if="productBarCode" class="select-subtext">{{ textValue(productBarCode) }}</text>
</view>
<uni-icons type="right" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
<view v-if="productId" class="info-panel">
<view class="info-grid">
<view v-if="relateTask" class="info-item">
<text class="info-label">{{ t('productInbound.workOrderNo') }}</text>
<text class="info-value">{{ textValue(taskCode) }}</text>
</view>
<view class="info-item">
<text class="info-label">{{ t('productInbound.product') }}</text>
<text class="info-value">{{ textValue(productName) }}</text>
</view>
<view v-if="!relateTask" class="info-item">
<text class="info-label">{{ t('productInbound.code') }}</text>
<text class="info-value">{{ textValue(productBarCode) }}</text>
</view>
<view class="info-item">
<text class="info-label">{{ t('productInbound.packagingScheme') }}</text>
<text class="info-value">{{ textValue(packagingSchemeName) }}</text>
</view>
<view class="info-item">
<text class="info-label">{{ t('productInbound.palletPackageQuantity') }}</text>
<text class="info-value">{{ t('productInbound.packageUnit', { count: textValue(palletPackageQuantity) }) }}</text>
</view>
<view class="info-item">
<text class="info-label">{{ t('productInbound.packageQuantity') }}</text>
<text class="info-value">{{ t('productInbound.pieceUnit', { count: textValue(packageQuantity) }) }}</text>
</view>
</view>
</view>
</view>
<view class="section-card">
<view class="section-header">
<view class="section-icon">
<uni-icons type="list" size="24" color="#1f7cff"></uni-icons>
</view>
<text class="section-title">{{ t('productInbound.pallet') }}</text>
</view>
<view class="form-field">
<view class="form-label-row">
<text class="form-label">{{ t('productInbound.palletCode') }}<text class="required-star">*</text></text>
<text v-if="selectedPallets.length" class="label-tip">{{ t('productInbound.selectedPalletCount', { count: selectedPallets.length }) }}</text>
</view>
<view :class="['select-field', selectedPallets.length ? 'selected' : '']" @click="goSelectPallet" >
<view class="select-content">
<text :class="selectedPallets.length ? 'select-value' : 'select-placeholder'">{{ palletCode || t('productInbound.selectPallet') }}</text>
</view>
<uni-icons type="right" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
<view v-if="selectedPallets.length" class="pallet-list">
<view v-for="(pallet, index) in selectedPallets" :key="pallet.id || index" class="pallet-card">
<view class="pallet-main">
<view class="pallet-top">
<text class="pallet-code">{{ textValue(getPalletCode(pallet)) }}</text>
<view class="remove-btn" @click="removePallet(index)">
<uni-icons type="closeempty" size="18" color="#ef4444"></uni-icons>
</view>
</view>
<view class="pallet-loc">
<view class="loc-cell">
<text class="loc-label">{{ t('productInbound.warehouse') }}</text>
<picker mode="selector" :range="warehouseOptions" range-key="label" :value="getWarehouseIndex(pallet.warehouseId)" @change="onPalletWarehouseChange($event, index)">
<view class="loc-picker">
<text :class="pallet.warehouseId ? 'loc-value' : 'loc-placeholder'">{{ pallet.warehouseId ? getWarehouseName(pallet.warehouseId) : t('productInbound.choose') }}</text>
<uni-icons type="bottom" size="14" color="#9ca3af"></uni-icons>
</view>
</picker>
</view>
<view class="loc-cell">
<text class="loc-label">{{ t('productInbound.location') }}</text>
<picker mode="selector" :range="getAreaOptions(pallet.warehouseId)" range-key="label" :value="getAreaIndex(pallet.warehouseId, pallet.areaId)" :disabled="!pallet.warehouseId" @change="onPalletAreaChange($event, index)">
<view class="loc-picker">
<text :class="pallet.areaId ? 'loc-value' : 'loc-placeholder'">{{ pallet.areaId ? getAreaName(pallet.warehouseId, pallet.areaId) : t('productInbound.choose') }}</text>
<uni-icons type="bottom" size="14" color="#9ca3af"></uni-icons>
</view>
</picker>
</view>
</view>
<view class="pallet-count-row">
<view class="count-cell">
<text class="count-label">{{ t('productInbound.packageCount') }}</text>
<input class="count-input" type="number" :value="pallet.packageCount" @input="onPalletCountInput($event, index)" placeholder="0" />
</view>
<view class="count-cell">
<text class="count-label">{{ t('productInbound.pieceCount') }}</text>
<text class="count-value">{{ getPalletItemCount(pallet) }}</text>
</view>
</view>
</view>
</view>
<view class="quantity-summary">
<view class="quantity-item">
<text class="quantity-value">{{ inputCount }}</text>
<text class="quantity-label">{{ t('productInbound.packageCount') }}</text>
</view>
<view class="quantity-item">
<text class="quantity-value">{{ count }}</text>
<text class="quantity-label">{{ t('productInbound.pieceCount') }}</text>
</view>
</view>
</view>
<view v-else class="empty-card" @click="goSelectPallet">{{ t('productInbound.selectPalletFirst') }}</view>
</view>
</view>
</scroll-view>
<view class="action-bar">
<view class="action-btn back-btn" @click="handleCancel">{{ t('productInbound.cancel') }}</view>
<view class="action-btn submit-btn" @click="handleConfirm">{{ t('productInbound.confirm') }}</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getTaskDefaultPackagingSchemes } from '@/api/mes/productInbound'
import { getWarehouseAreaSimpleList, getWarehouseSimpleList } from '@/api/mes/moldget'
const { t } = useI18n()
const product = ref({})
const relateTask = ref(true)
const taskId = ref(null)
const taskCode = ref('')
const selectedTaskData = ref(null)
const selectedTaskProduct = ref(null)
const selectedPallets = ref([])
const warehouseOptions = ref([])
const warehouseAreaMap = ref({})
const taskProductList = ref([])
const productName = computed(() => selectedTaskProduct.value?.productName || product.value.name || '')
const productId = computed(() => selectedTaskProduct.value?.productId || product.value.id)
const productBarCode = computed(() => selectedTaskProduct.value?.productCode || product.value.barCode || product.value.code || '')
const currentScheme = computed(() => selectedTaskProduct.value ? getDefaultScheme(selectedTaskProduct.value) : getDefaultScheme(product.value))
const packagingSchemeName = computed(() => currentScheme.value?.packagingSchemeName || '')
const packageQuantity = computed(() => Number(currentScheme.value?.packageQuantity) || 0)
const palletPackageQuantity = computed(() => Number(currentScheme.value?.palletPackageQuantity) || 0)
const palletTotalQuantity = computed(() => Number(currentScheme.value?.palletTotalQuantity) || packageQuantity.value * palletPackageQuantity.value)
const inputCount = computed(() => {
if (!selectedPallets.value.length) return 0
return selectedPallets.value.reduce((sum, pallet) => sum + (Number(pallet.packageCount) || 0), 0)
})
const count = computed(() => {
return selectedPallets.value.reduce((sum, pallet) => {
const packageCount = Number(pallet.packageCount) || 0
return sum + packageCount * (packageQuantity.value || 1)
}, 0)
})
const palletCode = computed(() => selectedPallets.value.map((item) => getPalletCode(item)).filter(Boolean).join(', '))
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
function getDefaultScheme(item) {
const schemes = Array.isArray(item?.packagingSchemes) ? item.packagingSchemes : []
return schemes.find((scheme) => Number(scheme?.defaultStatus) === 1) || schemes[0] || {}
}
function getPalletCode(pallet) {
return pallet?.code || pallet?.palletCode || ''
}
function getWarehouseName(id) {
return warehouseOptions.value.find((item) => String(item.value) === String(id))?.label || ''
}
function getAreaName(warehouseId, areaId) {
const areas = warehouseAreaMap.value[String(warehouseId)] || []
return areas.find((item) => String(item.value) === String(areaId))?.label || ''
}
function getAreaOptions(warehouseId) {
return warehouseAreaMap.value[String(warehouseId)] || []
}
function getWarehouseIndex(id) {
const i = warehouseOptions.value.findIndex((item) => String(item.value) === String(id))
return i >= 0 ? i : 0
}
function getAreaIndex(warehouseId, areaId) {
const areas = getAreaOptions(warehouseId)
const i = areas.findIndex((item) => String(item.value) === String(areaId))
return i >= 0 ? i : 0
}
function getPalletItemCount(pallet) {
const c = Number(pallet?.packageCount) || 0
return c * (packageQuantity.value || 1)
}
async function onPalletWarehouseChange(e, index) {
const opt = warehouseOptions.value[Number(e.detail.value)]
if (!opt) return
selectedPallets.value[index].warehouseId = opt.value
selectedPallets.value[index].areaId = null
await loadAreasForWarehouse(opt.value)
}
function onPalletAreaChange(e, index) {
const areas = getAreaOptions(selectedPallets.value[index].warehouseId)
const opt = areas[Number(e.detail.value)]
if (!opt) return
selectedPallets.value[index].areaId = opt.value
}
function onPalletCountInput(e, index) {
const v = Number(e.detail.value)
selectedPallets.value[index].packageCount = Number.isFinite(v) ? v : 0
}
function setRelateTask(value) {
if (relateTask.value === value) return
relateTask.value = value
product.value = {}
selectedTaskProduct.value = null
taskId.value = null
taskCode.value = ''
selectedTaskData.value = null
selectedPallets.value = []
}
function goSelectTask() {
const suffix = taskId.value ? `?selectedId=${taskId.value}` : ''
uni.navigateTo({ url: `/pages_function/pages/productInbound/taskSelect${suffix}` })
}
function goSelectProduct() {
const suffix = product.value?.id ? `?selectedId=${product.value.id}` : ''
uni.navigateTo({ url: `/pages_function/pages/productInbound/productSelect${suffix}` })
}
function goSelectTaskProduct() {
if (!taskId.value) {
uni.showToast({ title: t('productInbound.selectTaskFirst'), icon: 'none' })
return
}
if (!taskProductList.value.length) {
uni.showToast({ title: t('productInbound.emptyTaskProducts'), icon: 'none' })
return
}
getApp().globalData._productInboundTaskProductList = [...taskProductList.value]
const suffix = selectedTaskProduct.value?.productId ? `?selectedId=${selectedTaskProduct.value.productId}` : ''
uni.navigateTo({ url: `/pages_function/pages/productInbound/taskProductSelect${suffix}` })
}
function goSelectPallet() {
if (!productId.value) {
uni.showToast({ title: t('productInbound.selectProductFirst'), icon: 'none' })
return
}
getApp().globalData._productInboundSelectedPallets = [...selectedPallets.value]
const query = `productId=${productId.value}&packageCount=${palletPackageQuantity.value || 1}`
uni.navigateTo({ url: `/pages_function/pages/productInbound/palletSelect?${query}` })
}
function removePallet(index) {
selectedPallets.value.splice(index, 1)
}
async function loadWarehouses() {
try {
const res = await getWarehouseSimpleList()
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseOptions.value = data.map((w) => ({ value: w.id, label: w.name || String(w.id || '') }))
} catch (e) {}
}
async function loadAreasForWarehouse(warehouseId) {
if (!warehouseId || warehouseAreaMap.value[String(warehouseId)]) return
try {
const res = await getWarehouseAreaSimpleList(warehouseId)
const data = Array.isArray(res) ? res : (Array.isArray(res?.data) ? res.data : [])
warehouseAreaMap.value = {
...warehouseAreaMap.value,
[String(warehouseId)]: data.map((a) => ({ value: a.id, label: a.name || a.areaName || String(a.id || '') }))
}
} catch (e) {
warehouseAreaMap.value = { ...warehouseAreaMap.value, [String(warehouseId)]: [] }
}
}
async function loadAreasForPallets(pallets) {
const warehouseIds = Array.from(new Set((pallets || []).map((p) => p.warehouseId).filter(Boolean)))
await Promise.all(warehouseIds.map((id) => loadAreasForWarehouse(id)))
}
function handleCancel() {
uni.navigateBack()
}
function handleConfirm() {
if (relateTask.value && !taskId.value) {
uni.showToast({ title: t('productInbound.selectTask'), icon: 'none' })
return
}
if (relateTask.value && !selectedTaskProduct.value) {
uni.showToast({ title: t('productInbound.selectTaskProduct'), icon: 'none' })
return
}
if (!productId.value) {
uni.showToast({ title: t('productInbound.selectProduct'), icon: 'none' })
return
}
if (!selectedPallets.value.length) {
uni.showToast({ title: t('productInbound.selectPallet'), icon: 'none' })
return
}
const invalid = selectedPallets.value.find((p) => !p.warehouseId || !p.areaId || !Number(p.packageCount))
if (invalid) {
uni.showToast({ title: t('productInbound.completePalletInfo'), icon: 'none' })
return
}
const firstPallet = selectedPallets.value[0]
const item = {
productId: productId.value,
productName: productName.value,
productBarCode: productBarCode.value,
productUnitName: product.value.unitName || product.value.minStockUnitName || '个',
inputUnitType: '个',
inputCount: inputCount.value,
count: count.value,
relateTask: relateTask.value,
taskId: relateTask.value ? taskId.value : null,
taskCode: taskCode.value,
taskDetailIds: selectedTaskProduct.value?.taskDetailIds,
packagingSchemeRelationId: currentScheme.value?.id,
packagingSchemeId: currentScheme.value?.packagingSchemeId,
packagingSchemeName: packagingSchemeName.value,
packageQuantity: packageQuantity.value,
palletPackageQuantity: palletPackageQuantity.value,
palletTotalQuantity: palletTotalQuantity.value,
warehouseId: firstPallet?.warehouseId || null,
warehouseName: getWarehouseName(firstPallet?.warehouseId),
areaId: firstPallet?.areaId || null,
areaName: getAreaName(firstPallet?.warehouseId, firstPallet?.areaId),
palletCode: palletCode.value,
pallets: selectedPallets.value.map((pallet) => ({
palletId: pallet.id,
palletCode: getPalletCode(pallet),
packageCount: Number(pallet.packageCount) || 0,
warehouseId: pallet.warehouseId,
areaId: pallet.areaId,
count: (Number(pallet.packageCount) || 0) * (packageQuantity.value || 1)
})),
images: product.value.images,
_product: { ...product.value }
}
if (!getApp().globalData._productInboundItems) getApp().globalData._productInboundItems = []
getApp().globalData._productInboundItems.push(item)
uni.showToast({ title: t('productInbound.productAdded'), icon: 'success', duration: 1000 })
setTimeout(() => uni.navigateBack(), 700)
}
onShow(async () => {
const gd = getApp().globalData
const taskResult = gd?._productInboundTaskSelectResult
if (taskResult) {
taskId.value = taskResult.id
taskCode.value = taskResult.code || taskResult.taskName || ''
selectedTaskProduct.value = null
selectedPallets.value = []
gd._productInboundTaskSelectResult = null
try {
uni.showLoading({ title: t('productInbound.loading'), mask: true })
const res = await getTaskDefaultPackagingSchemes(taskResult.id)
uni.hideLoading()
selectedTaskData.value = res?.data || res || {}
taskProductList.value = Array.isArray(selectedTaskData.value?.products) ? selectedTaskData.value.products : []
} catch (e) {
uni.hideLoading()
uni.showToast({ title: t('productInbound.taskProductLoadFailed'), icon: 'none' })
}
}
const taskProductResult = gd?._productInboundTaskProductSelectResult
if (taskProductResult) {
selectedTaskProduct.value = taskProductResult
selectedPallets.value = []
gd._productInboundTaskProductSelectResult = null
}
const productResult = gd?._productInboundProductSelectResult
if (productResult) {
product.value = productResult
selectedPallets.value = []
gd._productInboundProductSelectResult = null
}
const palletResult = gd?._productInboundPalletSelectResult
if (Array.isArray(palletResult)) {
selectedPallets.value = palletResult
await loadAreasForPallets(selectedPallets.value)
gd._productInboundPalletSelectResult = null
}
await loadWarehouses()
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; }
.detail-scroll { height: calc(100vh - 172rpx); }
.content-section { padding: 20rpx 24rpx 28rpx; }
.section-card { background: #ffffff; border-radius: 20rpx; padding: 24rpx; margin-bottom: 20rpx; border: 1rpx solid #eef2f7; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.section-header { display: flex; align-items: center; gap: 12rpx; margin-bottom: 22rpx; padding-bottom: 18rpx; border-bottom: 1rpx solid #f1f5f9; }
.section-icon { width: 40rpx; height: 40rpx; border-radius: 10rpx; background: #eff6ff; display: flex; align-items: center; justify-content: center; }
.section-title { font-size: 32rpx; font-weight: 600; color: #1f2937; }
.form-field { display: flex; flex-direction: column; gap: 12rpx; }
.form-field + .form-field { margin-top: 24rpx; }
.form-label-row { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; }
.form-label { font-size: 26rpx; color: #4b5563; font-weight: 500; }
.label-tip { flex-shrink: 0; font-size: 24rpx; color: #6b7280; }
.required-star { color: #ef4444; font-size: 28rpx; margin-left: 4rpx; }
.segment-control { display: grid; grid-template-columns: 1fr 1fr; gap: 12rpx; padding: 6rpx; background: #f3f4f6; border-radius: 16rpx; }
.segment-item { height: 72rpx; border-radius: 12rpx; display: flex; align-items: center; justify-content: center; color: #6b7280; font-size: 28rpx; font-weight: 600; }
.segment-item.active { background: #ffffff; color: #1f7cff; box-shadow: 0 4rpx 12rpx rgba(15, 23, 42, 0.08); }
.select-field { min-height: 70rpx; padding: 16rpx 22rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 12rpx; }
.select-field.selected { background: #f9fbff; border-color: #bfdbfe; box-shadow: 0 4rpx 12rpx rgba(31, 124, 255, 0.08); }
.select-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.select-value { font-size: 28rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-placeholder { font-size: 28rpx; color: #9ca3af; }
.select-subtext { font-size: 24rpx; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-panel { margin-top: 22rpx; padding: 20rpx; background: #f8fafc; border: 1rpx solid #e8eef6; border-radius: 16rpx; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 14rpx; overflow: hidden; }
.info-item { min-width: 0; display: flex; flex-direction: column; gap: 8rpx; padding: 18rpx 20rpx; border-right: 1rpx solid #f1f5f9; border-bottom: 1rpx solid #f1f5f9; }
.info-item:nth-child(2n) { border-right: 0; }
.info-label { font-size: 23rpx; color: #8a94a6; }
.info-value { font-size: 27rpx; color: #334155; line-height: 1.35; word-break: break-all; }
.pallet-list { margin-top: 20rpx; display: flex; flex-direction: column; gap: 14rpx; }
.pallet-card { padding: 18rpx 20rpx; border: 1rpx solid #eef2f7; border-radius: 16rpx; background: #ffffff; }
.pallet-main { display: flex; flex-direction: column; gap: 14rpx; }
.pallet-top { display: flex; align-items: center; justify-content: space-between; gap: 12rpx; }
.pallet-code { flex: 1; min-width: 0; font-size: 28rpx; color: #1f2937; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-btn { width: 48rpx; height: 48rpx; border-radius: 24rpx; background: #fef2f2; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pallet-loc { display: grid; grid-template-columns: 1fr 1fr; gap: 12rpx; }
.loc-cell { min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.loc-label { font-size: 22rpx; color: #9ca3af; }
.loc-picker { min-height: 64rpx; padding: 0 16rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 12rpx; display: flex; align-items: center; justify-content: space-between; gap: 8rpx; box-sizing: border-box; }
.loc-value { flex: 1; min-width: 0; font-size: 25rpx; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-placeholder { flex: 1; font-size: 25rpx; color: #9ca3af; }
.pallet-count-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12rpx; }
.count-cell { min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.count-label { font-size: 22rpx; color: #9ca3af; }
.count-input { height: 64rpx; padding: 0 16rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 12rpx; font-size: 26rpx; color: #1f2937; box-sizing: border-box; }
.count-value { height: 64rpx; line-height: 64rpx; padding: 0 16rpx; background: #f1f5f9; border-radius: 12rpx; font-size: 26rpx; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quantity-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 14rpx; }
.quantity-item { padding: 18rpx; background: #eff6ff; border-radius: 14rpx; display: flex; flex-direction: column; align-items: center; gap: 6rpx; }
.quantity-value { font-size: 34rpx; color: #1f4b79; font-weight: 700; }
.quantity-label { font-size: 23rpx; color: #64748b; }
.empty-card { height: 96rpx; border-radius: 14rpx; background: #f8fafc; color: #94a3b8; font-size: 27rpx; display: flex; align-items: center; justify-content: center;margin-top: 20rpx; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 18rpx; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.action-btn { flex: 1; height: 84rpx; border-radius: 16rpx; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.back-btn { background: #eef2f7; color: #475569; }
.submit-btn { background: #1f4b79; color: #ffffff; }
</style>

@ -0,0 +1,170 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.selectProductTitle')" />
<view class="search-bar">
<view class="search-input-wrap">
<uni-icons type="search" size="18" color="#9ca3af"></uni-icons>
<input
v-model="searchText"
class="search-input"
:placeholder="t('productInbound.searchProductPlaceholder')"
placeholder-class="search-placeholder"
confirm-type="search"
/>
<view v-if="searchText" class="search-clear" @click="clearSearch">
<uni-icons type="closeempty" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
</view>
<scroll-view scroll-y class="product-list" v-if="filteredList.length">
<view
v-for="item in filteredList"
:key="item.id"
:class="['product-card', isSelected(item) ? 'active' : '']"
@click="selectedId = item.id"
>
<view class="product-header">
<view class="product-title-wrap">
<view class="product-name-row">
<text class="product-name">{{ textValue(item.name) }}</text>
<text v-if="getCategoryName(item)" class="category-tag">{{ getCategoryName(item) }}</text>
</view>
<text class="product-code">{{ textValue(item.barCode || item.code) }}</text>
</view>
<view class="check-badge">
<uni-icons v-if="isSelected(item)" type="checkmarkempty" size="16" color="#ffffff"></uni-icons>
</view>
</view>
<view class="info-grid">
<view class="info-cell">
<text class="info-label">{{ t('productInbound.spec') }}</text>
<text class="info-value">{{ textValue(item.standard || item.deviceSpec) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.unit') }}</text>
<text class="info-value">{{ textValue(item.unitName) }}</text>
</view>
</view>
</view>
</scroll-view>
<view v-else class="empty-wrap">
<uni-icons type="info" size="30" color="#cbd5e1"></uni-icons>
<text>{{ loading ? t('productInbound.loading') : t('productInbound.emptyProduct') }}</text>
</view>
<view class="action-bar">
<view :class="['action-btn', selectedId ? '' : 'action-btn-disabled']" @click="handleConfirm">{{ t('productInbound.confirm') }}</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getProduct, getProductPage } from '@/api/erp/productInfo'
const { t } = useI18n()
const productList = ref([])
const selectedId = ref(null)
const searchText = ref('')
const loading = ref(false)
onLoad((options) => {
selectedId.value = options?.selectedId ? String(options.selectedId) : null
})
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
const filteredList = computed(() => {
const keyword = searchText.value.trim().toLowerCase()
if (!keyword) return productList.value
return productList.value.filter((item) =>
String(item.name || '').toLowerCase().includes(keyword) ||
String(item.barCode || item.code || '').toLowerCase().includes(keyword) ||
String(item.standard || item.deviceSpec || '').toLowerCase().includes(keyword) ||
String(getCategoryName(item)).toLowerCase().includes(keyword)
)
})
function isSelected(item) {
return String(selectedId.value) === String(item.id)
}
function getCategoryName(item) {
return item?.subCategoryName || item?.categoryName || item?.category?.name || ''
}
function clearSearch() {
searchText.value = ''
}
function normalizePageList(res) {
const root = res && res.data !== undefined ? res.data : res
return Array.isArray(root) ? root : (root?.list || root?.rows || root?.records || [])
}
async function loadProducts() {
loading.value = true
try {
const raw = []
for (let pageNo = 1; pageNo <= 5; pageNo += 1) {
const res = await getProductPage({ pageNo, pageSize: 100, categoryType: 1 })
const list = normalizePageList(res)
if (!list.length) break
raw.push(...list)
if (list.length < 100) break
}
productList.value = raw
} catch (e) {
uni.showToast({ title: t('productInbound.loadFailed'), icon: 'none' })
} finally {
loading.value = false
}
}
async function handleConfirm() {
if (!selectedId.value) {
uni.showToast({ title: t('productInbound.selectProduct'), icon: 'none' })
return
}
let item = productList.value.find((d) => String(d.id) === String(selectedId.value))
if (!item) return
try {
const res = await getProduct(item.id)
item = { ...item, ...(res?.data || res || {}) }
} catch (e) {}
getApp().globalData._productInboundProductSelectResult = item
uni.navigateBack()
}
onShow(loadProducts)
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; padding-bottom: calc(120rpx + env(safe-area-inset-bottom)); }
.search-bar { padding: 18rpx 24rpx; background: #ffffff; box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.03); }
.search-input-wrap { display: flex; align-items: center; gap: 12rpx; height: 76rpx; padding: 0 22rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; }
.search-input { flex: 1; min-width: 0; font-size: 28rpx; color: #374151; }
.search-placeholder { color: #9ca3af; }
.search-clear { width: 44rpx; height: 44rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-list { height: calc(100vh - 294rpx); }
.product-card { margin: 18rpx 24rpx 0; padding: 24rpx; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 20rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.product-card.active { border-color: #bfdbfe; background: #f9fbff; box-shadow: 0 8rpx 22rpx rgba(31, 124, 255, 0.08); }
.product-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18rpx; }
.product-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8rpx; }
.product-name-row { display: flex; align-items: center; gap: 12rpx; min-width: 0; }
.product-name { min-width: 0; font-size: 30rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-tag { max-width: 180rpx; padding: 5rpx 14rpx; border-radius: 999rpx; background: #eff6ff; color: #1f7cff; font-size: 22rpx; line-height: 1.3; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-code { font-size: 24rpx; color: #8a94a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-badge { width: 36rpx; height: 36rpx; border-radius: 18rpx; border: 1rpx solid #d1d5db; background: #ffffff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-card.active .check-badge { border-color: #1f7cff; background: #1f7cff; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14rpx; margin-top: 20rpx; padding-top: 18rpx; border-top: 1rpx solid #f1f5f9; }
.info-cell { min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.info-label { font-size: 23rpx; color: #9ca3af; }
.info-value { font-size: 27rpx; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-wrap { height: calc(100vh - 294rpx); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14rpx; color: #94a3b8; font-size: 27rpx; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.action-btn { height: 84rpx; border-radius: 16rpx; background: #1f4b79; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.action-btn-disabled { background: #94a3b8; }
</style>

@ -0,0 +1,135 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.selectTaskProductTitle')" />
<view class="search-bar">
<view class="search-input-wrap">
<uni-icons type="search" size="18" color="#9ca3af"></uni-icons>
<input v-model="searchText" class="search-input" :placeholder="t('productInbound.searchTaskProductPlaceholder')" placeholder-class="search-placeholder" confirm-type="search" />
<view v-if="searchText" class="search-clear" @click="clearSearch">
<uni-icons type="closeempty" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
</view>
<scroll-view scroll-y class="product-list" v-if="filteredList.length">
<view v-for="item in filteredList" :key="item.productId" :class="['product-card', isSelected(item) ? 'active' : '']" @click="selectedId = item.productId">
<view class="product-header">
<view class="product-title-wrap">
<text class="product-name">{{ textValue(item.productName) }}</text>
<text class="product-code">{{ textValue(item.productCode) }}</text>
</view>
<view class="check-badge">
<uni-icons v-if="isSelected(item)" type="checkmarkempty" size="16" color="#ffffff"></uni-icons>
</view>
</view>
<view class="info-grid">
<view class="info-cell">
<text class="info-label">{{ t('productInbound.packagingScheme') }}</text>
<text class="info-value">{{ textValue(getDefaultScheme(item)?.packagingSchemeName) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.palletPackageQuantity') }}</text>
<text class="info-value">{{ textValue(getDefaultScheme(item)?.palletPackageQuantity) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.packageQuantity') }}</text>
<text class="info-value">{{ textValue(getDefaultScheme(item)?.packageQuantity) }}</text>
</view>
</view>
</view>
</scroll-view>
<view v-else class="empty-wrap">
<uni-icons type="info" size="30" color="#cbd5e1"></uni-icons>
<text>{{ t('productInbound.emptyTaskProduct') }}</text>
</view>
<view class="action-bar">
<view :class="['action-btn', selectedId ? '' : 'action-btn-disabled']" @click="handleConfirm">{{ t('productInbound.confirm') }}</view>
</view>
</view>
</template>
<script setup>
import { computed, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
const { t } = useI18n()
const productList = ref([])
const selectedId = ref(null)
const searchText = ref('')
const filteredList = computed(() => {
const keyword = searchText.value.trim().toLowerCase()
if (!keyword) return productList.value
return productList.value.filter((item) =>
String(item.productName || '').toLowerCase().includes(keyword) ||
String(item.productCode || '').toLowerCase().includes(keyword) ||
String(getDefaultScheme(item)?.packagingSchemeName || '').toLowerCase().includes(keyword)
)
})
onLoad((options) => {
selectedId.value = options?.selectedId ? String(options.selectedId) : null
})
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
function getDefaultScheme(item) {
const schemes = Array.isArray(item?.packagingSchemes) ? item.packagingSchemes : []
return schemes.find((scheme) => Number(scheme?.defaultStatus) === 1) || schemes[0] || {}
}
function isSelected(item) {
return String(selectedId.value) === String(item.productId)
}
function clearSearch() {
searchText.value = ''
}
function handleConfirm() {
if (!selectedId.value) {
uni.showToast({ title: t('productInbound.selectTaskProduct'), icon: 'none' })
return
}
const item = productList.value.find((d) => String(d.productId) === String(selectedId.value))
if (!item) return
getApp().globalData._productInboundTaskProductSelectResult = item
uni.navigateBack()
}
onShow(() => {
const list = getApp().globalData?._productInboundTaskProductList
productList.value = Array.isArray(list) ? list : []
})
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; padding-bottom: calc(120rpx + env(safe-area-inset-bottom)); }
.search-bar { padding: 18rpx 24rpx; background: #ffffff; box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.03); }
.search-input-wrap { display: flex; align-items: center; gap: 12rpx; height: 76rpx; padding: 0 22rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; }
.search-input { flex: 1; min-width: 0; font-size: 28rpx; color: #374151; }
.search-placeholder { color: #9ca3af; }
.search-clear { width: 44rpx; height: 44rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-list { height: calc(100vh - 294rpx); }
.product-card { margin: 18rpx 24rpx 0; padding: 24rpx; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 20rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.product-card.active { border-color: #bfdbfe; background: #f9fbff; box-shadow: 0 8rpx 22rpx rgba(31, 124, 255, 0.08); }
.product-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18rpx; }
.product-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8rpx; }
.product-name { font-size: 30rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-code { font-size: 24rpx; color: #8a94a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-badge { width: 36rpx; height: 36rpx; border-radius: 18rpx; border: 1rpx solid #d1d5db; background: #ffffff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-card.active .check-badge { border-color: #1f7cff; background: #1f7cff; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14rpx; margin-top: 20rpx; padding-top: 18rpx; border-top: 1rpx solid #f1f5f9; }
.info-cell { min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.info-label { font-size: 23rpx; color: #9ca3af; }
.info-value { font-size: 27rpx; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-wrap { height: calc(100vh - 294rpx); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14rpx; color: #94a3b8; font-size: 27rpx; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.action-btn { height: 84rpx; border-radius: 16rpx; background: #1f4b79; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.action-btn-disabled { background: #94a3b8; }
</style>

@ -0,0 +1,154 @@
<template>
<view class="page-container">
<NavBar :title="t('productInbound.selectTaskTitle')" />
<view class="search-bar">
<view class="search-input-wrap">
<uni-icons type="search" size="18" color="#9ca3af"></uni-icons>
<input
v-model="searchText"
class="search-input"
:placeholder="t('productInbound.searchTaskPlaceholder')"
placeholder-class="search-placeholder"
confirm-type="search"
@confirm="loadTasks"
/>
<view v-if="searchText" class="search-clear" @click="clearSearch">
<uni-icons type="closeempty" size="18" color="#9ca3af"></uni-icons>
</view>
</view>
</view>
<scroll-view scroll-y class="task-list" v-if="taskList.length">
<view
v-for="item in taskList"
:key="item.id"
:class="['task-card', isSelected(item) ? 'active' : '']"
@click="selectedId = item.id"
>
<view class="task-header">
<view class="task-title-wrap">
<text class="task-name">{{ textValue(item.code) }}</text>
<text class="task-date">{{ formatDateTime(item.orderDate || item.createTime) }}</text>
</view>
<view class="check-badge">
<uni-icons v-if="isSelected(item)" type="checkmarkempty" size="16" color="#ffffff"></uni-icons>
</view>
</view>
<view class="info-grid">
<view class="info-cell">
<text class="info-label">{{ t('productInbound.deliveryDate') }}</text>
<text class="info-value">{{ formatDateTime(item.deliveryDate) }}</text>
</view>
<view class="info-cell">
<text class="info-label">{{ t('productInbound.remark') }}</text>
<text class="info-value">{{ textValue(item.remark) }}</text>
</view>
</view>
</view>
</scroll-view>
<view v-else class="empty-wrap">
<uni-icons type="info" size="30" color="#cbd5e1"></uni-icons>
<text>{{ loading ? t('productInbound.loading') : t('productInbound.emptyTask') }}</text>
</view>
<view class="action-bar">
<view :class="['action-btn', selectedId ? '' : 'action-btn-disabled']" @click="handleConfirm">{{ t('productInbound.confirm') }}</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useI18n } from 'vue-i18n'
import NavBar from '@/components/common/NavBar.vue'
import { getTaskPage } from '@/api/mes/productInbound'
const { t } = useI18n()
const taskList = ref([])
const selectedId = ref(null)
const searchText = ref('')
const loading = ref(false)
onLoad((options) => {
selectedId.value = options?.selectedId ? String(options.selectedId) : null
})
function textValue(v) {
if (v === 0) return '0'
if (v == null) return '-'
const s = String(v).trim()
return s || '-'
}
function formatDateTime(value) {
if (!value) return '-'
if (Array.isArray(value) && value.length >= 3) {
const [year, month, day] = value
const pad = (n) => String(n).padStart(2, '0')
return `${year}-${pad(month)}-${pad(day)}`
}
const date = new Date(Number(value))
if (Number.isNaN(date.getTime())) return String(value)
const pad = (n) => String(n).padStart(2, '0')
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
}
function isSelected(item) {
return String(selectedId.value) === String(item.id)
}
function clearSearch() {
searchText.value = ''
}
function normalizeList(res) {
const root = res && res.data !== undefined ? res.data : res
return Array.isArray(root) ? root : (root?.list || root?.rows || root?.records || [])
}
async function loadTasks() {
loading.value = true
try {
const res = await getTaskPage({ pageNo: 1, pageSize: 50, code: searchText.value.trim() || undefined })
taskList.value = normalizeList(res)
} catch (e) {
uni.showToast({ title: t('productInbound.loadFailed'), icon: 'none' })
} finally {
loading.value = false
}
}
function handleConfirm() {
if (!selectedId.value) {
uni.showToast({ title: t('productInbound.selectTask'), icon: 'none' })
return
}
const task = taskList.value.find((d) => String(d.id) === String(selectedId.value))
if (!task) return
getApp().globalData._productInboundTaskSelectResult = task
uni.navigateBack()
}
onShow(loadTasks)
</script>
<style lang="scss" scoped>
.page-container { min-height: 100vh; background: #f5f7fb; padding-bottom: calc(120rpx + env(safe-area-inset-bottom)); }
.search-bar { padding: 18rpx 24rpx; background: #ffffff; box-shadow: 0 4rpx 16rpx rgba(15, 23, 42, 0.03); }
.search-input-wrap { display: flex; align-items: center; gap: 12rpx; height: 76rpx; padding: 0 22rpx; background: #f8fafc; border: 1rpx solid #e5e7eb; border-radius: 14rpx; box-sizing: border-box; }
.search-input { flex: 1; min-width: 0; font-size: 28rpx; color: #374151; }
.search-placeholder { color: #9ca3af; }
.search-clear { width: 44rpx; height: 44rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.task-list { height: calc(100vh - 294rpx); }
.task-card { margin: 18rpx 24rpx 0; padding: 24rpx; background: #ffffff; border: 1rpx solid #eef2f7; border-radius: 20rpx; box-shadow: 0 6rpx 18rpx rgba(15, 23, 42, 0.04); }
.task-card.active { border-color: #bfdbfe; background: #f9fbff; box-shadow: 0 8rpx 22rpx rgba(31, 124, 255, 0.08); }
.task-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18rpx; }
.task-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8rpx; }
.task-name { font-size: 30rpx; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-date { font-size: 24rpx; color: #8a94a6; }
.check-badge { width: 36rpx; height: 36rpx; border-radius: 18rpx; border: 1rpx solid #d1d5db; background: #ffffff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.task-card.active .check-badge { border-color: #1f7cff; background: #1f7cff; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14rpx; margin-top: 20rpx; padding-top: 18rpx; border-top: 1rpx solid #f1f5f9; }
.info-cell { min-width: 0; display: flex; flex-direction: column; gap: 6rpx; }
.info-label { font-size: 23rpx; color: #9ca3af; }
.info-value { font-size: 27rpx; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-wrap { height: calc(100vh - 294rpx); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14rpx; color: #94a3b8; font-size: 27rpx; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 18rpx 24rpx calc(18rpx + env(safe-area-inset-bottom)); background: #ffffff; box-shadow: 0 -8rpx 24rpx rgba(15, 23, 42, 0.06); z-index: 99; }
.action-btn { height: 84rpx; border-radius: 16rpx; background: #1f4b79; color: #ffffff; display: flex; align-items: center; justify-content: center; font-size: 30rpx; font-weight: 600; }
.action-btn-disabled { background: #94a3b8; }
</style>

@ -2,6 +2,7 @@ page {
--app-form-control-height: 70rpx;
--app-select-field-height: var(--app-form-control-height);
--app-input-field-height: var(--app-form-control-height);
--app-textarea-field-height: 150rpx;
}
.app-select-field,
@ -102,3 +103,13 @@ page {
.selected-items {
min-height: var(--app-select-field-height) !important;
}
.app-textarea-field,
.form-textarea,
.modal-textarea,
.remark-textarea,
.textarea {
min-height: var(--app-textarea-field-height) !important;
height: var(--app-textarea-field-height) !important;
box-sizing: border-box;
}

@ -7,6 +7,8 @@ export enum DICT_TYPE {
FAILURE_LEVEL = "failure_level",
ERP_MOLD_STATUS = "erp_mold_status",
ERP_AUDIT_STATUS = "erp_audit_status",
STORAGE_PALLET_TYPES = "storage_pallet_types",
STORAGE_PALLET_STATUS = "storage_pallet_status",
MES_ORG_TYPE = "mes_org_type",
MES_TZ_STATUS = "mes_tz_status",
INSPECTION_METHOD = "Inspection_method",

@ -89,6 +89,10 @@ const MENU_ROUTE_MAP = {
equipment: '/pages_function/pages/equipment/index',
spare: '/pages_function/pages/spare/index',
sparepartInbound: '/pages_function/pages/sparepartInbound/index',
productInbound: '/pages_function/pages/productInbound/index',
productinbound: '/pages_function/pages/productInbound/index',
productIn: '/pages_function/pages/productInbound/index',
'产品入库': '/pages_function/pages/productInbound/index',
sparepartoutbound: '/pages_function/pages/sparepartOutbound/index',
'备件出库': '/pages_function/pages/sparepartOutbound/index',
sparepartinbound: '/pages_function/pages/sparepartInbound/index',

Loading…
Cancel
Save