Commit 7d4beb90 by chenwq

领取券的merchantid,存用户昵称和头像

1 parent a8dfa1e0
...@@ -42,6 +42,16 @@ module.exports = { ...@@ -42,6 +42,16 @@ module.exports = {
true true
); );
}, },
// 通过scene获取merchantId等信息
sceneGetId(data) {
return api.post(
{
method: `scrm.api.wechat.get.scene.by.id`,
...data,
},
true
);
},
// 获取商品信息 // 获取商品信息
commodityMsg(data) { commodityMsg(data) {
return api.post({ return api.post({
......
...@@ -88,11 +88,10 @@ Page({ ...@@ -88,11 +88,10 @@ Page({
}) })
}, },
//
async tofreeReceive() { async tofreeReceive() {
const userInfo = wx.p.storage.get('userInfo') const userInfo = wx.p.storage.get('userInfo')
let { merchantId, phone } = userInfo const { merchantId } = this.data
let { phone } = userInfo
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
this.toPostFreeCard(merchantId, phone, userInfo) this.toPostFreeCard(merchantId, phone, userInfo)
}, },
...@@ -115,7 +114,6 @@ Page({ ...@@ -115,7 +114,6 @@ Page({
}) })
return return
} }
console.log(res, '////')
if (code == 0) { if (code == 0) {
// 获取会员卡信息 // 获取会员卡信息
wx.p.api.equityApi.checkOpenMember().then(res => { wx.p.api.equityApi.checkOpenMember().then(res => {
...@@ -170,11 +168,26 @@ Page({ ...@@ -170,11 +168,26 @@ Page({
}) })
}, },
sceneGetId(id) {
wx.p.api.equityApi.sceneGetId({ id }).then(res => {
let { code, data, message } = res
if (code == 0) {
this.setData({
merchantId: data?.scene.split('=')[1]
})
} else {
this.showTips(message)
}
})
},
async onLoad(options) { async onLoad(options) {
let system = wx.getSystemInfoSync() let system = wx.getSystemInfoSync()
const authStatus = await wx.p.router.intercept(false) const authStatus = await wx.p.router.intercept(false)
// const { merchantId } = wx.p.storage.get('merchant_info') let appEnter = wx.getEnterOptionsSync()
// this.toGetFreeCardDay(merchantId) if (appEnter?.query?.scene) {
this.sceneGetId(decodeURIComponent(appEnter.query.scene).split('=')[1])
}
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
const { const {
data, data,
...@@ -188,9 +201,6 @@ Page({ ...@@ -188,9 +201,6 @@ Page({
textpadding: system.windowHeight * 0.31, textpadding: system.windowHeight * 0.31,
authStatus authStatus
}) })
if (!authStatus) {
this.data.userInfo
}
}, },
onUnload: function () { onUnload: function () {
} }
......
// pages/crowdfunding/blank/blank.js // pages/crowdfunding/blank/blank.js
import USERAPI from "~/api/usersApi/index";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { async onLoad(options) {
const info = decodeURIComponent(options.userProfile) const info = JSON.parse(decodeURIComponent(options.userProfile))
wx.p.router.back(res => { const res = await USERAPI.updateUserInfo({
res.setData({ nickName: info.nickName,
nickName: info.nickName, avatarUrl: info.avatarUrl
headImgUrl: info.avatarUrl, })
hasUserInfo: true wx.p.router.back(res => {
}) res.setData({
}) nickName: info.nickName,
}, headImgUrl: info.avatarUrl,
hasUserInfo: true
/** })
* 生命周期函数--监听页面初次渲染完成 })
*/ },
onReady() {
/**
}, * 生命周期函数--监听页面初次渲染完成
*/
/** onReady() {
* 生命周期函数--监听页面显示
*/ },
onShow() {
/**
}, * 生命周期函数--监听页面显示
*/
/** onShow() {
* 生命周期函数--监听页面隐藏
*/ },
onHide() {
/**
}, * 生命周期函数--监听页面隐藏
*/
/** onHide() {
* 生命周期函数--监听页面卸载
*/ },
onUnload() {
/**
}, * 生命周期函数--监听页面卸载
*/
/** onUnload() {
* 页面相关事件处理函数--监听用户下拉动作
*/ },
onPullDownRefresh() {
/**
}, * 页面相关事件处理函数--监听用户下拉动作
*/
/** onPullDownRefresh() {
* 页面上拉触底事件的处理函数
*/ },
onReachBottom() {
/**
}, * 页面上拉触底事件的处理函数
*/
/** onReachBottom() {
* 用户点击右上角分享
*/ },
onShareAppMessage() {
/**
} * 用户点击右上角分享
*/
onShareAppMessage() {
}
}) })
\ No newline at end of file \ No newline at end of file
<!--pages/crowdfunding/blank/blank.wxml--> <!--pages/crowdfunding/blank/blank.wxml-->
<text>pages/crowdfunding/blank/blank.wxml</text>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!