From a27557dd16e938aed7f17fcbcbbb8f3d7e70be5e Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Wed, 12 Jul 2023 11:09:14 +0800 Subject: [PATCH] 阶梯团的优化 --- packageA/pages/serviceCard_pd/team_success/team_success.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/packageA/pages/serviceCard_pd/team_success/team_success.js b/packageA/pages/serviceCard_pd/team_success/team_success.js index a9968a6..2d2bcd6 100644 --- a/packageA/pages/serviceCard_pd/team_success/team_success.js +++ b/packageA/pages/serviceCard_pd/team_success/team_success.js @@ -87,6 +87,11 @@ Page({ getApp().getConfig(function (e) { th.setData({sto_sele_name_1: e.store_name}) }) + getApp().getConfig2(function(e) { + var json_d = JSON.parse(e.switch_list); + th.setData({ bconfig: e,sys_switch:json_d}); + }) + }, onShow:function () { getApp().check_can_share(this); @@ -214,6 +219,7 @@ Page({ if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){ var ct_rylist = JSON.parse(teamlist.ct_rylist); var max=0; var pri=0; + ct_rylist.forEach(function (val,ind) { if(val.rynum>max){ max=val.rynum; @@ -222,6 +228,7 @@ Page({ }) max_num=max; min_price=pri; + } } @@ -282,19 +289,21 @@ Page({ } } + //获取团的价格 + var ct_price = 0, num_0 = ordertx.length; + if (teamlist.kttype == 3 && teamlist.ct_rylist){ + var js_data = JSON.parse(teamlist.ct_rylist); + js_data.forEach(function (val,ind) { + if (num_0<=val.rynum && ct_price==0){ + ct_price=val.price; + } + }) + if(ct_price==0) ct_price=min_price; - var ct_price = 0, - num_0 = ordertx.length; - if (teamlist.kttype == 3){ - var js_data = JSON.parse(teamlist.ct_rylist); - js_data.forEach(function (val,ind) { - if (num_0<=val.rynum && ct_price==0){ - ct_price=val.price; - } - }) - if(ct_price==0) ct_price=min_price; - } + //-- 字符要改成json -- + ee.data.prom_act.ct_rylist=js_data + } //获取大家都在团信息 getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1?store_id="+ os.stoid +"&is_end=0&is_show=1" , { @@ -1020,7 +1029,7 @@ Page({ getApp().goto(url); }, - //-- 先版绘制 -- + //-- 先版绘制 --img 是中间的大图 drawPoster(context, unit, img, vpath, type) { var self=this; @@ -1059,6 +1068,7 @@ Page({ let bg_h = 474 * unit // 图片圆角 let bg_r = 4 + // 绘制海报背景图片圆角 context.save() context.beginPath() @@ -1091,6 +1101,10 @@ Page({ } context.setFontSize(22 * unit) context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit); + + + + } if (type == 2) { // 阶梯团 @@ -1115,9 +1129,21 @@ Page({ var wp= 52 * unit; var hp=755 * unit - self.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); + self.draw_pos_price(context,wp,hp,this.data.goods.show_price,unit); } + // 7.商品价格 + if (type != 2) { + let price = this.data.teamlist.price; + price = parseFloat(price).toFixed(2); + context.setFontSize(32 * unit); + context.setFillStyle('#DE1117'); + + context.fillText('¥' + price, 54 * unit, 735 * unit); + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit); + var hp=735 * unit + this.draw_pos_price(context,wp,hp,this.data.goods.show_price,unit); + } // 8.商品标题 context.setFontSize(20 * unit); @@ -1136,5 +1162,24 @@ Page({ context.fill(); }, + //---市场价划掉--- + draw_pos_price(context,w,h,market_price,unit){ + + if(!this.data.sys_switch) return false; + if(!this.data.sys_switch.is_retail_price) return false; + context.setFillStyle("gray") + context.setFontSize(22 * unit) + var pri0 = "¥" + market_price.toFixed(2); + context.fillText(pri0, w, h); + + var c_h=h-6; + context.setStrokeStyle('gray'); + context.setLineWidth(1 * unit); + context.moveTo(w - 5, c_h); + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); + context.stroke(); + + }, + }) -- libgit2 0.21.4