diff --git a/src/views/app/business/luckey/luckey.vue b/src/views/app/business/luckey/luckey.vue index 10de76b..a949661 100644 --- a/src/views/app/business/luckey/luckey.vue +++ b/src/views/app/business/luckey/luckey.vue @@ -183,7 +183,7 @@ - + 进行中 @@ -879,14 +879,18 @@ loadAdventureSession() { if (!this.guardRegion('adventureSession')) return; this.adventureSession.loading = true; planetAdventureSessionPage(this.baseParams('adventureSession')).then(r => this.fill('adventureSession', r)) }, // ---- 奖池 ---- openPool(row) { - this.poolForm = row ? Object.assign({}, row) : { regionId: this.regionId || '', poolAmount: 88.88, status: 0 } + this.poolForm = row ? Object.assign({}, row) : { + regionId: this.regionId || '', + poolAmount: 0, + drawTime: this.defaultDrawTime(), + status: 0 + } + if (this.poolForm.status !== 1) this.poolForm.drawTime = this.defaultDrawTime(this.poolForm.drawTime) this.poolModal = true }, savePool() { const form = Object.assign({}, this.poolForm) - if (form.drawTime instanceof Date) { - form.drawTime = this.fmt(form.drawTime) - } + if (form.status !== 1) form.drawTime = this.defaultDrawTime(form.drawTime) planetPoolSave(form).then(r => { if (r && r.success) { this.$Message.success('保存成功') @@ -1047,6 +1051,16 @@ fmt(d) { const p = n => (n < 10 ? '0' + n : n) return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}` + }, + defaultDrawTime(value) { + let d = value instanceof Date ? value : new Date() + if (!(value instanceof Date) && typeof value === 'string' && value.length >= 10) { + d = new Date(value.replace(/-/g, '/')) + } + const now = new Date() + const target = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 22, 0, 0) + if (target.getTime() <= now.getTime()) target.setDate(target.getDate() + 1) + return this.fmt(target) } } }