Commit 3c055896 by qinjianhui

feat: 缺货统计修改

parent c3f5b1f4
......@@ -8,8 +8,8 @@ export interface OutOfStockItem {
skuName?: string
currency?: string
costPrice?: number
outOfStockQuantity?: number
salesQuantity?: number
stockOutNum?: number
salesNum?: number
warehouseSpu?: string
inventory?: number
occupyInventory?: number
......
......@@ -165,7 +165,7 @@ interface formType {
}
const formRef = ref()
const inventoryLowerLimit = ref<number | null>(null)
const inventoryLowerLimit = ref<number | null>(100)
const logList = ref([])
async function saveConfiguration(item: formType, index: number) {
let loading
......@@ -263,8 +263,13 @@ const saveInventoryLowerLimit = async () => {
if (res.code !== 200) {
return
}
ElMessage.success('保存配置成功')
await ElMessageBox.confirm('保存配置成功!!需重新登录才能生效', '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'success',
})
getInventoryLowerLimit()
handleClick()
} catch (error) {
console.log(error)
}
......
......@@ -169,13 +169,13 @@ const tableColumns = computed(() => {
},
{
label: '缺货数量',
prop: 'outOfStockQuantity',
prop: 'stockOutNum',
width: 100,
align: 'right',
},
{
label: '销售数量',
prop: 'salesQuantity',
prop: 'salesNum',
width: 100,
align: 'right',
},
......
......@@ -20,6 +20,7 @@ import { ref, computed } from 'vue'
import SplitDiv from '@/components/splitDiv/splitDiv.vue'
import { filePath } from '@/api/axios.ts'
import { useEnterKeyTrigger } from '@/utils/hooks/useEnterKeyTrigger.ts'
import { getInventoryLowerLimitApi } from '@/api/externalAuth'
const searchForm = ref({
warehouseId: '',
......@@ -173,8 +174,16 @@ async function getData() {
...searchForm.value,
})
const sortedRecords = res.data.records.sort((a, b) => {
const aUsable = Number((a as WarehouseWarning & { usableInventory?: number | string }).usableInventory) || 0
const bUsable = Number((b as WarehouseWarning & { usableInventory?: number | string }).usableInventory) || 0
const aUsable =
Number(
(a as WarehouseWarning & { usableInventory?: number | string })
.usableInventory,
) || 0
const bUsable =
Number(
(b as WarehouseWarning & { usableInventory?: number | string })
.usableInventory,
) || 0
const aIsLow = aUsable < 100
const bIsLow = bUsable < 100
if (aIsLow && !bIsLow) return -1
......@@ -303,17 +312,16 @@ const getWarehouse = async () => {
}
const getRowClassName = (row: { row: WarehouseWarning }) => {
const rowData = row.row as WarehouseWarning & { usableInventory?: number | string }
const rowData = row.row as WarehouseWarning & {
usableInventory?: number | string
}
const usableInventory = Number(rowData.usableInventory) || 0
if (usableInventory < 100) {
if (usableInventory < inventoryLowerLimit.value) {
return 'low-inventory-row'
}
return ''
}
getData()
getWarehouse()
/**
* @description: 页面添加回车监听
*/
......@@ -329,6 +337,23 @@ useEnterKeyTrigger({
getData()
},
})
const inventoryLowerLimit = ref<number>(100)
const getInventoryLowerLimit = async () => {
try {
const res = await getInventoryLowerLimitApi()
if (res.code !== 200) {
return
}
inventoryLowerLimit.value = res.data
} catch (error) {
console.log(error)
}
}
onMounted(async () => {
getData()
getWarehouse()
getInventoryLowerLimit()
})
</script>
<template>
......@@ -857,12 +882,12 @@ useEnterKeyTrigger({
background-color: #f56c6c !important;
color: #fff !important;
}
td {
background-color: #f56c6c !important;
color: #fff !important;
}
&:hover td {
background-color: #f56c6c !important;
color: #fff !important;
......
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