diff --git a/buyer/src/pages/Login.vue b/buyer/src/pages/Login.vue index 98cb7762..da9db604 100644 --- a/buyer/src/pages/Login.vue +++ b/buyer/src/pages/Login.vue @@ -197,6 +197,7 @@ export default { mobile: "", }, verifyStatus: false, // 是否图片验证通过 + codeSent: false, // 是否已成功发送短信验证码 ruleInline: { // 验证规则 username: [{required: true, message: "请输入用户名"}], @@ -237,7 +238,15 @@ export default { if (this.type) { this.$refs.verify?.init(); } else { - let data = JSON.parse(JSON.stringify(this.formSms)); + if (!this.verifyStatus) { + Message.warning("请先完成安全验证"); + return; + } + if (!this.codeSent) { + Message.warning("请先获取短信验证码"); + return; + } + const data = JSON.parse(JSON.stringify(this.formSms)); apiLogin.smsLogin(data).then((res) => { this.hideVerify(); if (res.success) { @@ -262,7 +271,7 @@ export default { } else { Message.error(res.message); } - }); + }).catch(() => {}); } } }); @@ -285,6 +294,7 @@ export default { sendSms(params).then((res) => { if (res.success) { Message.success("验证码发送成功"); + this.codeSent = true; let that = this; this.interval = setInterval(() => { that.time--; @@ -292,6 +302,7 @@ export default { that.time = 60; that.codeMsg = "重新发送"; that.verifyStatus = false; + that.codeSent = false; clearInterval(that.interval); } else { that.codeMsg = that.time; @@ -300,7 +311,7 @@ export default { } else { Message.warning(res.message); } - }); + }).catch(() => {}); } }, verifyChange(con) { @@ -453,11 +464,19 @@ export default { this.$refs.formSms.resetFields(); } this.verifyStatus = false; + this.codeSent = false; this.hideVerify(); clearInterval(this.interval); this.codeMsg = "发送验证码"; this.time = 60; }, + "formSms.mobile"() { + this.codeSent = false; + this.verifyStatus = false; + clearInterval(this.interval); + this.codeMsg = "发送验证码"; + this.time = 60; + }, }, }; diff --git a/seller/src/views/promotion/flash-discount/flash-discount-add.vue b/seller/src/views/promotion/flash-discount/flash-discount-add.vue index 6eb37899..76dd3826 100644 --- a/seller/src/views/promotion/flash-discount/flash-discount-add.vue +++ b/seller/src/views/promotion/flash-discount/flash-discount-add.vue @@ -6,7 +6,14 @@ - + 0 表示不限 @@ -16,12 +23,17 @@ 选择商品 - - - - + + + + @@ -83,9 +95,18 @@ export default { submit() { const payload = { ...this.form }; if (payload.rangeTime && payload.rangeTime.length === 2) { - payload.startTime = payload.rangeTime[0]; - payload.endTime = payload.rangeTime[1]; + const start = + payload.rangeTime[0] instanceof Date + ? payload.rangeTime[0] + : new Date(payload.rangeTime[0]); + const end = + payload.rangeTime[1] instanceof Date + ? payload.rangeTime[1] + : new Date(payload.rangeTime[1]); + payload.startTime = this.$filters.unixToDate(start.getTime() / 1000); + payload.endTime = this.$filters.unixToDate(end.getTime() / 1000); } + delete payload.rangeTime; const req = payload.id ? editFlashDiscount(payload) : saveFlashDiscount(payload); req.then((res) => { if (res.success) { @@ -101,4 +122,16 @@ export default { diff --git a/seller/src/views/promotion/nth-item-discount/nth-item-discount-add.vue b/seller/src/views/promotion/nth-item-discount/nth-item-discount-add.vue index d4c7b0aa..8171cf06 100644 --- a/seller/src/views/promotion/nth-item-discount/nth-item-discount-add.vue +++ b/seller/src/views/promotion/nth-item-discount/nth-item-discount-add.vue @@ -6,7 +6,14 @@ - + @@ -92,9 +99,18 @@ export default { submit() { const payload = { ...this.form }; if (payload.rangeTime && payload.rangeTime.length === 2) { - payload.startTime = payload.rangeTime[0]; - payload.endTime = payload.rangeTime[1]; + const start = + payload.rangeTime[0] instanceof Date + ? payload.rangeTime[0] + : new Date(payload.rangeTime[0]); + const end = + payload.rangeTime[1] instanceof Date + ? payload.rangeTime[1] + : new Date(payload.rangeTime[1]); + payload.startTime = this.$filters.unixToDate(start.getTime() / 1000); + payload.endTime = this.$filters.unixToDate(end.getTime() / 1000); } + delete payload.rangeTime; const req = payload.id ? editNthItemDiscount(payload) : saveNthItemDiscount(payload); req.then((res) => { if (res.success) { @@ -110,4 +126,11 @@ export default {