Commit 3c055896 by qinjianhui

feat: 缺货统计修改

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