Commit 7d4beb90 by chenwq

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

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