|
@@ -138,10 +138,8 @@ Page({ |
|
|
// 绘制白色背景 |
|
|
// 绘制白色背景 |
|
|
ctx.setFillStyle("#fbfbfb"); |
|
|
ctx.setFillStyle("#fbfbfb"); |
|
|
ctx.fillRect(0, 0, that.data.windowWidth, that.data.windowHeight); |
|
|
ctx.fillRect(0, 0, that.data.windowWidth, that.data.windowHeight); |
|
|
// that.roundRect(ctx,0, 320, that.data.windowWidth, 320,50) |
|
|
|
|
|
ctx.drawImage(res.path, 0, 50, topImageWidth, topImageHeight); |
|
|
ctx.drawImage(res.path, 0, 50, topImageWidth, topImageHeight); |
|
|
ctx.setFillStyle("blue"); |
|
|
|
|
|
that.roundRect(ctx,12, 270, 330, 150,10) |
|
|
|
|
|
|
|
|
that.roundRect(ctx,12, 270, 320, 150,10) |
|
|
that.drawOtherImage(ctx, scale); |
|
|
that.drawOtherImage(ctx, scale); |
|
|
that.drawOtherContent(ctx, scale,options); |
|
|
that.drawOtherContent(ctx, scale,options); |
|
|
that.darwAvatarArc(ctx, that.data.avatarUrl, 10, 8, 35, 35); |
|
|
that.darwAvatarArc(ctx, that.data.avatarUrl, 10, 8, 35, 35); |
|
@@ -150,6 +148,19 @@ Page({ |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
//绘制微信头像 |
|
|
|
|
|
drawAvatarimg(ctx, scale) { |
|
|
|
|
|
var that = this; |
|
|
|
|
|
//商户详情海报 |
|
|
|
|
|
let src1 =that.data.avatarUrl +`?imageView/2/w/${topImageWidth}/h/${topImageHeight}`; |
|
|
|
|
|
let src2 = util.getProxyImgUrl(src1); |
|
|
|
|
|
wx.getImageInfo({ |
|
|
|
|
|
src: src2, |
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
that.darwAvatarArc(ctx, res.path, 10, 8, 35, 35); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
// 商户海报绘制 |
|
|
// 商户海报绘制 |
|
|
drawOtherContent(ctx, scale,options) { |
|
|
drawOtherContent(ctx, scale,options) { |
|
|
//昵称 |
|
|
//昵称 |
|
@@ -158,10 +169,10 @@ Page({ |
|
|
this.drawNormalText(ctx,"---"+this.data.mallname+"---",175 * scale,530 * scale,16 * scale,"#000","left","middle",scale); |
|
|
this.drawNormalText(ctx,"---"+this.data.mallname+"---",175 * scale,530 * scale,16 * scale,"#000","left","middle",scale); |
|
|
if (options && options.merchantId) { |
|
|
if (options && options.merchantId) { |
|
|
//店铺名 |
|
|
//店铺名 |
|
|
this.drawNormalText(ctx,"商户名称:"+this.data.data.merchantName,40 * scale,300 * scale,22 * scale,"#000","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"商户位置:"+this.data.data.shopVoList[0].buildingName+this.data.data.shopVoList[0].floorName+"--"+this.data.data.shopVoList[0].shopNumber,40 * scale,340 * scale,18 * scale,"#F4AA91","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"商户电话:"+this.data.data.merchantLinkPhone,40 * scale,380 * scale,16 * scale,"#000","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"长按识别,进店去看看",155 * scale,500 * scale,16 * scale,"#000","left","middle",scale); |
|
|
|
|
|
|
|
|
this.drawNormalText(ctx,"商户名称:"+this.data.data.merchantName,40 * scale,310 * scale,22 * scale,"#000","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"商户位置:"+this.data.data.shopVoList[0].buildingName+this.data.data.shopVoList[0].floorName+"--"+this.data.data.shopVoList[0].shopNumber,40 * scale,350 * scale,18 * scale,"#F4AA91","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"商户电话:"+this.data.data.merchantLinkPhone,40 * scale,390 * scale,16 * scale,"#000","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"长按识别,进店去看看",155 * scale,510 * scale,16 * scale,"#000","left","middle",scale); |
|
|
if (this.data.couponList.length > 0) { |
|
|
if (this.data.couponList.length > 0) { |
|
|
for (let i = 0; i < this.data.couponList.length; i++) { |
|
|
for (let i = 0; i < this.data.couponList.length; i++) { |
|
|
// 第一个商品信息 |
|
|
// 第一个商品信息 |
|
@@ -177,12 +188,12 @@ Page({ |
|
|
} |
|
|
} |
|
|
} else if (options && options.couponChannelId) { |
|
|
} else if (options && options.couponChannelId) { |
|
|
this.drawNormalText(ctx,"长按识别,享优惠",155 * scale,500 * scale,16 * scale,"#000","left","middle",scale); |
|
|
this.drawNormalText(ctx,"长按识别,享优惠",155 * scale,500 * scale,16 * scale,"#000","left","middle",scale); |
|
|
this.drawNormalText(ctx,this.data.data.title,40 * scale,300 * scale,23 * scale,"#000","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"售价:" + this.data.data.salePriceStr,40 * scale,330 * scale,20* scale,"#F4AA91","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"原价:" + this.data.data.salePriceStr,120 * scale,330 * scale,16 * scale,"#DFDCDB","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"适用门店:",40 * scale,360 * scale,16 * scale,"#000","left","middle",scale); |
|
|
|
|
|
|
|
|
this.drawNormalText(ctx,this.data.data.title,40 * scale,310 * scale,23 * scale,"#000","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"售价:" + this.data.data.salePriceStr,40 * scale,340 * scale,20* scale,"#F4AA91","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"原价:" + this.data.data.salePriceStr,120 * scale,340 * scale,16 * scale,"#DFDCDB","left","middle",scale); |
|
|
|
|
|
this.drawNormalText(ctx,"适用门店:",40 * scale,370 * scale,16 * scale,"#000","left","middle",scale); |
|
|
for(var i=0;i<this.data.data.merchantVoList.length;i++){ |
|
|
for(var i=0;i<this.data.data.merchantVoList.length;i++){ |
|
|
this.drawNormalText(ctx,this.data.data.merchantVoList[i].merchantName+"、",40 * scale+40*i,390 * scale,16 * scale,"#000","left","middle",scale); |
|
|
|
|
|
|
|
|
this.drawNormalText(ctx,this.data.data.merchantVoList[i].merchantName+"、",40 * scale+40*i,400 * scale,16 * scale,"#000","left","middle",scale); |
|
|
} |
|
|
} |
|
|
ctx.draw(true); |
|
|
ctx.draw(true); |
|
|
} |
|
|
} |
|
@@ -207,7 +218,7 @@ Page({ |
|
|
wx.getImageInfo({ |
|
|
wx.getImageInfo({ |
|
|
src: src2, |
|
|
src: src2, |
|
|
success: function(res) { |
|
|
success: function(res) { |
|
|
ctx.drawImage(res.path,25 * scale,435 * scale,coImageWidth,coImageHeight); |
|
|
|
|
|
|
|
|
ctx.drawImage(res.path,25 * scale,455 * scale,coImageWidth,coImageHeight); |
|
|
ctx.draw(true); |
|
|
ctx.draw(true); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|