diff --git a/components/diy_store_select/diy_store_select.js b/components/diy_store_select/diy_store_select.js index fdc6784..c83e633 100644 --- a/components/diy_store_select/diy_store_select.js +++ b/components/diy_store_select/diy_store_select.js @@ -44,10 +44,6 @@ Component({ //获取顶部的门店 getApp().get_user_store(function(){ - var top_store=getApp().globalData.pk_store; - if(top_store){ - th.setData({top_store:top_store}); - }else{ wx.getLocation({ type: 'gcj02', success: function(res) { @@ -61,9 +57,12 @@ Component({ } } }) - } + }) }, + + + //-- 设置最近的店为默认的店,一开始加载的时候 -- set_fir_store_to_def(){ var th=this; @@ -74,7 +73,13 @@ Component({ page:1, }; dd.lat = th.data.lat; - dd.lon = th.data.lon; + dd.lon = th.data.lon; + + var top_store=getApp().globalData.pk_store; + if(top_store){ + dd.pickup_id=top_store.pickup_id; + } + //----------获取门店,最近的门店---------------- getApp().request.promiseGet("/api/weshop/pickup/list", { data: dd, @@ -173,8 +178,7 @@ Component({ this.deal_pickup(this.data.all_pick_list,func) return false; } - var th = this,that=this; - var i = getApp().request; + var th = this,that=this; var dd = { store_id: o.stoid, isstop: 0, diff --git a/components/diy_store_select/diy_store_select.wxml b/components/diy_store_select/diy_store_select.wxml index 8db133f..b56406c 100644 --- a/components/diy_store_select/diy_store_select.wxml +++ b/components/diy_store_select/diy_store_select.wxml @@ -1,3 +1,5 @@ + + @@ -51,7 +53,7 @@ - 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}} + 距离: {{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}} 地址:{{item.fulladdress}} diff --git a/packageB/components/painter/painter.js b/packageB/components/painter/painter.js index f24fa86..2c00c0b 100644 --- a/packageB/components/painter/painter.js +++ b/packageB/components/painter/painter.js @@ -746,7 +746,7 @@ Component({ fail: (error) => { // 如果图片坏了,则直接置空,防止坑爹的 canvas 画崩溃了 view.url = ""; - console.error(`getImageInfo ${view.url} failed, ${JSON.stringify(error)}`); + // console.error(`getImageInfo ${view.url} failed, ${JSON.stringify(error)}`); }, complete: () => { completeCount++; diff --git a/packageB/images/luckDraw/jiang.png b/packageB/images/luckDraw/jiang.png new file mode 100644 index 0000000..78b4218 --- /dev/null +++ b/packageB/images/luckDraw/jiang.png diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.js b/packageB/pages/luckactivity/luckinfo/luckinfo.js index d36d23b..40033af 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.js +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.js @@ -1,10 +1,223 @@ +var util = require("../../../../utils/util.js"); var WxParse = require('../../../../utils/wxParse/wxParse.js'); const app = getApp(); let imghost = app.globalData.setting.imghost; let self = null; +let imgDraw = { + "width": "554px", + "height": "899px", + "background": imghost + "miniapp/images/share_bg.png", + "views": [ + { //0.头像 + "type": "image", + // "url": "", + "css": { + "background": "white", + "width": "80px", + "height": "80px", + "top": "24px", + "left": "40px", + "borderRadius": "80px", + } + }, + { //1.昵称 + "type": "text", + "text": "", + "css": { + "color": "#000000", + "width": "400px", + "top": "25px", + "left": "140px", + "fontSize": "26px", + "maxLines": "1", + } + }, + { //2.强烈推荐 + "type": "text", + "text": "强烈推荐", + "css": { + "color": "#fff", + "background": "#FF6768", + "width": "105px", + "height": "26px", + "lineHeight": "26px", + "top": "70px", + "left": "140px", + "borderRadius": "10px", + "fontSize": "18px", + "textAlign": "center" + + } + }, + { //3.分享标题 + "type": "text", + "text": "", + "css": { + "width": "554px", + "padding": "20px", + "left": "20px", + "top": "160px", + "fontSize": "28px", + "textAlign": "left", + "maxLines": "1", + } + }, + { //4.分享内容 + "type": "text", + // "text": "", + "css": { + "color": "#000000", + "width": "554px", + "padding": "20px", + "left": "20px", + "top": "190px", + "fontSize": "26px", + "textAlign": "center", + "maxLines": "1", + } + }, + { //5.分享图片 + "type": "image", + "url": "/packageB/images/luckDraw/jiang.png", + "css": { + "width": "auto", + "height": "350px", + "top": "230px", + "left": "277px", + "align": "center", + "mode": "aspectFill", + } + }, + { //6 + "type": "image", + "url": "/images/share/s_gou.png", + "css": { + "width": "30px", + "height": "30px", + "top": "620px", + "left": "18px", + "rotate": "0", + "borderRadius": "30px", + } + }, + { //7 + "type": "text", + "text": "正品保障", + "css": { + "color": "red", + "width": "110px", + "top": "620px", + "left": "52px", + "fontSize": "22px", + } + }, + { //8 + "type": "image", + "url": "/images/share/s_gou.png", + "css": { + "width": "30px", + "height": "30px", + "top": "620px", + "left": "208px", + "borderRadius": "30px", + } + }, + { //9 + "type": "text", + "text": "纯实体店", + "css": { + "color": "red", + "width": "129px", + "top": "620px", + "left": "243px", + "fontSize": "22px", + } + }, + { //10 + "type": "image", + "url": "/images/share/s_gou.png", + "css": { + "width": "30px", + "height": "30px", + "top": "620px", + "left": "410px", + "borderRadius": "30px", + } + }, + { //11 + "type": "text", + "text": "官方验证", + "css": { + "color": "red", + "width": "121px", + "top": "620px", + "left": "450px", + "fontSize": "22px", + } + }, + { //12.横线 + "type": "rect", + "css": { + "background": "#f0f0f0", + "width": "554px", + "height": "1px", + "top": "676px", + "left": "0px", + } + }, + { //13 + "type": "text", + "text": "特惠活动时间仅限", + "css": { + "color": "#000000", + "width": "245px", + "top": "730px", + "left": "28px", + "fontSize": "24px", + "textAlign": "left" + } + }, + { //14.时间 + "type": "text", + // "text": "", + "css": { + "width": "377px", + "top": "770px", + "left": "28px", + "fontSize": "24px", + } + }, + { //15 + "type": "text", + "text": "长按识别小程序码有惊喜哦!", + "css": { + "color": "#7c7c7c", + "width": "348px", + "top": "810px", + "left": "27px", + "fontSize": "24px", + } + }, + + { //16.码 + "type": "image", + // "url": "", + "css": { + "width": "150px", + "height": "150px", + "top": "705px", + "left": "380px", + "mode": "scaleToFill" + } + }, + + ] + }; + Page({ data: { + imgDraw: imgDraw, start: false, list: null, isLoading: false, // 检测是否已经发送请求,防止重复发送请求 @@ -12,6 +225,8 @@ Page({ pageNum: 1, // 当前页数 imghost: imghost, num: 3, + canStart: false, + prizes: [], defaultConfig: { @@ -63,7 +278,10 @@ Page({ // }); // console.log('imghost+++++', imghost); self = this; + let first_leader = null; this.data.options = options; + + // this.setData({ // options, // imghost, @@ -72,28 +290,58 @@ Page({ wx.setNavigationBarTitle({ title: options.title, }); + + app.isLogin().then(function(data) {//进入页面前已经授权登录成功 self.setData({ userInfo: data, - // imghost, }); }); + + + + //从分享的跳转过来 + if (options.id == undefined || options.id == null || options.id == '') { + var scene = decodeURIComponent(options.scene); + scene = scene.split('_'); + first_leader = scene[0]; + this.data.options.id = scene[1]; + }; + + if(first_leader) { + // console.log("log---", first_leader); + app.globalData.first_leader = first_leader; + //调用接口判断是不是会员 + app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid +"/" + first_leader,{}).then(res=>{ + if(res.data.code==0){ + app.globalData.guide_id = res.data.data.id; + } + }) + }; + + + + + }, onShow() { + // console.log('show~~`'); if(app.globalData.userInfo) { if(!this.data.isLogin) { - this.setData({ userInfo: app.globalData.userInfo, isLogin: true, + 'imgDraw.views[0].url': app.globalData.userInfo.head_pic,//头像 + 'imgDraw.views[1].text': app.globalData.userInfo.nickname,//昵称 }); - // console.log('imghost', this.data.imghost); let user_id = app.globalData.userInfo.user_id; let store_id = app.globalData.setting.stoid; let id = this.data.options.id; let url = `/api/weshop/marketing/marketingLuckForm/getLuckInfo/${store_id}/${id}/${user_id}`; + + app.request.get(url, { @@ -114,33 +362,89 @@ Page({ // console.log('luckInfo', res.data.data); let luckInfo = res.data.data; - + self.setData({ + 'imgDraw.views[3].text': self.data.luckInfo.act_name,//分享标题 + // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容 + 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 + }); + + + let luckStyle = null; if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板 - let url = `/api/weshop/marketing/marketingLuckTemplate/get/${store_id}/${luckInfo.template_id}`; + let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`; app.request.get(url, { success: function(res) { - // console.log('prizes//////', res.data.data); - self.setData({ - template: res.data.data, - bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 - 'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 - 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 - }); + let template = null; + if(res.data.code == 0) { + template = res.data.data; + self.setData({ + template, + bannerUrl: imghost + template.bannerUrl, //背景图 + 'blocks[0].imgs[0].src': imghost + ((template&&template.wheelBaseUrl) ? template.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 + 'buttons[0].imgs[0].src': imghost + ((template&&template.wheelPointerUrl) ? template.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 + 'imgDraw.views[3].text': template.title, //分享标题 + 'imgDraw.views[5].url': imghost + (template&&template.share_image ? template.share_image:self.data.luckInfo.imageurl), //分享图片 + }); + + let color = template&&template.colorCode ? template.colorCode:'#da104b'; + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; + self.setData({ + luckStyle, + }); + // self.setData({ + // template: res.data.data, + // bannerUrl: imghost + res.data.data.bannerUrl, //背景图 + // //bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图 + // 'blocks[0].imgs[0].src': imghost + res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 + // 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 + // 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题 + // // 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享内容 + // 'imgDraw.views[5].url': (res.data.data&&res.data.data.share_image) ? (imghost + res.data.data.share_image):(self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packpageB/images/luckDraw/jiang.png'),//分享图片 + // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间 + // }); + } else { + luckStyle = `background: #da104b url(${imghost + 'miniapp/images/luckDraw/bg.png?v=2'}) no-repeat;`; + self.setData({ + luckStyle, + 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packageB/images/luckDraw/jiang.png', //分享图片 + //'blocks[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘 + //'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针 + }); + // let color = template&&template.colorCode ? template.colorCode:'#da104b'; + + // self.setData({ + // luckStyle, + // }); + }; + }, }); } else { - // wx.hideLoading(); + + if(luckInfo && luckInfo.imageurl) { + self.setData({ + 'imgDraw.views[5].url': imghost + self.data.luckInfo.imageurl, //分享图片 + }); + }; + if(luckInfo && luckInfo.store_bannerUrl) { self.setData({ bannerUrl: imghost + luckInfo.store_bannerUrl, + custom: true, + }); + } else { + self.setData({ + bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2', + custom: false, }); }; - // self.setData({ - // showMask2: false, - // hiddenCanvas: false, - // }); - + let color = self.data.custom ? '#f0f0f0':'#da104b'; + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`; + self.setData({ + luckStyle, + }); + }; @@ -149,7 +453,6 @@ Page({ title: self.data.luckInfo.msgInfo, icon: 'none', }); - // return; }; }, @@ -167,7 +470,7 @@ Page({ self.setData({ award, }); - console.log('award', award); + // console.log('award', award); self.prizeLayout(award); }, @@ -211,6 +514,24 @@ Page({ }, }); + let mainUrl = app.globalData.setting.url; + // let stoid = app.globalData.setting.stoid; + let cj_id = this.data.options.id; + // let user_id = app.globalData.userInfo.user_id; + + wx.getImageInfo({ + src: `${mainUrl}/api/wx/open/app/user/getWeAppEwm/${store_id}?sceneValue=${user_id}_${cj_id}&pageValue=pages/index/index/index`, + success (res) { + if(res.code != -1) { + self.setData({ + 'imgDraw.views[16].url': res.path, + }); + }; + + } + }); + + }; }; }, @@ -503,146 +824,184 @@ Page({ 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) { - this.data.start = true; - // 获取抽奖组件实例 - const $lucky = this.selectComponent('#myLucky'); - // 调用play方法开始旋转 - $lucky.play(); + // 获取积分 + app.request.promisePost('/api/weshop/marketing/marketingLuckForm/startLuckIntegral', { + isShowLoading: false, + data: { + storeId: app.globalData.setting.stoid, + userId: app.globalData.userInfo.user_id, + LuckId: this.data.options.id, + }, + }) + .then(function(res) { + if(res.data.code == -1) { + //积分不足,弹出提示 + self.data.luckInfo.msgInfo = res.data.msg + wx.showToast({ + title: res.data.msg, + icon: 'none', + }); + return; + }; + + if(res.data.code == 0) { - // 获取抽奖结果 - app.request.post('/api/weshop/marketing/marketingLuckForm/startLuck', { - isShowLoading: false, - data: { - storeId: app.globalData.setting.stoid, - userId: app.globalData.userInfo.user_id, - LuckId: this.data.options.id, - }, - success: function(res) { + if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) { + // console.log('start choujiang'); + // let start = false; + if(!self.data.start) { + self.data.start = true; + // 获取抽奖组件实例 + const $lucky = self.selectComponent('#myLucky'); + // 调用play方法开始旋转 + $lucky.play(); - 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, - isActive: true, - wow: res.data.data, - }); - // console.log('请求成功', res.data.data); - let luckyId = res.data.data.id; - let indexArr = self.luckyIndex(self.data.prizes, luckyId); - // console.log('抽奖奖品id', luckyId); - // console.log('奖品列表', self.data.prizes); - // console.log('奖品对应的索引数组', indexArr); - let random = Math.random() * indexArr.length >> 0; - // console.log('random', random); - let index = indexArr[random]; - setTimeout(() => { - $lucky.stop(index); - self.data.start = false; - }, 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 { - let thxIndexArr = self.data.thxIndexArr; - const random = Math.random() * thxIndexArr.length >> 0; - const index = thxIndexArr[random]; - // console.log('谢谢参与数组', thxIndexArr); - // console.log('请求出错产生谢谢参与的随机数', index); - setTimeout(() => { - $lucky.stop(index); - self.data.start = false; - }, 3000); - - + // 获取抽奖结果 + app.request.post('/api/weshop/marketing/marketingLuckForm/startLuck', { + isShowLoading: false, + data: { + storeId: app.globalData.setting.stoid, + userId: app.globalData.userInfo.user_id, + LuckId: self.data.options.id, + }, + success: function(res) { + + 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, + isActive: true, + wow: res.data.data, + }); + // console.log('wow', self.data.wow); + // console.log('请求成功', res.data.data); + let luckyId = res.data.data.id; + let indexArr = self.luckyIndex(self.data.prizes, luckyId); + // console.log('抽奖奖品id', luckyId); + // console.log('奖品列表', self.data.prizes); + // console.log('奖品对应的索引数组', indexArr); + let random = Math.random() * indexArr.length >> 0; + // console.log('random', random); + let index = indexArr[random]; + setTimeout(() => { + $lucky.stop(index); + self.data.start = false; + }, 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 { + let thxIndexArr = self.data.thxIndexArr; + const random = Math.random() * thxIndexArr.length >> 0; + const index = thxIndexArr[random]; + // console.log('谢谢参与数组', thxIndexArr); + // console.log('请求出错产生谢谢参与的随机数', index); + setTimeout(() => { + $lucky.stop(index); + self.data.start = false; + }, 3000); + + + + + if(res.data.code == -1) { + wx.showToast({ + title: res.data.msg, + icon: 'none', + }); + self.data.luckInfo.msgInfo = res.data.msg; + return; + // self.data.start = true; + }; + + + if(res.data.code == -2 && self.data.luckInfo.vip_act_num != 0) { + self.setData({ + 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, + }); + }; + + + }; + + }, - if(res.data.code == -1) { + fail: function(res) { + // console.log('出错'); wx.showToast({ - title: res.data.msg, - icon: 'none', - }); - self.data.luckInfo.msgInfo = res.data.msg; - return; - // self.data.start = true; - }; - // console.log('请求出错'); - if(res.data.code == -2 && self.data.luckInfo.vip_act_num != 0) { - self.setData({ - 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1, + title: '数据请求失败', + icon: 'error', }); - }; + let thxIndexArr = self.data.thxIndexArr; + const random = Math.random() * thxIndexArr.length >> 0; + const index = thxIndexArr[random]; + setTimeout(() => { + $lucky.stop(index); + self.data.start = false; + }, 3000); + }, - - }; - }, - - 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]; - setTimeout(() => { - $lucky.stop(index); - self.data.start = false; - }, 3000); - }, + + } - }); + + } else { + wx.showToast({ + title: '你今天的抽奖次数已用完啦!~', + icon: 'none', + }); + }; - } - - - } else { - wx.showToast({ - title: '你今天的抽奖次数已用完啦!~', - icon: 'none', - }); - }; + }; + }); + + + + + }, end (event) { // 中奖奖品详情 - console.log('00000000~',event.detail.lbtype); + console.log('抽奖结果:',event.detail); let no_luck_urltype = this.data.luckInfo.no_luck_urltype; - let lbtype; + let lbtype = null; + // let good_id = null; let resultTitle = event.detail.fonts[0].text.replace('\n',''); + // if(event.detail.id) { + // console.log('~~~~~~----++++++',event.detail.id); + // good_id = event.detail.id; + // }; if(event.detail.lbtype == 5) { lbtype = 5; } else { @@ -656,6 +1015,7 @@ Page({ resultTitle, showPopup: false, currentLbtype: lbtype, + // good_id, }); @@ -691,7 +1051,7 @@ Page({ }); }; } else if((self.data.luckInfo.give_type == 2)) { - if(self.data.luckInfo.give_integral > 0) { + if(self.data.luckInfo.give_growth > 0) { wx.showToast({ title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`, icon: 'none', @@ -708,7 +1068,7 @@ Page({ }); }; } else if((self.data.luckInfo.give_type == 2)) { - if(self.data.luckInfo.give_integral > 0) { + if(self.data.luckInfo.give_growth > 0) { wx.showToast({ title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`, icon: 'none', @@ -887,20 +1247,30 @@ Page({ }, showQr(e) { + let id = null; let store_id = app.globalData.setting.stoid; - let id = e.currentTarget.dataset.id; + if(e && e.currentTarget.dataset.id) { + id = e.currentTarget.dataset.id; + } else { + id = this.data.wow.record_id; + }; let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`; + // console.log('good_id', id, url); app.request.put(url, { success: function(res) { if(res.data.code == 0) { let data = res.data.data; - console.log('data!!!!', data); let barcode = self.selectComponent("#qrcode"); barcode.open({val: data}); self.setData({ hiddenCanvas: true, showPopup: false, }); + } else { + wx.showToast({ + title: res.data.msg, + icon: 'none', + }); }; }, @@ -918,6 +1288,31 @@ Page({ this.setData({ showResult: false, }); - this.showPopup(); + this.showQr(); + }, + + showPoster() { + this.setData({ + hiddenCanvas: true, + showMask: true, + showPoster: true, + }); + }, + + closePoster() { + this.setData({ + showMask: false, + showPoster: false, + hiddenCanvas: false, + }); + }, + + + + onImgOK(e) { + this.setData({ + myimg: e.detail.path, + }); }, + }) \ No newline at end of file diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.json b/packageB/pages/luckactivity/luckinfo/luckinfo.json index e8748c5..27a7638 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.json +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.json @@ -2,7 +2,8 @@ "usingComponents": { "lucky-wheel":"/packageB/miniprogram_npm/mini-luck-draw/lucky-wheel/index", "qrcode": "/components/my-qrcode/my-qrcode", - "nodata": "/components/nodata/nodata" + "nodata": "/components/nodata/nodata", + "painter": "/packageB/components/painter/painter" }, "enablePullDownRefresh": false, "navigationBarTitleText": "幸运大转盘" diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml index e49b1a8..aecd4c8 100644 --- a/packageB/pages/luckactivity/luckinfo/luckinfo.wxml +++ b/packageB/pages/luckactivity/luckinfo/luckinfo.wxml @@ -1,6 +1,7 @@ - + + @@ -35,17 +36,17 @@ hiddenCanvas="{{hiddenCanvas}}" /> - 今天你有 不限次 抽奖机会 - 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 + 今天你有 不限次 抽奖机会 + 今天你还有 {{filter.show_default(luckInfo.user_LuckNumDay < 0 ? 0:luckInfo.user_LuckNumDay, '0')}} 次抽奖机会 - + - + @@ -64,19 +65,19 @@ - + - + 活动时间: {{filter.format_time(luckInfo.begindate, 1) + ' 至 ' + filter.format_time(luckInfo.enddate, 1)}} - + 活动说明: