견적서 pkgAsp
This commit is contained in:
parent
b2293962c5
commit
655b8f29cd
@ -493,19 +493,37 @@ export default function Estimate({ params }) {
|
|||||||
setSelection(newSelection)
|
setSelection(newSelection)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatNumberWithComma(number) {
|
||||||
|
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||||
|
}
|
||||||
|
|
||||||
//주택PKG input 변경
|
//주택PKG input 변경
|
||||||
const onChangePkgAsp = (value) => {
|
const onChangePkgAsp = (value) => {
|
||||||
if (estimateContextState.estimateType === 'YJSS') {
|
if (estimateContextState.estimateType === 'YJSS') {
|
||||||
let pkgAsp = Number(value.replace(/[^-\.0-9]/g, '').replaceAll(',', ''))
|
let newValue = value.replace(/[^0-9.]/g, '')
|
||||||
if (isNaN(pkgAsp)) {
|
if (newValue.length > 1) {
|
||||||
pkgAsp = 0
|
newValue = newValue.replace(/(^0+)/, '')
|
||||||
} else {
|
if (newValue.length === 0) {
|
||||||
pkgAsp = pkgAsp.toLocaleString()
|
newValue = '0'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//현재 PKG용량값 가져오기
|
|
||||||
|
|
||||||
|
const parts = newValue.split('.')
|
||||||
|
if (parts.length > 2) {
|
||||||
|
newValue = parts[0] + '.' + parts.slice(1).join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parts[1] && parts[1].length > 2) {
|
||||||
|
newValue = parts[0] + '.' + parts[1].substring(0, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
let pkgAsp = newValue || '0'
|
||||||
|
|
||||||
|
//현재 PKG용량값 가져오기
|
||||||
let totVolKw = estimateContextState.totVolKw * 1000
|
let totVolKw = estimateContextState.totVolKw * 1000
|
||||||
let pkgTotPrice = pkgAsp?.replaceAll(',', '') * totVolKw * 1000
|
let pkgTotPrice = parseFloat(pkgAsp?.replaceAll(',', '')) * totVolKw * 1000
|
||||||
|
|
||||||
|
// pkgAsp = formatNumberWithComma(parseFloat(pkgAsp).toFixed(2))
|
||||||
|
|
||||||
setEstimateContextState({
|
setEstimateContextState({
|
||||||
pkgAsp: pkgAsp,
|
pkgAsp: pkgAsp,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user