diff --git a/app.wxss b/app.wxss index 9b0bd37..5e585fb 100644 --- a/app.wxss +++ b/app.wxss @@ -16,6 +16,12 @@ .pdt20 { padding-top: 20rpx; } +.pdt30 { + padding-top: 30rpx; +} +.pdt40 { + padding-top: 40rpx; +} .pdb0 { padding-bottom: 0 !important; } @@ -299,10 +305,18 @@ button { .t-c { text-align: center; } +.img-block { + width: 100%; + height: 100%; + display: block; +} .ai_and{ align-items: flex-end; } +.ai_end{ + align-items: flex-end; +} .cover-layer { position: fixed; left: 0; @@ -613,7 +627,7 @@ background: #ffe3e2; font-size: 22rpx; } .fs24{ - font-size: 24rpx; + font-size: 24rpx !important; } .fs26{ @@ -652,12 +666,12 @@ background: #ffe3e2; align-items: flex-end; } .fs45{ - font-size: 45rpx; + font-size: 45rpx !important; } .fs50{ - font-size: 50rpx; + font-size: 50rpx !important; } -.fs60{ font-size:60rpx;} +.fs60{ font-size:60rpx !important;} .fs80 {font-size: 80rpx;} .flex-wrap, .wrap { @@ -689,9 +703,9 @@ background: #ffe3e2; /* 图标字体(ty) */ @font-face { font-family: 'iconfont'; /* Project id 2054717 */ - src: url('//at.alicdn.com/t/font_2054717_l5nx11noek8.woff2?t=1626055955086') format('woff2'), - url('//at.alicdn.com/t/font_2054717_l5nx11noek8.woff?t=1626055955086') format('woff'), - url('//at.alicdn.com/t/font_2054717_l5nx11noek8.ttf?t=1626055955086') format('truetype'); + src: url('//at.alicdn.com/t/font_2054717_nzwl8grylfi.woff2?t=1627287108388') format('woff2'), + url('//at.alicdn.com/t/font_2054717_nzwl8grylfi.woff?t=1627287108388') format('woff'), + url('//at.alicdn.com/t/font_2054717_nzwl8grylfi.ttf?t=1627287108388') format('truetype'); } .iconfont { @@ -702,6 +716,20 @@ background: #ffe3e2; -moz-osx-font-smoothing: grayscale; } +.icon-guan:before { + content: "\e612"; +} + +.icon-gouwuche:before { + content: "\e617"; +} + +.icon-zhuanfa:before { + content: "\e611"; +} + + + .icon-zhuanpan:before { content: "\e642"; } diff --git a/packageB/pages/luckactivity/index/g_filter.wxs b/packageB/pages/luckactivity/index/g_filter.wxs index 9719e7d..5855a19 100644 --- a/packageB/pages/luckactivity/index/g_filter.wxs +++ b/packageB/pages/luckactivity/index/g_filter.wxs @@ -20,10 +20,27 @@ var g_filters = { var tnow=getDate(); if(t1>=tnow) return 1; return 0; - } + }, + btnText: function(userlbtype) { + switch(userlbtype) { + case 1: { + return '去兑换'; + }; + case 2: { + return '已兑换'; + }; + case 3: { + return '已到期'; + }; + case 4: { + return '查看'; + }; + }; + }, } module.exports = { has_char: g_filters.has_char, beg_time: g_filters.beg_time, end_time: g_filters.end_time, + btnText: g_filters.btnText, } \ No newline at end of file diff --git a/packageB/pages/luckactivity/index/index.js b/packageB/pages/luckactivity/index/index.js index 222d866..b9d8f7d 100644 --- a/packageB/pages/luckactivity/index/index.js +++ b/packageB/pages/luckactivity/index/index.js @@ -23,6 +23,7 @@ Page({ let url = '/api/weshop/marketing/marketingLuckForm/page'; let data = { store_id: app.globalData.setting.stoid, + user_id: app.globalData.userInfo.user_id, }; this.setData({ @@ -79,6 +80,7 @@ Page({ let url = '/api/weshop/marketing/marketingLuckForm/page'; let data = { store_id: app.globalData.setting.stoid, + user_id: app.globalData.userInfo.user_id, is_end: 0, }; diff --git a/packageB/pages/luckactivity/index/index.wxml b/packageB/pages/luckactivity/index/index.wxml index c9ab532..8c4b17f 100644 --- a/packageB/pages/luckactivity/index/index.wxml +++ b/packageB/pages/luckactivity/index/index.wxml @@ -19,11 +19,14 @@ - + + + + - {{item.act_name}} + {{item.act_name}} 活动时间:{{filter.format_time(item.begindate) + ' 至 ' + filter.format_time(item.enddate)}} 兑换时间:{{filter.format_time(item.begindate) + ' 至 ' + filter.format_time(item.enddate)}} @@ -31,7 +34,7 @@ 立即参与 - 去兑换 + {{g_filter.btnText(item.userlbtype)}} diff --git a/packageB/pages/luckactivity/index/index.wxss b/packageB/pages/luckactivity/index/index.wxss index 0c76dbb..ea67f4a 100644 --- a/packageB/pages/luckactivity/index/index.wxss +++ b/packageB/pages/luckactivity/index/index.wxss @@ -104,25 +104,28 @@ page { .img-container { /* background-color: #dedede; */ /* height: 300rpx; */ - width: 100%; - height: 200rpx; + width: 160rpx; + height: 160rpx; + line-height: 160rpx; + text-align: center; } .img-container2 { - width: 200rpx; + /* width: 200rpx; height: 200rpx; background-color: #dedede; margin-right: 20rpx; flex-shrink: 0; display: flex; align-items: center; - position: relative; + justify-content: center; + position: relative; */ } .img-container2.error::before { - font-family: iconfont; + /* font-family: iconfont; position: absolute; - content: '\e8c1'; + content: '\e8c1'; */ } .img { @@ -178,4 +181,9 @@ page { color: #bbb; text-align: center; font-size: 22rpx; +} + +.btn.gray { + background-color: #aaa; + color: white; } \ No newline at end of file diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.js b/packageB/pages/luckactivity/luckinfo/luckinfo.js index 3f30273..1d4e6e6 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.js +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.js @@ -1,3 +1,4 @@ +var WxParse = require('../../../../utils/wxParse/wxParse.js'); const app = getApp(); let imghost = app.globalData.setting.imghost; let self = null; @@ -10,6 +11,7 @@ Page({ noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 pageNum: 1, // 当前页数 imghost: imghost, + num: 3, prizes: [], defaultConfig: { @@ -55,14 +57,14 @@ Page({ }, onLoad(options) { - console.log('imghost+++++', imghost); + // console.log('imghost+++++', imghost); self = this; this.data.options = options; // this.setData({ // options, // imghost, // }); - console.log('this data', this.data.imghost); + // console.log('this data', this.data.imghost); wx.setNavigationBarTitle({ title: options.title, }); @@ -96,6 +98,7 @@ Page({ self.setData({ luckInfo: res.data.data, }); + WxParse.wxParse('content', 'html', self.data.luckInfo.remark, self); } else { wx.showToast({ title: res.data.msg, @@ -195,7 +198,17 @@ Page({ // 设置转盘奖品布局 prizeLayout(award) { let prizes = []; - let length = award.length; + // let length = award.length; + if(award) { + var length = award.length; + } else { + wx.showToast({ + title: '请设置奖品', + icon: 'none', + }); + return; + }; + let thx = {fonts: [{ text: '谢谢\n参与', top: '18%', wordWrap:false, fontColor: 'rgba(255,255,255,.6)'}]}; if(length == 1) { @@ -441,7 +454,7 @@ Page({ results.push(pos);//找到就存储索引 }; - pos+=1;//并从下个位置开始搜索 + pos += 1;//并从下个位置开始搜索 // if(pos === -1){//未找到就退出循环完成搜索 // break; // }; @@ -462,7 +475,15 @@ Page({ return; }; - if(this.data.luckInfo.user_LuckNumDay != 0) { + if(this.data.luckInfo.msgInfo) { + wx.showToast({ + title: this.data.luckInfo.msgInfo, + icon: 'none', + }); + return; + }; + + if(this.data.luckInfo.user_LuckNumDay > 0 || this.data.luckInfo.vip_act_num == 0) { // console.log('start choujiang'); // let start = false; if(!this.data.start) { @@ -484,8 +505,16 @@ Page({ if(res.data.code == 0) { console.log('开始摇奖', res.data.data); + if(self.data.luckInfo.vip_act_num != 0) { + self.setData({ + 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, + // isActive: true, + }); + }; + self.setData({ - 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1 + // 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, + isActive: true, }); // console.log('请求成功', res.data.data); let luckyId = res.data.data.id; @@ -502,8 +531,34 @@ Page({ }, 3000); + //获取兑奖记录 + // app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { + // isShowLoading: false, + // data: { + // store_id: app.globalData.setting.stoid, + // user_id: app.globalData.userInfo.user_id, + // luck_formid: self.data.options.id, + // luck_state: 1 + // }, + // success: function(res) { + // if(res.data.code == 0) { + // // console.log('res===>', res.data.data.pageData); + // self.setData({ + // record: res.data.data.pageData, + // }); + // }; + // }, + // }); + + } else { // console.log('请求出错'); + if(self.data.luckInfo.vip_act_num != 0) { + self.setData({ + 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, + }); + }; + let thxIndexArr = self.data.thxIndexArr; const random = Math.random() * thxIndexArr.length >> 0; const index = thxIndexArr[random]; @@ -516,8 +571,12 @@ Page({ }; }, - fail: function() { + fail: function(res) { // console.log('出错'); + wx.showToast({ + title: '数据请求失败', + icon: 'error', + }); let thxIndexArr = self.data.thxIndexArr; const random = Math.random() * thxIndexArr.length >> 0; const index = thxIndexArr[random]; @@ -543,6 +602,7 @@ Page({ end (event) { // 中奖奖品详情 // console.log('zjiangla~~',event.detail.lbtype); + let no_luck_urltype = this.data.luckInfo.no_luck_urltype; let lbtype; let resultTitle = event.detail.fonts[0].text.replace('\n',''); if(event.detail.lbtype == 5) { @@ -551,12 +611,45 @@ Page({ lbtype = -1; }; this.setData({ + num: 3, hiddenCanvas: true, showResult: true, showMask: true, resultTitle, currentLbtype: lbtype, }); + + let num = this.data.num; + let timer = setInterval(function() { + if(num == 0) { + clearInterval(); + } else { + self.setData({ + num: --num, + }); + } + }, 1000); + + + if(no_luck_urltype == 1) { + if(this.data.luckInfo.no_luck_weappurl) { + // console.log('dfjsoafjoasfjds======>',this.data.luckInfo.no_luck_weappurl); + let num = this.data.num; + let url = this.data.luckInfo.no_luck_weappurl; + self.timer = setInterval(function() { + if(num == 0) { + clearInterval(); + app.goto(url); + } else { + self.setData({ + num: --num, + }); + } + }, 1000); + + }; + }; + }, showPopup() { @@ -570,39 +663,23 @@ Page({ user_id: app.globalData.userInfo.user_id, luck_formid: this.data.options.id, luck_state: 1, - pageSize: 50, }).then(function(res) { self.setData({ showPopup: true, showMask: true, hiddenCanvas: true, - // record: self.data.list.pageData, }); }); - // app.request.get('/api/weshop/marketing/marketingLuckRecord/page', { - // // isShowLoading: false, - // data: { - // store_id: app.globalData.setting.stoid, - // user_id: app.globalData.userInfo.user_id, - // luck_formid: this.data.options.id, - // luck_state: 1 - // }, - // success: function(res) { - // // console.log('中奖记录', res.data.data); - // if(res.data.code == 0) { - // self.setData({ - // showPopup: true, - // showMask: true, - // hiddenCanvas: true, - // record: self.data.list.pageData, - // }); - - - // }; - // }, - + + // this.setData({ + // showPopup: true, + // showMask: true, + // hiddenCanvas: true, + // 'list.pageData': this.data.record, + // // record: self.data.list.pageData, // }); + }, closePopup() { @@ -613,8 +690,13 @@ Page({ }); }, + /** + * 关闭中奖结果 + */ closeResult() { + clearInterval(this.timer); this.setData({ + num: 3, showResult: false, showMask: false, hiddenCanvas: false, @@ -627,7 +709,6 @@ Page({ user_id: app.globalData.userInfo.user_id, luck_formid: this.data.options.id, luck_state: 1, - pageSize: 50, }); }, diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml index aa67f42..f86878b 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml @@ -36,27 +36,27 @@ hiddenCanvas="{{hiddenCanvas}}" /> - - 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 + 今天你有 不限次 抽奖机会 + 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 - + - + {{item.luck_goods_name}} 价值:{{item.luck_goods_price}} - 数量:{{item.luck_goods_qty}} + 数量:{{item.num}} @@ -65,8 +65,10 @@ - - {{luckInfo.remark}} + + + +