|
|
@ -116,12 +116,12 @@ |
|
|
|
<el-table-column label="调整后销售指导价(元)" header-align="center"> |
|
|
|
<el-table-column label="全款价" align="left" header-align="center" width="140"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.tzhGuidedPrice" placeholder="" @keyup.native="UpNumber" @keydown.native="UpNumber" class="addinputw" clearable/> |
|
|
|
<el-input v-model="scope.row.tzhGuidedPrice" placeholder="" @keyup.native="scope.row.tzhGuidedPrice = getNumber(scope.row.tzhGuidedPrice, 0)" class="addinputw" clearable/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="贷款价" align="left" header-align="center" width="140"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.tzhManufactorSettlementPrice" placeholder="" @keyup.native="UpNumber" @keydown.native="UpNumber" class="addinputw" clearable/> |
|
|
|
<el-input v-model="scope.row.tzhManufactorSettlementPrice" placeholder="" @keyup.native="scope.row.tzhManufactorSettlementPrice = getNumber(scope.row.tzhManufactorSettlementPrice, 0)" class="addinputw" clearable/> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table-column> |
|
|
@ -150,7 +150,7 @@ import req from '@/api/kucunguanli/price' |
|
|
|
import configuration from './chexingbyconfiguration' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'priceAdd', |
|
|
|
name: 'PriceAdd', |
|
|
|
components: { |
|
|
|
configuration |
|
|
|
}, |
|
|
@ -191,27 +191,23 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 获取制单日期 |
|
|
|
newDate() { |
|
|
|
var date = new Date() |
|
|
|
var year = date.getFullYear() // 年 |
|
|
|
var month = date.getMonth() + 1 // 月 |
|
|
|
var day = date.getDate() // 日 |
|
|
|
if (month < 10) { |
|
|
|
month = '0' + month |
|
|
|
} |
|
|
|
if (day < 10) { |
|
|
|
day = '0' + day |
|
|
|
} |
|
|
|
this.formobj.createTime = year + '-' + month + '-' + day |
|
|
|
}, |
|
|
|
UpNumber(e) { |
|
|
|
e.target.value = e.target.value.replace(/[^\d]/g, '') // 清除“数字”和“.”"-"以外的字符 |
|
|
|
e.target.value = e.target.value.replace(/^00/, '0') // 开头不能有两个0 |
|
|
|
if (e.target.value.indexOf('.') < 0 && e.target.value !== '' && e.target.value !== '-') { |
|
|
|
// 以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额 |
|
|
|
e.target.value = parseFloat(e.target.value) |
|
|
|
getNumber(val, limit) { |
|
|
|
val = val.replace(/[^0-9.]/g, '') // 保留数字 |
|
|
|
val = val.replace(/^00/, '0.') // 开头不能有两个0 |
|
|
|
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0. |
|
|
|
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个 |
|
|
|
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点 |
|
|
|
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0 |
|
|
|
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$' |
|
|
|
const reg = new RegExp(str) |
|
|
|
if (limit === 0) { |
|
|
|
// 不需要小数点 |
|
|
|
val = val.replace(reg, '$1') |
|
|
|
} else { |
|
|
|
// 通过正则保留小数点后指定的位数 |
|
|
|
val = val.replace(reg, '$1.$2') |
|
|
|
} |
|
|
|
return val |
|
|
|
}, |
|
|
|
// 明细表添加一行数据 |
|
|
|
addCommodity() { |
|
|
@ -223,7 +219,6 @@ export default { |
|
|
|
this.formobj.baseModelModpriceModels.splice(index, 1) |
|
|
|
}, |
|
|
|
showAdd(createOrgSid) { |
|
|
|
this.newDate() |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs['form_obj'].clearValidate() |
|
|
|
}) |
|
|
@ -235,6 +230,13 @@ export default { |
|
|
|
this.formobj.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|
|
|
this.formobj.deptName = window.sessionStorage.getItem('defaultOrgPathName').substring(window.sessionStorage.getItem('defaultOrgPathName').lastIndexOf('/') + 1) |
|
|
|
this.formobj.deptSid = window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage.getItem('defaultOrgPath').lastIndexOf('/') + 1) |
|
|
|
var nowDate = new Date() |
|
|
|
var date = { |
|
|
|
year: nowDate.getFullYear(), |
|
|
|
month: nowDate.getMonth() + 1, |
|
|
|
day: nowDate.getDate() |
|
|
|
} |
|
|
|
this.formobj.createTime = date.year + '-' + (date.month >= 10 ? date.month : '0' + date.month) + '-' + (date.day >= 10 ? date.day : '0' + date.day) |
|
|
|
this.viewTitle = '【新增】车型调价申请' |
|
|
|
}, |
|
|
|
showEdit(row) { |
|
|
@ -345,11 +347,7 @@ export default { |
|
|
|
if (valid) { |
|
|
|
this.submitdisabled = true |
|
|
|
req.saveOrUpdate(this.formobj).then((resp) => { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'success', |
|
|
|
message: resp.msg |
|
|
|
}) |
|
|
|
this.$message({ showClose: true, type: 'success', message: resp.msg }) |
|
|
|
this.handleReturn('true') |
|
|
|
}).catch(() => { |
|
|
|
this.submitdisabled = false |
|
|
@ -360,16 +358,23 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
submitVehicleApply() { |
|
|
|
if (this.formobj.baseModelModpriceModels.length > 0) { |
|
|
|
for (var i = 0; i < this.formobj.baseModelModpriceModels.length; i++) { |
|
|
|
if (this.formobj.baseModelModpriceModels[i].tzhGuidedPrice === '' || this.formobj.baseModelModpriceModels[i].tzhManufactorSettlementPrice === '') { |
|
|
|
this.$message({ showClose: true, type: 'error', message: '车型列表中调整后销售指导价的全款价及贷款价均不能为空' }) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message({ showClose: true, type: 'error', message: '车型列表不能为空' }) |
|
|
|
return |
|
|
|
} |
|
|
|
this.$refs['form_obj'].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
this.submitdisabled = true |
|
|
|
req.submitVehicleApply(this.formobj).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'success', |
|
|
|
message: '提交成功' |
|
|
|
}) |
|
|
|
this.$message({ showClose: true, type: 'success', message: resp.msg }) |
|
|
|
this.handleReturn('true') |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|