Commit 87593839 by zhuzhequan

Merge remote-tracking branch 'origin/dev' into dev

parents e624075d de3dccbb
...@@ -139,6 +139,7 @@ export interface ProductList { ...@@ -139,6 +139,7 @@ export interface ProductList {
tagIds?: string tagIds?: string
isProduction?: boolean isProduction?: boolean
createTime?: string createTime?: string
startStockingTime?: string | null
updateTime?: string updateTime?: string
remark?: string | null remark?: string | null
version?: number version?: number
......
...@@ -54,6 +54,7 @@ export interface ProductList { ...@@ -54,6 +54,7 @@ export interface ProductList {
variantImage?: string variantImage?: string
podJomallUsNo?: string podJomallUsNo?: string
podJomallCnNo?: string podJomallCnNo?: string
thirdSkuCode?: string
previewImgs?: { sort?: string | number; title?: string; url: string }[] previewImgs?: { sort?: string | number; title?: string; url: string }[]
} }
......
...@@ -138,6 +138,7 @@ export interface ProductList { ...@@ -138,6 +138,7 @@ export interface ProductList {
tagIds?: string tagIds?: string
isProduction?: boolean isProduction?: boolean
createTime?: string createTime?: string
startStockingTime?: string | null
updateTime?: string updateTime?: string
remark?: string | null remark?: string | null
version?: number version?: number
......
...@@ -463,7 +463,18 @@ watch( ...@@ -463,7 +463,18 @@ watch(
(val) => { (val) => {
if (val && val.productList?.length) if (val && val.productList?.length)
val.productList.forEach((el) => { val.productList.forEach((el) => {
if (!el.previewImgs) el.previewImgs = JSON.parse(el.imageAry || '[]') if (!el.previewImgs) {
if (
el.productMark === 'custom_normal' ||
el.productMark === 'normal'
) {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = el.imageAry
? JSON.parse(el.imageAry)
: [{ url: el.variantImage }]
}
}
}) })
}, },
{ deep: true }, { deep: true },
...@@ -492,7 +503,13 @@ const renderItemBox = (bool: boolean) => { ...@@ -492,7 +503,13 @@ const renderItemBox = (bool: boolean) => {
if (!boxItem) boxItem = { data: { productList: [] } } if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem const { data } = boxItem
data?.productList?.forEach((el) => { data?.productList?.forEach((el) => {
if (!el.previewImgs) el.previewImgs = JSON.parse(el.imageAry || '[]') if (!el.previewImgs || !el.previewImgs.length) {
if (el.productMark === 'custom_normal' || el.productMark === 'normal') {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = JSON.parse(el.imageAry || '[]')
}
}
}) })
if (!data) { if (!data) {
renderLock = false renderLock = false
...@@ -513,6 +530,7 @@ const renderItemBox = (bool: boolean) => { ...@@ -513,6 +530,7 @@ const renderItemBox = (bool: boolean) => {
} }
} }
if (currentCode) { if (currentCode) {
if (!currentCode.startsWith('JM')) {
const parts = currentCode.split('_') const parts = currentCode.split('_')
currentCode = currentCode =
parts.length > 3 && parts[3].startsWith('CNPSC') parts.length > 3 && parts[3].startsWith('CNPSC')
...@@ -520,8 +538,15 @@ const renderItemBox = (bool: boolean) => { ...@@ -520,8 +538,15 @@ const renderItemBox = (bool: boolean) => {
: parts.length > 1 : parts.length > 1
? parts[1] ? parts[1]
: parts[0] : parts[0]
}
console.log(540, currentCode)
for (const product of productList) { for (const product of productList) {
if (product.podJomallCnNo === currentCode) { if (
product.podJomallCnNo === currentCode ||
product.thirdSkuCode === currentCode
) {
coverImage.value = product.previewImgs?.[0]?.url || '' coverImage.value = product.previewImgs?.[0]?.url || ''
nextTick(() => { nextTick(() => {
tableRef.value?.setCurrentRow(product) tableRef.value?.setCurrentRow(product)
......
...@@ -1604,6 +1604,15 @@ ...@@ -1604,6 +1604,15 @@
{{ row.lanshouAddress }} {{ row.lanshouAddress }}
</span> </span>
</div> </div>
<div
v-if="['TO_BE_CONFIRMED', 'STOCK_OUT'].includes(status)"
class="order-detail-item"
>
<span class="order-detail-item-label">订单延期时间:</span>
<span class="order-detail-item-value red-time">
{{ calculateDelayTime(row) }}
</span>
</div>
</div> </div>
</template> </template>
<template #price="{ row }"> <template #price="{ row }">
...@@ -5463,7 +5472,10 @@ watch( ...@@ -5463,7 +5472,10 @@ watch(
}, },
{ deep: true, immediate: true }, // 添加immediate确保初始化时执行 { deep: true, immediate: true }, // 添加immediate确保初始化时执行
) )
// 当前时间响应式变量(每60秒更新一次)
const currentTime = ref(new Date())
// 定时器实例
let timer: number | null = null
onMounted(() => { onMounted(() => {
loadTabData() loadTabData()
getUserMark() getUserMark()
...@@ -5471,8 +5483,45 @@ onMounted(() => { ...@@ -5471,8 +5483,45 @@ onMounted(() => {
getCustomTagList() getCustomTagList()
loadCraftList() loadCraftList()
getlogisticsCompanyAllCodelist() getlogisticsCompanyAllCodelist()
// 每60秒更新一次当前时间
timer = window.setInterval(() => {
currentTime.value = new Date()
}, 60000)
})
// 计算时间差(小时数)并向上取整
const calculateHoursDifference = (startDateString?: string): string => {
if (!startDateString) return '--'
try {
const startTime = new Date(startDateString)
const diffInMs = currentTime.value.getTime() - startTime.getTime()
// 转换为小时并取整:ceil向上或者round:四舍五入
const hours = Math.round(diffInMs / (1000 * 60 * 60))
return `${hours}小时`
} catch (error) {
console.error('日期解析错误:', error)
return '--'
}
}
// 根据订单状态计算延期时间
const calculateDelayTime = computed(() => (row: ProductList) => {
switch (status.value) {
case 'TO_BE_CONFIRMED':
return row.createTime ? calculateHoursDifference(row.createTime) : '--'
case 'STOCK_OUT':
return row.startStockingTime
? calculateHoursDifference(row.startStockingTime)
: '--'
default:
return '--'
}
})
onBeforeUnmount(() => {
// 组件卸载时清除定时器
if (timer) {
clearInterval(timer)
timer = null
}
}) })
const handleShipmentAreaCommand = (command: number) => { const handleShipmentAreaCommand = (command: number) => {
shipmentArea.value = command shipmentArea.value = command
search() search()
...@@ -5843,6 +5892,10 @@ useEnterKeyTrigger({ ...@@ -5843,6 +5892,10 @@ useEnterKeyTrigger({
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.red-time {
color: red;
font-weight: bold;
}
} }
.card-list { .card-list {
......
...@@ -435,7 +435,10 @@ watch( ...@@ -435,7 +435,10 @@ watch(
if (val && val.productList?.length) if (val && val.productList?.length)
val.productList.forEach((el) => { val.productList.forEach((el) => {
if (!el.previewImgs) { if (!el.previewImgs) {
if (el.productMark === 'custom_normal') { if (
el.productMark === 'custom_normal' ||
el.productMark === 'normal'
) {
el.previewImgs = [{ url: el.variantImage || '' }] el.previewImgs = [{ url: el.variantImage || '' }]
} else { } else {
el.previewImgs = el.imageAry el.previewImgs = el.imageAry
...@@ -468,11 +471,11 @@ const renderItemBox = (bool: boolean) => { ...@@ -468,11 +471,11 @@ const renderItemBox = (bool: boolean) => {
if (!boxItem) boxItem = { data: { productList: [] } } if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem const { data } = boxItem
data?.productList?.forEach((el) => { data?.productList?.forEach((el) => {
if (!el.previewImgs) { if (!el.previewImgs || !el.previewImgs.length) {
if (el.productMark === 'custom_normal' || el.productMark === 'normal') { if (el.productMark === 'custom_normal' || el.productMark === 'normal') {
el.previewImgs = [{ url: el.variantImage || '' }] el.previewImgs = [{ url: el.variantImage || '' }]
} else { } else {
el.previewImgs = JSON.parse(el.imageAry) el.previewImgs = JSON.parse(el.imageAry || '[]')
} }
} }
}) })
...@@ -495,6 +498,7 @@ const renderItemBox = (bool: boolean) => { ...@@ -495,6 +498,7 @@ const renderItemBox = (bool: boolean) => {
} }
} }
if (currentCode) { if (currentCode) {
if (!currentCode.startsWith('JM')) {
const parts = currentCode.split('_') const parts = currentCode.split('_')
currentCode = currentCode =
parts.length > 3 && parts[3].startsWith('USPSC') parts.length > 3 && parts[3].startsWith('USPSC')
...@@ -502,8 +506,13 @@ const renderItemBox = (bool: boolean) => { ...@@ -502,8 +506,13 @@ const renderItemBox = (bool: boolean) => {
: parts.length > 1 : parts.length > 1
? parts[1] ? parts[1]
: parts[0] : parts[0]
}
console.log(540, currentCode)
for (const product of productList) { for (const product of productList) {
if (product.podJomallUsNo === currentCode) { if (
product.podJomallUsNo === currentCode ||
product.thirdSkuCode === currentCode
) {
coverImage.value = product.previewImgs?.[0]?.url || '' coverImage.value = product.previewImgs?.[0]?.url || ''
console.log(441, coverImage.value) console.log(441, coverImage.value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment