fix: 修复优惠券减保留2位小数

This commit is contained in:
zhangds 2022-10-08 15:19:19 +08:00
parent f346189eff
commit 4140dd010d
2 changed files with 65 additions and 41 deletions

View File

@ -142,6 +142,14 @@ const rule_rules = {
reg: "^[0-9][0-9]*([.][0-9]{1,2})?$",
},
],
reduce: [
{ type: "required", message: "请输入减" },
{
type: "regExp",
message: "请输入两位小数",
reg: "^[0-9][0-9]*([.][0-9]{1,2})?$",
},
],
quantity: [
{ type: "required", message: "请输入发放总量" },
{
@ -1133,46 +1141,57 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
<Card style={{ margin: "10px auto" }} title={state.setup2_title}>
<Form model={form_rule_data} rules={rule_rules} ref={form_rule_el}>
<FormItem labelname="面额" prop="full">
<div className="justify-box">
<Ipt
onChange={(e) => {
setForm_rule_data({ full: e });
}}
onClearItem={() => {
setForm_rule_data({ full: "" });
}}
value={form_rule_data.full}
placeholder={"请输入"}
labelWidth={"0px"}
maxLength={20}
height={"36px"}
countShow={false}
width={"130px"}
alignment={"left"}
front="满"
disabled={state.isEdit}
/>
<Ipt
onChange={(e) => {
setForm_rule_data({ reduce: e });
}}
onClearItem={() => {
setForm_rule_data({ reduce: "" });
}}
value={form_rule_data.reduce}
placeholder={"请输入"}
labelWidth={"0px"}
maxLength={20}
height={"36px"}
countShow={false}
width={"130px"}
alignment={"left"}
front="减"
unit="元"
disabled={state.isEdit}
/>
</div>
<FormItem
labelname="面额"
prop="full"
myClassName="sel1 coupon-form-box"
>
<Ipt
onChange={(e) => {
setForm_rule_data({ full: e });
}}
onClearItem={() => {
setForm_rule_data({ full: "" });
}}
value={form_rule_data.full}
placeholder={"请输入"}
labelWidth={"0px"}
maxLength={20}
height={"36px"}
countShow={false}
width={"130px"}
alignment={"left"}
front="满"
disabled={state.isEdit}
/>
</FormItem>
<FormItem
labelname=""
labelwidth="0px"
prop="reduce"
myClassName="sel2"
required={false}
>
<Ipt
onChange={(e) => {
setForm_rule_data({ reduce: e });
}}
onClearItem={() => {
setForm_rule_data({ reduce: "" });
}}
value={form_rule_data.reduce}
placeholder={"请输入"}
labelWidth={"0px"}
maxLength={20}
height={"36px"}
countShow={false}
width={"130px"}
alignment={"left"}
front="减"
unit="元"
disabled={state.isEdit}
/>
</FormItem>
<FormItem labelname="发放总量" prop="quantity">

View File

@ -6,4 +6,9 @@
.justify-box{
display: flex;
align-items: center;
}
}
.coupon-form-box .form-compontent{
width: auto;
margin-left: 0!important;
}