Commit 5487f171 authored by wildfirecode13's avatar wildfirecode13

Merge branch 'master' of gitlab2.dui88.com:wanghongyuan/hello_taobao

parents 75b7a487 17ba49ff
...@@ -50,11 +50,36 @@ ...@@ -50,11 +50,36 @@
left: 60rpx; left: 60rpx;
position: absolute; position: absolute;
} }
.gou_mai_ji_lu32 .gou_mai_ji_lu_kao_bei33 .zu135 .zu13434 {
.gou_mai_ji_lu32 .gou_mai_ji_lu_kao_bei33 .zu135 .list {
width: 453rpx;
height: 383rpx;
opacity: 1;
top: 150rpx;
position: absolute;
overflow-y: auto;
}
.gou_mai_ji_lu32 .gou_mai_ji_lu_kao_bei33 .zu135 .no_order{
width: 453rpx;
height: 383rpx;
opacity: 1;
top: 180rpx;
left: 10rpx;
position: absolute;
text-align: center;
color: white;
font-size: 24rpx;
}
/*
*/
.gou_mai_ji_lu32 .gou_mai_ji_lu_kao_bei33 .zu135 .list .zu13434 {
width: 453rpx; width: 453rpx;
height: 183rpx; height: 183rpx;
opacity: 1; opacity: 1;
top: 163rpx; top: 10rpx;
position: absolute; position: absolute;
} }
.gou_mai_ji_lu32 .gou_mai_ji_lu_kao_bei33 .zu135 .zu13434 .tu_ceng09_yue15_ri43 { .gou_mai_ji_lu32 .gou_mai_ji_lu_kao_bei33 .zu135 .zu13434 .tu_ceng09_yue15_ri43 {
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
<image class="zu7" src={{resList['ae013a3c-875a-461d-9273-1f58dd01eca2'].url}} /> <image class="zu7" src={{resList['ae013a3c-875a-461d-9273-1f58dd01eca2'].url}} />
<image class="yuan_jiao_ju_xing71744" src={{resList['1a960b92-d4b6-40fe-8e31-9658a5d904ec'].url}} /> <image class="yuan_jiao_ju_xing71744" src={{resList['1a960b92-d4b6-40fe-8e31-9658a5d904ec'].url}} />
<view class="zu135"> <view class="zu135">
<view class="zu13434" a:if="{{orderList.length !== 0}}" a:for="{{orderList}}" a:key="index" a:for-item="item"> <view class="list" a:if="{{orderList != null}}">
<view class="zu13434" a:for="{{orderList}}" a:key="index" a:for-item="item">
<label style="{{item.order.orderDay}}">{{item.monthDate}}</label> <label style="{{item.order.orderDay}}">{{item.monthDate}}</label>
<label style="{{item.order.orderFloor}}">{{item.floorRange}}</label> <label style="{{item.order.orderFloor}}">{{item.floorRange}}</label>
<label style="{{item.order.orderCredits}}">{{item.credits}}</label> <label style="{{item.order.orderCredits}}">{{item.credits}}</label>
</view> </view>
<!-- <view a:else>暂无购买记录</view> --> </view>
<view class="no_order" a:elif="{{orderList == null}}">暂无购买记录</view>
<!-- <text >{{JSON.stringify(orderList)}}</text> --> <!-- <text >{{JSON.stringify(orderList)}}</text> -->
......
...@@ -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>
......
...@@ -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;
Component({ Component({
props: { props: {
onUserCredit:()=>{}
}, },
data: { data: {
resList: resList resList: resList
...@@ -34,17 +38,31 @@ Component({ ...@@ -34,17 +38,31 @@ Component({
// }) // })
// let {message,data,code,success} = API.submit({floor: vipCredits.canBuyFloor, grade:vipCredits.grade}) || {}; // let {message,data,code,success} = API.submit({floor: vipCredits.canBuyFloor, grade:vipCredits.grade}) || {};
API.submit({floor: vipCredits.canBuyFloor, grade:vipCredits.grade}).then((res)=>{ await API.submit({floor: vipCredits.canBuyFloor, grade:vipCredits.grade}).then((res)=>{
console.log(res,'res'); console.log(res,'res');
}) if(res.success){
console.log('success')
// 更新积分
// API.getCredits().then((res)=>{
// if(res.success){
// let userCredits = res.data;
// this.props.onUserCredit();
// console.log('succ',success)
// if(success){
// console.log('success');
// }else{
// console.log('failed')
// } // }
// success // })
commonToast("恭喜你购买成功");
this.props.onUserCredit();
// this.props.onUserCredit();
}else{
// 错误码判断不同情况
commonToast(res.message);
// if(res.code === '500000'){
// }
// console.log('fail')
}
})
this.onOrderNowModalClose(); this.onOrderNowModalClose();
......
...@@ -62,40 +62,40 @@ ...@@ -62,40 +62,40 @@
width: 35rpx; width: 35rpx;
height: 25rpx; height: 25rpx;
opacity: 1; opacity: 1;
left: 13rpx; left: 15rpx;
top: 47rpx; top: 40rpx;
position: absolute; position: absolute;
font-size: 14.41518rpx; font-size: 25rpx;
color: #ffffff; color: #ffffff;
} }
.huo_dong_ye .dao_ji_shi87 .tu_ceng22_kao_bei90 { .huo_dong_ye .dao_ji_shi87 .tu_ceng22_kao_bei90 {
width: 35rpx; width: 35rpx;
height: 25rpx; height: 25rpx;
opacity: 1; opacity: 1;
left: 131rpx; left: 135rpx;
top: 47rpx; top: 40rpx;
position: absolute; position: absolute;
font-size: 14.41518rpx; font-size: 25rpx;
color: #ffffff; color: #ffffff;
} }
.huo_dong_ye .dao_ji_shi87 .tu_ceng2289 { .huo_dong_ye .dao_ji_shi87 .tu_ceng2289 {
width: 35rpx; width: 35rpx;
height: 25rpx; height: 25rpx;
opacity: 1; opacity: 1;
left: 246rpx; left: 248rpx;
top: 47rpx; top: 40rpx;
position: absolute; position: absolute;
font-size: 14.41518rpx; font-size: 25rpx;
color: #ffffff; color: #ffffff;
} }
.huo_dong_ye .dao_ji_shi87 .tu_ceng22_kao_bei388 { .huo_dong_ye .dao_ji_shi87 .tu_ceng22_kao_bei388 {
width: 35rpx; width: 35rpx;
height: 25rpx; height: 25rpx;
opacity: 1; opacity: 1;
left: 357rpx; left: 360rpx;
top: 47rpx; top: 40rpx;
position: absolute; position: absolute;
font-size: 14.41518rpx; font-size: 25rpx;
color: #ffffff; color: #ffffff;
} }
.huo_dong_ye .jiang_pin78 { .huo_dong_ye .jiang_pin78 {
...@@ -283,12 +283,12 @@ ...@@ -283,12 +283,12 @@
} }
.huo_dong_ye .xxxxxx { .huo_dong_ye .xxxxxx {
width: 120rpx; width: 120rpx;
height: 24rpx; height: 36rpx;
opacity: 1; opacity: 1;
left: 315rpx; left: 345rpx;
top: 475rpx; top: 455rpx;
position: absolute; position: absolute;
font-size: 31.96651rpx; font-size: 28rpx;
color: #e7210a; color: #e7210a;
} }
.huo_dong_ye .ji_fen { .huo_dong_ye .ji_fen {
...@@ -317,9 +317,9 @@ ...@@ -317,9 +317,9 @@
width: 172rpx; width: 172rpx;
height: 25rpx; height: 25rpx;
opacity: 1; opacity: 1;
left: 26rpx; left: 30rpx;
top: 13rpx; top: 5rpx;
position: absolute; position: absolute;
font-size: 16.17499rpx; font-size: 24rpx;
color: #5392cc; color: #5392cc;
} }
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
<label class="xxx_yuan_jiang_pin79">XXX元奖品</label> --> <label class="xxx_yuan_jiang_pin79">XXX元奖品</label> -->
<!-- bianli --> <!-- bianli -->
<!-- <image style="width:100;height:100" src={{item.image}}></image> --> <image style="width:100rpx;height:100rpx;display:block;marginLeft:25rpx" src={{item.image}}></image>
<view style="width:100rpx;height:100rpx;background:white;marginLeft:25rpx"></view> <!-- <view style="width:100rpx;height:100rpx;background:white;marginLeft:25rpx"></view> -->
<label>{{item.probability}}</label> <view style="fontSize:22rpx">{{item.probability}}</view>
<label>{{item.name}}</label> <label style="fontSize:22rpx">{{item.name}}</label>
</view> </view>
</view> </view>
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
<view class="ji_fen"> <view class="ji_fen">
<image class="di111" src={{resList['8cb47bc2-bc31-4713-86ba-c8738367cb82'].url}} /> <image class="di111" src={{resList['8cb47bc2-bc31-4713-86ba-c8738367cb82'].url}} />
<image class="zu3" onTap="orderRecord" src={{resList['0c7c2470-690e-43df-aa7e-ed9aa99fb859'].url}} /> <image class="zu3" onTap="orderRecord" src={{resList['0c7c2470-690e-43df-aa7e-ed9aa99fb859'].url}} />
<label class="dang_qian_ji_fenxxxx">当前积分{{userCredits}}</label> <label class="dang_qian_ji_fenxxxx">当前积分:{{userCredits}}</label>
</view> </view>
</view> </view>
<order-record a:if="{{orderModalVisible}}" orderList="{{orderList}}" onOrderModalClose="orderModalClose"></order-record> <order-record a:if="{{orderModalVisible}}" orderList="{{orderList}}" onOrderModalClose="orderModalClose"></order-record>
<order-now a:if="{{orderNowModalVisible}}" vipCredits="{{vipCredits}}" onOrderNowModalClose="orderNowModalClose"></order-now> <order-now a:if="{{orderNowModalVisible}}" onUserCredit="onUserCredit" vipCredits="{{vipCredits}}" onOrderNowModalClose="orderNowModalClose"></order-now>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}222</text></rule-modal> <rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal>
\ No newline at end of file \ No newline at end of file
...@@ -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,
// 购买记录弹窗显示隐藏 // 购买记录弹窗显示隐藏
...@@ -12,49 +16,63 @@ Page({ ...@@ -12,49 +16,63 @@ Page({
// 立即购买弹窗 // 立即购买弹窗
orderNowModalVisible: false, orderNowModalVisible: false,
// 倒计时 // 倒计时
endTime: { // endTime: {
d: '', // d: '',
h: '', // h: '',
m: '', // m: '',
s: '', // s: '',
}, // },
endingTime: { endingTime: '',
d: '',
h: '',
m: '',
s: '',
},
// 奖品列表数据 // 奖品列表数据
prizeList: [], prizeList: [],
startTime: '', startTime: '',
endingTime: '', // endingTime: '',
start: '',
end: '',
// 活动结束时间props
endTime:'',
// 会员消耗积分 // 会员消耗积分
vipCredits: '', vipCredits: '',
// 用户当前积分 // 用户当前积分
userCredits:'', userCredits: '',
// 总楼层 // 总楼层
totalFloor:'', totalFloor: '',
countDown:'', // 单人最多购买楼层
eachBuyMostFloor: '',
countDown: '',
ruleModalVisible: false, ruleModalVisible: false,
myPrizeBtnVisible: false, myPrizeBtnVisible: false,
ruleData: ''
}, },
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.countDown();
this.getUserCredits();
this.getBaseInfo(); this.getBaseInfo();
this.getRuleSource();
this.getUserCredits();
// this.getEndTime(); // this.getEndTime();
this.getOrderList(); this.getOrderList();
}, },
// onReady() {
// let {endTime} = this.data
// this.countDowning(endTime);
// },
onPrizeBtnClick() { onPrizeBtnClick() {
my.navigateTo({ my.navigateTo({
...@@ -73,6 +91,17 @@ Page({ ...@@ -73,6 +91,17 @@ Page({
}, },
onUserCredit() {
// 购买成功后更新积分
// 更新购买记录
// 总楼层数更新
this.getOrderList();
this.getUserCredits();
this.getBaseInfo();
console.log(this.data.userCredits, '更新后的用户积分');
},
// 减楼层 // 减楼层
reduceFloor() { reduceFloor() {
let { canBuyFloor } = this.data let { canBuyFloor } = this.data
...@@ -84,8 +113,8 @@ Page({ ...@@ -84,8 +113,8 @@ Page({
}, },
// 加楼层 // 加楼层
addFloor() { addFloor() {
let { canBuyFloor } = this.data; let { canBuyFloor, eachBuyMostFloor } = this.data;
if (canBuyFloor < 100) { if (canBuyFloor < eachBuyMostFloor) {
this.setData({ this.setData({
canBuyFloor: canBuyFloor + 1 canBuyFloor: canBuyFloor + 1
}) })
...@@ -110,15 +139,16 @@ Page({ ...@@ -110,15 +139,16 @@ 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() || {};
// 判断会员等级 // 判断会员等级
this.setData({ this.setData({
vipCredits:{ vipCredits: {
gradeCredits, gradeCredits,
canBuyFloor, canBuyFloor,
grade grade,
gradeName
} }
}) })
// if(success){ // if(success){
...@@ -143,22 +173,72 @@ Page({ ...@@ -143,22 +173,72 @@ Page({
// }) // })
// }) // })
// 判断活动时间
let currentTime = new Date().getTime();
// 当前时间 < 结束时间 显示弹窗
if (currentTime < end) {
// 显示 // 显示
this.setData({ this.setData({
orderNowModalVisible: true orderNowModalVisible: true
}) })
} else {
commonToast('活动已结束,无法购买')
}
}, },
// 获取奖品列表数据 // 获取奖品列表数据
async getBaseInfo() { async getBaseInfo() {
let listStyleArr = [] // API.getActivityBaseInfoById().then((res) => {
let { data } = await API.getActivityBaseInfoById() || {}; // if (res.success) {
// let data = res.data;
// let list = data.list;
// let prize = data.prize;
// let totalFloor = data.totalFloor;
// let end = data.endTime;
// let start = data.startTime;
// let eachBuyMostFloor = data.eachBuyMostFloor;
// // startTime = data.startTime;
// // endingTime = data.endTime;
// for (let i = 0; i < list.length; i++) {
// let listStyle = {
// left: 180 * i + 'rpx',
// width: 150 + 'rpx',
// height: 150 + 'rpx',
// position: 'absolute',
// color: 'white',
// textAlign: 'center'
// }
// list[i].liststyle = listStyle;
// }
// this.setData({
// prizeList: list,
// start: start,
// end: end,
// totalFloor,
// eachBuyMostFloor
// })
// } else {
// console.log('返回失败')
// }
// }).catch((err) => {
// console.log('error', err)
// })
// let listStyleArr = []
let { data, success, code, message } = await API.getActivityBaseInfoById() || {};
if (success) {
console.log(data, 'data') console.log(data, 'data')
let list = data.list; let list = data.list;
let prize = data.prize; let prize = data.prize;
let totalFloor = data.totalFloor; let totalFloor = data.totalFloor;
let end = data.endTime;
let start = data.startTime;
let eachBuyMostFloor = data.eachBuyMostFloor;
// startTime = data.startTime; // startTime = data.startTime;
// endingTime = data.endTime; // endingTime = data.endTime;
...@@ -172,31 +252,97 @@ Page({ ...@@ -172,31 +252,97 @@ Page({
color: 'white', color: 'white',
textAlign: 'center' textAlign: 'center'
} }
// listStyleArr.push(listStyle);
list[i].liststyle = listStyle; list[i].liststyle = listStyle;
} }
// 合并样式
// for(let l of list){
// for(let ls of listStyleArr){
// l.liststyle = ls;
// }
// }
this.setData({ this.setData({
prizeList: list, prizeList: list,
startTime: data.startTime, start: start,
endingTime: data.endingTime, end: end,
totalFloor totalFloor,
eachBuyMostFloor
}) })
console.log('zhixingcount');
} else {
// 错误码
// 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() || {};
console.log('buy', data); console.log('buy', data);
// 购买时间 // 购买时间
if (data.length !== 0) {
for (let item of data) { for (let item of data) {
let createTime = item.createTime; let createTime = item.createTime;
console.log(createTime, 'create') console.log(createTime, 'create')
...@@ -209,23 +355,23 @@ Page({ ...@@ -209,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'
} }
...@@ -236,11 +382,19 @@ Page({ ...@@ -236,11 +382,19 @@ Page({
orderList: data, orderList: data,
// orderStyle:orderStyleArr // orderStyle:orderStyleArr
}) })
} else {
// 购买记录为空
console.log('购买记录为空');
this.setData({
orderList: null
})
}
}, },
// 用户当前积分 // 用户当前积分
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)
...@@ -249,16 +403,14 @@ Page({ ...@@ -249,16 +403,14 @@ Page({
// userCredits:data // userCredits:data
// }) // })
// }) // })
let {message,data,code,success} = await API.getCredits() || {}; let { message, data, code, success } = await API.getCredits() || {};
console.log(code,data,message,success,'ret') console.log(code, data, message, success, 'ret')
this.setData({ this.setData({
userCredits:data userCredits: data
}) })
console.log(data,'更新')
}, },
// 关闭立即购买 // 关闭立即购买
orderNowModalClose() { orderNowModalClose() {
this.setData({ this.setData({
...@@ -267,103 +419,77 @@ Page({ ...@@ -267,103 +419,77 @@ Page({
}, },
// 倒计时 // 倒计时
getEndTime() { // getEndTime() {
let { prizeList, endingTime } = this.data // let { prizeList, endingTime } = this.data
if (!prizeList || !prizeList.length) return null // if (!prizeList || !prizeList.length) return null
// const endTime = prizeList[0].expiredTime // // const endTime = prizeList[0].expiredTime
// if (!endTime) return null // // if (!endTime) return null
// const endTime = '2020/09/30'; // // const endTime = '2020/09/30';
// const endTime = '2020-10-17T00:00:00' // // const endTime = '2020-10-17T00:00:00'
let endTime = endingTime; // let endTime = endingTime;
let stringTime = this.data.stringTime || (new Date(endTime)).getTime(); // let stringTime = this.data.stringTime || (new Date(endTime)).getTime();
// // this.setData({
// // stringTime
// // })
// // const t1 = new Date(endTime).toLocaleDateString() + '';//获取年月日
// // const d1 = new Date(endTime).getDate() + '';
// // const t2 = new Date(endTime).getHours() + '';//获取时
// // const t3 = new Date(endTime).getMinutes() + '';//获取分
// // const t4 = new Date(endTime).getMilliseconds() + '';//获取秒
// // console.log(endTime, new Date(endTime + 48 * 60 * 60 * 1000).toLocaleString(), 'endTime',t1);
// const t1 = new Date(stringTime).toLocaleDateString() + '';//获取年月日
// const d1 = new Date(stringTime).getDate() + '';
// const t2 = new Date(stringTime).getHours() + '';//获取时
// const t3 = new Date(stringTime).getMinutes() + '';//获取分
// const t4 = new Date(stringTime).getSeconds() + '';//获取秒
// let hh = t2.padStart(2, '0');
// let mm = t3.padStart(2, '0');
// let ss = t4.padStart(2, '0');
// let timer = setTimeout(() => {
// this.setData({ // this.setData({
// stringTime // stringTime: stringTime - 1
// }) // })
// const t1 = new Date(endTime).toLocaleDateString() + '';//获取年月日 // console.log(stringTime, 'stringTime');
// const d1 = new Date(endTime).getDate() + '';
// const t2 = new Date(endTime).getHours() + '';//获取时
// const t3 = new Date(endTime).getMinutes() + '';//获取分
// const t4 = new Date(endTime).getMilliseconds() + '';//获取秒
// console.log(endTime, new Date(endTime + 48 * 60 * 60 * 1000).toLocaleString(), 'endTime',t1);
const t1 = new Date(stringTime).toLocaleDateString() + '';//获取年月日
const d1 = new Date(stringTime).getDate() + '';
const t2 = new Date(stringTime).getHours() + '';//获取时
const t3 = new Date(stringTime).getMinutes() + '';//获取分
const t4 = new Date(stringTime).getSeconds() + '';//获取秒
let hh = t2.padStart(2, '0');
let mm = t3.padStart(2, '0');
let ss = t4.padStart(2, '0');
let timer = setTimeout(() => {
this.setData({
stringTime: stringTime - 1
})
console.log(stringTime, 'stringTime');
if (stringTime <= 0) { // if (stringTime <= 0) {
clearTimeout(timer); // clearTimeout(timer);
} // }
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')
endTime: { // endTime: {
d: d1, // d: d1,
h: hh, // h: hh,
m: mm, // m: mm,
s: ss // s: ss
} // }
}) // })
}, 1000) // }, 1000)
},
// },
countDown(){
// var that=this;
const endtime = '2020-10-17T00:00:00'
var nowTime = new Date().getTime();//现在时间(时间戳)
var endTime = new Date(endtime).getTime();//结束时间(时间戳)
var time = (endTime-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);
// console.log(day + "," + hou + "," + min + "," + sec)
day = this.timeFormin(day),
hou = this.timeFormin(hou),
min = this.timeFormin(min),
sec = this.timeFormin(sec)
let that = this;
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.countDown, 1000);
}else{
this.setData({
countDown:false
})
}
},
//小于10的格式化函数(2变成02) //小于10的格式化函数(2变成02)
timeFormat(param) { timeFormat(param) {
return param < 10 ? '0' + param : param; return param < 10 ? '0' + param : param;
}, },
//小于0的格式化函数(不会出现负数) //小于0的格式化函数(不会出现负数)
timeFormin(param) { timeFormin(param) {
return param < 0 ? 0: param; return param < 0 ? 0 : param;
}, },
// 获取规则接口
async getRuleSource() {
API.getActivityBaseInfoById().then((res) => {
if (res.success) {
this.setData({
ruleData: res.data.rule
})
}
})
}
}); });
\ No newline at end of file
...@@ -119,7 +119,22 @@ ...@@ -119,7 +119,22 @@
height: 320rpx; height: 320rpx;
opacity: 1; opacity: 1;
position: absolute; position: absolute;
overflow-y: auto;
} }
.jie_shu_ye .zhong_jiang_ming_dan .zhong_jiang_zhuang_tai .yi_zhong_jiang .no_prize{
width: 458rpx;
height: 320rpx;
top:20rpx;
left: 10rpx;
opacity: 1;
position: absolute;
text-align: center;
}
/*
*/
.jie_shu_ye .zhong_jiang_ming_dan .zhong_jiang_zhuang_tai .yi_zhong_jiang .dixxx_ceng68 { .jie_shu_ye .zhong_jiang_ming_dan .zhong_jiang_zhuang_tai .yi_zhong_jiang .dixxx_ceng68 {
width: 84rpx; width: 84rpx;
height: 23rpx; height: 23rpx;
...@@ -454,8 +469,12 @@ ...@@ -454,8 +469,12 @@
} }
.jie_shu_ye .gou_mai_ji_lu46 .zu13447 .item{ .jie_shu_ye .gou_mai_ji_lu46 .zu13447 .item{
width: 100%; top:0rpx;
height:50rpx; width: 453rpx;
height: 222rpx;
opacity: 1;
left: 10rpx;
position: absolute;
} }
.jie_shu_ye .gou_mai_ji_lu46 .zu13447 .tu_ceng09_yue15_ri56 { .jie_shu_ye .gou_mai_ji_lu46 .zu13447 .tu_ceng09_yue15_ri56 {
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<view class="dao_ji_shi69"> <view class="dao_ji_shi69">
<image class="di74" src={{resList['ad6e754e-6243-4acf-9ffd-9a7aeb3f4971'].url}} /> <image class="di74" src={{resList['ad6e754e-6243-4acf-9ffd-9a7aeb3f4971'].url}} />
<label class="tu_ceng2273">22</label> <label class="tu_ceng2273">00</label>
<label class="tu_ceng22_kao_bei72">22</label> <label class="tu_ceng22_kao_bei72">00</label>
<label class="tu_ceng2271">22</label> <label class="tu_ceng2271">00</label>
<label class="tu_ceng22_kao_bei370">22</label> <label class="tu_ceng22_kao_bei370">00</label>
</view> </view>
<label class="mai_zhongn20n50n80_lou_ceng_de_yong_hu_ke_huo_de_jiang_pinn_dai_biao_gai_lou_jie_shu_shi_de_zong_lou_ceng"> <label class="mai_zhongn20n50n80_lou_ceng_de_yong_hu_ke_huo_de_jiang_pinn_dai_biao_gai_lou_jie_shu_shi_de_zong_lou_ceng">
买中N*20%,N*50%,N*80%楼层的用户可获得奖品 N代表盖楼结束时的总楼层 买中N*20%,N*50%,N*80%楼层的用户可获得奖品 N代表盖楼结束时的总楼层
...@@ -52,11 +52,15 @@ ...@@ -52,11 +52,15 @@
<label class="ba_la_kao_bei4">巴***拉</label> --> <label class="ba_la_kao_bei4">巴***拉</label> -->
<!-- 有中奖用户 --> <!-- 有中奖用户 -->
<view a:for="{{prizeMenu}}" a:key="idx" a:for-item="prizeItem" > <view style="position:absolute" a:if="{{prizeMenu != null}}" a:for="{{prizeMenu}}" a:key="idx" a:for-item="prizeItem" >
<view style="height:40rpx;position:absolute">
<label style="{{prizeItem.prizestyle.prizefloor}}">第{{prizeItem.floor}}层</label> <label style="{{prizeItem.prizestyle.prizefloor}}">第{{prizeItem.floor}}层</label>
<label style="{{prizeItem.prizestyle.prizeuser}}">{{prizeItem.username}}</label> <label style="{{prizeItem.prizestyle.prizeuser}}">{{prizeItem.username}}</label>
<image style="{{prizeItem.prizestyle.prizeimage}}" src={{prizeItem.image}}></image> <image style="{{prizeItem.prizestyle.prizeimage}}" src={{prizeItem.image}}></image>
</view> </view>
</view>
<view class="no_prize">无中奖名单</view>
</view> </view>
<!-- <view class="wei_zhong_jiang"> <!-- <view class="wei_zhong_jiang">
...@@ -99,4 +103,4 @@ ...@@ -99,4 +103,4 @@
<prize-modal a:if="{{prizeVisible}}" ></prize-modal> <prize-modal a:if="{{prizeVisible}}" ></prize-modal>
<noprize-modal a:if="{{noprizeVisible}}" openPrizeStatus="{{openPrizeStatus}}" ></noprize-modal> <noprize-modal a:if="{{noprizeVisible}}" openPrizeStatus="{{openPrizeStatus}}" ></noprize-modal>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}1111</text></rule-modal> <rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal>
\ No newline at end of file \ No newline at end of file
...@@ -17,6 +17,7 @@ Page({ ...@@ -17,6 +17,7 @@ Page({
ruleModalVisible: false, ruleModalVisible: false,
// myPrizeBtnVisible: false, // myPrizeBtnVisible: false,
ruleData:''
}, },
onLoad(props) { onLoad(props) {
...@@ -33,7 +34,7 @@ Page({ ...@@ -33,7 +34,7 @@ Page({
}) })
} }
} }
this.getRuleSource();
this.setData({ this.setData({
resList: resList resList: resList
}); });
...@@ -119,6 +120,8 @@ Page({ ...@@ -119,6 +120,8 @@ Page({
async getPrizeMenu(){ async getPrizeMenu(){
let {data} = await API.getFloorPrize() || {}; let {data} = await API.getFloorPrize() || {};
console.log(data,'prizemenu') console.log(data,'prizemenu')
if(data != null){
// 用户名单处理 // 用户名单处理
let floorPrize = data; let floorPrize = data;
var personMenuArr = []; var personMenuArr = [];
...@@ -153,8 +156,9 @@ Page({ ...@@ -153,8 +156,9 @@ Page({
}, },
prizeimage: { prizeimage: {
left: 400 + 'rpx', left: 400 + 'rpx',
top: 45 * i + 'rpx',
position: 'absolute', position: 'absolute',
verticalAlign:'middle',
top: 40 * i + 10 + 'rpx',
color: 'white', color: 'white',
width:40 + 'rpx', width:40 + 'rpx',
height: 30 + 'rpx' height: 30 + 'rpx'
...@@ -166,7 +170,24 @@ Page({ ...@@ -166,7 +170,24 @@ Page({
this.setData({ this.setData({
prizeMenu: floorPrize prizeMenu: floorPrize
}) })
} else {
// 无中奖
this.setData({
prizeMenu:null
})
}
},
// 获取规则接口
async getRuleSource(){
API.getActivityBaseInfoById().then((res)=>{
if(res.success){
this.setData({
ruleData:res.data.rule
})
}
})
} }
}); });
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<image class="wen_an" src={{resList['2a026ac4-0a9c-497b-9469-2da99f935821'].url}} /> <image class="wen_an" src={{resList['2a026ac4-0a9c-497b-9469-2da99f935821'].url}} />
<image onTap="onPrizeBtnClick" a:if="{{myPrizeBtnVisible}}" class="jiang_pinicon" src={{resList['b7517eae-3bc2-4456-935a-e6e3e1fe995e'].url}} /> <image onTap="onPrizeBtnClick" a:if="{{myPrizeBtnVisible}}" class="jiang_pinicon" src={{resList['b7517eae-3bc2-4456-935a-e6e3e1fe995e'].url}} />
<image a:if="{{ruleModalBtnVisible}}" class="gui_zeicon" onTap="showRuleModal" src={{resList['d826a2f1-a3ec-4764-aad2-f6cacc43cfce'].url}} /> <image a:if="{{ruleModalBtnVisible}}" class="gui_zeicon" onTap="showRuleModal" src={{resList['d826a2f1-a3ec-4764-aad2-f6cacc43cfce'].url}} />
<text a:if="{{ruleModalBtnVisible}}" class="can_yu_ren_shu">已有{{joinCount}}人参与</text> <text a:if="{{ruleModalBtnVisible}}" class="can_yu_ren_shu">已有{{joinCount * 20}}人参与</text>
</view> </view>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal> <rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal>
\ No newline at end of file
...@@ -15,7 +15,8 @@ Page({ ...@@ -15,7 +15,8 @@ Page({
ruleModalBtnVisible: false, ruleModalBtnVisible: false,
ruleData:'', ruleData:'',
joinCount:'' joinCount:'',
endTime:''
}, },
onLoad(query) { onLoad(query) {
...@@ -29,12 +30,14 @@ Page({ ...@@ -29,12 +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({endTime}) });
}) })
}, },
...@@ -65,13 +68,21 @@ Page({ ...@@ -65,13 +68,21 @@ Page({
API.getActivityBaseInfoById(), API.getActivityBaseInfoById(),
API.getVipInfo(), API.getVipInfo(),
]); ]);
this.setData({
endTime
})
console.log('fuck');
// vipInfo..data.isVip = true; // vipInfo..data.isVip = true;
if (vipInfo.data.isVip && isUserJoin) { if (vipInfo.data.isVip && isUserJoin) {
if (isEnd(endTime) && if (isEnd(endTime) &&
(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