Commit 19bc7c7d by 李伟康

提交接龙

1 parent dadb1e91
......@@ -24,7 +24,14 @@ module.exports = {
*/
receiveQuestionnaireRedEnvelope(data = {}) {
return api.post({
// method: 'marketing.api.activityRedEnvelope.questionnaire.binding',
method: 'marketing.api.activityRedEnvelope.questionnaire.binding',
projectName,
...data
})
},
/**绑定红包 */
bindRedEnvelopeLink(data = {}) {
return api.post({
method: 'marketing.api.self.red.envelope.banding.link',
projectName,
...data
......
......@@ -45,7 +45,8 @@ Page({
userInfo
} = this.data, {
activityId,
merchantId
merchantId,
linkId
} = this.options, {
sessionId
} = wx.p.storage.get()
......@@ -63,10 +64,12 @@ Page({
unionId,
openid,
phone
}))
})),
query = `activityId=${activityId}&merchantId=${merchantId}&sessionId=${sessionId}&userInfo=${user}`
if(linkId) query += `&linkId=${linkId}`
this.setData({
// url: `${domain}/scrm-wx-red-packet/#/redEnvelope?activityId=${activityId}&merchantId=${merchantId}&sessionId=${sessionId}&userInfo=${user}` //测试、预发布、生产
url: `${domain}/dj-scrm-wx-work-main-lwk/#/?activityId=${activityId}&merchantId=${merchantId}&sessionId=${sessionId}&userInfo=${user}` //开发环境
url: `${domain}/dj-scrm-wx-work-main-lwk/#/?${query}` //开发环境
})
}
},
......
......@@ -38,40 +38,47 @@ Page({
if (options.isLogin) this.getGroupEnterInfo(options)
else this.jumpLoading() //直接打开时跳转、防止sessionId失效
},
getGroupEnterInfo(options) {
try {
const _this = this
wx.getGroupEnterInfo({
async success({
iv,
encryptedData
}) {
const {
data,
code,
message
} = await wx.p.api.userApi.getOpengid({
async getGroupEnterInfo(options) {
const res = await wx.p.router.intercept()
if (!res) {
const {
userInfo
} = this.data
if (!userInfo.nickName) return this.getNickNameAndHeadUrl()
try {
const _this = this
wx.getGroupEnterInfo({
async success({
iv,
encryptedData
})
if (code == 0 && data) {
console.log('openGid:', data)
const res = await wx.p.api.userApi.openGIdtoChatId({
merchantId: options.merchantId,
openGid: 'GtsOh6zJoHmautQCAxaxaUzIxYNo' || data
}) {
const {
data,
code,
message
} = await wx.p.api.userApi.getOpengid({
iv,
encryptedData
})
console.log('chatId:', res.data)
options.chatId = res.data || ''
this.options = options
if (code == 0 && data) {
console.log('openGid:', data)
const res = await wx.p.api.userApi.openGIdtoChatId({
merchantId: options.merchantId,
openGid: 'GtsOh6zJoHmautQCAxaxaUzIxYNo' || data
})
console.log('chatId:', res.data)
options.chatId = res.data || ''
this.options = options
_this.getSolitaireUserInfo(options)
} else throw message
},
fail(err) {
_this.getSolitaireUserInfo(options)
} else throw message
},
fail(err) {
_this.getSolitaireUserInfo(options)
}
})
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
}
})
} catch (error) {
if (error) wx.p.wxApi.showToast(error)
}
}
},
/**获取用户接龙信息 */
......
......@@ -203,6 +203,13 @@ Page({
} else {
if (!data.isReceiveFlag) {
/**用户是否已添加福利官 true:是;false:否; */
// const {
// sourceType
// } = await wx.p.api.solitaireApi.getActivityRedEnvelopeDetail({
// id: equityFreeCardId
// })
// console.log(sourceType)
// /**sourceType 0-自研,1-外采 */
if (!data.isAddWelfareOfficerFlag) {
wx.p.router.switchTab('/pages/tab/mine/index', {
isMemberShow: true,
......
......@@ -27,41 +27,47 @@ Component({
}
if (data.activityType == 3) {
const {
sourceType
} = await wx.p.api.solitaireApi.getActivityRedEnvelopeDetail({
id: data.activityId
})
/**sourceType 0-自研,1-外采 */
if (sourceType == 1) {
userInfo
} = wx.p.router.getPageInstance().data
// const response = await wx.p.api.questionnaireApi.receiveQuestionnaireRedEnvelope({
// questionnaireId: data.id,
// activityRedEnvelopeId: data.activityId,
// nickName: userInfo.nickName
// })
// if (response.isActivityRedEnvelopeFlag && !response.isReceiveFlag) {
const {
userInfo
} = wx.p.router.getPageInstance().data,
res = await wx.p.api.questionnaireApi.receiveQuestionnaireRedEnvelope({
activityId: data.activityId,
bindingSource: 1,
wechatName: userInfo.nickName,
businessId: data.id
})
this.setData({
jumpOption: {
url: res.link,
type: data.activityType
}
sourceType
} = await wx.p.api.solitaireApi.getActivityRedEnvelopeDetail({
id: data.activityId
}),
/**sourceType 0-自研,1-外采 */
res = await wx.p.api.questionnaireApi.bindRedEnvelopeLink({
activityId: data.activityId,
bindingSource: 1,
wechatName: userInfo.nickName,
businessId: data.id
})
this.countDown()
} else {
this.setData({
if (sourceType == 1) {
this.setData({
jumpOption: {
url: res.link,
type: data.activityType
}
})
} else this.setData({
jumpOption: {
url: '/packageActivity/pages/redEnvelope/index/index',
type: 1,
options: {
activityId: data.activityId,
merchantId: data.merchantId
merchantId: data.merchantId,
linkId: res.id
}
}
})
this.countDown()
}
// } else this.countDown()
} else {
if (data.activityType == 2) {
options.couponId = data.activityId
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!