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}} + + +