123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- // pages/invitationDetails/invitationDetails.js
- import {
- get,
- } from '../../utils/http';
- import {
- trackUserEvent
- } from '../../utils/util'
- const app = getApp()
- /**
- * 数据上报-邀请者枚举类型
- */
- const XEnum_Inviter_Type = 7
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- call_team: [
- ],
- steps: [],
- active: -1,
- show: false,
- activity_time: '',
- page: 1,
- limit: 10,
- loading: false,
- finished: false,
- total:0,//已邀请的人数
- experienceList:['【舒敏修复】华熙生物智慧舒敏修复','【祛黄提亮】华熙智慧水光肌提亮祛黄','【无创水光】华熙生物真皮层补水','【清痘消炎】痘痘清理痘肌消炎','【紧致嫩肤】华熙智慧紧致提拉嫩肤'],//免费体验列表
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad() {
- this.getInvite()
- this.scrollToLower()
- // "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
- wx.showShareMenu({
- menus: ['shareAppMessage', 'shareTimeline'],
- // 需要显示的转发按钮名称列表.合法值包含 "shareAppMessage"、"shareTimeline"
- success(res) {
- console.log(res);
- },
- fail(e) {
- console.log(e);
- }
- });
- },
- onOpenShow() {
- this.setData({
- show: true
- });
- },
- onClose() {
- this.setData({
- show: false
- })
- },
- onShareFriends () {
- trackUserEvent(XEnum_Inviter_Type)
- },
- onMoments() {
- wx.navigateTo({
- url: `/pages/invitationDetails/poster/poster`,
- })
- },
- /**
- * 邀请活动主页
- * /api/invite
- */
- getInvite() {
- get('/api/invite', {}, (res) => {
- console.log(res);
- this.setData({
- activity_time: res.data.activity_time
- })
- let array = []
-
- res.data.progress_list.forEach((item, index) => {
- let obj = {}
- let init = {
- // value_1: '(价值',
- // value_2: ')',
- greyText_1: '成功解锁',
- greyText_2: `,可获得${item.product_name}一次`
- }
- obj["text"] = item.product_name
- // obj["price"] = `¥${item.price}`
- obj["redText"] = `${item.require_num.require_num}人`
- obj["status"] = item.status
- let obj_info = {
- ...obj,
- ...init
- }
- array.push(obj_info)
- if (item.status == 1) {
- this.setData({
- active: index
- })
- }
- })
- getApp().invite_id = res.data.qrcode_content
- this.setData({
- steps: array,
- })
- })
- },
- /**
- * 获取已邀请的列表
- * /api/invite/list
- */
- scrollToLower() {
- if (!this.data.finished && !this.data.loading) {
- this.setData({
- loading: true
- })
- setTimeout(() => {
- get('/api/invite/list', {
- page: this.data.page,
- limit: this.data.limit
- }, (res) => {
- this.setData({
- loading: false,
- total:res.data.total,
- page: this.data.page + 1
- })
- let arr = []
- arr = [...res.data.list, ...this.data.call_team]
- console.log(arr,'arrarr');
- this.setData({
- call_team:arr
- })
- if (res.data.list.length < 10) {
- this.setData({
- finished: true
- })
- }
- })
- }, 1000)
- }
- },
- onShareAppMessage() {
- return {
- title: '朋友送你的0元修丽可B5补水还未领取,点击去领取~', // 分享出的卡片标题
- path: `pages/invitees/invitees?invite_id=${app.globalData.userInfo.uid}`, // 他人通过卡片进入小程序的路径,可以在后面拼接URL的形式带参数
- imageUrl: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20220811/%E4%BA%8C%E5%9B%BE/%E5%9B%BE%E7%89%87/%E7%BC%96%E7%BB%84%203%402x.png',
- };
- },
- onShareTimeline() {
- return {
- title: '送你一份修丽可无创水光项目,一起变美丽吧',
- path: `pages/invitees/invitees?invite_id=${app.globalData.userInfo.uid}`,
- imageUrl: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20220413/%E9%82%80%E8%AF%B7%E8%80%85%E5%88%86%E4%BA%AB%E6%9C%8B%E5%8F%8B%E5%9C%88%E6%B5%B7%E6%8A%A5%402x%20%282%29.png',
- };
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- closeShow() {
- this.setData({
- show: false
- })
- }
- })
|