Commit fad71cff authored by chenjundi's avatar chenjundi

fix赠品配置验证问题

parent 7edf6ee5
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<el-dialog <el-dialog
:title="dialogObj.title" :title="dialogObj.title"
:visible.sync="dialogObj.show" :visible.sync="dialogObj.show"
:close-on-click-modal="false"
center center
width="500px"> width="500px">
<el-form :model="form" :rules="rules" ref="form"> <el-form :model="form" :rules="rules" ref="form">
...@@ -9,10 +10,10 @@ ...@@ -9,10 +10,10 @@
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="成本价格" prop="cost_price"> <el-form-item label="成本价格" prop="cost_price">
<el-input v-model.number="form.cost_price"></el-input> <el-input v-model="form.cost_price"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="赠品总数" prop="gift_num"> <el-form-item label="赠品总数" prop="gift_num">
<el-input v-model.number="form.gift_num" @change="giftNumChange"></el-input> <el-input v-model="form.gift_num" @change="giftNumChange"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="库存数量" prop="stock_num"> <el-form-item label="库存数量" prop="stock_num">
<div>{{form.stock_num}}</div> <div>{{form.stock_num}}</div>
...@@ -49,6 +50,14 @@ ...@@ -49,6 +50,14 @@
} }
}; };
const validCostPrice = (rule, value, callback) => {
if (!/^[\.\d]*$/.test(value)) {
callback(new Error('只能填数字和小数'));
} else {
callback();
}
};
return { return {
form: { form: {
name: '', name: '',
...@@ -64,7 +73,7 @@ ...@@ -64,7 +73,7 @@
], ],
cost_price: [ cost_price: [
{required: true, message: '请输入成本价格'}, {required: true, message: '请输入成本价格'},
{type: 'number', message: '只能填阿拉伯数字'} {validator: validCostPrice}
], ],
gift_num: [ gift_num: [
{required: true, message: '请输入赠品总数'}, {required: true, message: '请输入赠品总数'},
......
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
<el-form-item label="关联赠品"> <el-form-item label="关联赠品">
<el-input v-model="form.gift_name"></el-input> <el-input v-model="form.gift_name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="订单状态"> <el-form-item label="赠品物流状态">
<el-select v-model="form.deliver_status" placeholder="请选择" clearable> <el-select v-model="form.deliver_status" placeholder="请选择" clearable>
<el-option label="未发货" value="0"></el-option> <el-option label="未发货" value="0"></el-option>
<el-option label="已发货" value="1"></el-option> <el-option label="已发货" value="1"></el-option>
......
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