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({
/** /**
...@@ -11,8 +12,12 @@ Page({ ...@@ -11,8 +12,12 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { async onLoad(options) {
const info = decodeURIComponent(options.userProfile) const info = JSON.parse(decodeURIComponent(options.userProfile))
const res = await USERAPI.updateUserInfo({
nickName: info.nickName,
avatarUrl: info.avatarUrl
})
wx.p.router.back(res => { wx.p.router.back(res => {
res.setData({ res.setData({
nickName: info.nickName, nickName: info.nickName,
......
<!--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!