Commit b4150a0e by linjinhong

fix:【工厂端】【新派单-PODUS/PODCN】:CB、G类商品在订单列表商品图右上角展示标识#1000527

parent 1aca4c94
...@@ -161,7 +161,8 @@ ...@@ -161,7 +161,8 @@
<template #image="{ row }"> <template #image="{ row }">
<div style="display: flex; flex-wrap: nowrap"> <div style="display: flex; flex-wrap: nowrap">
<div <div
v-for="img in row.productMark !== 'normal' v-for="img in row.productMark !== 'normal' &&
row.productMark !== 'custom_normal'
? row.previewImgs ? row.previewImgs
: [{ url: row.variantImage }]" : [{ url: row.variantImage }]"
:key="img" :key="img"
......
...@@ -112,11 +112,12 @@ ...@@ -112,11 +112,12 @@
@row-click="handleRowClick" @row-click="handleRowClick"
> >
<template #image="{ row }"> <template #image="{ row }">
<div <div style="display: flex; flex-wrap: nowrap">
style="display: flex; flex-wrap: nowrap"
>
<div <div
v-for="img in row.productMark!=='normal'?row.previewImgs:[{url:row.variantImage}]" v-for="img in row.productMark !== 'normal' &&
row.productMark !== 'custom_normal'
? row.previewImgs
: [{ url: row.variantImage }]"
:key="img" :key="img"
style="cursor: pointer; margin-right: 5px; flex: 1" style="cursor: pointer; margin-right: 5px; flex: 1"
@click.stop="handleCurrentChange(img.url)" @click.stop="handleCurrentChange(img.url)"
...@@ -124,15 +125,13 @@ ...@@ -124,15 +125,13 @@
<img v-if="img.url" :src="img.url" alt="" /> <img v-if="img.url" :src="img.url" alt="" />
</div> </div>
</div> </div>
</template> </template>
<template #verifyResult="{ row }"> <template #verifyResult="{ row }">
<el-icon <el-icon
v-if="row.power" v-if="row.power"
style="color: #00cc00; font-size: 24px; font-weight: 900" style="color: #00cc00; font-size: 24px; font-weight: 900"
> >
<Check <Check />
/>
</el-icon> </el-icon>
</template> </template>
</TableView> </TableView>
...@@ -187,19 +186,12 @@ ...@@ -187,19 +186,12 @@
<ElButton <ElButton
type="primary" type="primary"
@click="podOrderDetailsData && print(podOrderDetailsData, true)" @click="podOrderDetailsData && print(podOrderDetailsData, true)"
>手动打印 >手动打印
</ElButton </ElButton>
> <ElButton type="primary" @click="printNormal">普货拣货 </ElButton>
<ElButton
type="primary"
@click="printNormal"
>普货拣货
</ElButton
>
<ElButton type="success" @click="handlePrintFinish" <ElButton type="success" @click="handlePrintFinish"
>打单完成 >打单完成
</ElButton </ElButton>
>
<ElButton type="danger" @click="handleClearBox">清空箱子</ElButton> <ElButton type="danger" @click="handleClearBox">清空箱子</ElButton>
</div> </div>
<div <div
...@@ -225,7 +217,7 @@ ...@@ -225,7 +217,7 @@
:class="{ :class="{
active: item.box && boxIndex == item.box, active: item.box && boxIndex == item.box,
isNull: !item.data, isNull: !item.data,
badge: handleProduct(item.data || {}), // badge: handleProduct(item.data || {}),
}" }"
@click="handleBoxClick(item)" @click="handleBoxClick(item)"
> >
...@@ -235,6 +227,19 @@ ...@@ -235,6 +227,19 @@
<span v-if="item.data" class="number"> <span v-if="item.data" class="number">
{{ item.data.pickingNumber }}/{{ item.data.purchaseNumber }} {{ item.data.pickingNumber }}/{{ item.data.purchaseNumber }}
</span> </span>
<div
v-if="
item.data &&
item.data.productList?.some(
(e) =>
e.productMark === 'custom_normal' ||
e.productMark === 'normal',
)
"
class="cb-product-mark"
>
<div class="red-circle"></div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -259,7 +264,8 @@ import { ...@@ -259,7 +264,8 @@ import {
getPackingCnDataApi, getPackingCnDataApi,
clearBoxApi, clearBoxApi,
getPodBoxListApi, getPodBoxListApi,
submitInspectionApi, printNormalPdf, submitInspectionApi,
printNormalPdf,
} from '@/api/podCnOrder' } from '@/api/podCnOrder'
import useUserStore from '@/store/user' import useUserStore from '@/store/user'
import { Check } from '@element-plus/icons-vue' import { Check } from '@element-plus/icons-vue'
...@@ -306,33 +312,28 @@ const podOrderDetailsColumns = computed(() => [ ...@@ -306,33 +312,28 @@ const podOrderDetailsColumns = computed(() => [
{ {
label: '生产单号', label: '生产单号',
prop: 'podJomallCnNo', prop: 'podJomallCnNo',
showOverflowTooltip:true, showOverflowTooltip: true,
width: 150, width: 150,
align: 'center', align: 'center',
}, },
// {
// label: 'base SKU', {
// prop: 'baseSku',
// width: 140,
// align: 'center',
// },
{
label: '库存SKU', label: '库存SKU',
prop: 'thirdSkuCode', prop: 'thirdSkuCode',
showOverflowTooltip:true, showOverflowTooltip: true,
width: 180, width: 180,
align: 'center', align: 'center',
}, },
{ {
label: 'variant SKU', label: 'variant SKU',
prop: 'variantSku', prop: 'variantSku',
showOverflowTooltip:true, showOverflowTooltip: true,
width: 150, width: 150,
align: 'center', align: 'center',
}, },
{ {
label: '商品名称', label: '商品名称',
showOverflowTooltip:true, showOverflowTooltip: true,
width: 200, width: 200,
prop: 'productName', prop: 'productName',
}, },
...@@ -380,6 +381,7 @@ watch(visible, async (value: boolean) => { ...@@ -380,6 +381,7 @@ watch(visible, async (value: boolean) => {
const hit = props.warehouseList.find((w) => w.id === localId) const hit = props.warehouseList.find((w) => w.id === localId)
warehouseId.value = hit ? localId : props.warehouseList[0].id warehouseId.value = hit ? localId : props.warehouseList[0].id
_warehouseId.value = hit ? localId : props.warehouseList[0].id _warehouseId.value = hit ? localId : props.warehouseList[0].id
if (userStore.user?.factory.id) { if (userStore.user?.factory.id) {
try { try {
await socket.init( await socket.init(
...@@ -501,8 +503,8 @@ const renderItemBox = (bool: boolean) => { ...@@ -501,8 +503,8 @@ const renderItemBox = (bool: boolean) => {
parts.length > 3 && parts[3].startsWith('CNPSC') parts.length > 3 && parts[3].startsWith('CNPSC')
? parts[3] ? parts[3]
: parts.length > 1 : parts.length > 1
? parts[1] ? parts[1]
: parts[0] : parts[0]
for (const product of productList) { for (const product of productList) {
if (product.podJomallCnNo === currentCode) { if (product.podJomallCnNo === currentCode) {
coverImage.value = product.previewImgs?.[0]?.url || '' coverImage.value = product.previewImgs?.[0]?.url || ''
...@@ -552,12 +554,15 @@ const setPodBoxList = (data: WebSocketMessage) => { ...@@ -552,12 +554,15 @@ const setPodBoxList = (data: WebSocketMessage) => {
} }
const printNormal = async () => { const printNormal = async () => {
const arr: (number | undefined)[] = []; const arr: (number | undefined)[] = []
(podBoxList.value || []).forEach((item: PodMakeOrderData) => { ;(podBoxList.value || []).forEach((item: PodMakeOrderData) => {
if (item.data) { if (item.data) {
if (item.data.productList && item.data.productList.length > 0) { if (item.data.productList && item.data.productList.length > 0) {
const flag = item.data.productList.some((item1) => { const flag = item.data.productList.some((item1) => {
return item1.productMark == 'normal' return (
item1.productMark == 'normal' ||
item1.productMark == 'custom_normal'
)
}) })
if (flag) { if (flag) {
arr?.push(item.data?.id) arr?.push(item.data?.id)
...@@ -589,15 +594,15 @@ const initPrintDevice = () => { ...@@ -589,15 +594,15 @@ const initPrintDevice = () => {
sheetPrinter.value = lodop.GET_PRINTER_NAME(0) sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
printDeviceList.value = arr printDeviceList.value = arr
} }
const handleProduct = (val: OrderData) => { // const handleProduct = (val: OrderData) => {
if (val && val.productList && val.productList.length > 0) { // if (val && val.productList && val.productList.length > 0) {
return val.productList?.some((item) => { // return val.productList?.some((item) => {
return item.productMark == 'normal' // return item.productMark == 'normal'
}) // })
} else { // } else {
return false // return false
} // }
} // }
const handleSearch = () => { const handleSearch = () => {
const code = productionOrder.value const code = productionOrder.value
if (!code) { if (!code) {
...@@ -733,9 +738,9 @@ const initOrderDetailBox = async () => { ...@@ -733,9 +738,9 @@ const initOrderDetailBox = async () => {
return return
} }
console.log(res.data) console.log(res.data)
res.data.forEach(r=>{ res.data.forEach((r) => {
r.data?.productList?.forEach(d=>{ r.data?.productList?.forEach((d) => {
if (d.productMark === 'normal') { if (d.productMark === 'normal' || d.productMark === 'custom_normal') {
d.previewImgs = [{ url: d.variantImage || '' }] d.previewImgs = [{ url: d.variantImage || '' }]
} else { } else {
if (!d.previewImgs) d.previewImgs = JSON.parse(d.imageAry || '[]') if (!d.previewImgs) d.previewImgs = JSON.parse(d.imageAry || '[]')
...@@ -779,7 +784,7 @@ const initOrderDetailBox = async () => { ...@@ -779,7 +784,7 @@ const initOrderDetailBox = async () => {
if ( if (
podOrderDetailsData.value && podOrderDetailsData.value &&
podOrderDetailsData.value.pickingNumber === podOrderDetailsData.value.pickingNumber ===
podOrderDetailsData.value.purchaseNumber podOrderDetailsData.value.purchaseNumber
) { ) {
podOrderDetailsData.value.printResult = 'notPrintSuccess' podOrderDetailsData.value.printResult = 'notPrintSuccess'
} }
...@@ -998,8 +1003,11 @@ const print = (data: OrderData, forcePrint = false, callback?: () => void) => { ...@@ -998,8 +1003,11 @@ const print = (data: OrderData, forcePrint = false, callback?: () => void) => {
// } // }
const handleRowClick = (row: ProductList) => { const handleRowClick = (row: ProductList) => {
console.log(907, row) console.log(907, row)
const previewImages = row.productMark!=='normal'?row.previewImgs:[{url:row.variantImage}] const previewImages =
coverImage.value =previewImages?.[0]?.url || '' row.productMark !== 'normal' && row.productMark !== 'custom_normal'
? row.previewImgs
: [{ url: row.variantImage }]
coverImage.value = previewImages?.[0]?.url || ''
productionOrderRef.value.focus() productionOrderRef.value.focus()
} }
const handleCurrentChange = (url: string) => { const handleCurrentChange = (url: string) => {
...@@ -1231,6 +1239,17 @@ const handleWarehouseChange = (value: string | number) => { ...@@ -1231,6 +1239,17 @@ const handleWarehouseChange = (value: string | number) => {
color: #ddd; color: #ddd;
} }
} }
.cb-product-mark {
position: absolute;
top: 0;
right: 0;
.red-circle {
width: 8px;
height: 8px;
border-radius: 50%;
background-color: red;
}
}
</style> </style>
<style lang="scss"> <style lang="scss">
.pod-make-order-dialog { .pod-make-order-dialog {
......
...@@ -996,32 +996,50 @@ ...@@ -996,32 +996,50 @@
class="goods-item-img" class="goods-item-img"
style="display: flex; flex-direction: column" style="display: flex; flex-direction: column"
> >
<div <template v-if="item.previewImgs?.length">
v-for="img in item.productMark !== 'normal' && <div
item.productMark !== 'custom_normal' v-for="img in item.previewImgs"
? item.previewImgs :key="img"
: [{ url: item.variantImage }]" style="text-align: center"
:key="img" >
style="text-align: center" <img
> :src="img.url"
alt="商品图片"
style="cursor: pointer"
@click="handlePictureCardPreview(img.url)"
/>
<div
v-if="item.customizedQuantity"
class="triangle-box"
:title="`类型:${getQuantityText(
item.customizedQuantity,
)}面`"
>
<div class="multi-text">
{{ getQuantityText(item.customizedQuantity) }}
</div>
</div>
</div>
</template>
<template v-else>
<img <img
:src="img.url" :src="item.variantImage"
alt="商品图片222" alt="商品图片"
style="cursor: pointer" style="cursor: pointer"
@click="handlePictureCardPreview(img.url)" @click="handlePictureCardPreview(item.variantImage)"
/> />
<div <div class="triangle-container-wrap">
v-if="item.customizedQuantity" <div class="triangle-container">
class="triangle-box" <div class="triangle-marker"></div>
:title="`类型:${getQuantityText( <div
item.customizedQuantity, class="content"
)}面`" :title="handleMark(item.productMark).label"
> >
<div class="multi-text"> {{ handleMark(item.productMark).name }}
{{ getQuantityText(item.customizedQuantity) }} </div>
</div> </div>
</div> </div>
</div> </template>
</div> </div>
<div class="goods-item-info"> <div class="goods-item-info">
<div class="goods-item-info-item"> <div class="goods-item-info-item">
...@@ -5006,14 +5024,16 @@ const openDetail = async (id: number) => { ...@@ -5006,14 +5024,16 @@ const openDetail = async (id: number) => {
try { try {
const res = await getOrderDetailById(id) const res = await getOrderDetailById(id)
if (res.code == 200) { if (res.code == 200) {
const item = res.data const item = res.data
if(item.imageAry){ if (item.imageAry) {
if(item.imageAry.startsWith('http')){ if (item.imageAry.startsWith('http')) {
item.imageAry = JSON.stringify(item.imageAry.split(',').map(e=>{ item.imageAry = JSON.stringify(
return { item.imageAry.split(',').map((e) => {
url:e return {
} url: e,
})) }
}),
)
} }
} }
if (item.imageAry) { if (item.imageAry) {
...@@ -5161,25 +5181,34 @@ watch( ...@@ -5161,25 +5181,34 @@ watch(
(newData) => { (newData) => {
if (!newData?.length) return if (!newData?.length) return
newData.forEach((order) => { newData.forEach((order) => {
const item = order as ProductList const item = order as ProductList
if(item.imageAry){ if (item.imageAry) {
if(item.imageAry.startsWith('http')){ if (item.imageAry.startsWith('http')) {
item.imageAry = JSON.stringify(item.imageAry.split(',').map(e=>{ item.imageAry = JSON.stringify(
return { item.imageAry.split(',').map((e) => {
url:e return {
} url: e,
})) }
}),
)
} }
} }
if(order.productList){ if (order.productList) {
// 使用可选链和空值合并简化判断 // 使用可选链和空值合并简化判断
order.productList?.forEach((product) => { order.productList?.forEach((product) => {
if (!product.previewImgs && product.imageAry) { if (!product.previewImgs && product.imageAry) {
try { try {
product.previewImgs = if (
JSON.parse(product.imageAry)?.filter( product.productMark === 'custom_normal' ||
(el: { title: string }) => el.title, product.productMark === 'normal'
) || [] ) {
product.previewImgs = []
} else {
product.previewImgs =
JSON.parse(product.imageAry)?.filter(
(el: { title: string }) => el.title,
) || []
}
} catch (error) { } catch (error) {
console.error('JSON解析失败:', error) console.error('JSON解析失败:', error)
product.previewImgs = [] product.previewImgs = []
...@@ -5187,7 +5216,6 @@ watch( ...@@ -5187,7 +5216,6 @@ watch(
} }
}) })
} }
}) })
}, },
{ deep: true, immediate: true }, // 添加immediate确保初始化时执行 { deep: true, immediate: true }, // 添加immediate确保初始化时执行
...@@ -5367,6 +5395,59 @@ function getQuantityText(qty: number) { ...@@ -5367,6 +5395,59 @@ function getQuantityText(qty: number) {
return Math.floor(qty) === 1 ? '单' : '多' return Math.floor(qty) === 1 ? '单' : '多'
} }
const handleMark = (mark: string) => {
switch (mark) {
case 'virtual':
return {
name: 'VIR',
color: '#ff9900',
label: '虚拟商品',
}
case 'normal':
return {
name: 'G',
color: '#67C23A',
label: '普通商品',
}
case 'pod':
return {
name: 'P',
color: '#F56C6C',
label: 'pod商品',
}
case 'custom':
return {
name: 'C',
color: '#6d9eeb',
label: '一件定制商品',
}
case 'custom_part':
return {
name: 'CP',
color: '#6d9eeb',
label: '一件定制局部印商品',
}
case 'custom_full':
return {
name: 'CF',
color: '#6d9eeb',
label: '一件定制满印商品',
}
case 'custom_normal':
return {
name: 'CB',
color: '#67C23A',
label: '胚衣',
}
default:
return {
name: '',
color: '#FFFFFF',
width: '0',
}
}
}
const dialogVisible = ref(false) const dialogVisible = ref(false)
const dialogImageUrl = ref('') const dialogImageUrl = ref('')
const handlePictureCardPreview = (fileUrl: string) => { const handlePictureCardPreview = (fileUrl: string) => {
...@@ -5482,9 +5563,9 @@ useEnterKeyTrigger({ ...@@ -5482,9 +5563,9 @@ useEnterKeyTrigger({
// height: 100px; // height: 100px;
position: relative; position: relative;
img { // img {
width: 65%; // width: 65%;
} // }
} }
&:not(:last-child) { &:not(:last-child) {
...@@ -5796,6 +5877,34 @@ useEnterKeyTrigger({ ...@@ -5796,6 +5877,34 @@ useEnterKeyTrigger({
} }
} }
} }
.triangle-container-wrap {
position: absolute;
top: 0;
right: 0;
}
.triangle-container {
position: relative;
.triangle-marker {
width: 0;
height: 0;
border: 18px solid transparent;
border-right: 18px solid #e74c3c;
border-top: 18px solid #e74c3c;
}
.content {
position: absolute;
top: 0;
left: 18px;
transform: rotate(45deg);
color: white;
text-align: center;
font-weight: bold;
font-size: 12px;
}
}
</style> </style>
<style lang="scss"> <style lang="scss">
.customize-select-style { .customize-select-style {
......
...@@ -201,7 +201,6 @@ ...@@ -201,7 +201,6 @@
:class="{ :class="{
active: item.box && boxIndex == item.box, active: item.box && boxIndex == item.box,
isNull: !item.data, isNull: !item.data,
badge: handleProduct(item.data || {}),
}" }"
@click="handleBoxClick(item)" @click="handleBoxClick(item)"
> >
...@@ -215,7 +214,9 @@ ...@@ -215,7 +214,9 @@
v-if=" v-if="
item.data && item.data &&
item.data.productList?.some( item.data.productList?.some(
(e) => e.productMark === 'custom_normal', (e) =>
e.productMark === 'custom_normal' ||
e.productMark === 'normal',
) )
" "
class="cb-product-mark" class="cb-product-mark"
...@@ -350,8 +351,12 @@ watch(visible, async (value: boolean) => { ...@@ -350,8 +351,12 @@ watch(visible, async (value: boolean) => {
if (value) { if (value) {
podOrderDetailsData.value = {} podOrderDetailsData.value = {}
currentCode = '' currentCode = ''
warehouseId.value = props.warehouseList[0].id const localRaw = sessionStorage.getItem('locaclCnWarehouseId')
_warehouseId.value = props.warehouseList[0].id const localId = localRaw ? JSON.parse(localRaw) : ''
/* 先找一次,确认本地值是否存在于列表 */
const hit = props.warehouseList.find((w) => w.id === localId)
warehouseId.value = hit ? localId : props.warehouseList[0].id
_warehouseId.value = hit ? localId : props.warehouseList[0].id
if (userStore.user?.factory.id) { if (userStore.user?.factory.id) {
try { try {
...@@ -378,6 +383,7 @@ watch(visible, async (value: boolean) => { ...@@ -378,6 +383,7 @@ watch(visible, async (value: boolean) => {
const locaclWarehouseId = localStorage.getItem('locaclWarehouseId') const locaclWarehouseId = localStorage.getItem('locaclWarehouseId')
if (locaclPrinter) sheetPrinter.value = JSON.parse(locaclPrinter) if (locaclPrinter) sheetPrinter.value = JSON.parse(locaclPrinter)
if (locaclWarehouseId) warehouseId.value = JSON.parse(locaclWarehouseId) if (locaclWarehouseId) warehouseId.value = JSON.parse(locaclWarehouseId)
emit('set-printer', sheetPrinter.value)
} else { } else {
if (userStore.user?.factory.id) { if (userStore.user?.factory.id) {
socket.send({ socket.send({
...@@ -453,7 +459,7 @@ const renderItemBox = (bool: boolean) => { ...@@ -453,7 +459,7 @@ const renderItemBox = (bool: boolean) => {
const { data } = boxItem const { data } = boxItem
data?.productList?.forEach((el) => { data?.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 = JSON.parse(el.imageAry) el.previewImgs = JSON.parse(el.imageAry)
...@@ -552,15 +558,15 @@ const initPrintDevice = () => { ...@@ -552,15 +558,15 @@ const initPrintDevice = () => {
sheetPrinter.value = lodop.GET_PRINTER_NAME(0) sheetPrinter.value = lodop.GET_PRINTER_NAME(0)
printDeviceList.value = arr printDeviceList.value = arr
} }
const handleProduct = (val: OrderData) => { // const handleProduct = (val: OrderData) => {
if (val && val.productList && val.productList.length > 0) { // if (val && val.productList && val.productList.length > 0) {
return val.productList?.some((item) => { // return val.productList?.some((item) => {
return item.productMark == 'normal' // return item.productMark == 'normal'
}) // })
} else { // } else {
return false // return false
} // }
} // }
const handleSearch = () => { const handleSearch = () => {
const code = productionOrder.value const code = productionOrder.value
if (!code) { if (!code) {
...@@ -723,7 +729,7 @@ const initOrderDetailBox = async () => { ...@@ -723,7 +729,7 @@ const initOrderDetailBox = async () => {
podOrderDetailsData.value?.productList?.forEach((el) => { podOrderDetailsData.value?.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
......
...@@ -3989,13 +3989,13 @@ watch( ...@@ -3989,13 +3989,13 @@ watch(
if (!newData?.length) return if (!newData?.length) return
newData.forEach((order) => { newData.forEach((order) => {
// console.log(3690, order)
// 使用可选链和空值合并简化判断
order.productList?.forEach((product) => { order.productList?.forEach((product) => {
if (!product.previewImgs && product.imageAry) { if (!product.previewImgs && product.imageAry) {
try { try {
if (product.productMark === 'custom_normal') { if (
product.productMark === 'custom_normal' ||
product.productMark === 'normal'
) {
product.previewImgs = [] product.previewImgs = []
} else { } else {
product.previewImgs = product.previewImgs =
......
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