From 8357d4cc430c5d50367272de344e5c862e4db1a7 Mon Sep 17 00:00:00 2001 From: taiyuan Date: Fri, 19 Nov 2021 14:42:47 +0800 Subject: [PATCH] 幸运购 --- packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------ pages/index/index/index.js | 39 +++++++++++++++++++++++++++++++++------ pages/index/index/index.wxml | 63 +++++++++++++++++++++++++++++++++------------------------------ pages/index/index/index.wxss | 2 +- 4 files changed, 179 insertions(+), 55 deletions(-) diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index b96ae3e..ceb5573 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -139,7 +139,7 @@ Page({ brand_name: '', nation_name: '', - //商品的活动类型 0普通 1秒杀 2团购 3优惠 4 积分购 6拼单 + //商品的活动类型 0普通 1秒杀 2团购 3优惠 4 积分购 6拼单 9幸运购 prom_type: 9, prom_time_text: "", prom_price: null, @@ -296,10 +296,14 @@ Page({ prom_id = t.group_id; //活动ID if(prom_type) { - this.data.prom_type = prom_type; - this.data.prom_id = prom_id; + // this.data.prom_type = prom_type; + // this.data.prom_id = prom_id; + this.setData({ + prom_type, + prom_id, + }); } - + console.log('type********>>',this.data.prom_type); //-- 自定义海报 -- // getApp().request.promiseGet("/api/weshop/goods/poster/page", { // data: { store_id: os.stoid, type: 1, is_use: 1 } @@ -4456,8 +4460,9 @@ Page({ this.setData({ share_hidden: false,}); }; - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 - var type = this.data.prom_type; + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 + var type = 9; + console.log('type',type); if (type == 6) type = 2; if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; @@ -4500,7 +4505,7 @@ Page({ var vpath = res.path; var context = wx.createCanvasContext('share'); // 先画背景 - var pg_path = "../../../images/share/share_bg.png"; + var pg_path = "../../../../images/share/share_bg.png"; // context.fillStyle="#FFFFFF"; // context.fillRect(0,0,554 * unit, 899 * unit); @@ -4530,6 +4535,8 @@ Page({ //-- 是自定义海报的情况下 -- if(type != 0) { + + if (th.data.poster && parseInt(th.data.poster.style) == 2) { //在线上分享人的情况下 if (parseInt(th.data.poster.show_headpic)) { @@ -4544,7 +4551,7 @@ Page({ context.fillText(app.globalData.userInfo.nickname, x1, y1); var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; //强烈推荐 改许程 - var tj_path = "../../../images/share/q_tj.png"; + var tj_path = "../../../../images/share/q_tj.png"; context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); context.setFontSize(16 * unit); context.setLineJoin('round'); //交点设置成圆角 @@ -4559,15 +4566,22 @@ Page({ //--昵称--- context.setFontSize(24 * unit); context.setFillStyle("black"); - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; //强烈推荐 改许程 - var tj_path = "../../../images/share/q_tj.png"; - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); + var tj_path = "../../../../images/share/q_tj.png"; + let txt_gn = th.data.luckGoInfo.group_num + '人团'; + let width_gn = ut.measureText(txt_gn, 15); + context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); context.setFontSize(16 * unit); context.setLineJoin('round'); //交点设置成圆角 context.setFillStyle("white"); - context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); + context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); + // 发出幸运购活动邀请 + context.setFillStyle("#7f7f7f") + context.setFontSize(21.3 * unit) + context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); + } }; @@ -4602,11 +4616,18 @@ Page({ context.fillText("¥", wd1 - 15, 185 * unit); context.setFontSize(31 * unit) context.fillText(pri0, wd1, 185 * unit); + + var tj_path = "../../../../images/share/q_tj.png"; + context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); + context.setLineJoin('round'); //交点设置成圆角 + context.setFontSize(22 * unit); + context.setFillStyle("blue"); + context.fillText('参团价', 320 * unit, 168 * unit); //---市场价划掉--- context.setFillStyle("gray") context.setFontSize(22 * unit) - pri0 = "¥" + th.data.data.market_price.toFixed(2); + pri0 = "零售价:¥" + th.data.data.market_price.toFixed(2); var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; context.fillText(pri0, wd2, 213 * unit); @@ -4649,7 +4670,7 @@ Page({ //中间的几个字 if (th.data.poster && parseInt(th.data.poster.style) == 2) { if (parseInt(th.data.poster.show_quality)) { - var g_path = "../../../images/share/s_gou.png"; + var g_path = "../../../../images/share/s_gou.png"; context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); context.setFillStyle("red") context.setFontSize(18 * unit) @@ -4667,7 +4688,7 @@ Page({ } } else { - var g_path = "../../../images/share/s_gou.png"; + var g_path = "../../../../images/share/s_gou.png"; context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); context.setFillStyle("red") context.setFontSize(18 * unit) @@ -4733,7 +4754,7 @@ Page({ context.stroke(); //画秒杀的图片 - var miaos_path = '../../../images/share/miao_share.png'; + var miaos_path = '../../../../images/share/miao_share.png'; context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); context.setFillStyle("black") @@ -4770,7 +4791,7 @@ Page({ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); //绘制成团图片 - var ct_img = "../../../images/share/ct_num.png"; + var ct_img = "../../../../images/share/ct_num.png"; context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); var ct_num = th.data.prom_act.ct_num; context.setFontSize(14 * unit) @@ -4853,7 +4874,80 @@ Page({ //---二维吗图--- context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); } - break + break; + + + case 9: + + //---画线--- + context.setLineWidth(1 * unit) + context.moveTo(32 * unit, 680 * unit) + context.lineTo(520 * unit, 680 * unit) + context.stroke(); + + //---文字--- + context.setFillStyle("black") + context.setFontSize(24 * unit) + context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); + + //还差N人,即可成团 + let group_num = th.data.luckGoInfo.group_num; + let num_joined = th.data.luckGoInfo.num; + let delta1 = group_num - num_joined; + let width_delta1 = ut.measureText(delta1, 15); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("还差", 40 * unit, 772 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta1, 86 * unit, 772 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人,即可成团", (95 + width_delta1) * unit, 772 * unit); + + // N人得商品,N人全额退款 + let group_win = th.data.luckGoInfo.group_win; + let delta2 = group_num - group_win; + let width_delta2 = ut.measureText(delta2, 16); + let width_groupNum = ut.measureText(group_num, 15); + let width_groupWin = ut.measureText(group_win, 15); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(group_win, 40 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); + context.setFillStyle("#FF6768"); + context.setFontSize(21.3 * unit); + context.fillText(delta2, 160 * unit, 806 * unit); + context.setFillStyle("black"); + context.setFontSize(21.3 * unit); + context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); + + // 并得帮团惊喜礼品 + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("并得帮团", 40 * unit, 840 * unit); + context.setFillStyle("#FF6768") + context.setFontSize(21.3 * unit) + context.fillText("惊喜礼品", 130 * unit, 840 * unit); + context.setFillStyle("black") + context.setFontSize(21.3 * unit) + context.fillText("!", 220 * unit, 840 * unit); + + + //---二维吗图--- + //-- 自定义海报 -- + if (th.data.poster) { + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); + } else { + //---二维吗图--- + context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + } + + break; } diff --git a/pages/index/index/index.js b/pages/index/index/index.js index c2508e4..6111093 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -17,6 +17,7 @@ var d = getApp().globalData; var full_screen = require('full_screen.js'); + Page({ data: { url: o.imghost, @@ -86,8 +87,6 @@ Page({ }, onLoad: async function (tt) { - console.log("进入首页-------------"); - console.log(tt); var th = this; var first_leader = tt.first_leader; if (!first_leader && tt.scene) { @@ -139,8 +138,8 @@ Page({ var pages = getCurrentPages(); //获取加载的页面 var currentPage = pages[pages.length - 1]; //获取当前页面的对象 - console.log("当前路由"); - console.log(currentPage.route); + // console.log("当前路由"); + // console.log(currentPage.route); th.setappdata(ob); @@ -173,7 +172,6 @@ Page({ getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, { data: {} }).then(function (data) { - // console.log('909090909090----->', data.data.code); let code = data.data.code; if (code == 0) { @@ -230,6 +228,7 @@ Page({ if (new_nav == "") { th.is_new(); } + // sty setTimeout(function () { if (getApp().globalData.user_id) getApp().requestCardNum(th); }, 500) @@ -392,6 +391,7 @@ Page({ active: index //数字是当前页面在tabbar的索引 }) + //sty getApp().requestCardNum(this); } @@ -421,6 +421,22 @@ Page({ getApp().globalData.isLoad_ad = 1; } }, 1500) + + + // 获取幸运购活动列表 + getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', { + data: { + store_id: getApp().globalData.setting.stoid, + is_end: 0, + timetype: 1, + } + }).then(res => { + if(res.data.code == 0) { + th.setData({ + luckGo_list: res.data.data.pageData.slice(0,3), + }); + } + }); @@ -601,6 +617,14 @@ Page({ }); } }) + + + + + + + + //---调用信息--- // this.requestRecommend(); this.setData({ @@ -615,6 +639,7 @@ Page({ th.is_new(); } + // sty setTimeout(function () { if (getApp().globalData.user_id) getApp().requestCardNum(th); }, 500) @@ -1140,6 +1165,8 @@ Page({ } var url=e.currentTarget.dataset.url; getApp().goto(url); - } + }, + + }); \ No newline at end of file diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index e19dbb0..6b6ca3c 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -229,43 +229,46 @@ - - - - - - 幸运购 - - - 查看全部 - + + + + + + + 幸运购 + + + 查看全部 + + - - - - - - - - - 我是商品 - - - 189.00 - 零售价:155 - - - - 去参团 + + + + + + + + {{item.title}} + + + {{filter.price(item.group_price)}} + 零售价:{{item.market_price}} + + + + 去参团 + + + - + *{{item.group_num}}人成团,{{item.group_win}}人得商品,{{item.group_num - item.group_win}}人全额退款并得惊喜礼品 - *5人成团,5人得商品,5人全额退款并得惊喜礼品 - diff --git a/pages/index/index/index.wxss b/pages/index/index/index.wxss index fb89c60..78f38b3 100644 --- a/pages/index/index/index.wxss +++ b/pages/index/index/index.wxss @@ -1151,7 +1151,7 @@ page { } .luck .name::before { - content: '5人团'; + content: attr(data-content); background-color: #FF6768; color: white; font-size: 26rpx; -- libgit2 0.21.4