// customer/pages/goldeneggact/goldeneggact.js const app = getApp(); const utils = require("../../../utils/http"); Page({ /** * 页面的初始数据 */ data: { activityInfo: {}, prizesText: '' }, /** * 获取活动详情 */ getActivityInfo() { var that = this; utils.$post({ url: app.globalData.webUrl + 'api/lottery/egg_act_detail', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: {}, success: function (res) { if (res.data.code == '0') { that.setData({ activityInfo: res.data.data, prizesText: res.data.data && res.data.data.good.length ? res.data.data.good.map(v => v.good_name).join('/') : '', }) } } }) }, /** * 员工转发活动记录 */ shareCountRecord() { var that = this; utils.$post({ url: app.globalData.webUrl + 'api/lottery/act_forward_log', header: { 'Authorization': 'bearer ' + app.globalData.token }, data: { actid: that.data.activityInfo.id }, success: function (res) { if (res.data.code == '0') { console.log('成功') } } }) }, /** * 抽奖客户 */ joinCustomer() { wx.navigateTo({ url: '/pages/other/other?type=29' + '&actid=' + this.data.activityInfo.id, }) }, /** * 我的中奖 */ myWinning() { wx.showToast({ title: '只有客户可以查看', icon: 'none' }) }, /** * 砸金蛋 */ smashGoldenEgg() { wx.showToast({ title: '只有客户才能参与活动', icon: 'none' }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getActivityInfo(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { this.shareCountRecord(); let uid = app.globalData.currentUserId ? app.globalData.currentUserId : app.globalData.personMsg.id; return { title: this.data.activityInfo.title, imageUrl: '', path: '/share/pages/eggsactivity/eggsactivity?uid=' + uid + '&clientype=' + app.globalData.clientype + '&actid=' + this.data.activityInfo.id, }; } })