|
|
@@ -38,7 +38,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<!-- 有效期 -->
|
|
|
- <el-form-item label="有效期" prop="specifiedDay">
|
|
|
+ <el-form-item label="有效期(天)" prop="specifiedDay">
|
|
|
<el-input v-model="couponModel.specifiedDay" maxlength="15" placeholder="请输入" clearable />
|
|
|
</el-form-item>
|
|
|
<!-- 库存 -->
|
|
|
@@ -180,6 +180,12 @@ const rules = reactive({
|
|
|
callback(new Error("请输入最低消费金额"));
|
|
|
return;
|
|
|
}
|
|
|
+ const strValue = value.toString().trim();
|
|
|
+ // 检查是否有前导零(除了单独的"0"或"0."开头的小数)
|
|
|
+ if (strValue.length > 1 && strValue.startsWith("0") && strValue !== "0" && !strValue.startsWith("0.")) {
|
|
|
+ callback(new Error("最低消费金额必须为正数"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
validatePositiveNumber("最低消费金额必须为正数")(rule, value, callback);
|
|
|
} else {
|
|
|
callback();
|
|
|
@@ -288,18 +294,18 @@ watch(
|
|
|
* 监听最低消费金额变化
|
|
|
* 当最低消费金额大于0时,自动设置为"是",否则设置为"否"
|
|
|
*/
|
|
|
-watch(
|
|
|
- () => couponModel.value.minimumSpendingAmount,
|
|
|
- newVal => {
|
|
|
- if (isInitializing.value) return;
|
|
|
- const amount = Number(newVal);
|
|
|
- if (!isNaN(amount) && amount > 0) {
|
|
|
- couponModel.value.hasMinimumSpend = 1;
|
|
|
- } else {
|
|
|
- couponModel.value.hasMinimumSpend = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-);
|
|
|
+// watch(
|
|
|
+// () => couponModel.value.minimumSpendingAmount,
|
|
|
+// newVal => {
|
|
|
+// if (isInitializing.value) return;
|
|
|
+// const amount = Number(newVal);
|
|
|
+// if (!isNaN(amount) && amount > 0) {
|
|
|
+// couponModel.value.hasMinimumSpend = 1;
|
|
|
+// } else {
|
|
|
+// couponModel.value.hasMinimumSpend = 0;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// );
|
|
|
|
|
|
// ==================== 事件处理函数 ====================
|
|
|
/**
|