Commit 4eabf2c9 by 李伟康

提交

1 parent 30fb72d1
...@@ -16,7 +16,10 @@ Page({ ...@@ -16,7 +16,10 @@ Page({
isOpenMember: false isOpenMember: false
}, },
navbarReady(e) { navbarReady(e) {
let { height, statusBarHeight } = e.detail let {
height,
statusBarHeight
} = e.detail
this.setData({ this.setData({
tabBarStyle: height / 2 + statusBarHeight, tabBarStyle: height / 2 + statusBarHeight,
tabBoxStyle: `height: ${height}px`, tabBoxStyle: `height: ${height}px`,
...@@ -57,7 +60,11 @@ Page({ ...@@ -57,7 +60,11 @@ Page({
wx.$LoginStatus = false wx.$LoginStatus = false
wx.p.storage.set('userInfo', data) wx.p.storage.set('userInfo', data)
wx.p.storage.set('sessionId', data.sessionId) wx.p.storage.set('sessionId', data.sessionId)
let { nickName, headImgUrl, phone } = data let {
nickName,
headImgUrl,
phone
} = data
this.setData({ this.setData({
userInfo: data, userInfo: data,
nickName: nickName, nickName: nickName,
...@@ -80,7 +87,9 @@ Page({ ...@@ -80,7 +87,9 @@ Page({
} }
let json = JSON.stringify(item) let json = JSON.stringify(item)
// 数据上报 // 数据上报
wx.p.api.common.trackHttp({ json }).then(response => { }) wx.p.api.common.trackHttp({
json
}).then(response => {})
if (nickName || headImgUrl) { if (nickName || headImgUrl) {
this.setData({ this.setData({
hasUserInfo: true hasUserInfo: true
...@@ -109,8 +118,12 @@ Page({ ...@@ -109,8 +118,12 @@ Page({
async tofreeReceive() { async tofreeReceive() {
const userInfo = wx.p.storage.get('userInfo') const userInfo = wx.p.storage.get('userInfo')
const { merchantId } = this.data const {
let { phone } = userInfo merchantId
} = this.data
let {
phone
} = userInfo
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
this.toPostFreeCard(merchantId, phone, userInfo) this.toPostFreeCard(merchantId, phone, userInfo)
}, },
...@@ -122,7 +135,12 @@ Page({ ...@@ -122,7 +135,12 @@ Page({
} }
wx.p.api.couponsApi.tolqFreecard(para).then(res => { wx.p.api.couponsApi.tolqFreecard(para).then(res => {
wx.hideLoading() wx.hideLoading()
const { errId, code, message, data } = res const {
errId,
code,
message,
data
} = res
if ((code == -1 && errId == 20313) || (code == -1 && errId == 20322)) { if ((code == -1 && errId == 20313) || (code == -1 && errId == 20322)) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
...@@ -135,7 +153,9 @@ Page({ ...@@ -135,7 +153,9 @@ Page({
} }
if (code == 0) { if (code == 0) {
// 获取会员卡信息 // 获取会员卡信息
wx.p.api.equityApi.checkOpenMember({ isTrialCardFlag: 1 }).then(res => { wx.p.api.equityApi.checkOpenMember({
isTrialCardFlag: 1
}).then(res => {
if (res.code == -1 && res.errId == 2008) { if (res.code == -1 && res.errId == 2008) {
this.showTips(message || '服务不可用') this.showTips(message || '服务不可用')
return return
...@@ -148,14 +168,20 @@ Page({ ...@@ -148,14 +168,20 @@ Page({
}) })
}, },
jumpMine() { jumpMine() {
let { isOpenMember } = this.data let {
isOpenMember
} = this.data
wx.p.router.switchTab('/pages/tab/mine/index', { wx.p.router.switchTab('/pages/tab/mine/index', {
isMemberShow: true, isMemberShow: true,
isOpenMember isOpenMember
}) })
}, },
receiveRed(equityFreeCardId) { receiveRed(equityFreeCardId) {
let { isOpenMember, nickName, bindingSource } = this.data let {
isOpenMember,
nickName,
bindingSource
} = this.data
let params = { let params = {
equityFreeCardId, equityFreeCardId,
nickName: nickName nickName: nickName
...@@ -163,7 +189,11 @@ Page({ ...@@ -163,7 +189,11 @@ Page({
if (bindingSource) params.bindingSource = bindingSource if (bindingSource) params.bindingSource = bindingSource
wx.p.api.equityApi.checkReceiveRed(params).then(res => { wx.p.api.equityApi.checkReceiveRed(params).then(res => {
console.log(res, 'checkReceiveRed---') console.log(res, 'checkReceiveRed---')
let { code, message, data } = res let {
code,
message,
data
} = res
if (code != 0) { if (code != 0) {
this.showTips(message || '服务不可用') this.showTips(message || '服务不可用')
return return
...@@ -172,10 +202,19 @@ Page({ ...@@ -172,10 +202,19 @@ Page({
this.jumpMine() this.jumpMine()
} else { } else {
if (!data.isReceiveFlag) { if (!data.isReceiveFlag) {
/**用户是否已添加福利官 true:是;false:否; */
if (!data.isAddWelfareOfficerFlag) {
wx.p.router.switchTab('/pages/tab/mine/index', {
isMemberShow: true,
isOpenMember: true,
addWelfareOfficer: 'bg-member-welfare'
})
} else {
wx.p.router.go('/packageEquity/pages/receiveRed/receiveRed', { wx.p.router.go('/packageEquity/pages/receiveRed/receiveRed', {
isOpenMember: isOpenMember, isOpenMember: isOpenMember,
activityRedEnvelopeLink: data.activityRedEnvelopeLink activityRedEnvelopeLink: data.activityRedEnvelopeLink
}) })
}
} else { } else {
this.jumpMine() this.jumpMine()
} }
...@@ -187,7 +226,9 @@ Page({ ...@@ -187,7 +226,9 @@ Page({
// 先判断登录 // 先判断登录
const authStatus = await wx.p.router.intercept(false) const authStatus = await wx.p.router.intercept(false)
if (authStatus) return if (authStatus) return
wx.p.api.equityApi.checkOpenMember({ isTrialCardFlag: 1 }).then(res => { wx.p.api.equityApi.checkOpenMember({
isTrialCardFlag: 1
}).then(res => {
if (res.code == -1 && res.errId == 2008) { if (res.code == -1 && res.errId == 2008) {
this.showTips(res.message || '服务不可用') this.showTips(res.message || '服务不可用')
return return
...@@ -211,8 +252,14 @@ Page({ ...@@ -211,8 +252,14 @@ Page({
}, },
sceneGetId(id) { sceneGetId(id) {
wx.p.api.equityApi.sceneGetId({ id }).then(res => { wx.p.api.equityApi.sceneGetId({
let { code, data, message } = res id
}).then(res => {
let {
code,
data,
message
} = res
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
merchantId: data?.scene.split('=')[1] merchantId: data?.scene.split('=')[1]
...@@ -228,7 +275,9 @@ Page({ ...@@ -228,7 +275,9 @@ Page({
let system = wx.getSystemInfoSync(), let system = wx.getSystemInfoSync(),
bindingSource = '' bindingSource = ''
const authStatus = await wx.p.router.intercept(false) const authStatus = await wx.p.router.intercept(false)
const { merchantId } = wx.p.storage.get('merchant_info') const {
merchantId
} = wx.p.storage.get('merchant_info')
if (options.bindingSource) bindingSource = options.bindingSource if (options.bindingSource) bindingSource = options.bindingSource
this.setData({ this.setData({
merchantId, merchantId,
...@@ -248,6 +297,5 @@ Page({ ...@@ -248,6 +297,5 @@ Page({
authStatus authStatus
}) })
}, },
onUnload: function () { onUnload: function () {}
}
}) })
\ No newline at end of file \ No newline at end of file
import { IMG_URL } from '../../../config' import {
import { devMixin } from '~/mixins/index' IMG_URL
} from '../../../config'
import {
devMixin
} from '~/mixins/index'
Page({ Page({
behaviors: [devMixin], behaviors: [devMixin],
data: { data: {
...@@ -34,7 +38,10 @@ Page({ ...@@ -34,7 +38,10 @@ Page({
isMemberShow: false isMemberShow: false
}, },
handleChangeVal(e) { handleChangeVal(e) {
const { attr, val } = e.currentTarget.dataset const {
attr,
val
} = e.currentTarget.dataset
this.setData({ this.setData({
[attr]: val [attr]: val
}) })
...@@ -65,9 +72,13 @@ Page({ ...@@ -65,9 +72,13 @@ Page({
}, },
onLoad(options) { onLoad(options) {
if (options?.isMemberShow) { if (options?.isMemberShow) {
const {
addWelfareOfficer,
isOpenMember
} = options
this.setData({ this.setData({
isMemberShow: true, isMemberShow: true,
memberUrl: options.isOpenMember ? 'bg-member' : 'bg-member-first' memberUrl: addWelfareOfficer ? addWelfareOfficer : isOpenMember ? 'bg-member' : 'bg-member-first'
}) })
} }
this.shareTitle = "我的" this.shareTitle = "我的"
...@@ -216,6 +227,6 @@ Page({ ...@@ -216,6 +227,6 @@ Page({
freshMerchant() { freshMerchant() {
this.getMemberCardData() this.getMemberCardData()
}, },
onShareAppMessage() { } onShareAppMessage() {}
}) })
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!