Commit dadb1e91 by 李伟康

修改问卷红包

1 parent 1e158eb2
......@@ -24,7 +24,8 @@ module.exports = {
*/
receiveQuestionnaireRedEnvelope(data = {}) {
return api.post({
method: 'marketing.api.activityRedEnvelope.questionnaire.binding',
// method: 'marketing.api.activityRedEnvelope.questionnaire.binding',
method: 'marketing.api.self.red.envelope.banding.link',
projectName,
...data
})
......
......@@ -37,7 +37,7 @@ module.exports = {
method: 'marketing.api.activityRedEnvelope.relay.lottery.user.commit',
projectName,
...data
})
}, true)
},
/**分页获取用户红包中奖记录 */
......@@ -65,5 +65,13 @@ module.exports = {
projectName,
...data
}, true)
}
},
getActivityRedEnvelopeDetail(data = {}) {
return api.post({
method: 'marketing.api.activityRedEnvelope.findOne',
projectName,
...data
})
},
//
}
\ No newline at end of file
......@@ -4,18 +4,22 @@
<view class="bg">
<glsx-image src="activity/{{popupConfig.type == 1?'default-bg':'expire-bg'}}.png"></glsx-image>
</view>
<block wx:if="{{popupConfig.type == 1}}">
<block wx:if="{{popupConfig.title}}">
<view class="title">{{popupConfig.title}}</view>
</block>
<block wx:else>
<view class="title"> 很遗憾您未中奖!敬请期待下次活动!</view>
</block>
<block wx:if="{{popupConfig.type == 1}}">
<block wx:if="{{popupConfig.showDefault}}">
<view class="text">很遗憾您未参加此次接龙!敬请期待下次活动!</view>
</block>
<block wx:else>
<view class="text">本次开奖数字为:{{popupConfig.numWin}}</view>
<view class="text">您选择的数字为:{{popupConfig.relayContent}}</view>
<block wx:if="{{popupConfig.numWin}}">
<view class="text">本次开奖数字为:{{popupConfig.numWin}}</view>
</block>
<block wx:if="{{popupConfig.relayContent}}">
<view class="text">您选择的数字为:{{popupConfig.relayContent}}</view>
</block>
</block>
<view class="btn" bindtap="close">好的</view>
</view>
......
......@@ -18,11 +18,7 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
popupTitle: '接龙时间已截止!'
})
},
onLoad(options) {},
/**
......@@ -100,41 +96,37 @@ Page({
openId,
unionId
})
this.getSolitaireDetail(params)
if (code == 0) {
this.getSolitaireDetail(params)
if (data) {
/**
* stateCode 状态码 -1.未参与 0.已参加 1.未中奖 2.已中奖
* relayContent 接龙内容
*/
if (data.stateCode == 1) this.setData({
const {
stateCode,
stateName,
relayContent
} = data
if (stateCode == 0) this.setData({
['popupConfig.type']: 1,
['popupConfig.title']: stateName,
['popupConfig.relayContent']: relayContent,
})
if (stateCode == 1) this.setData({
['popupConfig.type']: 2,
['popupConfig.relayContent']: data.relayContent,
show: true,
disabled: true,
['popupConfig.relayContent']: relayContent,
})
if (stateCode == 0 || stateCode == 1) this.setData({
show: true
})
if (stateCode == 1 || stateCode == 2) this.setData({
disabled: true
})
// const {
// relayContent,
// stateCode,
// stateName
// } = data
// this.setData({
// finishObject: data
// })
}
} else throw message
} catch (error) {
console.log(error)
wx.showModal({
title: '温馨提示',
content: error,
showCancel: false,
confirmText: '返回首页',
confirmColor: '#3772EC',
complete: (res) => {
if (res.confirm) wx.p.router.goHome()
}
})
this.showGroupNoAccess(error)
}
},
async getSolitaireDetail(params) {
......@@ -145,18 +137,15 @@ Page({
const {
chatId
} = this.options
if (!chatId) this.showGroupNoAccess()
else {
// res.groupLimitList.map(e => {
// // if () this.showGroupNoAccess()
// })
}
if (!chatId) this.showGroupNoAccess('此群无法参加接龙游戏')
}
this.setData({
activityDetail: decodeURIComponent(res.description),
title: res.title,
array: generateOptionsArray(res.numLimit),
loading: true,
})
if (new Date(wx.p.format.iosTimeFormat(res.lotteryTime)).getTime() <= Date.now()) this.setData({
['popupConfig.numWin']: res.numWin
})
wx.p.wxApi.hideLoading()
......@@ -171,10 +160,11 @@ Page({
if (error) wx.p.wxApi.showToast(error)
}
},
showGroupNoAccess() {
showGroupNoAccess(title) {
this.setData({
['popupConfig.type']: 1,
['popupConfig.title']: '此群无法进行接龙游戏!',
['popupConfig.title']: title,
['popupConfig.showDefault']: true,
show: true,
disabled: true
})
......@@ -208,19 +198,28 @@ Page({
if (!params.name) throw '请输入名称!'
if (!params.num) throw '请选择数字!'
wx.p.wxApi.showLoading()
const res = await wx.p.api.solitaireApi.commitSolitaire({
const {
code,
data,
message
} = await wx.p.api.solitaireApi.commitSolitaire({
relayLotteryId,
name: params.name,
phone: userInfo.phone,
openId: userInfo.openId,
unionId: userInfo.unionId,
relayContent: params.num,
chatId
})
wx.p.wxApi.showToast('提交成功!')
// this.getSolitaireDetail()
console.log(res)
wx.hideLoading()
if (code == 0) {
if (data) {
wx.p.wxApi.showToast('提交成功!')
this.getSolitaireDetail({
relayLotteryId
})
} else throw message
} else this.setData({
show: true
})
} catch (error) {
wx.hideLoading()
if (error) wx.p.wxApi.showToast(error)
}
},
......
......@@ -27,20 +27,41 @@ Component({
}
if (data.activityType == 3) {
const {
userInfo
} = wx.p.router.getPageInstance().data
const res = await wx.p.api.questionnaireApi.receiveQuestionnaireRedEnvelope({
questionnaireId: data.id,
activityRedEnvelopeId: data.activityId,
nickName: userInfo.nickName
sourceType
} = await wx.p.api.solitaireApi.getActivityRedEnvelopeDetail({
id: data.activityId
})
if (res.isActivityRedEnvelopeFlag && !res.isReceiveFlag) this.setData({
jumpOption: {
url: res.activityRedEnvelopeLink,
type: data.activityType
}
})
this.countDown()
/**sourceType 0-自研,1-外采 */
if (sourceType == 1) {
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
}
})
this.countDown()
} else {
this.setData({
jumpOption: {
url: '/packageActivity/pages/redEnvelope/index/index',
type: 1,
options: {
activityId: data.activityId,
merchantId: data.merchantId
}
}
})
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!