From bc12ee4b12b621aeb7d4d584bb7ac4b6d493a8e9 Mon Sep 17 00:00:00 2001 From: ZhaoTongYao <531131322@qq.com> Date: Mon, 27 Sep 2021 17:14:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC1.7.21=20=E5=BF=97=E6=84=BF?= =?UTF-8?q?=E8=80=85=E6=B4=BB=E5=8A=A8=E5=8F=96=E6=B6=88=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=B6=E9=97=B4=E6=AE=B5=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/toRegister/toRegister.js | 2 +- .../heart/pages/heartDetail/heartDetail.js | 54 +++++++++++++++++-- .../heart/pages/heartDetail/heartDetail.wxml | 43 +++++++++++++-- .../heart/pages/heartDetail/heartDetail.wxss | 30 ++++++++++- utils/api.js | 12 +++-- 5 files changed, 128 insertions(+), 13 deletions(-) diff --git a/pages/toRegister/toRegister.js b/pages/toRegister/toRegister.js index f1efd37..caf39aa 100644 --- a/pages/toRegister/toRegister.js +++ b/pages/toRegister/toRegister.js @@ -21,7 +21,7 @@ Page({ // } // }) let that = this - const versionNum = "1.7.20" + const versionNum = "1.7.21" api.getScanSwitch(versionNum).then(function (res) { console.log(res.data) let state = res.data ? res.data.scanFlag : '1' diff --git a/subpages/heart/pages/heartDetail/heartDetail.js b/subpages/heart/pages/heartDetail/heartDetail.js index c911c9f..d435c62 100644 --- a/subpages/heart/pages/heartDetail/heartDetail.js +++ b/subpages/heart/pages/heartDetail/heartDetail.js @@ -35,6 +35,9 @@ Page({ dialogTips: '', sponsor: '', // 主办方 periodList: [], // 时间段 + actPeriodId: [], // + cancelPeriodList: [], // 取消报名的时间段 + textareaValue: '', // 取消原因 }, onLoad: function (options) { console.log("当前时间" + getTimestamp()) @@ -52,8 +55,6 @@ Page({ // } // 获取默认网格 this.getDefaultGridInfo() - // 获取活动时间段 - this.getActPeriods() }, onReachBottom () { if (this.data.curSize == this.data.pageSize) { @@ -131,6 +132,8 @@ Page({ // dialogConfirmText: '确定', // dialogCancelText: '' // }) + // 获取活动时间段 + this.getActPeriods() this.setData({ // dialogVisible: this.data.periodList.length == 0 ? true : false, showPeriodDialog: !this.data.showPeriodDialog, @@ -141,6 +144,8 @@ Page({ dialogCancelText: "否" }) } else if (uservolunteerflag == 1) { + // 获取活动时间段 + this.getActPeriods() this.setData({ // dialogVisible: this.data.periodList.length == 0 ? true : false, showPeriodDialog: !this.data.showPeriodDialog, @@ -181,6 +186,7 @@ Page({ }, // 取消报名 prompt () { + this.getSignInActPeriods() const now = getTimestamp() if (now > this.data.detail.signupEndTime) { this.setData({ @@ -246,8 +252,18 @@ Page({ }, cancelSignupCallback (e) { let id = this.data.id - let reason = e.detail.data - api.cancelsignup(id, reason).then(() => { + let actPeriodId = this.data.actPeriodId + let reason = this.data.textareaValue + console.log(this.data.actPeriodId) + if (actPeriodId.length == 0) { + wx.showToast({ + title: "请选择取消的时间段", + icon: "none", + duration: 2000 + }) + return + } + api.cancelsignup(id, reason, actPeriodId).then(() => { wx.showToast({ title: "取消报名成功", icon: "none", @@ -349,11 +365,41 @@ Page({ } }, getActPeriods () { + this.setData({ + periodList: [], + actPeriodId: [], + }) api.getActPeriods(this.data.id).then(res => { console.log(res.data) this.setData({ periodList: res.data }) }) + }, + textareaInput (e) { + this.setData({ + textareaValue: e.detail.value + }) + }, + closeCancelDialog () { + this.setData({ + cancelPeriodList: [], + actPeriodId: [], + textareaValue: '', + cancelSignupVisible: !this.data.cancelSignupVisible, + cancelSignupTipValue: "" + }) + }, + getSignInActPeriods () { + this.setData({ + cancelPeriodList: [], + actPeriodId: [], + }) + api.getSignInActPeriods(this.data.id).then(res => { + console.log(res.data) + this.setData({ + cancelPeriodList: res.data + }) + }).catch(err => {}) } }) \ No newline at end of file diff --git a/subpages/heart/pages/heartDetail/heartDetail.wxml b/subpages/heart/pages/heartDetail/heartDetail.wxml index 5bebd74..6c49592 100644 --- a/subpages/heart/pages/heartDetail/heartDetail.wxml +++ b/subpages/heart/pages/heartDetail/heartDetail.wxml @@ -368,22 +368,28 @@ content="{{dialogContent}}" confirmText="{{dialogConfirmText}}" cancelText="{{dialogCancelText}}"> - - + --> 请选择时间段 + + 活动时间段 + 剩余名额 + - @@ -396,4 +402,33 @@ 确定 + + + + + 请选择时间段 + + + + + + + {{cancelSignupTipValue}} + + +