Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
144cfaa3
Commit
144cfaa3
authored
Jun 15, 2026
by
qinjianhui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 商品库存明细接口联调
parent
c469630a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
13 deletions
+46
-13
src/views/order/factoryOrderNew/component/OrderInventoryDialog.vue
+46
-13
No files found.
src/views/order/factoryOrderNew/component/OrderInventoryDialog.vue
View file @
144cfaa3
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
</ElFormItem>
</ElFormItem>
<ElFormItem
label=
"库存状况"
>
<ElFormItem
label=
"库存状况"
>
<ElSelect
<ElSelect
v-model=
"filterForm.
stock
Status"
v-model=
"filterForm.
inventory
Status"
placeholder=
"请选择库存状况"
placeholder=
"请选择库存状况"
clearable
clearable
style=
"width: 160px"
style=
"width: 160px"
...
@@ -103,15 +103,16 @@ import {
...
@@ -103,15 +103,16 @@ import {
getOrderInventoryListApi
,
getOrderInventoryListApi
,
exportOrderInventoryApi
,
exportOrderInventoryApi
,
}
from
'@/api/factoryOrderNew'
}
from
'@/api/factoryOrderNew'
import
BigNumber
from
'bignumber.js'
const
props
=
defineProps
<
{
const
props
=
defineProps
<
{
visible
:
boolean
visible
:
boolean
selectedRows
:
FactoryOrderNewListData
[]
selectedRows
:
FactoryOrderNewListData
[]
warehouseList
:
WarehouseListData
[]
warehouseList
:
WarehouseListData
[]
}
>
()
}
>
()
const
stockStatusOptions
=
[
const
stockStatusOptions
=
[
{
label
:
'缺货商品'
,
value
:
'OUT_OF_STOCK'
},
{
label
:
'缺货商品'
,
value
:
1
},
{
label
:
'不缺货商品'
,
value
:
'IN_STOCK'
},
{
label
:
'不缺货商品'
,
value
:
2
},
{
label
:
'未入过库的商品'
,
value
:
'NEVER_STOCKED'
},
{
label
:
'未入过库的商品'
,
value
:
3
},
]
]
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
...
@@ -132,7 +133,7 @@ watch(visible, (newVal) => {
...
@@ -132,7 +133,7 @@ watch(visible, (newVal) => {
warehouseId
:
undefined
,
warehouseId
:
undefined
,
warehouseSku
:
''
,
warehouseSku
:
''
,
productNo
:
''
,
productNo
:
''
,
stock
Status
:
undefined
,
inventory
Status
:
undefined
,
}
}
refresh
()
refresh
()
}
}
...
@@ -141,7 +142,7 @@ const filterForm = ref({
...
@@ -141,7 +142,7 @@ const filterForm = ref({
warehouseId
:
undefined
as
number
|
undefined
,
warehouseId
:
undefined
as
number
|
undefined
,
warehouseSku
:
''
,
warehouseSku
:
''
,
productNo
:
''
,
productNo
:
''
,
stock
Status
:
undefined
as
string
|
undefined
,
inventory
Status
:
undefined
as
string
|
undefined
,
})
})
const
buildQueryParams
=
()
=>
({
const
buildQueryParams
=
()
=>
({
...
@@ -149,7 +150,7 @@ const buildQueryParams = () => ({
...
@@ -149,7 +150,7 @@ const buildQueryParams = () => ({
warehouseId
:
filterForm
.
value
.
warehouseId
||
undefined
,
warehouseId
:
filterForm
.
value
.
warehouseId
||
undefined
,
warehouseSku
:
filterForm
.
value
.
warehouseSku
||
undefined
,
warehouseSku
:
filterForm
.
value
.
warehouseSku
||
undefined
,
productNo
:
filterForm
.
value
.
productNo
||
undefined
,
productNo
:
filterForm
.
value
.
productNo
||
undefined
,
stockStatus
:
filterForm
.
value
.
stock
Status
||
undefined
,
inventoryStatus
:
filterForm
.
value
.
inventory
Status
||
undefined
,
})
})
const
{
const
{
...
@@ -174,6 +175,20 @@ const {
...
@@ -174,6 +175,20 @@ const {
},
},
})
})
/** 可用数量 = 库存数量 - 占用数量 - 冻结数量 */
function
getAvailableQuantity
(
row
:
OrderInventoryData
):
number
{
return
new
BigNumber
(
row
.
inventory
??
0
)
.
minus
(
row
.
occupyInventory
??
0
)
.
minus
(
row
.
freezeInventory
??
0
)
.
toNumber
()
}
function
getShortageQuantity
(
row
:
OrderInventoryData
):
number
{
const
shortage
=
new
BigNumber
(
row
.
salesNum
??
0
)
.
minus
(
getAvailableQuantity
(
row
))
.
toNumber
()
return
Math
.
max
(
0
,
shortage
)
}
const
columns
=
[
const
columns
=
[
{
{
label
:
'图片'
,
label
:
'图片'
,
...
@@ -181,9 +196,9 @@ const columns = [
...
@@ -181,9 +196,9 @@ const columns = [
align
:
'center'
,
align
:
'center'
,
render
:
(
row
:
OrderInventoryData
)
=>
(
render
:
(
row
:
OrderInventoryData
)
=>
(
<
el
-
image
<
el
-
image
src
=
{
row
.
i
mage
??
''
}
src
=
{
row
.
variantI
mage
??
''
}
style
=
{{
width
:
'40px'
,
height
:
'40px'
}}
style
=
{{
width
:
'40px'
,
height
:
'40px'
}}
preview
-
src
-
list
=
{
row
.
image
?
[
row
.
i
mage
]
:
[]}
preview
-
src
-
list
=
{
row
.
variantImage
?
[
row
.
variantI
mage
]
:
[]}
preview
-
teleported
preview
-
teleported
fit
=
"cover"
fit
=
"cover"
/>
/>
...
@@ -215,7 +230,7 @@ const columns = [
...
@@ -215,7 +230,7 @@ const columns = [
{
{
prop
:
'skuName'
,
prop
:
'skuName'
,
label
:
'商品名称'
,
label
:
'商品名称'
,
minWidth
:
1
2
0
,
minWidth
:
1
4
0
,
showOverflowTooltip
:
true
,
showOverflowTooltip
:
true
,
},
},
{
{
...
@@ -223,7 +238,7 @@ const columns = [
...
@@ -223,7 +238,7 @@ const columns = [
width
:
100
,
width
:
100
,
align
:
'right'
,
align
:
'right'
,
render
:
(
row
:
OrderInventoryData
)
=>
{
render
:
(
row
:
OrderInventoryData
)
=>
{
const
v
=
row
.
shortageQuantity
??
0
const
v
=
getShortageQuantity
(
row
)
if
(
v
>
0
)
{
if
(
v
>
0
)
{
return
<
span
style
=
"color: #f56c6c; font-weight: bold"
>
{
v
}
<
/span
>
return
<
span
style
=
"color: #f56c6c; font-weight: bold"
>
{
v
}
<
/span
>
}
}
...
@@ -231,16 +246,31 @@ const columns = [
...
@@ -231,16 +246,31 @@ const columns = [
},
},
},
},
{
{
prop
:
'
demandQuantity
'
,
prop
:
'
salesNum
'
,
label
:
'需求数量'
,
label
:
'需求数量'
,
width
:
100
,
width
:
100
,
align
:
'right'
,
align
:
'right'
,
render
:
(
row
:
OrderInventoryData
)
=>
{
return
(
<
span
style
=
{{
color
:
row
.
inventoryStatus
===
3
?
'#E6A23C'
:
''
,
fontWeight
:
row
.
inventoryStatus
===
3
?
'bold'
:
''
,
}}
>
{
row
.
salesNum
||
0
}
<
/span
>
)
},
},
},
{
{
prop
:
'usableQuantity'
,
prop
:
'usableQuantity'
,
label
:
'可用数量'
,
label
:
'可用数量'
,
width
:
100
,
width
:
100
,
align
:
'right'
,
align
:
'right'
,
render
:
(
row
:
OrderInventoryData
)
=>
{
return
<
span
>
{
getAvailableQuantity
(
row
)}
<
/span
>
},
},
},
{
{
prop
:
'inventory'
,
prop
:
'inventory'
,
...
@@ -253,6 +283,9 @@ const columns = [
...
@@ -253,6 +283,9 @@ const columns = [
label
:
'占用数量'
,
label
:
'占用数量'
,
width
:
100
,
width
:
100
,
align
:
'right'
,
align
:
'right'
,
render
:
(
row
:
OrderInventoryData
)
=>
{
return
<
span
>
{
row
.
occupyInventory
||
0
}
<
/span
>
},
},
},
{
{
prop
:
'freezeInventory'
,
prop
:
'freezeInventory'
,
...
@@ -269,7 +302,7 @@ const handleSearch = () => {
...
@@ -269,7 +302,7 @@ const handleSearch = () => {
const
handleExport
=
async
()
=>
{
const
handleExport
=
async
()
=>
{
try
{
try
{
await
exportOrderInventoryApi
(
buildQueryParams
())
await
exportOrderInventoryApi
(
buildQueryParams
())
ElMessage
.
success
(
'
导出成功
'
)
ElMessage
.
success
(
'
请求成功,请稍后到右上角[我的下载]中查看
'
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
)
console
.
error
(
e
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment