Commit 2cc2b8f4 authored by Edwise's avatar Edwise 🍷

111

parent 0b78ea6b
...@@ -30,8 +30,8 @@ Component({ ...@@ -30,8 +30,8 @@ Component({
}, },
didMount(){ didMount(){
const {unLockStep,warms}= this.props.gameOverData; const {unLockStep,warms}= this.props.gameOverData;
let str = unLockStep==2?'恭喜您解锁5系赛段,获得30温暖值':'恭喜您解锁7系赛段,,获得50温暖值'; let str = unLockStep==2?'恭喜您解锁5系赛段':'恭喜您解锁7系赛段';
let str1 = unLockStep==2?'进入三人场':'进入四人场'; let str1 = unLockStep==2?'进入三人场,获得30温暖值':'进入四人场,获得50温暖值';
this.setData({ this.setData({
unLockStep:unLockStep, unLockStep:unLockStep,
title1:str, title1:str,
......
'use strict'; 'use strict';
import API from "/api"; import API from "/api";
import { SHARE_CONFIG } from '/tbcc-sdk/lib/constants'; import {
SHARE_CONFIG
} from '/tbcc-sdk/lib/constants';
const app = getApp(); const app = getApp();
const { tbcc } = app; const {
const { commonToast, navigateToOutside, getUserAddress, setClipboard } = tbcc.tb; tbcc
const { PRIZE_TYPE_MAP, PRIZE_DRAW_STATUS_MAP } = tbcc.constants; } = app;
const {
commonToast,
navigateToOutside,
getUserAddress,
setClipboard
} = tbcc.tb;
const {
PRIZE_TYPE_MAP,
PRIZE_DRAW_STATUS_MAP
} = tbcc.constants;
let flag = false; let flag = false;
...@@ -13,7 +25,7 @@ Page({ ...@@ -13,7 +25,7 @@ Page({
PRIZE_TYPE_MAP, PRIZE_TYPE_MAP,
PRIZE_DRAW_STATUS_MAP, PRIZE_DRAW_STATUS_MAP,
myPrizeList: null, //我的奖品 myPrizeList: null, //我的奖品
endTime: null,//到期时间 endTime: null, //到期时间
task: { task: {
image: { image: {
bg: '//yun.duiba.com.cn/spark/assets/myprizeBg.1f636c459b0a7e272f3cc65c80c7bc2a88bc2833.jpg', //背景图 bg: '//yun.duiba.com.cn/spark/assets/myprizeBg.1f636c459b0a7e272f3cc65c80c7bc2a88bc2833.jpg', //背景图
...@@ -56,9 +68,9 @@ Page({ ...@@ -56,9 +68,9 @@ Page({
const t1 = `${yy}${mm}${dd}日`; const t1 = `${yy}${mm}${dd}日`;
// console.log(new Date(endTime).toLocaleDateString()) // console.log(new Date(endTime).toLocaleDateString())
// const t1 = new Date(endTime).toLocaleDateString() + '';//获取年月日 // const t1 = new Date(endTime).toLocaleDateString() + '';//获取年月日
const t2 = new Date(endTime).getHours() + '';//获取时 const t2 = new Date(endTime).getHours() + ''; //获取时
const t3 = new Date(endTime).getMinutes() + '';//获取分 const t3 = new Date(endTime).getMinutes() + ''; //获取分
const t4 = new Date(endTime).getMilliseconds() + '';//获取秒 const t4 = new Date(endTime).getMilliseconds() + ''; //获取秒
console.log(endTime, new Date(endTime + 48 * 60 * 60 * 1000).toLocaleString(), 'endTime'); console.log(endTime, new Date(endTime + 48 * 60 * 60 * 1000).toLocaleString(), 'endTime');
this.setData({ this.setData({
endTime: t1 + "" + t2.padStart(2, '0') + ":" + t3.padStart(2, '0') + ":" + t4.padStart(2, '0') endTime: t1 + "" + t2.padStart(2, '0') + ":" + t3.padStart(2, '0') + ":" + t4.padStart(2, '0')
...@@ -70,11 +82,19 @@ Page({ ...@@ -70,11 +82,19 @@ Page({
* @param {string} type 是否展示loading * @param {string} type 是否展示loading
*/ */
async getMyPrize(type) { async getMyPrize(type) {
const { activityId } = app; const {
activityId
} = app;
if (type != 'noLoading') { if (type != 'noLoading') {
my.showLoading(); my.showLoading();
} }
const { success, data, message } = await API.getMyPrizeList({ activityId }).catch(res => { const {
success,
data,
message
} = await API.getMyPrizeList({
activityId
}).catch(res => {
this.setData({ this.setData({
myPrizeList: [] myPrizeList: []
}) })
...@@ -92,8 +112,10 @@ Page({ ...@@ -92,8 +112,10 @@ Page({
//领取奖品 //领取奖品
async handleClick(e) { async handleClick(e) {
console.log("领取奖品",e) console.log("领取奖品", e)
const { item } = e.target.dataset; const {
item
} = e.target.dataset;
// 领取权益 // 领取权益
if (item.type === PRIZE_TYPE_MAP.EQUITY) return this.handleGetEquity(e) if (item.type === PRIZE_TYPE_MAP.EQUITY) return this.handleGetEquity(e)
// 领取实物 // 领取实物
...@@ -107,10 +129,20 @@ Page({ ...@@ -107,10 +129,20 @@ Page({
return return
} }
flag = true; flag = true;
const { activityId } = app; const {
const { item } = e.target.dataset; activityId
} = app;
const {
item
} = e.target.dataset;
console.log(item, '领取权益') console.log(item, '领取权益')
const { success, data, message } = await API.receiveEnamePrize({ _id: item._id }).catch(res => { const {
success,
data,
message
} = await API.receiveEnamePrize({
id: item._id
}).catch(res => {
this.getMyPrize('noLoading') this.getMyPrize('noLoading')
commonToast(res && res.message) commonToast(res && res.message)
}) || {}; }) || {};
...@@ -129,31 +161,46 @@ Page({ ...@@ -129,31 +161,46 @@ Page({
} }
// my.showLoading(); // my.showLoading();
flag = true; flag = true;
setTimeout(()=>{ setTimeout(() => {
flag = false flag = false
},500) }, 500)
console.log('领取实物') console.log('领取实物')
const { activityId } = app; const {
const { item } = e.target.dataset; activityId
const userAddress = await getUserAddress({ joinTag: " " }).catch((data)=>{ } = app;
const {
item
} = e.target.dataset;
const userAddress = await getUserAddress({
joinTag: " "
}).catch((data) => {
flag = false flag = false
console.log('getUserAddress出错了,错误信息是',data); console.log('getUserAddress出错了,错误信息是', data);
}) })
// my.hideLoading(); // my.hideLoading();
if (!userAddress) return if (!userAddress) return
// commonToast(' getUserAddress =>'+JSON.stringify( userAddress)) // commonToast(' getUserAddress =>'+JSON.stringify( userAddress))
const { name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName } = userAddress || {}; const {
name,
telNumber,
provinceName,
cityName,
cityCode,
countyName,
detailInfo,
streetName
} = userAddress || {};
const params = { const params = {
activityId, activityId,
area:countyName, area: countyName,
addressDetail:detailInfo, addressDetail: detailInfo,
name, name,
phone: telNumber, phone: telNumber,
detailInfo, detailInfo,
cityCode, cityCode,
cityName, cityName,
city:cityName, city: cityName,
province:provinceName, province: provinceName,
provinceName, provinceName,
countyName, countyName,
streetName, streetName,
...@@ -167,7 +214,9 @@ Page({ ...@@ -167,7 +214,9 @@ Page({
cancelButtonText: '取消', cancelButtonText: '取消',
success: (result) => { success: (result) => {
console.log(result) console.log(result)
const { confirm } = result; const {
confirm
} = result;
if (confirm) { if (confirm) {
this.receiveObjectPrize(params); this.receiveObjectPrize(params);
...@@ -184,14 +233,18 @@ Page({ ...@@ -184,14 +233,18 @@ Page({
// commonToast(JSON.stringify(res)) // commonToast(JSON.stringify(res))
// }, 5000); // }, 5000);
const { success, data, message } = res; const {
success,
data,
message
} = res;
if (success && data) { if (success && data) {
commonToast('领取成功') commonToast('领取成功')
} else { } else {
commonToast(message) commonToast(message)
} }
this.getMyPrize() this.getMyPrize()
},(rej)=>{ }, (rej) => {
commonToast(rej.message) commonToast(rej.message)
}); });
}, },
...@@ -204,7 +257,10 @@ Page({ ...@@ -204,7 +257,10 @@ Page({
console.log(item, '领取积分') console.log(item, '领取积分')
// 判断是否为会员 // 判断是否为会员
await this.getUserInfo() await this.getUserInfo()
const { isVip, vipLink } = app; const {
isVip,
vipLink
} = app;
if (!isVip) { if (!isVip) {
commonToast('立即加入会员,即可领取奖品', 2000); commonToast('立即加入会员,即可领取奖品', 2000);
setTimeout(() => { setTimeout(() => {
...@@ -213,10 +269,20 @@ Page({ ...@@ -213,10 +269,20 @@ Page({
flag = false flag = false
return return
} }
const { activityId } = app; const {
const { item } = e.target.dataset; activityId
} = app;
const {
item
} = e.target.dataset;
console.log(item, '领取积分') console.log(item, '领取积分')
const { success, data, message } = await API.receiveEnamePrize({ activityId, _id: item._id }) || {}; const {
success,
data,
message
} = await API.receiveEnamePrize({
id: item._id
}) || {};
if (success && data) { if (success && data) {
commonToast('领取成功') commonToast('领取成功')
} else { } else {
...@@ -228,8 +294,16 @@ Page({ ...@@ -228,8 +294,16 @@ Page({
//获取用户vip信息 //获取用户vip信息
async getUserInfo() { async getUserInfo() {
const { activityId } = app; const {
const { success, data, message } = await API.getVipInfo({ activityId }) || {}; activityId
} = app;
const {
success,
data,
message
} = await API.getVipInfo({
activityId
}) || {};
console.log(data, '用户vip信息'); console.log(data, '用户vip信息');
if (success && data) { if (success && data) {
app.isVip = (data && data.isVip) || false; app.isVip = (data && data.isVip) || false;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment