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 @@
left: 60rpx;
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;
height: 183rpx;
opacity: 1;
top: 163rpx;
top: 10rpx;
position: absolute;
}
.gou_mai_ji_lu32 .gou_mai_ji_lu_kao_bei33 .zu135 .zu13434 .tu_ceng09_yue15_ri43 {
......
......@@ -5,12 +5,14 @@
<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}} />
<view class="zu135">
<view class="zu13434" a:if="{{orderList.length !== 0}}" a:for="{{orderList}}" a:key="index" a:for-item="item">
<label style="{{item.order.orderDay}}">{{item.monthDate}}</label>
<label style="{{item.order.orderFloor}}">{{item.floorRange}}</label>
<label style="{{item.order.orderCredits}}">{{item.credits}}</label>
<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.orderFloor}}">{{item.floorRange}}</label>
<label style="{{item.order.orderCredits}}">{{item.credits}}</label>
</view>
</view>
<!-- <view a:else>暂无购买记录</view> -->
<view class="no_order" a:elif="{{orderList == null}}">暂无购买记录</view>
<!-- <text >{{JSON.stringify(orderList)}}</text> -->
......
......@@ -192,6 +192,18 @@
opacity: 1;
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 {
width: 309rpx;
height: 44rpx;
......
......@@ -2,8 +2,14 @@
<image class="cha_cha4582" onTap="onOrderNowModalClose" src={{resList['b8bc26de-51ac-457f-bd3f-348e7df0af34'].url}} />
<view class="hui_yuan_deng_ji">
<view class="zhu_ce_hui_yuan">
<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_jing1" src={{resList['26ff41d0-0891-4573-a557-1a0bb7881405'].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">
购买 {{vipCredits.canBuyFloor}} 个楼层 一共需要花费 {{vipCredits.gradeCredits}} 积分
</label>
......
......@@ -2,9 +2,13 @@
import resList from '../../resconfig/resList';
import API from '../../api'
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
Component({
props: {
onUserCredit:()=>{}
},
data: {
resList: resList
......@@ -34,17 +38,31 @@ Component({
// })
// 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');
if(res.success){
console.log('success')
// 更新积分
// API.getCredits().then((res)=>{
// if(res.success){
// let userCredits = res.data;
// this.props.onUserCredit();
// }
// })
commonToast("恭喜你购买成功");
this.props.onUserCredit();
// this.props.onUserCredit();
}else{
// 错误码判断不同情况
commonToast(res.message);
// if(res.code === '500000'){
// }
// console.log('fail')
}
})
// console.log('succ',success)
// if(success){
// console.log('success');
// }else{
// console.log('failed')
// }
// success
this.onOrderNowModalClose();
......
......@@ -62,40 +62,40 @@
width: 35rpx;
height: 25rpx;
opacity: 1;
left: 13rpx;
top: 47rpx;
left: 15rpx;
top: 40rpx;
position: absolute;
font-size: 14.41518rpx;
font-size: 25rpx;
color: #ffffff;
}
.huo_dong_ye .dao_ji_shi87 .tu_ceng22_kao_bei90 {
width: 35rpx;
height: 25rpx;
opacity: 1;
left: 131rpx;
top: 47rpx;
left: 135rpx;
top: 40rpx;
position: absolute;
font-size: 14.41518rpx;
font-size: 25rpx;
color: #ffffff;
}
.huo_dong_ye .dao_ji_shi87 .tu_ceng2289 {
width: 35rpx;
height: 25rpx;
opacity: 1;
left: 246rpx;
top: 47rpx;
left: 248rpx;
top: 40rpx;
position: absolute;
font-size: 14.41518rpx;
font-size: 25rpx;
color: #ffffff;
}
.huo_dong_ye .dao_ji_shi87 .tu_ceng22_kao_bei388 {
width: 35rpx;
height: 25rpx;
opacity: 1;
left: 357rpx;
top: 47rpx;
left: 360rpx;
top: 40rpx;
position: absolute;
font-size: 14.41518rpx;
font-size: 25rpx;
color: #ffffff;
}
.huo_dong_ye .jiang_pin78 {
......@@ -283,12 +283,12 @@
}
.huo_dong_ye .xxxxxx {
width: 120rpx;
height: 24rpx;
height: 36rpx;
opacity: 1;
left: 315rpx;
top: 475rpx;
left: 345rpx;
top: 455rpx;
position: absolute;
font-size: 31.96651rpx;
font-size: 28rpx;
color: #e7210a;
}
.huo_dong_ye .ji_fen {
......@@ -317,9 +317,9 @@
width: 172rpx;
height: 25rpx;
opacity: 1;
left: 26rpx;
top: 13rpx;
left: 30rpx;
top: 5rpx;
position: absolute;
font-size: 16.17499rpx;
font-size: 24rpx;
color: #5392cc;
}
......@@ -30,10 +30,10 @@
<label class="xxx_yuan_jiang_pin79">XXX元奖品</label> -->
<!-- bianli -->
<!-- <image style="width:100;height:100" src={{item.image}}></image> -->
<view style="width:100rpx;height:100rpx;background:white;marginLeft:25rpx"></view>
<label>{{item.probability}}</label>
<label>{{item.name}}</label>
<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="fontSize:22rpx">{{item.probability}}</view>
<label style="fontSize:22rpx">{{item.name}}</label>
</view>
</view>
......@@ -50,11 +50,11 @@
<view class="ji_fen">
<image class="di111" src={{resList['8cb47bc2-bc31-4713-86ba-c8738367cb82'].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>
<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>
\ No newline at end of file
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal>
\ No newline at end of file
......@@ -2,9 +2,13 @@
import resList from '../../resconfig/resList';
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast, getAuthUserInfo, navigateToOutside } = tbcc.tb;
Page({
data: {
resList: resList,
// 购买楼层数
canBuyFloor: 10,
// 购买记录弹窗显示隐藏
......@@ -12,49 +16,63 @@ Page({
// 立即购买弹窗
orderNowModalVisible: false,
// 倒计时
endTime: {
d: '',
h: '',
m: '',
s: '',
},
endingTime: {
d: '',
h: '',
m: '',
s: '',
},
// endTime: {
// d: '',
// h: '',
// m: '',
// s: '',
// },
endingTime: '',
// 奖品列表数据
prizeList: [],
startTime: '',
endingTime: '',
// endingTime: '',
start: '',
end: '',
// 活动结束时间props
endTime:'',
// 会员消耗积分
vipCredits: '',
// 用户当前积分
userCredits:'',
userCredits: '',
// 总楼层
totalFloor:'',
countDown:'',
totalFloor: '',
// 单人最多购买楼层
eachBuyMostFloor: '',
countDown: '',
ruleModalVisible: false,
myPrizeBtnVisible: false,
ruleData: ''
},
onLoad(props) {
// this.setData({
// resList: resList
// });
console.log(props.data,'dataprops');
const { endTime } = JSON.parse(props.data);
this.setData({
resList: resList
});
// this.countDown();
this.getUserCredits();
endTime
})
this.getBaseInfo();
this.getRuleSource();
this.getUserCredits();
// this.getEndTime();
this.getOrderList();
},
// onReady() {
// let {endTime} = this.data
// this.countDowning(endTime);
// },
onPrizeBtnClick() {
my.navigateTo({
......@@ -73,6 +91,17 @@ Page({
},
onUserCredit() {
// 购买成功后更新积分
// 更新购买记录
// 总楼层数更新
this.getOrderList();
this.getUserCredits();
this.getBaseInfo();
console.log(this.data.userCredits, '更新后的用户积分');
},
// 减楼层
reduceFloor() {
let { canBuyFloor } = this.data
......@@ -84,8 +113,8 @@ Page({
},
// 加楼层
addFloor() {
let { canBuyFloor } = this.data;
if (canBuyFloor < 100) {
let { canBuyFloor, eachBuyMostFloor } = this.data;
if (canBuyFloor < eachBuyMostFloor) {
this.setData({
canBuyFloor: canBuyFloor + 1
})
......@@ -110,15 +139,16 @@ Page({
async buyFloors() {
// 购买楼层数
let { canBuyFloor } = this.data;
let { canBuyFloor, end } = this.data;
let { data: { isVip, grade, gradeName, gradeCredits } } = await API.getVipInfo() || {};
// 判断会员等级
this.setData({
vipCredits:{
vipCredits: {
gradeCredits,
canBuyFloor,
grade
grade,
gradeName
}
})
// if(success){
......@@ -143,52 +173,168 @@ Page({
// })
// })
// 显示
this.setData({
orderNowModalVisible: true
})
// 判断活动时间
let currentTime = new Date().getTime();
// 当前时间 < 结束时间 显示弹窗
if (currentTime < end) {
// 显示
this.setData({
orderNowModalVisible: true
})
} else {
commonToast('活动已结束,无法购买')
}
},
// 获取奖品列表数据
async getBaseInfo() {
let listStyleArr = []
let { data } = await API.getActivityBaseInfoById() || {};
console.log(data, 'data')
let list = data.list;
let prize = data.prize;
let totalFloor = data.totalFloor;
// 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'
// API.getActivityBaseInfoById().then((res) => {
// 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')
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;
}
// listStyleArr.push(listStyle);
list[i].liststyle = listStyle;
this.setData({
prizeList: list,
start: start,
end: end,
totalFloor,
eachBuyMostFloor
})
console.log('zhixingcount');
} else {
// 错误码
// console.log('error');
commonToast(message);
}
// 合并样式
// for(let l of list){
// for(let ls of listStyleArr){
// l.liststyle = ls;
// }
// }
this.setData({
prizeList: list,
startTime: data.startTime,
endingTime: data.endingTime,
totalFloor
})
},
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'
// }
},
// 获取购买记录信息
......@@ -196,51 +342,59 @@ Page({
let { data } = await API.getBuyFloorList() || {};
console.log('buy', data);
// 购买时间
if (data.length !== 0) {
for (let item of data) {
let createTime = item.createTime;
console.log(createTime, 'create')
// let formatCreateTime = new Date(parseInt(createTime)).toLocaleDateString();
let month = new Date(parseInt(createTime)).getMonth() + 1;
let date = new Date(parseInt(createTime)).getDate();
item.monthDate = month + '月' + date + '日';
console.log(item.monthDate, 'time')
}
for (let item of data) {
let createTime = item.createTime;
console.log(createTime, 'create')
// let formatCreateTime = new Date(parseInt(createTime)).toLocaleDateString();
let month = new Date(parseInt(createTime)).getMonth() + 1;
let date = new Date(parseInt(createTime)).getDate();
item.monthDate = month + '月' + date + '日';
console.log(item.monthDate, 'time')
}
let lens = data.length;
for (let i = 0; i < lens; i++) {
let orderStyle = {
orderDay: {
left: 0,
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
orderFloor: {
left: 200 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
orderCredits: {
left: 400 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
let lens = data.length;
for (let i = lens -1; i >= 0; i--) {
let orderStyle = {
orderDay: {
left: 0,
top: 40 * (lens-i) + 'rpx',
position: 'absolute',
color: 'white'
},
orderFloor: {
left: 200 + 'rpx',
top: 40 * (lens-i) + 'rpx',
position: 'absolute',
color: 'white'
},
orderCredits: {
left: 400 + 'rpx',
top: 40 * (lens-i) + 'rpx',
position: 'absolute',
color: 'white'
}
}
data[i].order = orderStyle;
}
data[i].order = orderStyle;
this.setData({
orderList: data,
// orderStyle:orderStyleArr
})
} else {
// 购买记录为空
console.log('购买记录为空');
this.setData({
orderList: null
})
}
this.setData({
orderList: data,
// orderStyle:orderStyleArr
})
},
// 用户当前积分
async getUserCredits() {
console.log('zhxing')
// console.log('zhxing')
// await API.getCredits().catch((res) => {
// console.log('resdata', res)
// // if(res.success)
......@@ -249,16 +403,14 @@ Page({
// userCredits:data
// })
// })
let {message,data,code,success} = await API.getCredits() || {};
console.log(code,data,message,success,'ret')
this.setData({
userCredits:data
})
let { message, data, code, success } = await API.getCredits() || {};
console.log(code, data, message, success, 'ret')
this.setData({
userCredits: data
})
console.log(data,'更新')
},
// 关闭立即购买
orderNowModalClose() {
this.setData({
......@@ -267,103 +419,77 @@ Page({
},
// 倒计时
getEndTime() {
let { prizeList, endingTime } = this.data
if (!prizeList || !prizeList.length) return null
// const endTime = prizeList[0].expiredTime
// if (!endTime) return null
// const endTime = '2020/09/30';
// const endTime = '2020-10-17T00:00:00'
let endTime = endingTime;
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({
stringTime: stringTime - 1
})
console.log(stringTime, 'stringTime');
// getEndTime() {
// let { prizeList, endingTime } = this.data
// if (!prizeList || !prizeList.length) return null
// // const endTime = prizeList[0].expiredTime
// // if (!endTime) return null
// // const endTime = '2020/09/30';
// // const endTime = '2020-10-17T00:00:00'
// let endTime = endingTime;
// 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({
// stringTime: stringTime - 1
// })
// console.log(stringTime, 'stringTime');
// if (stringTime <= 0) {
// clearTimeout(timer);
// }
// this.setData({
// // endTime: t1 + " " + t2.padStart(2, '0') + ":" + t3.padStart(2, '0') + ":" + t4.padStart(2, '0')
// endTime: {
// d: d1,
// h: hh,
// m: mm,
// s: ss
// }
// })
// }, 1000)
// },
if (stringTime <= 0) {
clearTimeout(timer);
}
this.setData({
// endTime: t1 + " " + t2.padStart(2, '0') + ":" + t3.padStart(2, '0') + ":" + t4.padStart(2, '0')
endTime: {
d: d1,
h: hh,
m: mm,
s: ss
}
})
}, 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)
timeFormat(param) {
return param < 10 ? '0' + param : param;
},
//小于0的格式化函数(不会出现负数)
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 @@
height: 320rpx;
opacity: 1;
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 {
width: 84rpx;
height: 23rpx;
......@@ -454,8 +469,12 @@
}
.jie_shu_ye .gou_mai_ji_lu46 .zu13447 .item{
width: 100%;
height:50rpx;
top:0rpx;
width: 453rpx;
height: 222rpx;
opacity: 1;
left: 10rpx;
position: absolute;
}
.jie_shu_ye .gou_mai_ji_lu46 .zu13447 .tu_ceng09_yue15_ri56 {
......
......@@ -6,10 +6,10 @@
<view class="dao_ji_shi69">
<image class="di74" src={{resList['ad6e754e-6243-4acf-9ffd-9a7aeb3f4971'].url}} />
<label class="tu_ceng2273">22</label>
<label class="tu_ceng22_kao_bei72">22</label>
<label class="tu_ceng2271">22</label>
<label class="tu_ceng22_kao_bei370">22</label>
<label class="tu_ceng2273">00</label>
<label class="tu_ceng22_kao_bei72">00</label>
<label class="tu_ceng2271">00</label>
<label class="tu_ceng22_kao_bei370">00</label>
</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">
买中N*20%,N*50%,N*80%楼层的用户可获得奖品 N代表盖楼结束时的总楼层
......@@ -52,12 +52,16 @@
<label class="ba_la_kao_bei4">巴***拉</label> -->
<!-- 有中奖用户 -->
<view a:for="{{prizeMenu}}" a:key="idx" a:for-item="prizeItem" >
<label style="{{prizeItem.prizestyle.prizefloor}}">第{{prizeItem.floor}}层</label>
<label style="{{prizeItem.prizestyle.prizeuser}}">{{prizeItem.username}}</label>
<image style="{{prizeItem.prizestyle.prizeimage}}" src={{prizeItem.image}}></image>
<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.prizeuser}}">{{prizeItem.username}}</label>
<image style="{{prizeItem.prizestyle.prizeimage}}" src={{prizeItem.image}}></image>
</view>
</view>
<view class="no_prize">无中奖名单</view>
</view>
<!-- <view class="wei_zhong_jiang">
<label class="zong_lou_ceng_bu_zu_wu_ren_zhong_jiang">总楼层不足,无人中奖</label>
......@@ -99,4 +103,4 @@
<prize-modal a:if="{{prizeVisible}}" ></prize-modal>
<noprize-modal a:if="{{noprizeVisible}}" openPrizeStatus="{{openPrizeStatus}}" ></noprize-modal>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}1111</text></rule-modal>
\ No newline at end of file
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal>
\ No newline at end of file
......@@ -17,6 +17,7 @@ Page({
ruleModalVisible: false,
// myPrizeBtnVisible: false,
ruleData:''
},
onLoad(props) {
......@@ -33,7 +34,7 @@ Page({
})
}
}
this.getRuleSource();
this.setData({
resList: resList
});
......@@ -119,54 +120,74 @@ Page({
async getPrizeMenu(){
let {data} = await API.getFloorPrize() || {};
console.log(data,'prizemenu')
// 用户名单处理
let floorPrize = data;
var personMenuArr = [];
for(let i=0; i<floorPrize.length;i++){
let userName = floorPrize[i].userNick ;
console.log(userName,'userName');
if(userName.length >=2){
console.log(userName.length);
let length = userName.length;
let f = userName.toString().substr(0,1);
// console.log('f',f);
let last = userName.toString().substr(length -1,1)
// console.log('last',last)
userName = f + "***" + last;
// console.log('22222',userName)
}
floorPrize[i].username = userName;
let prizeStyle = {
prizefloor: {
left: 0,
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
prizeuser: {
left: 200 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
prizeimage: {
left: 400 + 'rpx',
top: 45 * i + 'rpx',
position: 'absolute',
color: 'white',
width:40 + 'rpx',
height: 30 + 'rpx'
if(data != null){
// 用户名单处理
let floorPrize = data;
var personMenuArr = [];
for(let i=0; i<floorPrize.length;i++){
let userName = floorPrize[i].userNick ;
console.log(userName,'userName');
if(userName.length >=2){
console.log(userName.length);
let length = userName.length;
let f = userName.toString().substr(0,1);
// console.log('f',f);
let last = userName.toString().substr(length -1,1)
// console.log('last',last)
userName = f + "***" + last;
// console.log('22222',userName)
}
floorPrize[i].username = userName;
let prizeStyle = {
prizefloor: {
left: 0,
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
prizeuser: {
left: 200 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
prizeimage: {
left: 400 + 'rpx',
position: 'absolute',
verticalAlign:'middle',
top: 40 * i + 10 + 'rpx',
color: 'white',
width:40 + 'rpx',
height: 30 + 'rpx'
}
}
floorPrize[i].prizestyle = prizeStyle;
}
floorPrize[i].prizestyle = prizeStyle;
console.log(floorPrize,'arr')
this.setData({
prizeMenu: floorPrize
})
} else {
// 无中奖
this.setData({
prizeMenu:null
})
}
console.log(floorPrize,'arr')
this.setData({
prizeMenu: floorPrize
})
},
// 获取规则接口
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 @@
<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 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>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}</text></rule-modal>
\ No newline at end of file
......@@ -15,7 +15,8 @@ Page({
ruleModalBtnVisible: false,
ruleData:'',
joinCount:''
joinCount:'',
endTime:''
},
onLoad(query) {
......@@ -29,12 +30,14 @@ Page({
},
gotoVipPage() {
let {endTime} = this.data
API.getVipInfo().then(res => {
// res.data.isVip=true;
if (!res.data.isVip)
navigateToOutside(res.data.url)
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({
API.getActivityBaseInfoById(),
API.getVipInfo(),
]);
this.setData({
endTime
})
console.log('fuck');
// vipInfo..data.isVip = true;
if (vipInfo.data.isVip && isUserJoin) {
if (isEnd(endTime) &&
(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 }) });
} 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 {
//设置状态
......
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