From b467bab684c67baa8d31318347e88f1ca6557fc8 Mon Sep 17 00:00:00 2001 From: liugongyu <290219706@qq.com> Date: Thu, 18 Aug 2022 15:21:38 +0800 Subject: [PATCH] 卡券发放默认时间为一天有效 --- pages/businessCard/printCard.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+), 0 deletions(-) diff --git a/pages/businessCard/printCard.vue b/pages/businessCard/printCard.vue index e6bb5ec..3daac61 100644 --- a/pages/businessCard/printCard.vue +++ b/pages/businessCard/printCard.vue @@ -64,6 +64,8 @@ export default { this.plName = option.plName this.price = option.price this.cardNum = option.cardNum + this.deadline = this.dateAdd(1) + console.log(this.deadline) this.getCouponStaticQR() }, onShow() { @@ -79,6 +81,20 @@ export default { }, computed: {}, methods: { + + timeAdd0(str) { + if (str < 10) { + str = '0' + str; + } + return str + }, + dateAdd(days) { + var startDate = new Date(); + startDate = +startDate + days * 1000 * 60 * 60 * 24; + startDate = new Date(startDate); + var nextStartDate = startDate.getFullYear() + "-" + this.timeAdd0((startDate.getMonth() + 1)) + "-" + this.timeAdd0(startDate.getDate()) + " " + this.timeAdd0(startDate.getHours()) + ":" + this.timeAdd0(startDate.getMinutes()) + ":" + this.timeAdd0(startDate.getSeconds()) + return nextStartDate; + }, changeValue(value) { this.numberValue = value }, -- libgit2 0.21.4