|
@@ -9,38 +9,41 @@
|
|
|
<input name="id" th:field="*{id}" type="hidden">
|
|
<input name="id" th:field="*{id}" type="hidden">
|
|
|
<div class="col-xs-12">
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">代金券名称:</label>
|
|
|
|
|
|
|
+ <label class="col-sm-3 control-label is-required">代金券类型:</label>
|
|
|
<div class="col-sm-8">
|
|
<div class="col-sm-8">
|
|
|
- <input name="voucherName" th:field="*{voucherName}" class="form-control" type="text" required>
|
|
|
|
|
|
|
+ <select name="voucherType" class="form-control" th:with="type=${@dict.getType('voucher_type')}" required>
|
|
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{voucherType}"></option>
|
|
|
|
|
+ </select>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">代金券金额:</label>
|
|
|
|
|
|
|
+ <label class="col-sm-3 control-label is-required">代金券名称:</label>
|
|
|
<div class="col-sm-8">
|
|
<div class="col-sm-8">
|
|
|
- <input name="voucherPrice" th:field="*{voucherPrice}" class="form-control" type="text" required>
|
|
|
|
|
|
|
+ <input name="voucherName" th:field="*{voucherName}" class="form-control" type="text" required>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
<div class="col-xs-12">
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">代金券类型:</label>
|
|
|
|
|
|
|
+ <label class="col-sm-3 control-label is-required">门槛金额:</label>
|
|
|
<div class="col-sm-8">
|
|
<div class="col-sm-8">
|
|
|
- <select name="voucherType" class="form-control" th:with="type=${@dict.getType('voucher_type')}" required>
|
|
|
|
|
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{voucherType}"></option>
|
|
|
|
|
- </select>
|
|
|
|
|
|
|
+ <input name="instantDiscount" class="form-control" type="text" required>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label is-required">满多少元立减:</label>
|
|
|
|
|
|
|
+ <label class="col-sm-3 control-label is-required">代金券金额:</label>
|
|
|
<div class="col-sm-8">
|
|
<div class="col-sm-8">
|
|
|
- <input name="instantDiscount" th:field="*{instantDiscount}" class="form-control" type="text" required>
|
|
|
|
|
|
|
+ <input name="voucherPrice" th:field="*{voucherPrice}" class="form-control" type="text" required>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</form>
|
|
</form>
|
|
|
</div>
|
|
</div>
|
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: footer" />
|
|
@@ -61,7 +64,9 @@
|
|
|
required:true
|
|
required:true
|
|
|
},
|
|
},
|
|
|
instantDiscount:{
|
|
instantDiscount:{
|
|
|
- double:true
|
|
|
|
|
|
|
+ required: true, // 必填
|
|
|
|
|
+ digits: true, // 必须为整数
|
|
|
|
|
+ min: 1 // 最小值为1,确保为正整数
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
messages: {
|
|
messages: {
|
|
@@ -69,12 +74,26 @@
|
|
|
required: "代金券金额不能为空",
|
|
required: "代金券金额不能为空",
|
|
|
digits: "代金券金额必须为整数",
|
|
digits: "代金券金额必须为整数",
|
|
|
min: "代金券金额必须大于0"
|
|
min: "代金券金额必须大于0"
|
|
|
|
|
+ },
|
|
|
|
|
+ instantDiscount: {
|
|
|
|
|
+ required: "门槛金额不能为空",
|
|
|
|
|
+ digits: "门槛金额必须为整数",
|
|
|
|
|
+ min: "门槛金额必须大于0"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function submitHandler() {
|
|
function submitHandler() {
|
|
|
if ($.validate.form()) {
|
|
if ($.validate.form()) {
|
|
|
|
|
+ // 提交之前增加校验: 代金券金额不能大于门槛金额
|
|
|
|
|
+ var voucherPrice = parseInt($("input[name='voucherPrice']").val());
|
|
|
|
|
+ var instantDiscount = parseInt($("input[name='instantDiscount']").val());
|
|
|
|
|
+
|
|
|
|
|
+ if (voucherPrice > instantDiscount) {
|
|
|
|
|
+ $.modal.alertWarning("代金券金额不能大于门槛金额");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$.operate.save(prefix + "/edit", $('#form-voucher-edit').serialize());
|
|
$.operate.save(prefix + "/edit", $('#form-voucher-edit').serialize());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|