菜谱优化

This commit is contained in:
zzyuan 2025-12-17 15:14:41 +08:00
parent bdf353e6b8
commit 35e47bc019
2 changed files with 28 additions and 6 deletions

View File

@ -181,12 +181,12 @@
<el-table-column label="菜品类别" align="center" prop="dishesTypeName"></el-table-column>
<el-table-column label="当餐售价" align="center" prop="price">
<template slot-scope="scope">
<el-input v-model="scope.row.price" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.price=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
<el-input v-model="scope.row.price" placeholder="请输入" maxlength="10" clearable @change="patternValue(scope.row)" @input="(v)=>(scope.row.price=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
<el-table-column label="当餐优惠价" align="center" prop="salePrice">
<template slot-scope="scope">
<el-input v-model="scope.row.salePrice" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.salePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
<el-input v-model="scope.row.salePrice" placeholder="请输入" maxlength="10" clearable @change="patternValue(scope.row)" @input="(v)=>(scope.row.salePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
<el-table-column label="最大供应量" align="center" prop="supplyNum">
@ -1885,7 +1885,18 @@ export default {
const month = String(date.getMonth() + 1).padStart(2, '0'); // 0
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
},
//price salePrice
patternValue(row){
if(row.price&&row.salePrice){
console.log(111)
setTimeout(()=>{
if(Number(row.salePrice)>=(Number(row.price))){
row.salePrice = Number(row.price)
}
},200)
}
}
}
};
</script>

View File

@ -180,12 +180,12 @@
<el-table-column label="菜品类别" align="center" prop="dishesTypeName"></el-table-column>
<el-table-column label="当餐售价" align="center" prop="price">
<template slot-scope="scope">
<el-input v-model="scope.row.price" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.price=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
<el-input v-model="scope.row.price" placeholder="请输入" maxlength="10" clearable @change="patternValue(scope.row)" @input="(v)=>(scope.row.price=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
<el-table-column label="当餐优惠价" align="center" prop="salePrice">
<template slot-scope="scope">
<el-input v-model="scope.row.salePrice" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.salePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
<el-input v-model="scope.row.salePrice" placeholder="请输入" maxlength="10" clearable @change="patternValue(scope.row)" @input="(v)=>(scope.row.salePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
<el-table-column label="最大供应量" align="center" prop="supplyNum">
@ -2111,7 +2111,18 @@ export default {
const month = String(date.getMonth() + 1).padStart(2, '0'); // 0
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
},
//price salePrice
patternValue(row){
if(row.price&&row.salePrice){
console.log(111)
setTimeout(()=>{
if(Number(row.salePrice)>=(Number(row.price))){
row.salePrice = Number(row.price)
}
},200)
}
}
}
};
</script>