diff --git a/config.js b/config.js index 601e2676..8f8f793e 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ module.exports = { - version: "6.5.0", - note: '增加三级分销功能', + version: "6.5.1", + note: '增加分销二维码及转发', subDomain: "tz", // 如果你的域名是: https://api.it120.cc/abcd 那么这里只要填写 abcd appid: "wxa46b09d413fbcaff", // 您的小程序的appid,购物单功能需要使用 shareProfile: '百款精品商品,总有一款适合您' // 首页转发的时候话术 diff --git a/pages/fx/apply-status.js b/pages/fx/apply-status.js index 99380b4a..8adc1a2e 100644 --- a/pages/fx/apply-status.js +++ b/pages/fx/apply-status.js @@ -1,5 +1,7 @@ const app = getApp() +const CONFIG = require('../../config.js') const WXAPI = require('../../wxapi/main') +const regeneratorRuntime = require('../../utils/runtime') Page({ @@ -8,7 +10,8 @@ Page({ */ data: { applyStatus: -2, // -1 表示未申请,0 审核中 1 不通过 2 通过 - applyInfo: {} + applyInfo: {}, + qrcode: '/images/fx.png' }, /** @@ -28,28 +31,56 @@ Page({ /** * 生命周期函数--监听页面显示 */ - onShow: function () { + async onShow() { const _this = this + const userDetail = await WXAPI.userDetail(wx.getStorageSync('token')) WXAPI.fxApplyProgress(wx.getStorageSync('token')).then(res => { - let applyStatus = -1 + let applyStatus = userDetail.data.base.isSeller ? 2 : -1 if (res.code == 2000) { app.goLoginPageTimeOut() return } if (res.code === 700) { _this.setData({ - applyStatus: -1 + applyStatus: applyStatus }) } if (res.code === 0) { + if (userDetail.data.base.isSeller) { + applyStatus = 2 + } else { + applyStatus = res.data.status + } _this.setData({ - applyStatus: res.data.status, + applyStatus: applyStatus, applyInfo: res.data }) } + if (applyStatus == 2) { + _this.fetchQrcode() + } + }) + }, + fetchQrcode(){ + const _this = this + wx.showLoading({ + title: '加载中', + mask: true + }) + WXAPI.wxaQrcode({ + scene: 'inviter_id=' + wx.getStorageSync('uid'), + page: 'pages/index/index', + is_hyaline: true, + expireHours: 1 + }).then(res => { + wx.hideLoading() + if (res.code == 0) { + _this.setData({ + qrcode: res.data + }) + } }) }, - /** * 生命周期函数--监听页面隐藏 */ @@ -82,7 +113,16 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage: function () { - + return { + title: '"' + wx.getStorageSync('mallName') + '" ' + CONFIG.shareProfile, + path: '/pages/index/index?inviter_id=' + wx.getStorageSync('uid'), + success: function (res) { + // 转发成功 + }, + fail: function (res) { + // 转发失败 + } + } }, bindSave: function (e) { WXAPI.addTempleMsgFormid({ diff --git a/pages/fx/apply-status.wxml b/pages/fx/apply-status.wxml index 50c63e3f..7f378bda 100644 --- a/pages/fx/apply-status.wxml +++ b/pages/fx/apply-status.wxml @@ -24,9 +24,7 @@ -
- - 恭喜您,您已经是一名合格的分销商! - -
+ + 扫码关注您的专属推广码,或者转发邀请好友 +
\ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 507c6251..dee3db38 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -65,8 +65,14 @@ Page({ selectCurrent: e.index }) }, - onLoad: function() { - var that = this + onLoad: function(e) { + const that = this + if (e && e.scene) { + const scene = decodeURIComponent(e.scene) + if (scene) { + wx.setStorageSync('referrer', scene.substring(11)) + } + } wx.setNavigationBarTitle({ title: wx.getStorageSync('mallName') }) diff --git a/pages/my/index.wxml b/pages/my/index.wxml index 1982b6f2..8ceed78e 100755 --- a/pages/my/index.wxml +++ b/pages/my/index.wxml @@ -41,6 +41,9 @@ 成为分销商 + + 分销中心 + 我的团队 diff --git a/wxapi/main.js b/wxapi/main.js index 15558b4b..6dc81675 100644 --- a/wxapi/main.js +++ b/wxapi/main.js @@ -315,5 +315,8 @@ module.exports = { }, fxCommisionLog: (data) => { return request('/saleDistribution/commision/log', true, 'post', data) + }, + wxaQrcode: (data) => { + return request('/qrcode/wxa/unlimit', true, 'post', data) } } \ No newline at end of file