Commit 17ba49ff authored by 汪欢's avatar 汪欢

fixsth

parent 85072f3e
...@@ -6,8 +6,8 @@ cloud.init({ ...@@ -6,8 +6,8 @@ cloud.init({
}); });
App({ App({
// requestType: 'cloud', // yapi,cloud: 云函数 requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'yapi', // yapi,cloud: 云函数 // requestType: 'yapi', // yapi,cloud: 云函数
cloudName: 'floor', // 主云函数项目名 base clientTemplate2C cloudName: 'floor', // 主云函数项目名 base clientTemplate2C
cloud, cloud,
tbcc, tbcc,
......
...@@ -192,6 +192,18 @@ ...@@ -192,6 +192,18 @@
opacity: 1; opacity: 1;
position: absolute; position: absolute;
} }
.hui_yuan .hui_yuan_deng_ji .zhu_ce_hui_yuan .grade_name {
width: 300rpx;
opacity: 1;
top: 20rpx;
left: 200rpx;
color: white;
font-size: 50rpx;
text-align: center;
position: absolute;
}
.hui_yuan .hui_yuan_deng_ji .hei_qia_hui_yuan .zu926 { .hui_yuan .hui_yuan_deng_ji .hei_qia_hui_yuan .zu926 {
width: 309rpx; width: 309rpx;
height: 44rpx; height: 44rpx;
......
...@@ -2,8 +2,14 @@ ...@@ -2,8 +2,14 @@
<image class="cha_cha4582" onTap="onOrderNowModalClose" src={{resList['b8bc26de-51ac-457f-bd3f-348e7df0af34'].url}} /> <image class="cha_cha4582" onTap="onOrderNowModalClose" src={{resList['b8bc26de-51ac-457f-bd3f-348e7df0af34'].url}} />
<view class="hui_yuan_deng_ji"> <view class="hui_yuan_deng_ji">
<view class="zhu_ce_hui_yuan"> <view class="zhu_ce_hui_yuan">
<image class="bei_jing1" src={{resList['26ff41d0-0891-4573-a557-1a0bb7881405'].url}} /> <!-- <image class="bei_jing1" src={{resList['26ff41d0-0891-4573-a557-1a0bb7881405'].url}} /> -->
<image class="zu012" src={{resList['948928c1-e583-449d-baca-77db2e213fe1'].url}} /> <image class="bei_jing5" a:if="{{vipCredits.grade == 5}}" src={{resList['c46f1953-53df-4fdd-aaab-b5e8252b84ce'].url}} />
<image class="bei_jing4" a:else src={{resList['fcb78ed4-6a1a-4a00-9a63-14359b9c44ae'].url}} />
<!-- <image class="zu012" src={{resList['948928c1-e583-449d-baca-77db2e213fe1'].url}} /> -->
<!-- 会员标签 -->
<label class="grade_name">您是{{vipCredits.gradeName}}</label>
<label class="gou_maixxx_ge_lou_ceng_yi_gong_xu_yao_hua_feixxxx_ji_fen22"> <label class="gou_maixxx_ge_lou_ceng_yi_gong_xu_yao_hua_feixxxx_ji_fen22">
购买 {{vipCredits.canBuyFloor}} 个楼层 一共需要花费 {{vipCredits.gradeCredits}} 积分 购买 {{vipCredits.canBuyFloor}} 个楼层 一共需要花费 {{vipCredits.gradeCredits}} 积分
</label> </label>
......
...@@ -50,15 +50,15 @@ Component({ ...@@ -50,15 +50,15 @@ Component({
// } // }
// }) // })
commonToast("恭喜你购买成功");
this.props.onUserCredit(); this.props.onUserCredit();
// this.props.onUserCredit(); // this.props.onUserCredit();
}else{ }else{
// 错误码判断不同情况 // 错误码判断不同情况
if(res.code === '500000'){
commonToast(res.message); commonToast(res.message);
} // if(res.code === '500000'){
// }
// console.log('fail') // console.log('fail')
} }
}) })
......
...@@ -2,9 +2,13 @@ ...@@ -2,9 +2,13 @@
import resList from '../../resconfig/resList'; import resList from '../../resconfig/resList';
import API from '../../api'; import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
Page({ Page({
data: { data: {
resList: resList,
// 购买楼层数 // 购买楼层数
canBuyFloor: 10, canBuyFloor: 10,
// 购买记录弹窗显示隐藏 // 购买记录弹窗显示隐藏
...@@ -28,6 +32,9 @@ Page({ ...@@ -28,6 +32,9 @@ Page({
start: '', start: '',
end: '', end: '',
// 活动结束时间props
endTime:'',
// 会员消耗积分 // 会员消耗积分
vipCredits: '', vipCredits: '',
// 用户当前积分 // 用户当前积分
...@@ -46,20 +53,26 @@ Page({ ...@@ -46,20 +53,26 @@ Page({
onLoad(props) { onLoad(props) {
// this.setData({
// resList: resList
// });
console.log(props.data,'dataprops');
const { endTime } = JSON.parse(props.data);
this.setData({ this.setData({
resList: resList endTime
}); })
this.getBaseInfo(); this.getBaseInfo();
this.getRuleSource(); this.getRuleSource();
// this.countDowning();
this.getUserCredits(); this.getUserCredits();
// this.getEndTime(); // this.getEndTime();
this.getOrderList(); this.getOrderList();
}, },
onReady(){ // onReady() {
this.countDowning(); // let {endTime} = this.data
}, // this.countDowning(endTime);
// },
onPrizeBtnClick() { onPrizeBtnClick() {
my.navigateTo({ my.navigateTo({
...@@ -76,54 +89,15 @@ Page({ ...@@ -76,54 +89,15 @@ Page({
ruleModalVisible: false ruleModalVisible: false
}) })
}, },
countDowning() {
let { start, end } = this.data
// const endtime = '2020-10-17T00:00:00'
var nowTime = new Date().getTime();//现在时间(时间戳)
var endTimess = new Date(end).getTime();//结束时间(时间戳)
var time = (endTimess - nowTime) / 1000;//距离结束的毫秒数
// 获取天、时、分、秒
let day = parseInt(time / (60 * 60 * 24));
let hou = parseInt(time % (60 * 60 * 24) / 3600);
let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
// day = (day < 0 ? 0 : day);
// hou = (hou < 0 ? 0 : hou);
// min = (min < 0 ? 0 : min);
// sec = (sec < 0 ? 0 : sec);
day = this.timeFormin(day)
hou = this.timeFormin(hou)
min = this.timeFormin(min)
sec = this.timeFormin(sec)
this.setData({
endingTime: {
d: this.timeFormat(day),
h: this.timeFormat(hou),
m: this.timeFormat(min),
s: this.timeFormat(sec)
}
})
// 每1000ms刷新一次
if (time > 0) {
this.setData({
countDown: true
})
setTimeout(this.countDowning.bind(this), 1000);
} else {
this.setData({
countDown: false
})
}
},
// 购买成功后更新积分
onUserCredit() { onUserCredit() {
// 购买成功后更新积分
// 更新购买记录
// 总楼层数更新
this.getOrderList();
this.getUserCredits(); this.getUserCredits();
this.getBaseInfo();
console.log(this.data.userCredits, '更新后的用户积分'); console.log(this.data.userCredits, '更新后的用户积分');
}, },
...@@ -165,7 +139,7 @@ Page({ ...@@ -165,7 +139,7 @@ Page({
async buyFloors() { async buyFloors() {
// 购买楼层数 // 购买楼层数
let { canBuyFloor } = this.data; let { canBuyFloor, end } = this.data;
let { data: { isVip, grade, gradeName, gradeCredits } } = await API.getVipInfo() || {}; let { data: { isVip, grade, gradeName, gradeCredits } } = await API.getVipInfo() || {};
// 判断会员等级 // 判断会员等级
...@@ -173,7 +147,8 @@ Page({ ...@@ -173,7 +147,8 @@ Page({
vipCredits: { vipCredits: {
gradeCredits, gradeCredits,
canBuyFloor, canBuyFloor,
grade grade,
gradeName
} }
}) })
// if(success){ // if(success){
...@@ -198,10 +173,17 @@ Page({ ...@@ -198,10 +173,17 @@ Page({
// }) // })
// }) // })
// 判断活动时间
let currentTime = new Date().getTime();
// 当前时间 < 结束时间 显示弹窗
if (currentTime < end) {
// 显示 // 显示
this.setData({ this.setData({
orderNowModalVisible: true orderNowModalVisible: true
}) })
} else {
commonToast('活动已结束,无法购买')
}
}, },
...@@ -248,7 +230,7 @@ Page({ ...@@ -248,7 +230,7 @@ Page({
// }) // })
// let listStyleArr = [] // let listStyleArr = []
let { data,success,code } = await API.getActivityBaseInfoById() || {}; let { data, success, code, message } = await API.getActivityBaseInfoById() || {};
if (success) { if (success) {
console.log(data, 'data') console.log(data, 'data')
let list = data.list; let list = data.list;
...@@ -280,15 +262,81 @@ Page({ ...@@ -280,15 +262,81 @@ Page({
totalFloor, totalFloor,
eachBuyMostFloor eachBuyMostFloor
}) })
console.log('zhixingcount');
} else { } else {
// 错误码 // 错误码
console.log('error') // console.log('error');
commonToast(message);
} }
}, },
async countDowning(end) {
// let { start, end } = this.data;
// let { data, success, code, message } = await API.getActivityBaseInfoById() || {};
console.log('执行时间count')
// let end = data.endTime;
var nowTime = new Date().getTime();//现在时间(时间戳)
var endTimess = new Date(end).getTime();//结束时间(时间戳)
var time = (endTimess - nowTime) / 1000;//距离结束的毫秒数
// 获取天、时、分、秒
let day = parseInt(time / (60 * 60 * 24));
let hou = parseInt(time % (60 * 60 * 24) / 3600);
let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
// day = (day < 0 ? 0 : day);
// hou = (hou < 0 ? 0 : hou);
// min = (min < 0 ? 0 : min);
// sec = (sec < 0 ? 0 : sec);
day = this.timeFormin(day)
hou = this.timeFormin(hou)
min = this.timeFormin(min)
sec = this.timeFormin(sec)
this.setData({
endingTime: {
d: this.timeFormat(day),
h: this.timeFormat(hou),
m: this.timeFormat(min),
s: this.timeFormat(sec)
}
})
// 每1000ms刷新一次
if (time > 0) {
this.setData({
countDown: true
})
setTimeout(this.countDowning.bind(this), 1000);
} else {
this.setData({
countDown: false
})
}
// if(end.length == 0){
// this.setData({
// endingTime: {
// d: '00',
// h: '00',
// m: '00',
// s: '00'
// }
// })
// } else {
// const endtime = '2020-10-17T00:00:00'
// }
},
// 获取购买记录信息 // 获取购买记录信息
async getOrderList() { async getOrderList() {
let { data } = await API.getBuyFloorList() || {}; let { data } = await API.getBuyFloorList() || {};
...@@ -307,23 +355,23 @@ Page({ ...@@ -307,23 +355,23 @@ Page({
} }
let lens = data.length; let lens = data.length;
for (let i = 0; i < lens; i++) { for (let i = lens -1; i >= 0; i--) {
let orderStyle = { let orderStyle = {
orderDay: { orderDay: {
left: 0, left: 0,
top: 40 * i + 'rpx', top: 40 * (lens-i) + 'rpx',
position: 'absolute', position: 'absolute',
color: 'white' color: 'white'
}, },
orderFloor: { orderFloor: {
left: 200 + 'rpx', left: 200 + 'rpx',
top: 40 * i + 'rpx', top: 40 * (lens-i) + 'rpx',
position: 'absolute', position: 'absolute',
color: 'white' color: 'white'
}, },
orderCredits: { orderCredits: {
left: 400 + 'rpx', left: 400 + 'rpx',
top: 40 * i + 'rpx', top: 40 * (lens-i) + 'rpx',
position: 'absolute', position: 'absolute',
color: 'white' color: 'white'
} }
...@@ -346,7 +394,7 @@ Page({ ...@@ -346,7 +394,7 @@ Page({
// 用户当前积分 // 用户当前积分
async getUserCredits() { async getUserCredits() {
console.log('zhxing') // console.log('zhxing')
// await API.getCredits().catch((res) => { // await API.getCredits().catch((res) => {
// console.log('resdata', res) // console.log('resdata', res)
// // if(res.success) // // if(res.success)
...@@ -360,6 +408,7 @@ Page({ ...@@ -360,6 +408,7 @@ Page({
this.setData({ this.setData({
userCredits: data userCredits: data
}) })
console.log(data,'更新')
}, },
// 关闭立即购买 // 关闭立即购买
......
...@@ -15,7 +15,8 @@ Page({ ...@@ -15,7 +15,8 @@ Page({
ruleModalBtnVisible: false, ruleModalBtnVisible: false,
ruleData:'', ruleData:'',
joinCount:'' joinCount:'',
endTime:''
}, },
onLoad(query) { onLoad(query) {
...@@ -29,13 +30,14 @@ Page({ ...@@ -29,13 +30,14 @@ Page({
}, },
gotoVipPage() { gotoVipPage() {
let {endTime} = this.data
API.getVipInfo().then(res => { API.getVipInfo().then(res => {
// res.data.isVip=true; // res.data.isVip=true;
if (!res.data.isVip) if (!res.data.isVip)
navigateToOutside(res.data.url) navigateToOutside(res.data.url)
else else
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' }); // my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' });
// my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye?data=' + JSON.stringify() }); my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye?data=' + JSON.stringify({endTime}) });
}) })
}, },
...@@ -67,6 +69,10 @@ Page({ ...@@ -67,6 +69,10 @@ Page({
API.getVipInfo(), API.getVipInfo(),
]); ]);
this.setData({
endTime
})
console.log('fuck'); console.log('fuck');
// vipInfo..data.isVip = true; // vipInfo..data.isVip = true;
...@@ -75,7 +81,8 @@ Page({ ...@@ -75,7 +81,8 @@ Page({
(openPrizeStatus == OPEN_PRIZE_STATUS.SUCCESS || openPrizeStatus == OPEN_PRIZE_STATUS.NOT_OPEN)) {//活动结束,开奖成功or不开奖 (openPrizeStatus == OPEN_PRIZE_STATUS.SUCCESS || openPrizeStatus == OPEN_PRIZE_STATUS.NOT_OPEN)) {//活动结束,开奖成功or不开奖
my.redirectTo({ url: '/pages/pagejie_shu_ye/pagejie_shu_ye?data=' + JSON.stringify({ prize, openPrizeStatus, isShowPrize }) }); my.redirectTo({ url: '/pages/pagejie_shu_ye/pagejie_shu_ye?data=' + JSON.stringify({ prize, openPrizeStatus, isShowPrize }) });
} else { } else {
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' }); // my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' });
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye?data=' + JSON.stringify({endTime}) });
} }
} else { } else {
//设置状态 //设置状态
......
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