Commit f96005b9 by yangxiaolei

格式化金额

parent bf29f930
...@@ -143,6 +143,7 @@ ...@@ -143,6 +143,7 @@
:key="key" :key="key"
:label="item.label" :label="item.label"
:prop="item.prop" :prop="item.prop"
:formatter="item.rounding"
></el-table-column> ></el-table-column>
<el-table-column fixed="right" prop="op" label="操作" width="140px"> <el-table-column fixed="right" prop="op" label="操作" width="140px">
<template slot="header"> <template slot="header">
...@@ -298,7 +299,7 @@ export default { ...@@ -298,7 +299,7 @@ export default {
{ {
label: '金额', label: '金额',
prop: 'maxamt', prop: 'maxamt',
rounding:this.rounding
}, },
{ {
label: '余额', label: '余额',
......
...@@ -181,14 +181,14 @@ export default { ...@@ -181,14 +181,14 @@ export default {
{ max: 35, message: '长度不能超过35' }, { max: 35, message: '长度不能超过35' },
], ],
'lidgrp.cbs.nom1.amt': [ // 'lidgrp.cbs.nom1.amt': [
{ type: 'string', required: true, message: '必输项' }, // { type: 'string', required: true, message: '必输项' },
{ max: 18, message: '整数位不能超过15位' }, // { max: 18, message: '整数位不能超过15位' },
{ // {
pattern: /(^\d+$)|(^\.\d{1,2}$)|(^\d+\.\d{1,2}$)/, // pattern: /(^\d+$)|(^\.\d{1,2}$)|(^\d+\.\d{1,2}$)/,
message: '小数位不能超过2位', // message: '小数位不能超过2位',
}, // },
], // ],
'lidgrp.apl.pts.adrblk': [ 'lidgrp.apl.pts.adrblk': [
{ type: 'string', required: false, message: '必输项' }, { type: 'string', required: false, message: '必输项' },
......
...@@ -87,13 +87,21 @@ ...@@ -87,13 +87,21 @@
</c-select> </c-select>
</el-form-item> </el-form-item>
</c-col> </c-col>
<c-col :span="9">
<c-col :span="9" >
<el-form-item <el-form-item
style="text-align: left; margin-left: 5px" style="text-align: left; margin-left: 5px"
label-width="0px" label-width="0px"
prop="lidgrp.cbs.nom1.amt" prop="lidgrp.cbs.nom1.amt"
> >
<c-input-currency <c-input-number v-if="model.lidgrp.cbs.nom1.cur =='JPY'"
v-model="model.lidgrp.cbs.nom1.amt"
style="text-align: left; width: 90%"
placeholder="请输入金额"
@change="nomtopChange"
></c-input-number>
<c-input-currency v-else
v-model="model.lidgrp.cbs.nom1.amt" v-model="model.lidgrp.cbs.nom1.amt"
style="text-align: left; width: 90%" style="text-align: left; width: 90%"
placeholder="请输入金额" placeholder="请输入金额"
...@@ -653,7 +661,15 @@ export default { ...@@ -653,7 +661,15 @@ export default {
} else { } else {
this.flag = true; this.flag = true;
} }
}
}, },
"model.lidgrp.cbs.nom1.cur":{
immediate: true,
handler(val, oldVal) {
if (val == "JPY") {
this.model.lidgrp.cbs.nom1.amt = Number(this.model.lidgrp.cbs.nom1.amt)
}
}
}, },
"model.lidgrp":{ "model.lidgrp":{
immediate: true, immediate: true,
...@@ -695,7 +711,7 @@ export default { ...@@ -695,7 +711,7 @@ export default {
return this.model.lidgrp.apl.pts.extkey == ""; return this.model.lidgrp.apl.pts.extkey == "";
}, },
}, },
}; }
</script> </script>
<style> <style>
.marginLable { .marginLable {
......
...@@ -36,10 +36,6 @@ export default { ...@@ -36,10 +36,6 @@ export default {
} }
}, },
props: { props: {
red:{
type: Boolean,
default: false
},
value: { value: {
default: '' default: ''
}, },
...@@ -60,6 +56,11 @@ export default { ...@@ -60,6 +56,11 @@ export default {
default: undefined default: undefined
} }
}, },
data(){
return {
red:false
}
},
computed: { computed: {
model: { model: {
get () { get () {
......
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="应收金额" prop="ogiamt" width="110px"> <el-table-column label="应收金额" prop="ogiamt" :formatter="rounding" width="110px">
</el-table-column> </el-table-column>
<el-table-column label="实收金额" prop="amt" width="auto"> <el-table-column label="实收金额" prop="amt" width="auto">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -350,7 +350,8 @@ ...@@ -350,7 +350,8 @@
label-width="0" label-width="0"
:prop="'setmod.setfeg.setfel.' + scope.$index + '.amt'" :prop="'setmod.setfeg.setfel.' + scope.$index + '.amt'"
> >
{{ scope.row.amt }} {{ parseFloat(scope.row.amt).toFixed(2) }}
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
......
...@@ -57,10 +57,22 @@ export function moneyFormat(value, precision = 2) { ...@@ -57,10 +57,22 @@ export function moneyFormat(value, precision = 2) {
return num = null; return num = null;
} }
} }
export function rounding(row,column) {
let val = row[column.property]
return toThousandslsFilter(val, 2);
}
export function toThousandslsFilter(num, digits) {
num = (num + '').replace(/\,/g, '')
return (+num || 0).toFixed(digits).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
}
export default { export default {
install(Vue){ install(Vue){
Vue.prototype.findCodeLabel = findCodeLabel Vue.prototype.findCodeLabel = findCodeLabel
Vue.prototype.dateFormat = dateFormat Vue.prototype.dateFormat = dateFormat
Vue.prototype.moneyFormat = moneyFormat Vue.prototype.moneyFormat = moneyFormat
Vue.prototype.rounding = rounding
} }
} }
...@@ -129,8 +129,10 @@ export default { ...@@ -129,8 +129,10 @@ export default {
window.sessionStorage.setItem("bchnam", dd.bch_namcn); window.sessionStorage.setItem("bchnam", dd.bch_namcn);
} }
}); });
this.$router.push("/home"); this.$router.push("/taskList");
} }
}).catch((err)=>{
this.$router.push("/taskList");
}); });
} else { } else {
console.log("error submit!!"); console.log("error submit!!");
......
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