Commit b467bab684c67baa8d31318347e88f1ca6557fc8
1 parent
b63f86d6
卡券发放默认时间为一天有效
Showing
1 changed file
with
16 additions
and
0 deletions
pages/businessCard/printCard.vue
| ... | ... | @@ -64,6 +64,8 @@ export default { |
| 64 | 64 | this.plName = option.plName |
| 65 | 65 | this.price = option.price |
| 66 | 66 | this.cardNum = option.cardNum |
| 67 | + this.deadline = this.dateAdd(1) | |
| 68 | + console.log(this.deadline) | |
| 67 | 69 | this.getCouponStaticQR() |
| 68 | 70 | }, |
| 69 | 71 | onShow() { |
| ... | ... | @@ -79,6 +81,20 @@ export default { |
| 79 | 81 | }, |
| 80 | 82 | computed: {}, |
| 81 | 83 | methods: { |
| 84 | + | |
| 85 | + timeAdd0(str) { | |
| 86 | + if (str < 10) { | |
| 87 | + str = '0' + str; | |
| 88 | + } | |
| 89 | + return str | |
| 90 | + }, | |
| 91 | + dateAdd(days) { | |
| 92 | + var startDate = new Date(); | |
| 93 | + startDate = +startDate + days * 1000 * 60 * 60 * 24; | |
| 94 | + startDate = new Date(startDate); | |
| 95 | + 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()) | |
| 96 | + return nextStartDate; | |
| 97 | + }, | |
| 82 | 98 | changeValue(value) { |
| 83 | 99 | this.numberValue = value |
| 84 | 100 | }, | ... | ... |