// pages/my/service/service.js const App = getApp(); Page({ /** * 页面的初始数据 */ data: { meetId: null, detail: {}, groupList: [], refuseContent: null, queryPage: { page: 1, limit: 10, }, list: [], total: null, totalPage: null, currPage: null, isShowContact: false, user: wx.getStorageSync("USER"), }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options); this.setData({ meetId: options.meetId, }); this.getDetail(options.meetId); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { this.popup2 = this.selectComponent("#popup2"); }, /** * 生命周期函数--监听页面显示 */ onShow() {}, getDetail(meetId) { wx.showLoading({ title: "努力加载中...", }); App._get( `myMeet/myAppointmentInfo`, { meetId: meetId, id: this.data.user.id, }, (res) => { if (res.code === 0) { this.setData({ detail: res.data, groupList: res.data.meetPeopleBOList, }); if (res.data.process >= 3) { this.getExperience(res.data.meetId); } } }, (err) => {}, (complete) => { setTimeout(() => { wx.hideLoading(); }, 500); } ); }, // 获取心得分享 getExperience(meetId) { if (this.data.queryPage.page > 1) { if (this.data.total > 0 && this.data.currPage == this.data.totalPage) { wx.showToast({ title: "没有更多了~", icon: "none", }); return false; } } wx.showLoading({ title: "努力加载中...", }); App._get( "meetevaluation/evaluatePage", { meetId: meetId, ...this.data.queryPage, }, (res) => { if (res.code === 0) { this.setData({ list: [...this.data.list, ...res.page.list], total: res.page.totalCount, totalPage: res.page.totalPage, currPage: res.page.currPage, }); } }, (err) => {}, (complete) => { setTimeout(() => { wx.hideLoading(); }, 500); } ); }, agreeHandle() { if (this.data.detail.groupWay == 1 && this.data.detail.process == 0) { wx.showToast({ icon: "none", title: "请等待拼团成功", }); return false; } wx.requestSubscribeMessage({ tmplIds: ["LyWMllU4dWpy1Y8tS39EhOBLUSQWmUb_yDFKoJojKq8"], success: (success) => {}, fail: (fail) => {}, complete: (complete) => { console.log("查看"); wx.showLoading({ title: "处理中...", }); App._put_form( "expert_workbench/agreeToAsk", "", { id: this.data.user.id, meetId: this.data.meetId, }, (res) => { if (res.code === 0) { this.getDetail(this.data.meetId); wx.hideLoading(); wx.showToast({ title: "操作成功", }); } }, (err) => {}, (complete) => {} ); }, }); }, toCustomer() { wx.navigateTo({ url: "/pages/my/myCustomer/myCustomer", }); }, contactUser() { this.setData({ isShowContact: true, }); }, cancelContact() { this.setData({ isShowContact: false, }); }, contactPhone(e) { console.log(e, 1111); wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.phone, }); this.setData({ isShowContact: false, }); }, refuseHandle() { this.popup2.showPopup(); }, _error() { console.log("返回"); this.popup2.hidePopup(); }, _success() { if (!this.data.refuseContent) { wx.showToast({ icon: "error", title: "请填写拒绝原因", }); return false; } wx.showLoading({ title: "处理中...", }); App._put_form( "expert_workbench/refuseToAsk", "", { id: this.data.user.id, denialReason: this.data.refuseContent, meetId: this.data.meetId, }, (res) => { if (res.code === 0) { this.getDetail(this.data.meetId); this.popup2.hidePopup(); wx.hideLoading(); wx.showToast({ title: "操作成功", }); } }, (err) => {}, (complete) => {} ); }, /** * 生命周期函数--监听页面隐藏 */ onHide() {}, /** * 生命周期函数--监听页面卸载 */ onUnload() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { this.setData({ queryPage: { page: ++this.data.queryPage.page, limit: 10, }, }); if (this.data.detail.process >= 3) { this.getExperience(this.meetId); } }, /** * 用户点击右上角分享 */ onShareAppMessage() {}, });