Commit a538d8b1 authored by wildfirecode13's avatar wildfirecode13

1

parent f46234af
'use strict';
import resList from '../../resconfig/resList';
import resList from '../../resconfig/resList';
import API from '../../api';
Page({
data: {
prizeVisible:false,
noprizeVisible:false,
openPrizeStatus:0,
prizeVisible: false,
noprizeVisible: false,
openPrizeStatus: 0,
// 购买记录列表
orderList:[],
orderList: [],
// 中奖名单
prizeMenu:[],
prizeMenu: [],
// 购买列表渲染
orderStyle:[]
orderStyle: []
},
onLoad(props) {
// console.log('fuck',JSON.parse(props.prize))
console.log('fuck', JSON.parse(props.data));
const { prize, openPrizeStatus, isShowPrize } = JSON.parse(props.data);
if (isShowPrize) {
if (prize) {
this.setData({ prizeVisible: true })
} else {
this.setData({
noprizeVisible: true,
openPrizeStatus: openPrizeStatus
})
}
}
this.setData({
resList: resList
});
this.getOrderList();
// this.getPrizeMenu();
},
// 获取购买记录
async getOrderList(){
let {data} = await API.getBuyFloorList() || {};
async getOrderList() {
let { data } = await API.getBuyFloorList() || {};
let orderStyleArr = [];
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);
......@@ -60,36 +73,36 @@ Page({
// data[i].order = orderStyleArr[i];
// }
this.setData({
orderList:data,
orderList: data,
// orderStyle:orderStyleArr
})
},
async getPrizeMenu(){
let {data} = await API.getFloorPrize() || {};
async getPrizeMenu() {
let { data } = await API.getFloorPrize() || {};
// 用户名单处理
let floorPrize = data;
var personMenuArr = [];
for(let i=0; i<floorPrize.length;i++){
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);
if (userName.length >= 2) {
let firstLetter = userName.subStr(0, 1);
let lastLetter = userName.reverse().subStr(0, 1);
userName = firstLetter + '***' + lastLetter;
}
personMenuArr.push(userName);
}
console.log(floorPrize,'arr')
console.log(floorPrize, 'arr')
// 处理好的姓名合并到floorPrize
if(floorPrize != null){
for(var floorprize of floorPrize){
for(var usernames of personMenuArr){
if (floorPrize != null) {
for (var floorprize of floorPrize) {
for (var usernames of personMenuArr) {
floorprize.username = usernames;
}
}
}
this.setData({
prizeMenu:floorPrize
prizeMenu: floorPrize
})
}
......
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