Commit a27557dd16e938aed7f17fcbcbbb8f3d7e70be5e

Authored by yvan.ni
1 parent 26544ba9

阶梯团的优化

packageA/pages/serviceCard_pd/team_success/team_success.js
@@ -87,6 +87,11 @@ Page({ @@ -87,6 +87,11 @@ Page({
87 getApp().getConfig(function (e) { 87 getApp().getConfig(function (e) {
88 th.setData({sto_sele_name_1: e.store_name}) 88 th.setData({sto_sele_name_1: e.store_name})
89 }) 89 })
  90 + getApp().getConfig2(function(e) {
  91 + var json_d = JSON.parse(e.switch_list);
  92 + th.setData({ bconfig: e,sys_switch:json_d});
  93 + })
  94 +
90 }, 95 },
91 onShow:function () { 96 onShow:function () {
92 getApp().check_can_share(this); 97 getApp().check_can_share(this);
@@ -214,6 +219,7 @@ Page({ @@ -214,6 +219,7 @@ Page({
214 if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){ 219 if (teamlist.ct_rylist != "" && teamlist.ct_rylist != null && teamlist.ct_rylist != undefined){
215 var ct_rylist = JSON.parse(teamlist.ct_rylist); 220 var ct_rylist = JSON.parse(teamlist.ct_rylist);
216 var max=0; var pri=0; 221 var max=0; var pri=0;
  222 +
217 ct_rylist.forEach(function (val,ind) { 223 ct_rylist.forEach(function (val,ind) {
218 if(val.rynum>max){ 224 if(val.rynum>max){
219 max=val.rynum; 225 max=val.rynum;
@@ -222,6 +228,7 @@ Page({ @@ -222,6 +228,7 @@ Page({
222 }) 228 })
223 max_num=max; 229 max_num=max;
224 min_price=pri; 230 min_price=pri;
  231 +
225 } 232 }
226 233
227 } 234 }
@@ -282,19 +289,21 @@ Page({ @@ -282,19 +289,21 @@ Page({
282 } 289 }
283 } 290 }
284 291
  292 + //获取团的价格
  293 + var ct_price = 0, num_0 = ordertx.length;
  294 + if (teamlist.kttype == 3 && teamlist.ct_rylist){
285 295
  296 + var js_data = JSON.parse(teamlist.ct_rylist);
  297 + js_data.forEach(function (val,ind) {
  298 + if (num_0<=val.rynum && ct_price==0){
  299 + ct_price=val.price;
  300 + }
  301 + })
  302 + if(ct_price==0) ct_price=min_price;
286 303
287 - var ct_price = 0,  
288 - num_0 = ordertx.length;  
289 - if (teamlist.kttype == 3){  
290 - var js_data = JSON.parse(teamlist.ct_rylist);  
291 - js_data.forEach(function (val,ind) {  
292 - if (num_0<=val.rynum && ct_price==0){  
293 - ct_price=val.price;  
294 - }  
295 - })  
296 - if(ct_price==0) ct_price=min_price;  
297 - } 304 + //-- 字符要改成json --
  305 + ee.data.prom_act.ct_rylist=js_data
  306 + }
298 307
299 //获取大家都在团信息 308 //获取大家都在团信息
300 getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1?store_id="+ os.stoid +"&is_end=0&is_show=1" , { 309 getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1?store_id="+ os.stoid +"&is_end=0&is_show=1" , {
@@ -1020,7 +1029,7 @@ Page({ @@ -1020,7 +1029,7 @@ Page({
1020 getApp().goto(url); 1029 getApp().goto(url);
1021 }, 1030 },
1022 1031
1023 - //-- 先版绘制 -- 1032 + //-- 先版绘制 --img 是中间的大图
1024 drawPoster(context, unit, img, vpath, type) { 1033 drawPoster(context, unit, img, vpath, type) {
1025 1034
1026 var self=this; 1035 var self=this;
@@ -1059,6 +1068,7 @@ Page({ @@ -1059,6 +1068,7 @@ Page({
1059 let bg_h = 474 * unit 1068 let bg_h = 474 * unit
1060 // 图片圆角 1069 // 图片圆角
1061 let bg_r = 4 1070 let bg_r = 4
  1071 +
1062 // 绘制海报背景图片圆角 1072 // 绘制海报背景图片圆角
1063 context.save() 1073 context.save()
1064 context.beginPath() 1074 context.beginPath()
@@ -1091,6 +1101,10 @@ Page({ @@ -1091,6 +1101,10 @@ Page({
1091 } 1101 }
1092 context.setFontSize(22 * unit) 1102 context.setFontSize(22 * unit)
1093 context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit); 1103 context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit);
  1104 +
  1105 +
  1106 +
  1107 +
1094 } 1108 }
1095 1109
1096 if (type == 2) { // 阶梯团 1110 if (type == 2) { // 阶梯团
@@ -1115,9 +1129,21 @@ Page({ @@ -1115,9 +1129,21 @@ Page({
1115 1129
1116 var wp= 52 * unit; 1130 var wp= 52 * unit;
1117 var hp=755 * unit 1131 var hp=755 * unit
1118 - self.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); 1132 + self.draw_pos_price(context,wp,hp,this.data.goods.show_price,unit);
1119 } 1133 }
1120 1134
  1135 + // 7.商品价格
  1136 + if (type != 2) {
  1137 + let price = this.data.teamlist.price;
  1138 + price = parseFloat(price).toFixed(2);
  1139 + context.setFontSize(32 * unit);
  1140 + context.setFillStyle('#DE1117');
  1141 +
  1142 + context.fillText('¥' + price, 54 * unit, 735 * unit);
  1143 + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit);
  1144 + var hp=735 * unit
  1145 + this.draw_pos_price(context,wp,hp,this.data.goods.show_price,unit);
  1146 + }
1121 1147
1122 // 8.商品标题 1148 // 8.商品标题
1123 context.setFontSize(20 * unit); 1149 context.setFontSize(20 * unit);
@@ -1136,5 +1162,24 @@ Page({ @@ -1136,5 +1162,24 @@ Page({
1136 context.fill(); 1162 context.fill();
1137 }, 1163 },
1138 1164
  1165 + //---市场价划掉---
  1166 + draw_pos_price(context,w,h,market_price,unit){
  1167 +
  1168 + if(!this.data.sys_switch) return false;
  1169 + if(!this.data.sys_switch.is_retail_price) return false;
  1170 + context.setFillStyle("gray")
  1171 + context.setFontSize(22 * unit)
  1172 + var pri0 = "¥" + market_price.toFixed(2);
  1173 + context.fillText(pri0, w, h);
  1174 +
  1175 + var c_h=h-6;
  1176 + context.setStrokeStyle('gray');
  1177 + context.setLineWidth(1 * unit);
  1178 + context.moveTo(w - 5, c_h);
  1179 + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h);
  1180 + context.stroke();
  1181 +
  1182 + },
  1183 +
1139 }) 1184 })
1140 1185