Commit 39509fd3 authored by 汪欢's avatar 汪欢

prizelist

parent f46234af
......@@ -3,13 +3,13 @@ require('./config$');
require('../../components/comgou_mai_ji_lu32/comgou_mai_ji_lu32?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comhui_yuan/comhui_yuan?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comyou_xi_gui_ze27/comyou_xi_gui_ze27?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comgong_xi_huo_jiang/comgong_xi_huo_jiang?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comhen_yi_han23/comhen_yi_han23?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comyou_xi_gui_ze27/comyou_xi_gui_ze27?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/logisticsModal/logisticsModal?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/prizeModal/prizeModal?hash=951cb6a7fcdd2a5332763295aa08b4f86b6fd2e1');
require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=90465399d3364a1028b01344ac9aa9dacad0f7e0');
require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=1959bae1d571bb9ed770cf51fdf6090f42925135');
require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=7ec0f338c71bf4e4819fe4b1de0280c7c068fa10');
require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=4990da67de8821c5cecd5d61ea1f930142c306d6');
require('../../pages/pageshou_ye/pageshou_ye?hash=f6ca2530b12f33cb12545f5a792a8e73d47ec084');
require('../../pages/myprize/myprize?hash=74b7edb09b315961bb13059a83b72836912bfd2c');
require('../../pages/pagewo_de_jiang_pin_ye_mian1/pagewo_de_jiang_pin_ye_mian1?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
......@@ -34,13 +34,13 @@ function success() {
require('../../app');
require('../../components/comgou_mai_ji_lu32/comgou_mai_ji_lu32?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comhui_yuan/comhui_yuan?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comyou_xi_gui_ze27/comyou_xi_gui_ze27?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comgong_xi_huo_jiang/comgong_xi_huo_jiang?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comhen_yi_han23/comhen_yi_han23?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/comyou_xi_gui_ze27/comyou_xi_gui_ze27?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/logisticsModal/logisticsModal?hash=05d2a9730dd6009bf9446182f9c985f40f8c0f43');
require('../../components/prizeModal/prizeModal?hash=951cb6a7fcdd2a5332763295aa08b4f86b6fd2e1');
require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=90465399d3364a1028b01344ac9aa9dacad0f7e0');
require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=1959bae1d571bb9ed770cf51fdf6090f42925135');
require('../../pages/pagehuo_dong_ye/pagehuo_dong_ye?hash=7ec0f338c71bf4e4819fe4b1de0280c7c068fa10');
require('../../pages/pagejie_shu_ye/pagejie_shu_ye?hash=4990da67de8821c5cecd5d61ea1f930142c306d6');
require('../../pages/pageshou_ye/pageshou_ye?hash=f6ca2530b12f33cb12545f5a792a8e73d47ec084');
require('../../pages/myprize/myprize?hash=74b7edb09b315961bb13059a83b72836912bfd2c');
require('../../pages/pagewo_de_jiang_pin_ye_mian1/pagewo_de_jiang_pin_ye_mian1?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
......
{
"pages": [
"pages/pageshou_ye/pageshou_ye",
"pages/myprize/myprize",
"pages/pagehuo_dong_ye/pagehuo_dong_ye",
"pages/pagejie_shu_ye/pagejie_shu_ye",
"pages/pageshou_ye/pageshou_ye",
"pages/myprize/myprize",
"pages/pagewo_de_jiang_pin_ye_mian1/pagewo_de_jiang_pin_ye_mian1"
],
"window": {}
......
......@@ -5,14 +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:for="{{orderList}}" a:for-index="idx" a:for-item="item">
<!--<label class="tu_ceng09_yue15_ri43">09 月 15日</label><label class="tu_ceng10012042">100-120</label><label class="tu_ceng10012041">100-120</label><label class="tu_ceng10012040">100-120</label><label class="tu_ceng20039">200</label><label class="tu_ceng20038">200</label><label class="tu_ceng20037">200</label><label class="tu_ceng09_yue15_ri36">09 月 15日</label><label class="tu_ceng09_yue15_ri35">09 月 15日</label><label class="tu_ceng100120_kao_bei4">100-120</label><label class="tu_ceng200_kao_bei4">200</label><label class="tu_ceng09_yue15_ri_kao_bei4">09 月 15日</label><label class="tu_ceng100120_kao_bei5">100-120</label><label class="tu_ceng200_kao_bei5">200</label><label class="tu_ceng09_yue15_ri_kao_bei5">09 月 15日</label> -->
<!-- bianli -->
<label style="{{item.order.orderDay}}">{{item.orderDay}}</label>
<label style="{{item.order.orderFloor}}">{{item.orderFloor}}</label>
<label style="{{item.order.orderCredits}}">{{item.consumeCredits}}</label>
<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>
<!-- <view a:else>暂无购买记录</view> -->
<!-- <text >{{JSON.stringify(orderList)}}</text> -->
<!-- <view class="item" a:for="{{orderList}}" a:for-index="index" a:for-item="item">
<label style="{{item.order.orderDay}}">{{item.createTime}}</label>
......
......@@ -3,36 +3,10 @@
import resList from '../../resconfig/resList';
import API from '../../api'
Component({
props: {},
props: {
},
data: {
resList: resList,
orderList: [
// {
// orderDay: '09月16日',
// orderFloor: 10,
// consumeCredits: 100
// },
// {
// orderDay: '09月17日',
// orderFloor: 20,
// consumeCredits: 200
// },
// {
// orderDay: '09月18日',
// orderFloor: 30,
// consumeCredits: 300
// },
// {
// orderDay: '09月19日',
// orderFloor: 40,
// consumeCredits: 400
// },
// {
// orderDay: '09月20日',
// orderFloor: 50,
// consumeCredits: 500
// },
],
},
methods: {
......@@ -41,41 +15,55 @@ Component({
onOrderModalClose && onOrderModalClose();
},
async getOrderList(){
let {data} = await API.getBuyFloorList() || {};
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'
}
}
data[i].order = orderStyle;
getOrderListProps(){
let {orderList} = this.props;
console.log(this.props,'props');
}
this.setData({
orderList:data,
// orderStyle:orderStyleArr
})
},
// async getOrderList(){
// let {data} = await API.getBuyFloorList() || {};
// console.log('buy',data);
// // 购买时间
// let createTime = data.list.cteateTime;
// 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'
// }
// }
// data[i].order = orderStyle;
// }
// this.setData({
// orderList:data,
// // orderStyle:orderStyleArr
// })
// },
},
onInit(props) {
this.getOrderList();
// this.getOrderList();
},
didMount(){
this.getOrderListProps();
}
});
\ No newline at end of file
......@@ -5,7 +5,7 @@
<image class="bei_jing1" src={{resList['26ff41d0-0891-4573-a557-1a0bb7881405'].url}} />
<image class="zu012" src={{resList['948928c1-e583-449d-baca-77db2e213fe1'].url}} />
<label class="gou_maixxx_ge_lou_ceng_yi_gong_xu_yao_hua_feixxxx_ji_fen22">
购买 XXX 个楼层 一共需要花费 XXXX 积分
购买 {{vipCredits.canBuyFloor}} 个楼层 一共需要花费 {{vipCredits.gradeCredits}} 积分
</label>
<label class="ps_mei_ceng_lou50_ji_fen">(PS:每层楼50积分)</label>
</view>
......@@ -15,6 +15,6 @@
购买 XXX 个楼层 一共需要花费 XXXX 积分</label><label class="ps_mei_ceng_lou20_ji_fen">(PS:每层楼20积分)</label></view><view class="hei_qia_hui_yuan"><image class="bei_jing5" src={{resList['c46f1953-53df-4fdd-aaab-b5e8252b84ce'].url}} /><image class="zu926" src={{resList['53ff1056-22d3-48ad-8f55-3e8a459073b2'].url}} /><label class="gou_maixxx_ge_lou_ceng_yi_gong_xu_yao_hua_feixxxx_ji_fen21">
购买 XXX 个楼层 一共需要花费 XXXX 积分</label><label class="ps_mei_ceng_lou10_ji_fen">(PS:每层楼10积分)</label><label class="xu_yao_xiao_hao10n_ge_ji_fen">需要消耗 10*N 个积分</label></view> -->
</view>
<image class="an_niu66" src={{resList['3cd0f2ce-f2e0-42c6-be49-52b3177164c5'].url}} />
<image class="an_niu66" onTap="consumeCredits" src={{resList['3cd0f2ce-f2e0-42c6-be49-52b3177164c5'].url}} />
<image class="an_niu_kao_bei2" onTap="onOrderNowModalClose" src={{resList['0eba7d77-43f9-4127-8976-ebf54e0b84be'].url}} />
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList';
import API from '../../api'
Component({
props: {},
props: {
},
data: {
resList: resList
},
......@@ -11,6 +14,24 @@ Component({
onOrderNowModalClose(){
const {onOrderNowModalClose} = this.props;
onOrderNowModalClose && onOrderNowModalClose();
},
// 购买判断
async consumeCredits(){
let vipCredits = this.props.vipCredits;
// console.log(this.props,'datas')
API.getCredits().catch((res)=>{
console.log('resdata',res)
// if(res.success){
let data = res.data;
console.log(data,vipCredits.gradeCredits,'1111')
if(data >= vipCredits.gradeCredits){
console.log('购买成功!')
} else {
console.log('购买失败!')
}
// }
})
}
},
......@@ -18,6 +39,11 @@ Component({
// this.setData({
// resList: resList
// });
},
didMount(){
let {vipCredits} = this.props;
console.log(this.props,'huiyuan')
}
});
\ No newline at end of file
......@@ -52,6 +52,7 @@
position: absolute;
font-size: 24rpx;
color: #ffffff;
overflow-y: auto;
}
.you_xi_gui_ze27 .gou_mai_ji_lu_kao_bei28 .zu1357 {
width: 202rpx;
......
......@@ -10,6 +10,24 @@
opacity: 1;
position: absolute;
}
.huo_dong_ye .jiang_pinicon {
width: 136rpx;
height: 48rpx;
opacity: 1;
left: 600rpx;
top: 221rpx;
position: absolute;
}
.huo_dong_ye .gui_zeicon {
width: 136rpx;
height: 48rpx;
opacity: 1;
left: 17rpx;
top: 221rpx;
position: absolute;
}
.huo_dong_ye .tu2 {
width: 543rpx;
height: 494rpx;
......
<view class="huo_dong_ye">
<image class="di_kao_bei2" src={{resList['66f2b76f-7265-4cb2-9b4d-7e8207ab1d74'].url}} />
<image onTap="onPrizeBtnClick" class="jiang_pinicon" src={{resList['b7517eae-3bc2-4456-935a-e6e3e1fe995e'].url}} />
<image class="gui_zeicon" onTap="showRuleModal" src={{resList['d826a2f1-a3ec-4764-aad2-f6cacc43cfce'].url}} />
<image class="tu2" src={{resList['d2cd8191-8fbd-423a-8c36-5bd52659317e'].url}} />
<!-- 立即购买 -->
<image class="an_niu2" onTap="buyFloors" src={{resList['34e91d1d-6c84-45f5-ab77-870939ca7b12'].url}} />
......@@ -27,7 +31,7 @@
<!-- bianli -->
<!-- <image style="width:100;height:100" src={{item.image}}></image> -->
<view style="width:100rpx;height:100rpx;background:white;marginLeft:50rpx"></view>
<view style="width:100rpx;height:100rpx;background:white;marginLeft:25rpx"></view>
<label>{{item.probability}}</label>
<label>{{item.name}}</label>
......@@ -46,9 +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">当前积分:xxxx</label>
<label class="dang_qian_ji_fenxxxx">当前积分:{{userCredits}}</label>
</view>
</view>
<order-record a:if="{{orderModalVisible}}" 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}}" onOrderNowModalClose="orderNowModalClose"></order-now>
\ No newline at end of file
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>{{ruleData}}222</text></rule-modal>
\ No newline at end of file
......@@ -6,24 +6,34 @@ import API from '../../api';
Page({
data: {
// 购买楼层数
canBuyFloor:10,
canBuyFloor: 10,
// 购买记录
orderList: [],
// 购买记录弹窗显示隐藏
orderModalVisible:false,
orderModalVisible: false,
// 立即购买弹窗
orderNowModalVisible:false,
orderNowModalVisible: false,
// 倒计时
endTime:{
d:'',
h:'',
m:'',
s:'',
endTime: {
d: '',
h: '',
m: '',
s: '',
},
// 奖品列表数据
prizeList:[],
prizeList: [],
startTime:'',
endingTime:'',
startTime: '',
endingTime: '',
// 会员消耗积分
vipCredits: '',
// 用户当前积分
userCredits:'',
ruleModalVisible: false,
myPrizeBtnVisible: false,
},
......@@ -31,86 +41,123 @@ Page({
this.setData({
resList: resList
});
this.getUserCredits();
this.getBaseInfo();
// this.getEndTime();
this.getOrderList();
this.getEndTime();
},
onPrizeBtnClick() {
my.navigateTo({
url: '/pages/myprize/myprize'
});
},
showRuleModal() {
this.setData({
ruleModalVisible: true
})
},
ruleModalClose() {
this.setData({
ruleModalVisible: false
})
},
// 减楼层
reduceFloor(){
let {canBuyFloor} = this.data
if(canBuyFloor > 1){
reduceFloor() {
let { canBuyFloor } = this.data
if (canBuyFloor > 1) {
this.setData({
canBuyFloor:canBuyFloor - 1
canBuyFloor: canBuyFloor - 1
})
}
},
// 加楼层
addFloor(){
let {canBuyFloor} = this.data;
if(canBuyFloor < 100){
addFloor() {
let { canBuyFloor } = this.data;
if (canBuyFloor < 100) {
this.setData({
canBuyFloor:canBuyFloor + 1
canBuyFloor: canBuyFloor + 1
})
}
},
// 购买记录弹窗
orderRecord(){
orderRecord() {
// let {orderModalVisible} = this.data
console.log('click',this.data)
// 点击弹窗时调用接口
// console.log('click',this.data)
this.setData({
orderModalVisible:true
orderModalVisible: true
})
},
// 关闭弹窗
orderModalClose(){
orderModalClose() {
this.setData({
orderModalVisible:false
orderModalVisible: false
})
},
// 购买楼层
async buyFloors(){
async buyFloors() {
// 购买楼层数
let {canBuyFloor} = this.data
let { canBuyFloor } = this.data
// 判断会员等级
let {isVip,grade,gradeName,gradeCredits} = await API.getVipInfo() || {};
let { data } = await API.getVipInfo() || {};
let grade = data.grade;
let url = data.url;
let gradeName = data.gradeName;
let gradeCredits = data.gradeCredits;
console.log(data, 'grade');
// await API.submit({ floor: canBuyFloor, grade: grade }).catch((res) => {
// console.log('res', res);
// // console.log(this.data.vipCredits, 'vip')
// })
API.submit({floor:canBuyFloor,grade:grade}).catch((res)=>{
console.log(res);
// let {message,data,code,success} = await API.submit({ floor: canBuyFloor, grade: grade }) || {};
this.setData({
vipCredits: {
grade,
gradeName,
gradeCredits,
canBuyFloor
}
})
// 显示
this.setData({
orderNowModalVisible:true
orderNowModalVisible: true
})
},
// 获取奖品列表数据
async getBaseInfo(){
async getBaseInfo() {
let listStyleArr = []
let {data} = await API.getActivityBaseInfoById() || {};
console.log(data,'data')
let { data } = await API.getActivityBaseInfoById() || {};
console.log(data, 'data')
let list = data.list;
let prize = data.prize;
// startTime = data.startTime;
// endingTime = data.endTime;
for(let i=0;i<list.length;i++){
for (let i = 0; i < list.length; i++) {
let listStyle = {
left: 200*i + 'rpx',
width: 200 + 'rpx',
height: 200 + 'rpx',
position:'absolute',
color:'white',
textAlign:'center'
left: 180 * i + 'rpx',
width: 150 + 'rpx',
height: 150 + 'rpx',
position: 'absolute',
color: 'white',
textAlign: 'center'
}
// listStyleArr.push(listStyle);
list[i].liststyle = listStyle;
......@@ -123,24 +170,91 @@ Page({
// }
// }
this.setData({
prizeList:list,
startTime:data.startTime,
endingTime:data.endingTime
prizeList: list,
startTime: data.startTime,
endingTime: data.endingTime
})
},
// 获取购买记录信息
async getOrderList() {
let { data } = await API.getBuyFloorList() || {};
console.log('buy', data);
// 购买时间
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'
}
}
data[i].order = orderStyle;
}
this.setData({
orderList: data,
// orderStyle:orderStyleArr
})
},
// 用户当前积分
async getUserCredits() {
console.log('zhxing')
// await API.getCredits().catch((res) => {
// console.log('resdata', res)
// // if(res.success)
// let data = res.data;
// this.setData({
// userCredits:data
// })
// })
let {message,data,code,success} = await API.getCredits() || {};
console.log(code,data,message,success,'ret')
this.setData({
userCredits:data
})
},
// 关闭立即购买
orderNowModalClose(){
orderNowModalClose() {
this.setData({
orderNowModalVisible:false
orderNowModalVisible: false
})
},
// 倒计时
getEndTime() {
let {prizeList,endingTime} = this.data
let { prizeList, endingTime } = this.data
if (!prizeList || !prizeList.length) return null
// const endTime = prizeList[0].expiredTime
// if (!endTime) return null
......@@ -166,27 +280,27 @@ Page({
let hh = t2.padStart(2, '0');
let mm = t3.padStart(2, '0');
let ss =t4.padStart(2, '0');
let ss = t4.padStart(2, '0');
let timer = setTimeout(()=>{
let timer = setTimeout(() => {
this.setData({
stringTime: stringTime - 1
})
console.log(stringTime,'stringTime');
console.log(stringTime, 'stringTime');
if(stringTime <= 0){
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
endTime: {
d: d1,
h: hh,
m: mm,
s: ss
}
})
},1000)
}, 1000)
}
......
{
"usingComponents": {
"order-record":"/components/comgou_mai_ji_lu32/comgou_mai_ji_lu32",
"order-now":"/components/comhui_yuan/comhui_yuan"
"order-now":"/components/comhui_yuan/comhui_yuan",
"rule-modal": "/components/comyou_xi_gui_ze27/comyou_xi_gui_ze27"
}
}
\ No newline at end of file
......@@ -4,6 +4,24 @@
opacity: 1;
position: absolute;
}
.jie_shu_ye .jiang_pinicon {
width: 136rpx;
height: 48rpx;
opacity: 1;
left: 600rpx;
top: 221rpx;
position: absolute;
}
.jie_shu_ye .gui_zeicon {
width: 136rpx;
height: 48rpx;
opacity: 1;
left: 17rpx;
top: 221rpx;
position: absolute;
}
.jie_shu_ye .di_kao_bei3 {
width: 750rpx;
height: 1624rpx;
......
<view class="jie_shu_ye">
<image class="di_kao_bei3" src={{resList['66f2b76f-7265-4cb2-9b4d-7e8207ab1d74'].url}} />
<image onTap="onPrizeBtnClick" class="jiang_pinicon" src={{resList['b7517eae-3bc2-4456-935a-e6e3e1fe995e'].url}} />
<image class="gui_zeicon" onTap="showRuleModal" src={{resList['d826a2f1-a3ec-4764-aad2-f6cacc43cfce'].url}} />
<view class="dao_ji_shi69">
<image class="di74" src={{resList['ad6e754e-6243-4acf-9ffd-9a7aeb3f4971'].url}} />
<label class="tu_ceng2273">22</label>
......@@ -48,16 +52,16 @@
<label class="ba_la_kao_bei4">巴***拉</label> -->
<!-- 有中奖用户 -->
<view a:for="{{prizeMenu}}" a:for-index="idx" a:for-item="prizeItem">
<label>第{{prizeItem.floor}}层</label>
<label>用户名{{prizeItem.username}}</label>
<image src={{prizeItem.image}}></image>
<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>
</view>
<view class="wei_zhong_jiang">
<!-- <view class="wei_zhong_jiang">
<label class="zong_lou_ceng_bu_zu_wu_ren_zhong_jiang">总楼层不足,无人中奖</label>
</view>
</view> -->
</view>
</view>
<!-- 购买记录组件 -->
......@@ -84,8 +88,8 @@
<label class="tu_ceng200_kao_bei3">200</label>
<label class="tu_ceng09_yue15_ri_kao_bei3">09 月 15日</label> -->
<view class="item" a:for="{{orderList}}" a:for-index="index" a:for-item="item" >
<label style="{{item.order.orderDay}}">{{item.createTime}}</label>
<view class="item" 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>
......@@ -94,3 +98,5 @@
</view>
<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
......@@ -11,9 +11,12 @@ Page({
// 购买记录列表
orderList:[],
// 中奖名单
prizeMenu:[],
prizeMenu:'',
// 购买列表渲染
orderStyle:[]
orderStyle:[],
ruleModalVisible: false,
// myPrizeBtnVisible: false,
},
onLoad(props) {
......@@ -22,75 +25,135 @@ Page({
resList: resList
});
// const {prize,openPrizeStatus,isShowPrize} = JSON.parse(props.data)
// if(isShowPrize){
// if(prize){
// this.setData({prizeVisible:true})
// } else {
// this.setData({
// noprizeVisible:true,
// openPrizeStatus:openPrizeStatus
// })
// }
// }
this.getOrderList();
// this.getPrizeMenu();
this.getPrizeMenu();
},
onPrizeBtnClick() {
my.navigateTo({
url: '/pages/myprize/myprize'
});
},
showRuleModal() {
this.setData({
ruleModalVisible: true
})
},
ruleModalClose() {
this.setData({
ruleModalVisible: false
})
},
// 获取购买记录
async getOrderList(){
let {data} = await API.getBuyFloorList() || {};
let orderStyleArr = [];
async getOrderList() {
let { data } = await API.getBuyFloorList() || {};
console.log('buy', data);
// 购买时间
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++){
for (let i = 0; i < lens; i++) {
let orderStyle = {
orderDay:{
orderDay: {
left: 0,
top: 40*i+'rpx',
position:'absolute',
color:'white'
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
orderFloor:{
left: 200+'rpx',
top: 40*i + 'rpx',
position:'absolute',
color:'white'
orderFloor: {
left: 200 + 'rpx',
top: 40 * i + 'rpx',
position: 'absolute',
color: 'white'
},
orderCredits:{
left:400 + 'rpx',
orderCredits: {
left: 400 + 'rpx',
top: 40 * i + 'rpx',
position:'absolute',
color:'white'
position: 'absolute',
color: 'white'
}
}
// orderStyleArr.push(orderStyle);
data[i].order = orderStyle;
}
// 合并样式
// for(let i=0;i<lens;i++){
// data[i].order = orderStyleArr[i];
// }
this.setData({
orderList:data,
orderList: data,
// orderStyle:orderStyleArr
})
},
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].uerNick;
if(userName.length >= 2){
let firstLetter = userName.subStr(0,1);
let lastLetter = userName.reverse().subStr(0,1);
userName = firstLetter + '***' + lastLetter;
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)
}
personMenuArr.push(userName);
}
console.log(floorPrize,'arr')
// 处理好的姓名合并到floorPrize
if(floorPrize != null){
for(var floorprize of floorPrize){
for(var usernames of personMenuArr){
floorprize.username = usernames;
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'
}
}
floorPrize[i].prizestyle = prizeStyle;
}
console.log(floorPrize,'arr')
this.setData({
prizeMenu:floorPrize
})
}
});
\ No newline at end of file
{
"usingComponents": {
"prize-modal": "/components/comgong_xi_huo_jiang/comgong_xi_huo_jiang",
"noprize-modal": "/components/comhen_yi_han23/comhen_yi_han23"
"noprize-modal": "/components/comhen_yi_han23/comhen_yi_han23",
"rule-modal": "/components/comyou_xi_gui_ze27/comyou_xi_gui_ze27"
}
}
\ No newline at end of file
......@@ -43,6 +43,19 @@
top: 328rpx;
position: absolute;
}
.shou_ye .can_yu_ren_shu {
width: 300rpx;
height: 40rpx;
opacity: 1;
display: block;
left: 224rpx;
top: 1364rpx;
position: absolute;
transform-origin: 0rpx 0rpx 0rpx;
font-size: 30rpx;
text-align: center;
color: white;
}
.shou_ye .jiang_pinicon {
width: 136rpx;
height: 48rpx;
......
......@@ -6,6 +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>
</view>
<rule-modal a:if="{{ruleModalVisible}}" onModalClose="ruleModalClose"><text>案文文案文案文案文案文案文案文案文案文案文案</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
......@@ -12,7 +12,10 @@ Page({
ruleModalVisible: false,
myPrizeBtnVisible: false,
startBtnVisible: false,
ruleModalBtnVisible: false
ruleModalBtnVisible: false,
ruleData:'',
joinCount:''
},
onLoad(query) {
......@@ -22,10 +25,12 @@ Page({
// 页面加载
this.getAuth();
console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
},
gotoVipPage() {
API.getVipInfo().then(res => {
if (!res.isVip)
if (!!res.isVip)
navigateToOutside(res.url)
else
my.redirectTo({ url: '/pages/pagehuo_dong_ye/pagehuo_dong_ye' });
......@@ -55,7 +60,7 @@ Page({
})
},
async init() {
const [{ data: { isUserJoin, endTime, openPrizeStatus, prize, isShowPrize } }, vipInfo] = await Promise.all([
const [{ data: { isUserJoin, endTime, openPrizeStatus, prize, isShowPrize, rule, joinCount } }, vipInfo] = await Promise.all([
API.getActivityBaseInfoById(),
API.getVipInfo(),
]);
......@@ -76,6 +81,11 @@ Page({
})
};
this.setData({
ruleData:rule,
joinCount:joinCount
})
},
/**
* 登录接口
......@@ -106,6 +116,6 @@ Page({
app.avatar = avatar;
this.login();
}
}
},
});
\ No newline at end of file
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