Commit eeebce7f by lixiaomin

修改金额小数点

parent b223161e
......@@ -106,9 +106,9 @@ export default {
subTag=false;
return;
}else{
const regular = /(^[+]{0,1}([1-9]+)$)|(^[+]{0,1}([1-9][0]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1,2}$)/; //正数(包括小数)
const regular = /^([0-9]*)+(.[0-9]{1,2})?$/; //正数(包括小数)
if (!regular.test(item.quantity)) {
this.$message.error(''+item.name+"原料名称的原料数量不是大于0的数字,最多保留2位小数!")
this.$message.error(''+item.name+"原料名称的原料数量不是大于等于0的数字,最多保留2位小数!")
subTag=false;
return;
}
......
......@@ -104,7 +104,7 @@
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="描述" prop="desc">
<el-input v-model="form.desc" type="textarea" placeholder="请输入内容" />
<el-input v-model="form.desc" type="textarea" placeholder="请输入内容" maxlength="18" show-word-limit/>
</el-form-item>
</el-col>
<el-col :span="12">
......@@ -161,14 +161,14 @@ export default {
}
};
var validateDiscount = (rule, value, callback) => {
var regular=/(^[+]{0,1}([0-9]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1,2}$)/; //正数(保留2位小数)
var regular=/(^[+]{0,1}([0-9]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1}$)/; //正数(保留2位小数)
if (value == undefined || value === '') {
callback(new Error('不能为空'));
}else if(!regular.test(value)){
callback(new Error('请输入大于0的正数,最多保留2位小数'));
callback(new Error('请输入大于0的正数,最多保留1位小数'));
}else if(this.form.price){
if(value >= this.form.price){
callback(new Error('折扣价不能大于等于原价'));
if(value > this.form.price){
callback(new Error('折扣价不能大于原价'));
}else {
callback();
}
......@@ -178,14 +178,14 @@ export default {
};
var validatePrice = (rule, value, callback) => {
//let regular = /(^[+]{0,1}([1-9]+)$)|(^[+]{0,1}(\d+\.\d{1,2})$)/ //正数(保留2位小数)
var regular=/(^[+]{0,1}([0-9]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1,2}$)/; //正数 ,小数可有可无,最多2位
var regular=/(^[+]{0,1}([0-9]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1}$)/; //正数 ,小数可有可无,最多2位
if (value == undefined || value === '') {
callback(new Error('不能为空'));
}else if(!regular.test(value)){
callback(new Error('请输入大于0的正数,最多保留2位小数'));
callback(new Error('请输入大于0的正数,最多保留1位小数'));
}else if(this.form.discount){
if(value<=this.form.discount){
callback(new Error('原价不能小于等于折扣价'));
if(value<this.form.discount){
callback(new Error('原价不能小于折扣价'));
}else {
callback();
}
......@@ -216,6 +216,7 @@ export default {
detailImages:[{required: true, validator: validateDetailImages, trigger: "blur" }],
},
tagValues:"",
goodsTagList: [],
inputVisible: false,
inputValue: ''
......@@ -232,10 +233,20 @@ export default {
});
},
handleInputConfirm() {
let inputValue = this.inputValue;
if (inputValue) {
if(this.goodsTagList.indexOf(inputValue)==-1){
this.goodsTagList.push(inputValue);
let inputValues = this.inputValue;
if (inputValues) {
if(this.goodsTagList.indexOf(inputValues)==-1){
if(this.goodsTagList.length >= 3){
this.$message('标签个数最多添加三个!');
}else{
this.tagValues=this.tagValues+inputValues;
if(this.tagValues.length>16){
this.$message('标签总字符数量最大16!');
this.tagValues=this.tagValues.replace(inputValues,"");
}else{
this.goodsTagList.push(inputValues);
}
}
}else{
this.$message('请重新添加标签,该标签已存在!');
}
......@@ -265,6 +276,7 @@ export default {
},
// 表单重置
reset() {
this.tagValues="";
this.goodsTagList=[];
this.form = {
pics: {},
......
......@@ -242,7 +242,7 @@ export default {
},
/** 提交按钮 */
submitForm() {
let regular=/(^[+]{0,1}([0-9]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1,2}$)/; //正数 ,小数可有可无,最多2位
let regular=/(^[+]{0,1}([0-9]+)$)|(^[+]{0,1}([0-9]+)[\.]{1}[0-9]{1}$)/; //正数 ,小数可有可无,最多2位
this.$refs["form"].validate((valid) => {
if (valid) {
let specsSelectList = this.$refs.specsSelect.list;
......@@ -253,7 +253,7 @@ export default {
return;
}
if(!regular.test(specsSelectList[i].amount)){
this.$modal.msgSuccess('选项列表中的第' + index + '行价格不是大于等于0的数字,最多保留位小数');
this.$modal.msgSuccess('选项列表中的第' + index + '行价格不是大于等于0的数字,最多保留1位小数');
return;
}
if(!specsSelectList[i].isRecommend){
......
......@@ -65,7 +65,7 @@
</el-table-column>
<el-table-column width="200" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" v-if="authBtn(['3','4','5','6','13'], scope.row.state)"
<el-button size="mini" type="text" v-if="authBtn(['2','3','4','5','6','7','13'], scope.row.state)"
@click="refundClick(scope.row)" v-hasPermi="['system:order:refund']">退款</el-button>
</template>
</el-table-column>
......
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