From b183c7fcb054223ac962ce645cbbb42eb28f18a2 Mon Sep 17 00:00:00 2001 From: yin <3313488199@qq.com> Date: Fri, 27 Mar 2026 17:57:54 +0800 Subject: [PATCH] =?UTF-8?q?3=E6=9C=8827=E6=97=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/profile.ts | 28 +- src/api/storage/entry.ts | 83 +++- src/api/storage/receiving.ts | 26 +- src/api/storage/stockout.ts | 15 + src/router/map.ts | 1 + src/utils/request.ts | 3 +- src/views/order/orderManagement/index.vue | 2 +- src/views/profile/components/Bind.vue | 299 +++++++------ src/views/profile/index.vue | 2 +- src/views/stock/stock/component/add.vue | 34 +- src/views/stock/stock/index.vue | 22 +- .../storage/entry/component/entrydetail.vue | 83 +++- src/views/storage/entry/entry-config.ts | 17 + src/views/storage/entry/index.vue | 132 +++++- src/views/storage/receiving/index.vue | 39 +- .../storage/receiving/receiving-config.ts | 2 +- src/views/storage/stockout/component/log.vue | 79 ++++ .../storage/stockout/component/product.vue | 64 +++ .../stockout/component/stockoutdetail.vue | 169 ++++++++ src/views/storage/stockout/index.vue | 392 ++++++++++++++++++ src/views/storage/stockout/stockout-config.ts | 96 +++++ 日志.md | 31 +- 22 files changed, 1431 insertions(+), 188 deletions(-) create mode 100644 src/api/storage/stockout.ts create mode 100644 src/views/storage/stockout/component/log.vue create mode 100644 src/views/storage/stockout/component/product.vue create mode 100644 src/views/storage/stockout/component/stockoutdetail.vue create mode 100644 src/views/storage/stockout/index.vue create mode 100644 src/views/storage/stockout/stockout-config.ts diff --git a/src/api/profile.ts b/src/api/profile.ts index a850e677..9b67a773 100644 --- a/src/api/profile.ts +++ b/src/api/profile.ts @@ -16,12 +16,30 @@ export const getBindInfo = () => { } as any) } +export interface BindWechatCodeParams { + /** 是否强制刷新状态,true 时跳过缓存等待窗口 */ + forceRefresh?: boolean + /** 是否显式开启长轮询等待;true 时进入最长 60 秒等待 */ + waitForChange?: boolean + /** 长轮询开关(兼容字段);true 时进入最长 60 秒等待 */ + longPoll?: boolean + /** 等待超时毫秒数;后端自动封顶 60000 */ + waitTimeoutMs?: number + /** 初始化请求标记;true 时强制立即返回,不进入长等待 */ + init?: boolean +} + /** * 获取微信绑定二维码及轮询状态 - * 支持轮询,优先命中缓存,不重复查库 - * 返回: { status: 'waiting'|'scanned'|'bound'|'expired', bindCode, qrUrl, nickname, openid } + * 支持长轮询:longPoll/waitForChange=true 时服务端最长等待 60 秒 + * 初始化调用时传 init:true,服务端立即返回二维码数据 + * 返回: { status: 'waiting'|'scanned'|'bound'|'expired', code, qrUrl, nickname, openid } */ -export const getBindWechatCode = () => { +export const getBindWechatCode = (params?: BindWechatCodeParams) => { + const isLongPoll = params?.longPoll || params?.waitForChange + const waitMs = params?.waitTimeoutMs ?? (isLongPoll ? 60000 : 0) + // HTTP 超时需大于后端等待时长 + const httpTimeout = isLongPoll ? Math.max(waitMs, 60000) + 10000 : 15000 return request({ url: '/system', method: 'post', @@ -30,9 +48,9 @@ export const getBindWechatCode = () => { v, timestamp: new Date().getTime() }, - data: {}, + data: params ?? {}, isSystemApi: true, - timeout: 120000 // 轮询接口,适当延长超时时间 + timeout: httpTimeout } as any) } diff --git a/src/api/storage/entry.ts b/src/api/storage/entry.ts index 2f7e04c9..d4ab9806 100644 --- a/src/api/storage/entry.ts +++ b/src/api/storage/entry.ts @@ -1,4 +1,5 @@ import request from '@/utils/request' + const v = "1.0" export function getEntryList(data:any): Promise { @@ -6,7 +7,7 @@ export function getEntryList(data:any): Promise { url: '/system', method: 'post', params: { - method: 'storage.entry.getEntryList', + method: 'storage.entry.list', v, timestamp: new Date().getTime() }, @@ -19,7 +20,85 @@ export function getEntryDetail(data:any): Promise { url: '/system', method: 'post', params: { - method: 'storage.entry.getEntryDetail', + method: 'storage.entry.get', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + +export function createEntry(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.create', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + +export function addDetail(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.addDetail', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + +export function deleteDetail(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.deleteDetail', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + +export function detailChange(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.detailChange', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + +export function cancelEntry(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.cancel', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} + +export function completeEntry(data:any): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.entry.completeEntry', v, timestamp: new Date().getTime() }, diff --git a/src/api/storage/receiving.ts b/src/api/storage/receiving.ts index 5d41be84..af0e1932 100644 --- a/src/api/storage/receiving.ts +++ b/src/api/storage/receiving.ts @@ -98,19 +98,19 @@ export function createReceiving(data: any): Promise { }) } -// 不可用 -export function cancelReceiving(data: any): Promise { - return request({ - url: '/system', - method: 'post', - params: { - method: 'storage.receiving.batchCancelReceiving', - v, - timestamp: new Date().getTime() - }, - data: data - }) -} + +// export function cancelReceiving(data: any): Promise { +// return request({ +// url: '/system', +// method: 'post', +// params: { +// method: 'storage.receiving.batchCancelReceiving', +// v, +// timestamp: new Date().getTime() +// }, +// data: data +// }) +// } export function addItem(data: any): Promise { diff --git a/src/api/storage/stockout.ts b/src/api/storage/stockout.ts new file mode 100644 index 00000000..3bbf07c6 --- /dev/null +++ b/src/api/storage/stockout.ts @@ -0,0 +1,15 @@ +import request from '@/utils/request' +const v = "1.0" + +export const stockoutList = (data: any) => { + return request({ + url: `/system`, + method: 'post', + params: { + method: 'storage.stockout.list', + v, + timestamp: new Date().getTime() + }, + data: data + }) +} \ No newline at end of file diff --git a/src/router/map.ts b/src/router/map.ts index b2319fa6..e9d618c9 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -13,6 +13,7 @@ export const componentMap: Record = { 'storage/receiving': () => import('@/views/storage/receiving/index.vue'), 'storage/entry': () => import('@/views/storage/entry/index.vue'), 'storage/inventory': () => import('@/views/storage/inventory/index.vue'), + 'storage/stockout': () => import('@/views/storage/stockout/index.vue'), 'system/setting/printTemplate/index': () => import('@/views/system/setting/printTemplate/index.vue'), // 'system/setting/printStation/index': () => import('@/views/system/setting/printStation/index.vue'), 'system/print/station': () => import('@/views/system/setting/printStation/index.vue'), diff --git a/src/utils/request.ts b/src/utils/request.ts index 78bb293d..39a39876 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -99,7 +99,8 @@ service.interceptors.response.use( // 检查业务状态码 if (!SUCCESS_CODES.includes(res.code)) { - const errorMessage = (ERROR_CODE_MAP as Record)[res.code] || res.message || '请求失败' + // 优先使用后端返回的 message,如果没有则从映射表获取,最后使用默认值 + const errorMessage = res.message || (ERROR_CODE_MAP as Record)[res.code] || '请求失败' // Token 失效处理 if ([401, 50008, 50012, 50014].includes(res.code)) { diff --git a/src/views/order/orderManagement/index.vue b/src/views/order/orderManagement/index.vue index b179122c..0f2b6438 100644 --- a/src/views/order/orderManagement/index.vue +++ b/src/views/order/orderManagement/index.vue @@ -1,5 +1,5 @@ - 去绑定 - - + +
-
+
+ 加载中...
-
+
二维码已过期,点击刷新
-
+
扫码成功,正在确认...
- + 微信二维码 + +
+ + 正在获取二维码... +

- +

- +
@@ -68,16 +64,140 @@ const isBound = ref(false) const unbinding = ref(false) const binderInfo = reactive({ nickname: '', openid: '' }) const loading = ref(false) -const dialogVisible = ref(false) -const qrCodeUrl = ref("") -const qrBaseUrl = "https://ye4s.wms.gztbyc.com/qrcode/build?text=" - +const qrCodeUrl = ref('') const qrStatus = ref('waiting') -let pollTimer: ReturnType | null = null -const POLL_INTERVAL = 120000 // 120 秒轮询一次 +const qrBaseUrl = 'https://ye4s.wms.gztbyc.com/qrcode/build?text=' +const bindLinkTemplate = 'https://ye4s.wms.gztbyc.com/mini/?spm=0.3.${code}.1.4' -/** 初始化:获取当前绑定状态 */ +/** 是否已获取到首次二维码(决定后续请求是否携带 longPoll) */ +let hasInitQr = false +/** 停止长轮询的标志位 */ +let stopPollFlag = false +/** 轮询版本号,每次停止时递增,用于丢弃过期回调 */ +let pollVersion = 0 + +/** 构造完整二维码 URL */ +const getFullQrUrl = (code: string) => { + const targetUrl = bindLinkTemplate.replace('${code}', code) + return qrBaseUrl + encodeURIComponent(targetUrl) +} + +/** + * 处理后端返回数据,更新组件状态。 + * @returns true 表示已绑定,轮询应终止 + */ +const processBindData = (data: any, showSuccessMsg = false): boolean => { + const boundNow = data.status === 'bound' || data.is_bound === true + if (boundNow) { + isBound.value = true + binderInfo.nickname = data.nickname || '' + binderInfo.openid = data.openid || '' + if (showSuccessMsg) { + ElMessage.success(`微信绑定成功:${data.nickname || '微信用户'}`) + } + return true + } + const mapped: QrStatus = data.status === 'pending' ? 'waiting' : (data.status as QrStatus) + qrStatus.value = mapped + if (data.code) { + qrCodeUrl.value = getFullQrUrl(data.code) + } + return false +} + +/** + * 启动长轮询循环。 + * 每次请求携带 longPoll + waitForChange,服务端最长等待 60 秒后返回; + * 收到响应后立刻发起下一次,直至绑定成功或 stopPollFlag 为 true。 + */ +const startLongPoll = () => { + stopPollFlag = false + const version = pollVersion + const poll = async () => { + if (stopPollFlag || pollVersion !== version || isBound.value) return + try { + const res = await getBindWechatCode({ + longPoll: true, + waitForChange: true, + waitTimeoutMs: 60000 + }) + if (stopPollFlag || pollVersion !== version || isBound.value) return + const data = res?.data + if (data) { + const bound = processBindData(data, true) + if (bound) return // 已绑定,终止轮询 + } + // 继续下一轮(不等待,立即发起) + poll() + } catch { + // 网络异常时静默处理,稍后重试 + if (!stopPollFlag && pollVersion === version && !isBound.value) { + setTimeout(poll, 3000) + } + } + } + poll() +} + +/** 停止长轮询 */ +const stopPolling = () => { + stopPollFlag = true + pollVersion++ // 递增版本号,使所有进行中的回调失效 +} + +/** + * 首次初始化二维码:携带 init:true,服务端立即返回二维码数据,不进入长等待。 + * 成功拿到数据后启动长轮询。 + */ +const initQrCode = async () => { + loading.value = true + qrStatus.value = 'waiting' + qrCodeUrl.value = '' + hasInitQr = false + try { + const res = await getBindWechatCode({ init: true }) + const data = res?.data + if (!data) throw new Error('无返回数据') + const bound = processBindData(data) + if (!bound) { + hasInitQr = true + startLongPoll() + } + } catch { + ElMessage.error('获取二维码失败,请重试') + } finally { + loading.value = false + } +} + +/** + * 手动刷新二维码(过期后点击触发): + * 携带 forceRefresh:true + init:true,强制跳过缓存并立即返回。 + */ +const refreshQrCode = async () => { + stopPolling() + loading.value = true + qrStatus.value = 'waiting' + qrCodeUrl.value = '' + hasInitQr = false + try { + const res = await getBindWechatCode({ forceRefresh: true, init: true }) + const data = res?.data + if (!data) throw new Error('无返回数据') + const bound = processBindData(data) + if (!bound) { + hasInitQr = true + startLongPoll() + } + } catch { + ElMessage.error('获取二维码失败,请重试') + } finally { + loading.value = false + } +} + +/** 初始化:先查询绑定状态,未绑定则自动加载二维码 */ const fetchBindInfo = async () => { try { const res = await getBindInfo() @@ -88,115 +208,15 @@ const fetchBindInfo = async () => { binderInfo.openid = data.openid || '' } else { isBound.value = false + await initQrCode() } } catch { - // 获取失败不阻断页面 + // 查询失败时仍尝试显示二维码 + isBound.value = false + await initQrCode() } } -/** 打开绑定弹窗,获取二维码 */ -const handleBind = async () => { - dialogVisible.value = true - await refreshQrCode() -} - -/** 获取/刷新二维码,刷新完成后自动重启轮询 */ -const refreshQrCode = async () => { - stopPolling() // 先停止旧的轮询,避免并发干扰 - loading.value = true - qrStatus.value = 'waiting' - qrCodeUrl.value = '' - try { - const res = await getBindWechatCode() - const data = res?.data - if (!data) throw new Error('无返回数据') - - const isBoundNow = data.status === 'bound' || data.is_bound === true - if (isBoundNow) { - // 已绑定,直接刷新状态关闭弹窗 - isBound.value = true - binderInfo.nickname = data.nickname || '' - binderInfo.openid = data.openid || '' - dialogVisible.value = false - ElMessage.success('微信已绑定') - return - } - - // 将后端 'pending' 归为 'waiting' 处理 - const mappedStatus = data.status === 'pending' ? 'waiting' : data.status as QrStatus - qrStatus.value = mappedStatus - // 有新 code 时更新二维码 URL - if (data.code) { - qrCodeUrl.value = qrBaseUrl + data.code - } - - // 刷新成功后重新启动轮询(过期状态不轮询,等待用户手动刷新) - if (mappedStatus !== 'expired') { - startPolling() - } - } catch { - ElMessage.error('获取二维码失败,请重试') - dialogVisible.value = false - } finally { - loading.value = false - } -} - -/** 启动轮询 */ -const startPolling = () => { - stopPolling() - pollTimer = setInterval(async () => { - try { - const res = await getBindWechatCode() - const data = res?.data - if (!data) return - - // 将后端 'pending' 归为 'waiting' 处理 - const mappedStatus = data.status === 'pending' ? 'waiting' : data.status as QrStatus - qrStatus.value = mappedStatus - - // 更新二维码 - if (data.code) { - qrCodeUrl.value = qrBaseUrl + data.code - console.log('二维码已更新') - } - - const isBoundNow = data.status === 'bound' || data.is_bound === true - if (isBoundNow) { - stopPolling() - isBound.value = true - binderInfo.nickname = data.nickname || '' - binderInfo.openid = data.openid || '' - dialogVisible.value = false - ElMessage.success(`微信绑定成功:${data.nickname || '微信用户'}`) - } - - // expired 状态不再停止轮询,等待后端更新 code 或 status - if (data.status === 'expired') { - // 可选:如果需要清除旧二维码,可以在这里处理 - // 但为了体验平滑,保持 overlay 覆盖在旧图上即可 - } - } catch { - // 轮询失败静默处理,不弹错误 - } - }, POLL_INTERVAL) -} - -/** 停止轮询 */ -const stopPolling = () => { - if (pollTimer) { - clearInterval(pollTimer) - pollTimer = null - } -} - -/** 关闭弹窗时停止轮询 */ -const handleDialogClose = () => { - stopPolling() - qrStatus.value = 'waiting' - qrCodeUrl.value = '' -} - /** 解绑微信 */ const handleUnbind = () => { ElMessageBox.confirm('确定要解除微信绑定吗?', '提示', { @@ -211,6 +231,8 @@ const handleUnbind = () => { binderInfo.nickname = '' binderInfo.openid = '' ElMessage.success('微信绑定已解除') + // 解绑后重新加载二维码 + await initQrCode() } catch { ElMessage.error('解绑失败,请重试') } finally { @@ -273,16 +295,26 @@ onUnmounted(() => { } } + .qrcode-section { + margin-top: 16px; + display: flex; + justify-content: center; + } + .qrcode-wrapper { display: flex; flex-direction: column; align-items: center; - padding: 10px; + padding: 20px; + border: 1px solid var(--el-border-color-lighter); + border-radius: 8px; + background-color: var(--el-fill-color-blank); .qrcode-img { width: 200px; height: 200px; border: 1px solid var(--el-border-color); + border-radius: 4px; } .qrcode-tip { @@ -291,10 +323,8 @@ onUnmounted(() => { color: var(--el-text-color-secondary); text-align: center; } - - .loading-overlay, - .expired-overlay, - .scanned-overlay { + + .status-overlay { width: 200px; height: 200px; display: flex; @@ -313,6 +343,7 @@ onUnmounted(() => { .loading-overlay { background: var(--el-fill-color-light); + color: var(--el-text-color-secondary); .el-icon { color: var(--el-color-primary); } } diff --git a/src/views/profile/index.vue b/src/views/profile/index.vue index a6fe0171..3c75a270 100644 --- a/src/views/profile/index.vue +++ b/src/views/profile/index.vue @@ -44,7 +44,7 @@ - + diff --git a/src/views/stock/stock/component/add.vue b/src/views/stock/stock/component/add.vue index d97960f3..a2250b9f 100644 --- a/src/views/stock/stock/component/add.vue +++ b/src/views/stock/stock/component/add.vue @@ -2,11 +2,11 @@
- + @@ -35,22 +35,26 @@
- - + + +
- + - + + +
@@ -220,8 +224,14 @@
- 保存 - 重置 + + + 保存 + + + + 重置 +
@@ -759,6 +769,14 @@ onMounted(() => { align-items: center; gap: 10px; width: 100%; + + :deep(.el-select) { + flex: 1; + } + + :deep(.el-button) { + flex-shrink: 0; + } } .management-flags { diff --git a/src/views/stock/stock/index.vue b/src/views/stock/stock/index.vue index c9b4c087..30314f2e 100644 --- a/src/views/stock/stock/index.vue +++ b/src/views/stock/stock/index.vue @@ -383,10 +383,24 @@ const confirmBatchDelete = () => { ElMessageBox.confirm('确认删除选中项?', '提示', { type: 'warning' }).then(async () => { - // await stockApi.batchDelete(selectionIds.value) - ElMessage.success('删除成功') - loadData() - }) + try { + loading.value = true + const res = await stockApi.handleBatchDelete({ + ids: selectionIds.value.map((item: any) => item.id) + }) + if ((res as any).code === 200) { + ElMessage.success((res as any).message || '删除成功') + loadData() + selectionIds.value = [] + } else { + ElMessage.error((res as any).message || '删除失败') + } + } catch (error) { + console.error(error) + } finally { + loading.value = false + } + }).catch(() => {}) } const handleBatchChange = async (command: string) => { diff --git a/src/views/storage/entry/component/entrydetail.vue b/src/views/storage/entry/component/entrydetail.vue index bd8857bb..26766a2e 100644 --- a/src/views/storage/entry/component/entrydetail.vue +++ b/src/views/storage/entry/component/entrydetail.vue @@ -3,8 +3,8 @@
刷新 - 入库 - 批量入库 + 新增入库 + EXCEL导出 导出
@@ -38,12 +38,33 @@
+ + + + + + + + + + + + +
+ + diff --git a/src/views/storage/stockout/component/product.vue b/src/views/storage/stockout/component/product.vue new file mode 100644 index 00000000..c40a3078 --- /dev/null +++ b/src/views/storage/stockout/component/product.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/src/views/storage/stockout/component/stockoutdetail.vue b/src/views/storage/stockout/component/stockoutdetail.vue new file mode 100644 index 00000000..e9cb3232 --- /dev/null +++ b/src/views/storage/stockout/component/stockoutdetail.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/src/views/storage/stockout/index.vue b/src/views/storage/stockout/index.vue new file mode 100644 index 00000000..58af1f94 --- /dev/null +++ b/src/views/storage/stockout/index.vue @@ -0,0 +1,392 @@ + + + + + diff --git a/src/views/storage/stockout/stockout-config.ts b/src/views/storage/stockout/stockout-config.ts new file mode 100644 index 00000000..88a391ba --- /dev/null +++ b/src/views/storage/stockout/stockout-config.ts @@ -0,0 +1,96 @@ +export const statusConfig = { + pending: { text: '待出库', tagType: 'warning' }, + processing: { text: '出库中', tagType: 'primary' }, + completed: { text: '已完成', tagType: 'success' }, + cancelled: { text: '已作废', tagType: 'danger' } +} + +export const syncStatusConfig = { + pending: { text: '待同步', tagType: 'info' }, + success: { text: '同步成功', tagType: 'success' }, + failed: { text: '同步失败', tagType: 'danger' } +} + +// 时间格式化函数 +export function formatDateTime(dateStr: string): string { + if (!dateStr) return '--' + try { + const date = new Date(dateStr) + if (isNaN(date.getTime())) return '--' + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0') + const seconds = String(date.getSeconds()).padStart(2, '0') + return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` + } catch (e) { + return '--' + } +} + +export const entryColums = [ + { prop: 'entry_order_code', label: '出库单号', width: '180', fixed: 'left' }, + { prop: 'status', label: '出库状态', width: '100', align: 'center' }, + { prop: 'order_type', label: '单据类型', width: '120' }, + { prop: 'store_name', label: '货主', width: '120' }, + { prop: 'total_order_lines', label: '商品种类', width: '100', align: 'right' }, + { prop: 'supplier_name', label: '收货方', width: '150' }, + { prop: 'logistics_name', label: '物流公司', width: '120' }, + { prop: 'express_code', label: '运单号', width: '150' }, + { prop: 'sync_status', label: '同步状态', width: '100', align: 'center' }, + { prop: 'order_create_time', label: '下单时间', width: '160', sortable: true, formatter: (row: any) => formatDateTime(row.order_create_time) }, + { prop: 'expect_start_time', label: '预计开始', width: '160', sortable: true, formatter: (row: any) => formatDateTime(row.expect_start_time) }, + { prop: 'expect_end_time', label: '预计结束', width: '160', sortable: true, formatter: (row: any) => formatDateTime(row.expect_end_time) }, + { prop: 'source_type', label: '来源', width: '100' }, + { prop: 'remark', label: '备注', minWidth: '150' } +] + +export const availableFields = [ + { value: 'entry_order_code', label: '出库单号', type: 'text' }, + { value: 'status', label: '出库状态', type: 'select', options: Object.entries(statusConfig).map(([v, c]) => ({ value: v, label: c.text })) }, + { value: 'store_id', label: '货主', type: 'select', filterable: true, options: [] }, + { value: 'order_type', label: '单据类型', type: 'select', options: [ + { label: '销售出库', value: 'SALE' }, + { label: '调拨出库', value: 'TRANSFER' }, + { label: '退货出库', value: 'RETURN' }, + { label: '其他出库', value: 'OTHER' } + ]}, + { value: 'sync_status', label: '同步状态', type: 'select', options: Object.entries(syncStatusConfig).map(([v, c]) => ({ value: v, label: c.text })) }, + { value: 'logistics_name', label: '物流公司', type: 'text' }, + { value: 'express_code', label: '运单号', type: 'text' }, + { value: 'order_create_time', label: '下单时间', type: 'daterange', startPlaceholder: '开始时间', endPlaceholder: '结束时间' }, + { value: 'remark', label: '备注', type: 'text' } +] + +// 详情面板表单配置 +export const detailpanel = [ + { prop: 'entry_order_code', label: '出库单号', type: 'input', disabled: true }, + { prop: 'store_name', label: '货主', type: 'input', disabled: true }, + { prop: 'status', label: '出库状态', type: 'select', disabled: true }, + { prop: 'order_type', label: '单据类型', type: 'input', disabled: true }, + { prop: 'supplier_name', label: '收货方', type: 'input' }, + { prop: 'logistics_name', label: '物流公司', type: 'input' }, + { prop: 'express_code', label: '运单号', type: 'input' }, + { prop: 'total_order_lines', label: '商品种类', type: 'number', disabled: true }, + { prop: 'remark', label: '备注', type: 'textarea' } +] + +export const productColumns = [ + { prop: 'product_name', label: '商品名称', width: '180', fixed: 'left' }, + { prop: 'barcode', label: '条码', width: '150' }, + { prop: 'spec', label: '规格', width: '120' }, + { prop: 'plan_quantity', label: '计划数量', width: '100', align: 'right' }, + { prop: 'actual_quantity', label: '实际出库', width: '100', align: 'right' }, + { prop: 'batch_number', label: '批次', width: '120' }, + { prop: 'remark', label: '备注', minWidth: '150' } +] + +export function formatStockoutData(list: any[] = []) { + return (list || []).map(item => ({ + ...item, + // 可以在这里做一些数据映射或格式化 + status: item.status || item.order_status || 'pending', + sync_status: item.sync_status || 'pending' + })) +} diff --git a/日志.md b/日志.md index 50adca49..0cc5f6f2 100644 --- a/日志.md +++ b/日志.md @@ -62,7 +62,6 @@ -修复receiving页面时间格式显示异常问题。 -优化stock接口,排除删除废弃或无用接口。 -更新stock-config.ts配置文件,提升stock页面维护性;更新表格状态字段数据。 -- 二、问题记录 -stock回收站,后端 stock.warehouse.list 接口(对应的数据库表)中不存在 is_deleted 字段,或者该接口不支持通过 is_deleted 参数进行过滤。 @@ -74,4 +73,32 @@ 完善各页面config.ts配置设计,优化功能结构。 完善各页面布局设计,统一样式和风格,降低维护成本。 解决跨域问题。 -解决路由相关的一些潜在小问题。 \ No newline at end of file +解决路由相关的一些潜在小问题。 + + +2026.3.27 +一、今日完成 +-修复stock无法删除/批量删除商品问题。 +-修复receiving无法作废收货单的问题。 +-更新“绑定微信”二维码生成逻辑,修复轮询、绑定状态异常问题,优化二维码使用逻辑,修复轮询关闭异常的问题。 +-修复入库单页面入库列表、入库单详情接口无法获取数据问题。 +- 在 entry-config.ts 中实现了用于缺货创建的新录入字段。 +- 在 index.vue 中添加了用于创建缺货记录的对话框。 +- 增强了收货功能,增加了批量取消和完成选项。 +- 更新了 receiving-config.ts,以禁用状态选择。 +- 创建了用于列出缺货记录的缺货 API。 +- 开发了用于显示缺货日志和产品详情的组件。 +- 引入了缺货详情视图,支持表单处理及保存/重置功能。 +- 在 stockout-config.ts 中配置了缺货特定设置,包括状态和同步状态配置。 +- 通过新的 index.vue 布局改善了缺货管理的 UI。 + +二、问题记录 +order.reviewOrder.getreviewOrderlist接口没有返回数据。 +storage.receiving.completeReceiving收货单入库报错:有3个商品缺少必要信息。 +stock.warehouse.bindItem商品明细外部商品绑定报错:stock.warehouse.bindItem。 +stock获取回收站商品接口复用了商品信息接口stock.warehouse.list,导致冲突。 + + +三、后续计划 +完善接口设计,排除故障接口,测试接口功能。 +实现将项目打包并上传到服务器实现静态资源托管。 \ No newline at end of file