diff --git a/api/lottery.js b/api/lottery.js index bb3815f..21e7b69 100644 --- a/api/lottery.js +++ b/api/lottery.js @@ -84,5 +84,45 @@ export function getLotteryShareInfo() { * @param orderId 订单号 */ export function getDrawTicketByOrder(orderId) { - return request.get('/draw/ticketByOrder', { orderId }) + return request.get('/draw/ticketCheck', { orderId }) +} + +/** + * 校验抽奖活动是否到开奖时间 + * @param activityId 抽奖活动ID + */ +export function checkDrawTime(activityId) { + return request.get('/draw/checkTime', { activityId }) +} + +/** + * 领取优惠券奖品 + * @param ticketId 抽奖券ID + */ +export function claimCoupon(ticketId) { + return request.post('/draw/claimCoupon', { ticketId }) +} + +/** + * 领取实物奖品 + * @param ticketId 抽奖券ID + * @param addressId 用户收货地址ID + */ +export function claimPrize(ticketId, addressId) { + return request.post('/draw/claimPrize', { ticketId, addressId }) +} + +/** + * 获取实名认证信息 + */ +export function getDrawRealname() { + return request.get('/draw/realname') +} + +/** + * 提交实名认证 + * @param data { realName, idCard, phone } + */ +export function submitDrawRealname(data = {}) { + return request.post('/draw/realname', data) } diff --git a/pages.json b/pages.json index 8cbd610..cd2bb44 100644 --- a/pages.json +++ b/pages.json @@ -430,6 +430,18 @@ "style": { "navigationStyle": "custom" } + }, + { + "path": "views/county-claim-address", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "views/county-realname", + "style": { + "navigationStyle": "custom" + } } ] }, diff --git a/pages/home/index.vue b/pages/home/index.vue index ba8b31e..bca3b65 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -441,6 +441,7 @@ import { openLocationSettting } from "@/utils/common" import { getWeixinShareConfig } from '@/api/public' +import { checkDrawTime } from '@/api/lottery' export default { name: 'IndexPage', components: { @@ -1658,12 +1659,35 @@ export default { this.isDrawPosterVisible = false this.showNextPoster() }, - goDrawLotteryPage() { + parseCheckTimeResult(res) { + if (typeof res === 'boolean') return res + if (typeof (res && res.data) === 'boolean') return res.data + if (res && typeof res.success !== 'undefined') return Boolean(res.data) + return false + }, + async goDrawLotteryPage() { const config = this.drawEntranceConfig || {} const linkType = Number(config.homePosterLinkType) || 1 - const activityId = Number(config.homePosterAreaId) || 0 + const activityId = Number(config.drawActivityId) || 0 + if (!activityId) { + uni.showToast({ + title: '活动配置异常', + icon: 'none' + }) + return + } + let opened = false + try { + const res = await checkDrawTime(activityId) + // opened = this.parseCheckTimeResult(res) + } catch (e) { + opened = false + } + const url = opened + ? `/pkg-video/views/county-winners?activityId=${activityId}` + : `/pkg-video/views/county-lottery?linkType=${linkType}&activityId=${activityId}` uni.navigateTo({ - url: `/pkg-video/views/county-lottery?linkType=${linkType}&activityId=${4}` + url }) }, tapDrawPoster() { diff --git a/pkg-video/views/county-claim-address.vue b/pkg-video/views/county-claim-address.vue new file mode 100644 index 0000000..f407464 --- /dev/null +++ b/pkg-video/views/county-claim-address.vue @@ -0,0 +1,746 @@ +