Commit eeebce7f by lixiaomin

修改金额小数点

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