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