diff --git a/packageC/pages/group_list/group_list.js b/packageC/pages/group_list/group_list.js
index 2a4cffc..43c6bbf 100644
--- a/packageC/pages/group_list/group_list.js
+++ b/packageC/pages/group_list/group_list.js
@@ -14,10 +14,12 @@ Page({
// goodlist: null,
isLogin: false,
- list: null,
+ list: [],
isLoading: false, // 检测是否已经发送请求,防止重复发送请求
noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据
pageNum: 1, // 当前页数
+
+ time_arr:[]
},
/**
@@ -63,7 +65,7 @@ Page({
};
this.setData({
- list: null,
+ list: [],
pageNum: 1,
noMore: false,
});
@@ -110,7 +112,7 @@ Page({
this.setData({
- list: null,
+ list: [],
type: typeValue,
});
@@ -141,6 +143,9 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
+
+ if(this.data.isLoading) return false;
+
let data = this.data.currentData;
this.scrollToLower('/api/weshop/goods/groupBuy/page', data);
},
@@ -148,47 +153,48 @@ Page({
/**
* 用户点击右上角分享
*/
- onShareAppMessage: function () { getApp().globalData.no_clear=1
-
- },
+ onShareAppMessage: function () { getApp().globalData.no_clear=1; },
/**
* 请求数据
*/
getData: function(isInit, url, data) {
+
+ wx.showLoading();
+
let p = app.request.promiseGet(url, {
data: data,
- isShowLoading: true,
+ isShowLoading: false,
})
.then(function(res) {
- if(res.data.code == 0) {
-
+
+
+
+ if(ut.ajax_ok(res)) {
+
self.setData({
- isLoading: false
- });
+ ['list['+(self.data.pageNum-1)+']']:res.data.data.pageData
+ })
- if(isInit) {// 第一次加载
- self.setData({
- list: res.data.data
- });
- } else {
- self.setData({
- 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData)
- });
- };
-
- if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) {
+ if(res.data.data.pageSize * res.data.data.page >= res.data.data.total){
self.setData({
noMore: true
});
};
+
+
} else {
- self.setData({
- 'list.pageData': []
- });
+ self.setData({ noMore: true });
};
+
+ self.setData({
+ isLoading: false,
+ is_get:1
+ });
+
+ wx.hideLoading();
});
@@ -218,6 +224,7 @@ Page({
});
requestData.page = this.data.pageNum;
this.getData(false, url, requestData);
+
};
},
@@ -229,38 +236,64 @@ Page({
//----倒计时函数-----
- countDown() {
- if(!this.data.is_timer) return false;
- var th=this;
- // 获取当前时间,同时得到活动结束时间数组
- let newTime = ut.gettimestamp();
- var endTimeList = this.data.list.pageData;
- if(endTimeList == null) return null;
- // 对结束时间进行处理渲染到页面
- for(var i = 0; i < endTimeList.length; i++) {
- var o = endTimeList[i];
- var endTime = this.data.type == 1?o.end_time:o.start_time;
- // if(th.data.type==0) endTime = o.start_time;
- let obj = null;
- // 如果活动未结束,对时间进行处理
- if (endTime - newTime > 0) {
- let time = (endTime - newTime);
- // 获取天、时、分、秒
- let day = parseInt(time / (60 * 60 * 24));
- let hou = parseInt(time % (60 * 60 * 24) / 3600);
- let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
- let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
- obj = {
- day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec), hide: 1
- }
- } else {
- //活动已结束,全部设置为'00'
- obj = { day: '00', hou: '00', min: '00', sec: '00' }
- }
- var txt ="goodlist["+i+"].djs";
- th.setData({ [txt]: obj});
- }
- },
+ countDown() {
+
+ if (!this.data.is_timer) return false;
+ var th = this;
+ // 获取当前时间,同时得到活动结束时间数组
+ let newTime = ut.gettimestamp();
+
+
+ var time_arr=[];
+
+ for (let j = 0; j < this.data.list.length; j++) {
+ var endTimeList = this.data.list[j];
+ if (endTimeList == null) return null;
+
+ var arr_new=[];
+
+ // 对结束时间进行处理渲染到页面
+ for (var i = 0; i < endTimeList.length; i++) {
+
+ var o = endTimeList[i];
+ var endTime = this.data.type == 1 ? o.end_time : o.start_time;
+ // if(th.data.type==0) endTime = o.start_time;
+ let obj = null;
+ // 如果活动未结束,对时间进行处理
+ if (endTime - newTime > 0) {
+ let time = (endTime - newTime);
+ // 获取天、时、分、秒
+ let day = parseInt(time / (60 * 60 * 24));
+ let hou = parseInt(time % (60 * 60 * 24) / 3600);
+ let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
+ let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
+ obj = {
+ day: this.timeFormat(day),
+ hou: this.timeFormat(hou),
+ min: this.timeFormat(min),
+ sec: this.timeFormat(sec),
+ hide: 1
+ }
+ } else {
+ //活动已结束,全部设置为'00'
+ obj = {day: '00', hou: '00', min: '00', sec: '00'}
+ }
+ //var txt = "goodlist[" + i + "].djs";
+ //th.setData({[txt]: obj});
+
+ var e={djs:obj};
+ arr_new.push(e);
+
+ }
+
+ time_arr.push(arr_new);
+
+
+ }
+
+ this.setData({time_arr:time_arr});
+
+ },
diff --git a/packageC/pages/group_list/group_list.wxml b/packageC/pages/group_list/group_list.wxml
index 92526d1..daa82b6 100644
--- a/packageC/pages/group_list/group_list.wxml
+++ b/packageC/pages/group_list/group_list.wxml
@@ -1,9 +1,13 @@
-
-
+
+
+
+
+
+
+ data-errorimg="list[{{p_idx}}][{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true">
@@ -24,7 +28,9 @@
已售{{item.buy_num+item.virtual_num}}0件
- {{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒
+
+ {{time_arr[p_idx][index].djs.day}}天{{time_arr[p_idx][index].djs.hou}}时{{time_arr[p_idx][index].djs.min}}分{{time_arr[p_idx][index].djs.sec}}秒
+
@@ -35,24 +41,11 @@
-
+
-—— 已经到底啦 ——
-
+—— 已经到底啦 ——
+
-
-
\ No newline at end of file
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral.wxml
deleted file mode 100644
index 383f797..0000000
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral.wxml
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
-
-
-
- {{data.goods_name}}
-
-
- {{prom_integral}}积分
- +
- {{prom_price}}元
- 0积分
-
-
-
-
-
- 已售:{{prom_act.buy_num}}
- 可售:{{prom_act.limitqty-prom_act.buy_num}}
-
-
-
-
-
-
-
-
- {{def_pick_store.pickup_name}}
-
- 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
-
-
-
-
-
-
-
- 选择门店
-
-
-
- 更多门店
-
-
-
- (库存不足)
-
- (库存不足)
-
- (配送不匹配)
- (库存不足)
-
-
-
- 地址:{{def_pick_store.fulladdress}}
-
-
-
-
- 商品规格
-
-
- {{item.gg}}
-
-
-
-
-
- 购买数量
-
- -
-
- +
-
-
-
-
-
-
-
-
- 配送不匹配
-
-
-
-
-
-
- 库存不足
-
-
-
-
-
- 库存不足
-
-
-
- 库存不足
-
-
-
- 请先选择门店
-
-
-
- 库存不足
-
-
- 立即兑换
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral_normal.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral_normal.wxml
deleted file mode 100644
index 24db585..0000000
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral_normal.wxml
+++ /dev/null
@@ -1,146 +0,0 @@
-
-
-
-
-
-
-
- {{sele_g.goods_name}}
-
- ¥
-
- {{sele_g[card_field]}}
- {{sele_g.shop_price}}
-
-
-
- 已售:{{sele_g.sales_sum}}
-
- 可售:{{def_pick_store.CanOutQty}}
- 可售:0
-
- 可售:{{sele_g.store_count}}
-
-
-
-
-
-
-
-
-
- {{def_pick_store.pickup_name}}
-
- 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
-
-
-
-
-
-
-
- 选择门店
-
-
-
- 更多门店
-
-
-
- (库存不足)
-
- (库存不足)
-
- (配送不匹配)
- (库存不足)
-
-
- 地址:{{def_pick_store.fulladdress}}
-
-
-
-
- 商品规格
-
-
- {{item.gg}}
-
-
-
-
-
- 购买数量
-
- -
-
- +
-
-
-
-
-
-
-
- 再买{{hui_condition.need}}
- ,免{{hui_condition.money}}元
- ,打{{hui_condition.sale}}折
- ,包邮
- ,送{{hui_condition.intValue}}积分
- ,送优惠券
- ,送赠品
- ,送礼包
- ,送专享礼包
-
-
-
-
-
-
-
-
-
- 配送不匹配
-
-
-
-
- 库存不足
-
-
-
-
-
- 库存不足
-
-
-
- 库存不足
-
-
-
- 请先选择门店
-
-
-
- 库存不足
-
-
-
- 加入购物车
- 立即购买
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
index 53d4f8f..33be4f1 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -4066,8 +4066,6 @@ Page({
// ind == 1 为普通购买
openSpecModel_pt: function (e) {
-
-
this.setData({ open_ind_store: 9, goodsInputNum: 1 });
// 判断是否有待支付订单
var aid = this.data.group_id;
@@ -4190,7 +4188,9 @@ Page({
// }
// });
+
th.data.prom_type=9;
+
th.get_sto();
th.setData({
is_normal: 0,
@@ -4809,12 +4809,16 @@ Page({
context.setTextAlign('left');
context.fillText('强烈推荐', 64 * unit, 672 * unit);
// 7.商品价格
- let price = '¥' + this.data.data.shop_price;
- // if (th.data.prom_act)
- // pri0 = th.data.prom_act.price;
+ let price = '¥' + parseFloat( this.data.luckGoInfo.group_price/100).toFixed(2);
context.setFontSize(32 * unit);
context.setFillStyle('#DE1117');
context.fillText(price, 54 * unit, 730 * unit);
+
+ //-- 零售价的优化 --
+ var wp= 60 * unit+ut.measureText( price, 32 * unit);
+ var hp=730 * unit
+ this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit);
+
// 8.商品标题
context.setFontSize(20 * unit);
context.setFillStyle('#898989');
@@ -4835,6 +4839,29 @@ Page({
+ //---市场价划掉---
+ 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;
+ 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();
+
+ },
+
+
+
//--定义的保存图片方法,分享团---
saveImageToPhotosAlbum: function () {
//--先判断会员状态--
@@ -4851,8 +4878,8 @@ Page({
//类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购
var type = 9;
- console.log('type', type);
- if (type == 6) type = 2;
+ var th=this;
+
if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
wx.showLoading({ title: '生成中...', })
@@ -4882,8 +4909,6 @@ Page({
///二微码
var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo";
- // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
- // os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo";
console.log('path3......', path3);
@@ -4899,14 +4924,6 @@ Page({
// 先画背景
var pg_path = "../../../../images/share/share_bg.png";
- // context.fillStyle="#FFFFFF";
- // context.fillRect(0,0,554 * unit, 899 * unit);
-
- // if(type == 0) {
- // this.drawPoster(context);
- // return false;
- // };
-
//-- 如果有自定义海报的时候,判断背景的图片 --
if (th.data.share_b_img) {
@@ -4915,17 +4932,17 @@ Page({
// context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
- if (!th.data.share_b_img && (type == 9)) { // 如果是普通商品,绘制新海报
+ if (!th.data.share_b_img) { // 如果是普通商品,绘制新海报
th.drawPoster(context, unit, th.data.share_goods_img, vpath);
} else {
context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
};
- // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
+
//-- 是自定义海报的情况下 --
- if (th.data.share_b_img || type != 0) {
+ if (th.data.share_b_img ) {
@@ -4973,28 +4990,22 @@ Page({
// context.setFillStyle("#7f7f7f")
// context.setFontSize(21.3 * unit)
// context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
-
}
-
- };
+ }
var share_title = th.data.data.goods_name;
- if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) {
- share_title = th.data.prom_act.share_title;
- if (!share_title) share_title = th.data.prom_act.title;
- if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
- }
-
//---产品名称---
//文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if (th.data.share_b_img || (type != 4 && type != 9)) {
+ if (th.data.share_b_img ) {
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
- th.draw_Text(context, share_title,
+ getApp().draw_Text(context, share_title,
38 * unit, 180 * unit, 220 * unit, 220 * unit, unit);
+
+
//------产品的价格-------
context.setFontSize(23 * unit)
context.setFillStyle("red")
@@ -5018,276 +5029,49 @@ Page({
context.fillText('参团价', 330 * unit, 179 * unit);
//---市场价划掉---
- context.setFillStyle("gray")
- context.setFontSize(22 * unit)
- 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);
-
- context.setStrokeStyle('gray');
- context.setLineWidth(1 * unit);
- context.moveTo(wd2 - 5, 206 * unit);
- context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
- context.stroke();
-
- } else if (type == 4 && type != 0) {
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- th.draw_Text(context, share_title,
- 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
- //------ 产品的价格 -----
- var pri0 = th.data.prom_act.addmoney;
- var integral = th.data.prom_act.integral;
- var text = "";
- if (integral) { text = integral + "积分"; }
- if (pri0 && integral) { text += "+"; }
- if (pri0) { text += "¥" + pri0; }
-
- if (!pri0 && !integral) { text = "0积分"; }
- context.setFillStyle("red");
- context.fillText(text, 38 * unit, 235 * unit);
+ // context.setFillStyle("gray")
+ // context.setFontSize(22 * unit)
+ 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);
+ // context.setStrokeStyle('gray');
+ // context.setLineWidth(1 * unit);
+ // context.moveTo(wd2 - 5, 206 * unit);
+ // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
+ // context.stroke();
+
+ th.draw_pos_price(context,wd2, 213 * unit,pri0,unit);
}
//---中间大图---
- if ( th.data.share_b_img || type != 9) {
- context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
+ if ( th.data.share_b_img ) {
+ context.drawImage(th.data.share_goods_img, 70 * unit, 245 * unit, 408 * unit, 408 * unit);
};
//---自定义海报 产品质量保证
if(th.data.share_b_img && th.data.poster.show_quality==1 ){
var g_path = "../../../../images/share/s_gou.png";
- context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 56 * unit, 650 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("正品保证", 84 * unit, 690 * unit);
+ context.fillText("正品保证", 84 * unit, 670 * unit);
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 218 * unit, 650 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
+ context.fillText("纯实体店", 246 * unit, 670 * unit);
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 388 * unit, 650 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
+ context.fillText("官方验证", 420 * unit, 670 * unit);
}
//-------大图后面就不一样了-----------
switch (type) {
- case 0: break;//普通商品的展示
- case 4:
- //中间的几个字
- 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";
- context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("正品保证", 84 * unit, 690 * unit);
-
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
-
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
- }
-
- } else {
- 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)
- context.fillText("正品保证", 84 * unit, 690 * unit);
-
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
-
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
- }
-
-
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 710 * unit)
- context.lineTo(520 * unit, 710 * unit)
- context.stroke();
-
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(22 * unit)
-
- if (type == 0) {
- // 原来start --->
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
-
- context.setFontSize(22 * unit)
- context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
-
- } else {
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
- context.setFontSize(22 * unit)
- context.fillText("长按识别二维码", 40 * unit, 806 * unit);
- context.fillText("立即开始兑换", 40 * unit, 846 * 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;
- case 1: //秒杀商品的展示
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
-
- //画秒杀的图片
- var miaos_path = '../../../../images/share/miao_share.png';
- context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
-
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
- //---文字---
- context.setFontSize(22 * unit)
- context.setFillStyle("black")
- context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * 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, 135 * unit, 135 * unit);
- } else {
- //---二维吗图---
- context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
- }
- break;
-
- case 2: //会员团和商家团的展示
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //绘制成团图片
- 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)
- context.font = 'normal';
- context.setFillStyle("red")
- if (ct_num < 10) {
- context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
- } else {
- context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
- }
- context.setFontSize(22 * unit)
- context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
-
- context.setFillStyle("gray")
- context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);
- context.setFillStyle("black")
- context.font = 'normal bold 18px sans-serif';
- context.setFontSize(21.3 * unit)
- context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * 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
- case 3: //阶梯团的展示
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //---绘制中间阶梯的价格---
- var list = th.data.prom_act.ct_rylist;
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- var wi = i * 90 * unit;
- context.font = 'normal';
- context.setFontSize(16 * unit)
- context.setFillStyle("red")
- context.fillText("¥", 40 * unit + wi, 756 * unit);
- context.setFontSize(22 * unit)
- var pri = parseFloat(item.price).toFixed(2);
- context.fillText(pri, 56 * unit + wi, 756 * unit);
- context.setFillStyle("gray")
- context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
- }
- //----------------下面部分----------------
- // context.setFillStyle("gray")
- // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);
- // context.setFillStyle("black")
- // context.font = 'normal bold 18px sans-serif';
- // context.setFontSize(22 * unit)
- // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
- //context.setFillStyle("gray")
- context.setFillStyle("black")
- context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
- //context.font = 'normal bold 18px sans-serif';
- context.setFontSize(21 * unit)
- context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * 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;
-
-
case 9:
if(th.data.share_b_img){
@@ -5363,12 +5147,11 @@ Page({
break;
-
}
//--- 如果是自定义海报的时候 ---
- if ( th.data.share_b_img || type != 9) {
+ if ( th.data.share_b_img ) {
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
@@ -5413,6 +5196,14 @@ Page({
};
+ if(th.data.poster.show_time==1){
+ var act_time = '';
+ act_time="截止时间:"+ ut.formatTime(th.data.luckGoInfo.end_time);
+ context.setFillStyle("red")
+ getApp().draw_Text(context, act_time, 38 * unit, 880 * unit, 200 * unit, 340 * unit, unit);
+ }
+
+
//把画板内容绘制成图片,并回调 画板图片路径
context.draw(false, function () {
@@ -5464,35 +5255,6 @@ Page({
});
},
-
- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
- var lineWidth = 0;
- var lastSubStrIndex = 0; //每次开始截取的字符串的索引
- var han = 0;
- for (let i = 0; i < str.length; i++) {
- if (han == 2) return;
- //lineWidth += ctx.measureText(str[i]).width;
- lineWidth += ut.measureText(str[i], 21.3 * unit);
- if (lineWidth > canvasWidth) {
- han++;
-
- if (han == 2)
- ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
- else
- ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
-
- initHeight += 22; //22为字体的高度
- lineWidth = 0;
- lastSubStrIndex = i;
- titleHeight += 20;
- }
- if (i == str.length - 1) { //绘制剩余部分
- ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
- }
- }
- },
-
// ----视频图片----
// 图片计数器
swiperChange: function (e) {
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
index 007e47b..5dbbfe7 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
@@ -113,12 +113,22 @@
{{filters.toFix(luckGoInfo.group_price/100,2)}}
-
-
-
- {{sele_g[card_field]}}
- {{sele_g.shop_price}}
+
+ 零售价:{{data.market_price}}
+
+
+
+
+
+ {{sele_g[card_field]}}
+ {{data.shop_price}}
+
+
+
+
+
+
@@ -1049,8 +1059,6 @@
-
-
@@ -1336,40 +1344,7 @@
-
-
-
-
-
- ¥
- {{item.money}}
-
- 满{{item.condition}}元可用
-
-
-
- 订单金额满{{item.condition}}元可用
-
- {{filters.replace_time2(item.start)}} 至 {{filters.replace_time2(item.end)}}
-
-
-
-
- {{ item.linging==1?'领取中':'领取'}}
-
-
-
-
-
-
-
-
-
-
- 关闭
-
-
- -->
+
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
index 76eb995..7d49f88 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
@@ -2319,7 +2319,7 @@ left:25rpx;
color: #fff;
}
.xc-qt-price .xc-qtunit-price{
- margin-left:-96rpx;
+ margin-left:-70rpx;
}
.xc-nanber{
top:-25rpx;
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js
index e95fa43..4076ef1 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -2775,6 +2775,8 @@ Page({
}
},
+
+
//--定义的保存图片方法,分享团---
saveImageToPhotosAlbum: function () {
//--先判断会员状态--
@@ -2823,7 +2825,7 @@ Page({
///二微码
var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/goodsInfo/goodsInfo";
-
+
console.log(path3);
@@ -2838,9 +2840,6 @@ Page({
//先画背景
var pg_path = "../../../../images/share/share_bg.png";
- // context.fillStyle="#FFFFFF";
- // context.fillRect(0,0,554 * unit, 899 * unit);
-
//-- 如果有自定义海报的时候,判断背景的图片 --
if (th.data.share_b_img) {
pg_path = th.data.share_b_img;
@@ -2893,11 +2892,11 @@ Page({
//---产品名称---
//文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if (type != 4) {
+
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
th.draw_Text(context, share_title,
- 80 * unit, 200 * unit, 200 * unit, 279 * unit, unit);
+ 80 * unit, 160 * unit, 200 * unit, 279 * unit, unit);
//------产品的价格-------
context.setFontSize(22 * unit)
@@ -2909,15 +2908,16 @@ Page({
// pri0 = th.data.prom_act.price;
pri0 = parseFloat(pri0).toFixed(2);
var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
- context.fillText("¥", wd1 - 15, 185 * unit);
+ context.fillText("¥", wd1 - 15, 160 * unit);
context.setFontSize(22 * unit)
- context.fillText(pri0, wd1, 185 * unit);
+ context.fillText(pri0, wd1, 165 * unit);
//---市场价划掉---
- context.setFillStyle("red")
- context.setFontSize(22 * unit)
- pri0 = "¥" + th.data.data.market_price.toFixed(2);
- var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
+ // context.setFillStyle("red")
+ // context.setFontSize(22 * unit)
+ // pri0 = "¥" + th.data.data.market_price.toFixed(2);
+ // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
+
if(th.data.presellForm.presell_type==1){
// context.setStrokeStyle('gray');
@@ -2926,75 +2926,62 @@ Page({
// context.moveTo(wd2 - 5, 206 * unit);
// context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
// context.stroke();
- }else{
- context.fillText('定金', wd2, 213 * unit);
+
+ //-- 零售价的优化 --
+ var wp= th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50;
+ var hp= 180 * unit
+ th.draw_pos_price(context,wp,hp,th.data.data.market_price,unit);
+
+ }else{
+ var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50;
+ context.fillText('定金', wd2, 190 * unit);
}
-
-
- } else {
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- th.draw_Text(context, share_title,
- 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
- //------ 产品的价格 -----
- var pri0 = th.data.prom_act.addmoney;
- var integral = th.data.prom_act.integral;
- var text = "";
- if (integral) { text = integral + "积分"; }
- if (pri0 && integral) { text += "+"; }
- if (pri0) { text += "¥" + pri0; }
-
- if (!pri0 && !integral) { text = "0积分"; }
- context.setFillStyle("red");
- context.fillText(text, 38 * unit, 235 * unit);
- }
-
//console.log(th.data.share_goods_img);
//let share_goods_img=th.data.presellForm.share_img;
//share_goods_img?share_goods_img:th.data.data.share_goods_img;
//---中间大图---
- context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
+ context.drawImage(th.data.share_goods_img, 70 * unit, 210 * unit, 408 * unit, 408 * unit);
//---自定义海报 产品质量保证
if(th.data.poster.show_quality==1 ){
var g_path = "/images/share/s_gou.png";
- context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 56 * unit, 630 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("正品保证", 84 * unit, 690 * unit);
+ context.fillText("正品保证", 84 * unit, 650 * unit);
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 218 * unit, 630 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
+ context.fillText("纯实体店", 246 * unit, 650 * unit);
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 388 * unit, 630 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
+ context.fillText("官方验证", 420 * unit, 650 * unit);
}
//---画线---
context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 665 * unit)
- context.lineTo(520 * unit, 665 * unit)
+ context.moveTo(32 * unit, 662 * unit)
+ context.lineTo(520 * unit, 662 * unit)
context.stroke();
//---文字---
context.setFillStyle("black")
// context.setFontSize(22 * unit)
context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 730 * unit);
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 700 * unit);
context.setFillStyle("red")
context.setFontSize(20 * unit)
var presell_price = `预售价:${th.data.presellList.presell_price}`
- context.fillText(presell_price, 40 * unit, 780 * unit);
+ context.fillText(presell_price, 40 * unit, 750 * unit);
context.setFillStyle("black")
context.setFontSize(22 * unit)
- context.fillText("特惠好物,限时预售", 40 * unit, 826 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
+ context.fillText("特惠好物,限时预售", 40 * unit, 800 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 840 * unit);
//---二维吗图---
//-- 自定义海报 --
@@ -3007,8 +2994,6 @@ Page({
context.drawImage(vpath, 390 * unit, 746 * unit, 130 * unit, 116 * unit);
}
-
-
//--- 如果是自定义海报的时候 ---
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
@@ -3051,6 +3036,13 @@ Page({
}
+ if(th.data.poster.show_time==1){
+ var act_time='';
+ act_time="截止时间:"+ ut.formatTime(th.data.presellForm.end_time);
+ context.setFillStyle("red")
+ getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit);
+ }
+
//把画板内容绘制成图片,并回调 画板图片路径
context.draw(false, function () {
setTimeout(function () {
@@ -3170,490 +3162,7 @@ Page({
// 先画背景
var pg_path = "../../../../images/share/share_bg.png";
-
- //-- 如果有自定义海报的时候,判断背景的图片 --
- if (th.data.share_b_img) {
- pg_path = th.data.share_b_img;
- }
- // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
- console.log('海报类型-----')
- console.log(type);
-
- if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报
- th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
- } else {
- context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
- // 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);
- // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
- };
-
- // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
-
-
- //-- 是自定义海报的情况下 --
- if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
-
- if (th.data.poster && parseInt(th.data.poster.style) == 2) {
- //在线上分享人的情况下
- if (parseInt(th.data.poster.show_headpic)) {
- //获取坐标
- var x = parseFloat(th.data.poster.head_x) * 2;
- var y = parseFloat(th.data.poster.head_y) * 2;
- var x1 = (x + 90) * unit;
- var y1 = (y + 50) * unit;
- //--昵称---
- context.setFontSize(24 * unit)
- context.setFillStyle("black")
- 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";
- context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit);
- context.setFontSize(16 * unit);
- context.setLineJoin('round'); //交点设置成圆角
- context.setFillStyle("white");
- context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit);
-
- //context.setFillStyle("black")
- //context.setFontSize(24 * unit)
- //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
- }
- } else {
- //--昵称---
- context.setFontSize(24 * unit);
- context.setFillStyle("black");
- context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * 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);
- context.setFontSize(16 * unit);
- context.setLineJoin('round'); //交点设置成圆角
- context.setFillStyle("white");
- context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
- }
-
- };
-
-
- var share_title = th.data.data.goods_name;
- if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) {
- share_title = th.data.prom_act.share_title;
- if (!share_title) share_title = th.data.prom_act.title;
- if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
- }
-
- //---产品名称---
- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- getApp().draw_Text(context, share_title,
- 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
-
- //------产品的价格-------
- context.setFontSize(23 * unit)
- context.setFillStyle("red")
-
- var pri0 = th.data.data.shop_price;
- if (th.data.card_field && th.data.data[th.data.card_field]) {
- pri0 = th.data.data[th.data.card_field];
- }
-
- if (th.data.prom_act)
- pri0 = th.data.prom_price;
- pri0 = parseFloat(pri0).toFixed(2);
- var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
- context.fillText("¥", wd1 - 15, 185 * unit);
- context.setFontSize(31 * unit)
- context.fillText(pri0, wd1, 185 * unit);
-
- //---市场价划掉---
- /*--
- context.setFillStyle("gray")
- context.setFontSize(22 * unit)
- 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);
-
- context.setStrokeStyle('gray');
- context.setLineWidth(1 * unit);
- context.moveTo(wd2 - 5, 206 * unit);
- context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
- context.stroke();--*/
-
- } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- getApp().draw_Text(context, share_title,
- 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
- //------ 产品的价格 -----
- var pri0 = th.data.prom_act.addmoney;
- var integral = th.data.prom_act.integral;
- var text = "";
- if (integral) {
- text = integral + "积分";
- }
- if (pri0 && integral) {
- text += "+";
- }
- if (pri0) {
- text += "¥" + pri0;
- }
-
- if (!pri0 && !integral) {
- text = "0积分";
- }
- context.setFillStyle("red");
- context.fillText(text, 38 * unit, 235 * unit);
-
- }
-
- //---中间大图---
- if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
- context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
- }
- ;
-
- //---自定义海报 产品质量保证
- if(th.data.share_b_img && th.data.poster.show_quality==1 ){
- 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)
- context.fillText("正品保证", 84 * unit, 690 * unit);
-
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
-
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
-
- }
- //-------大图后面就不一样了-----------
- switch (type) {
- case 0:
- if(!th.data.share_b_img){
- break
- }
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 710 * unit)
- context.lineTo(520 * unit, 710 * unit)
- context.stroke();
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(22 * unit)
- // 原来start --->
- context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
- // <--- 原来end
- // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit);
- // context.setFontSize(18 * unit)
- // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit);
- //---二维吗图---
- context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
- break;//普通商品的展示
- case 4:
- // 中间的几个字
- 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";
- context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("正品保证", 84 * unit, 690 * unit);
-
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
-
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
- }
-
- } else {
- 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)
- context.fillText("正品保证", 84 * unit, 690 * unit);
-
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
-
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
- }
-
-
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 710 * unit)
- context.lineTo(520 * unit, 710 * unit)
- context.stroke();
-
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(22 * unit)
-
- if (type == 0 || type == -1) {
- // 原来start --->
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
-
- context.setFontSize(22 * unit)
- context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
-
- } else {
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
- context.setFontSize(22 * unit)
- context.fillText("长按识别二维码", 40 * unit, 806 * unit);
- context.fillText("立即开始兑换", 40 * unit, 846 * unit);
-
- }
-
- //---二维吗图---
- //-- 自定义海报 --
- if (th.data.share_b_img || 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;
- case 1: //秒杀商品的展示
- if(!th.data.share_b_img){
- break
- }
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
-
- //画秒杀的图片
- var miaos_path = '../../../../images/share/miao_share.png';
- context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
-
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
- //---文字---
- context.setFontSize(22 * unit)
- context.setFillStyle("black")
- context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
-
-
- //---二维吗图---
- //-- 自定义海报 --
- if (th.data.share_b_img || 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, 135 * unit, 135 * unit);
- } else {
- //---二维吗图---
- context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
- }
- break;
-
- case 2: //会员团和商家团的展示
- if(!th.data.share_b_img){
- break
- }
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //绘制成团图片
- 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)
- context.font = 'normal';
- context.setFillStyle("red")
- if (ct_num < 10) {
- context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
- } else {
- context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
- }
- context.setFontSize(22 * unit)
- context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
-
- context.setFillStyle("gray")
- context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);
- context.setFillStyle("black")
- context.font = 'normal bold 18px sans-serif';
- context.setFontSize(21.3 * unit)
- context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit);
-
-
- //---二维吗图---
- //-- 自定义海报 --
- if (th.data.share_b_img || 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
- case 3: //阶梯团的展示
- if(!th.data.share_b_img){
- break
- }
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //---绘制中间阶梯的价格---
- var list = th.data.prom_act.ct_rylist;
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- var wi = i * 90 * unit;
- context.font = 'normal';
- context.setFontSize(16 * unit)
- context.setFillStyle("red")
- context.fillText("¥", 40 * unit + wi, 756 * unit);
- context.setFontSize(22 * unit)
- var pri = parseFloat(item.price).toFixed(2);
- context.fillText(pri, 56 * unit + wi, 756 * unit);
- context.setFillStyle("gray")
- context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
- }
- //----------------下面部分----------------
-
- context.setFillStyle("black")
- context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
- //context.font = 'normal bold 18px sans-serif';
- context.setFontSize(21 * unit)
- context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit);
-
-
- //-- 自定义海报 --
- if (th.data.share_b_img || 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
-
-
- case -1: //秒杀商品的展示
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
-
-
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 744 * unit);
- //---文字---
- context.setFontSize(22 * unit)
- context.setFillStyle("black")
- context.fillText("长按识别二维码", 40 * unit, 800 * unit);
- context.fillText("立即开始抢购", 40 * unit, 846 * unit);
-
-
- //---二维吗图---
- //-- 自定义海报 --
- if (th.data.share_b_img || 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, 135 * unit, 135 * unit);
- } else {
- //---二维吗图---
- context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
- }
- break;
-
-
- }
-
-
- //--- 如果是自定义海报的时候 ---
- if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
-
- if (th.data.poster && parseInt(th.data.poster.style) == 2) {
-
- //如果显示会员信息的话
- if (parseInt(th.data.poster.show_headpic)) {
- //获取坐标
- var x = parseFloat(th.data.poster.head_x) * 2;
- var y = parseFloat(th.data.poster.head_y) * 2;
- //---绘制圆形要放在最后----
- context.save();
- context.beginPath();
- var h_x = x * unit;
- var h_y = y * unit;
- var h_r = 40 * unit;
- var cx = h_x + h_r;
- var cy = h_y + h_r;
- context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
- context.closePath();
- context.fill();
- context.clip();
- context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
- context.restore();
- }
-
- } else {
- //---绘制圆形要放在最后----
- context.save();
- context.beginPath();
- var h_x = 60 * unit;
- var h_y = 24 * unit;
- var h_r = 40 * unit;
- var cx = h_x + h_r;
- var cy = h_y + h_r;
- context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
- context.closePath();
- context.fill();
- context.clip();
- context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
- context.restore();
- }
-
- }
- ;
+ th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
//把画板内容绘制成图片,并回调 画板图片路径
@@ -3729,144 +3238,126 @@ Page({
}
}
},
+
drawPoster(context, unit, img, vpath, type) {
- // 1.灰色背景
- context.setFillStyle('#f2f1f6');
- context.rect(0, 0, 554 * unit, 899 * unit);
- context.fill();
-
- // 2.商城名称
- let shopName = this.data.sto_sele_name_1;
- context.setTextAlign('center');
- context.setFontSize(26 * unit);
- context.setFillStyle('black');
- context.fillText(shopName, 277 * unit, 60 * unit);
-
- // 3.推荐来源
- let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`;
- context.setTextAlign('center');
- context.setFontSize(22 * unit);
- context.setFillStyle('#96959a');
- context.fillText(fromText, 277 * unit, 105 * unit);
-
- // 4.海报背景
- context.setFillStyle('white');
- context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit);
-
- // 5.商品图片
- // 图片的x坐标
- let bg_x = 37 * unit
- // 图片的y坐标
- let bg_y = 157 * unit
- // 图片宽度
- let bg_w = 480 * unit
- // 图片高度
- let bg_h = 474 * unit
- // 图片圆角
- let bg_r = 4
- // 绘制海报背景图片圆角
- context.save()
- context.beginPath()
- context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5)
- context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2)
- context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5)
- context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI)
- context.clip()
- context.drawImage(img, bg_x, bg_y, bg_w, bg_h);
- context.restore();
-
- // 6.强烈推荐
- let src = '';
- context.beginPath();
- if(type == 0) { // 普通
- src = '../../../../images/share/q_tj.png';
- context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit);
- context.setFontSize(16 * unit)
- context.setFillStyle("white")
- context.setTextAlign('left');
- context.fillText('强烈推荐', 64 * unit, 668 * unit);
- };
- if(type == 1) { // 秒杀
- src = '../../../images/share/miao_share.png';
- context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit);
- context.setTextAlign('left');
- };
- if(type == 2) { // 商家和会员团
- src = '../../../images/share/ct_num.png';
- context.drawImage(src, 54 * unit, 648 * unit, 120 * unit, 30 * unit);
- context.setTextAlign('left');
-
- let ct_num = self.data.prom_act.ct_num;
- context.setFontSize(16 * unit)
- context.font = 'normal';
- context.setFillStyle("red")
- if (ct_num < 10) {
- context.fillText(ct_num + "人拼团", 100 * unit, 670 * unit);
- } else {
- context.fillText(ct_num + "人拼团", 96 * unit, 670 * unit);
- }
- context.setFontSize(22 * unit)
- context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit);
- };
- if(type == 3) { // 阶梯团
- let list = self.data.prom_act.ct_rylist;
- for (let i = 0; i < list.length; i++) {
- let item = list[i];
- let wi = i * 90 * unit;
- context.font = 'normal';
- context.setTextAlign('left');
- context.setFontSize(16 * unit)
- context.setFillStyle("red")
- context.fillText("¥", 50 * unit + wi, 680 * unit);
- context.setFontSize(22 * unit)
- let pri = parseFloat(item.price).toFixed(2);
- context.fillText(pri, 66 * unit + wi, 680 * unit);
- context.setFillStyle("gray")
- context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit);
- }
- };
-
- // 7.商品价格
- if(type != 3) {
- let price = this.data.data.shop_price;
- if (this.data.card_field && this.data.data[this.data.card_field]) {
- price = this.data.data[this.data.card_field];
- }
- if (this.data.prom_act) price = this.data.prom_price;
- price = parseFloat(price).toFixed(2);
- context.setFontSize(32 * unit);
- context.setFillStyle('#DE1117');
- if (this.data.prom_type == 4 && this.data.prom_integral){
- context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit);
- }else{
- if(this.data.prom_type ==8){
- price = this.data.presellList.presell_price
- context.fillText('¥' + price, 54 * unit, 735 * unit);
- }else{
- context.fillText('¥' + price, 54 * unit, 735 * unit);
- }
- }
-
+ // 1.灰色背景
+ context.setFillStyle('#f2f1f6');
+ context.rect(0, 0, 554 * unit, 899 * unit);
+ context.fill();
+
+ // 2.商城名称
+ let shopName = this.data.sto_sele_name_1;
+ context.setTextAlign('center');
+ context.setFontSize(26 * unit);
+ context.setFillStyle('black');
+ context.fillText(shopName, 277 * unit, 60 * unit);
+
+ // 3.推荐来源
+ let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`;
+ context.setTextAlign('center');
+ context.setFontSize(22 * unit);
+ context.setFillStyle('#96959a');
+ context.fillText(fromText, 277 * unit, 105 * unit);
+
+ // 4.海报背景
+ context.setFillStyle('white');
+ context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit);
+
+ // 5.商品图片
+ // 图片的x坐标
+ let bg_x = 37 * unit
+ // 图片的y坐标
+ let bg_y = 157 * unit
+ // 图片宽度
+ let bg_w = 480 * unit
+ // 图片高度
+ let bg_h = 474 * unit
+ // 图片圆角
+ let bg_r = 4
+ // 绘制海报背景图片圆角
+ context.save()
+ context.beginPath()
+ context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5)
+ context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2)
+ context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5)
+ context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI)
+ context.clip()
+ context.drawImage(img, bg_x, bg_y, bg_w, bg_h);
+ context.restore();
+
+ // 6.强烈推荐
+ let src = '';
+ context.beginPath();
+ if (type == 0) { // 普通
+ src = '../../../../images/share/q_tj.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit)
+ context.setFillStyle("white")
+ context.setTextAlign('left');
+ context.fillText('强烈推荐', 64 * unit, 668 * unit);
+ }
+
+
+ // 7.商品价格
+ let price = this.data.data.shop_price;
+ if (this.data.card_field && this.data.data[this.data.card_field]) {
+ price = this.data.data[this.data.card_field];
+ }
+ if (this.data.prom_act) price = this.data.prom_price;
+ price = parseFloat(price).toFixed(2);
+ context.setFontSize(32 * unit);
+ context.setFillStyle('#DE1117');
+
+ price = this.data.presellList.presell_price
+ 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.data.market_price,unit);
+
+
+ // 8.商品标题
+ context.setFontSize(20 * unit);
+ context.setFillStyle('#898989');
+ getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
+
+ // 9.小程序码
+ context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
+ context.setFontSize(16 * unit);
+ context.setFillStyle('#777');
+ context.fillText('长按识别二维码', 378 * unit, 810 * unit);
+
+ // 10.竖线
+ context.beginPath();
+ context.setFillStyle('#eee');
+ context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit);
+ 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();
- };
-
- // 8.商品标题
- context.setFontSize(20 * unit);
- context.setFillStyle('#898989');
- getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
-
- // 9.小程序码
- context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
- context.setFontSize(16 * unit);
- context.setFillStyle('#777');
- context.fillText('长按识别二维码', 378 * unit, 810 * unit);
-
- // 10.竖线
- context.beginPath();
- context.setFillStyle('#eee');
- context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit);
- context.fill();
},
+
+
// ----视频图片----
// 图片计数器
swiperChange: function (e) {
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index e5e8b1d..8f47225 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -5371,13 +5371,15 @@ Page({
let pri = parseFloat(item.price).toFixed(2);
context.fillText(pri, 66 * unit + wi, 680 * unit);
- var wp = 62 * unit + wi + ut.measureText('¥' + pri, 32 * unit);
- var hp = 735 * unit
- self.draw_pos_price(context, wp, hp, self.data.data.market_price, unit);
context.setFillStyle("gray")
context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit);
}
+
+
+ var wp= 52 * unit;
+ var hp=755 * unit
+ self.draw_pos_price(context,wp,hp,self.data.data.market_price,unit);
}
@@ -5394,16 +5396,16 @@ Page({
if (this.data.prom_type == 4 && this.data.prom_integral) {
context.fillText(this.data.prom_integral + '积分+¥' + price, 54 * unit, 735 * unit);
- var wp = 62 * unit + ut.measureText(this.data.prom_integral + '积分+¥' + price, 32 * unit);
- var hp = 735 * unit
- this.draw_pos_price(context, wp, hp, this.data.data.market_price, unit);
+ var wp= 62 * unit+ut.measureText(this.data.prom_integral + '积分+¥' + price, 32 * unit);
+ var hp=735 * unit
+ this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit);
} else {
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.data.market_price, unit);
+ var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit);
+ var hp=735 * unit
+ this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit);
}
@@ -5429,17 +5431,17 @@ Page({
},
//---市场价划掉---
- draw_pos_price(context, w, h, market_price, unit) {
+ 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;
+ 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;
+ var c_h=h-6;
context.setStrokeStyle('gray');
context.setLineWidth(1 * unit);
context.moveTo(w - 5, c_h);
@@ -5456,16 +5458,12 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
//getApp().my_warnning("请先登录",0,this);
- wx.navigateTo({
- url: '/packageE/pages/togoin/togoin',
- })
+ wx.navigateTo({url: '/packageE/pages/togoin/togoin',})
return false;
}
if (this.data.share_hidden) {
- this.setData({
- share_hidden: false,
- });
+ this.setData({share_hidden: false,});
};
//类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
@@ -5482,18 +5480,15 @@ Page({
if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
console.log('商品类型。。。。。');
console.log(type);
- wx.showLoading({
- title: '生成中...',
- })
- var that = this,
- th = that;
+ wx.showLoading({title: '生成中...',})
+ var that = this, th = that;
//设置画板显示,才能开始绘图
that.setData({
canvasHidden: false
})
var app = getApp();
- var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
+ var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
var path2 = that.data.data.original_img;
var scene = th.data.gid + "";
scene += "." + th.data.sele_g.prom_type + "." + th.data.sele_g.prom_id;
@@ -5510,7 +5505,7 @@ Page({
}
///二微码
var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
- os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
+ os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
console.log(path3);
@@ -5535,7 +5530,7 @@ Page({
console.log('海报类型-----')
console.log(type);
- if (!th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3)) { // 如果是普通商品,绘制新海报
+ if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报
th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
} else {
context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
@@ -5546,10 +5541,10 @@ Page({
};
-
+ var act_time='';
//-- 是自定义海报的情况下 --
- if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+ if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
//在线上分享人的情况下
@@ -5595,19 +5590,27 @@ Page({
var share_title = th.data.data.goods_name;
+
+
if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) {
share_title = th.data.prom_act.share_title;
if (!share_title) share_title = th.data.prom_act.title;
if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
+
+ //-- 显示活动时间 --
+ if(th.data.share_b_img) {
+ act_time="截止时间:"+ ut.formatTime(th.data.prom_act.end_time);
+ }
}
//---产品名称---
//文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
+ if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
getApp().draw_Text(context, share_title,
- 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
+ 38 * unit, 170 * unit, 200 * unit, 279 * unit, unit);
+
//------产品的价格-------
context.setFontSize(23 * unit)
@@ -5621,17 +5624,18 @@ Page({
if (th.data.prom_act)
pri0 = th.data.prom_price;
pri0 = parseFloat(pri0).toFixed(2);
+
var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
- if (th.data.prom_type != 4)
- context.fillText("¥", wd1 - 15, 185 * unit);
+ if(th.data.prom_type!=4)
+ context.fillText("¥", wd1 - 15, 175 * unit);
context.setFontSize(31 * unit)
- var pri_str = pri0;
- if (th.data.prom_type == 4) {
- pri_str = '';
+ var pri_str=pri0;
+ if(th.data.prom_type==4){
+ pri_str='';
- if (th.data.prom_integral) pri_str = th.data.prom_integral + '积分';
+ if(th.data.prom_integral) pri_str=th.data.prom_integral+'积分';
if (pri0 && th.data.prom_integral) {
pri_str += "+";
}
@@ -5640,8 +5644,9 @@ Page({
}
wd1 = th.data.screenWidth - ut.measureText(pri_str, 31 * unit) - 20;
+
}
- context.fillText(pri_str, wd1, 185 * unit);
+ context.fillText(pri_str, wd1, 175 * unit);
//---市场价划掉---
// context.setFillStyle("gray")
// context.setFontSize(22 * unit)
@@ -5655,15 +5660,18 @@ Page({
// context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
// context.stroke();
- var wp = 62 * unit + wi + ut.measureText(pri_str, 32 * unit);
- var hp = 735 * unit
- th.draw_pos_price(context, wp, hp, self.data.data.market_price, unit);
+ var wp= wd1;
+ var hp=203 * unit;
+ if(th.data.prom_type!=4) wp-=12;
+ th.draw_pos_price(context,wp,hp,self.data.data.market_price,unit);
- } else if (type == 4) {
+ } else if (type == 4 ) {
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
getApp().draw_Text(context, share_title,
- 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
+ 38 * unit, 160 * unit, 20 * unit, 300 * unit, unit);
+
+
//------ 产品的价格 -----
var pri0 = th.data.prom_act.addmoney;
var integral = th.data.prom_act.integral;
@@ -5682,7 +5690,7 @@ Page({
text = "0积分";
}
context.setFillStyle("red");
- context.fillText(text, 38 * unit, 235 * unit);
+ context.fillText(text, 38 * unit, 175 * unit);
//---市场价划掉---
// context.setFillStyle("gray")
@@ -5697,44 +5705,42 @@ Page({
// context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
// context.stroke();
-
-
- var wp = 62 * unit + wi + ut.measureText(text, 32 * unit);
- var hp = 735 * unit
- th.draw_pos_price(context, wp, hp, self.data.data.market_price, unit);
+ var wp= wd1-12;
+ var hp=203 * unit
+ th.draw_pos_price(context,wp,hp,self.data.data.market_price,unit);
}
//---中间大图---
- if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
- context.drawImage(th.data.share_goods_img, 70 * unit, 240 * unit, 408 * unit, 408 * unit);
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+ context.drawImage(th.data.share_goods_img, 70 * unit, 220 * unit, 408 * unit, 408 * unit);
}
//---自定义海报 产品质量保证
- if (th.data.share_b_img && th.data.poster.show_quality == 1 && type != 4) {
+ if(th.data.share_b_img && th.data.poster.show_quality==1 && type!=4){
var g_path = "../../../images/share/s_gou.png";
- context.drawImage(g_path, 56 * unit, 650 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 56 * unit, 640 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("正品保证", 84 * unit, 670 * unit);
+ context.fillText("正品保证", 84 * unit, 660 * unit);
- context.drawImage(g_path, 218 * unit, 650 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 218 * unit, 640 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 670 * unit);
+ context.fillText("纯实体店", 246 * unit, 660 * unit);
- context.drawImage(g_path, 388 * unit, 650 * unit, 22 * unit, 22 * unit);
+ context.drawImage(g_path, 388 * unit, 640 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 670 * unit);
+ context.fillText("官方验证", 420 * unit, 660 * unit);
}
- //-------大图后面就不一样了-----------
+ //-------大图后面就不一样了-----------
switch (type) {
case 0:
- if (!th.data.share_b_img) {
+ if(!th.data.share_b_img){
break
}
//---画线---
@@ -5754,10 +5760,10 @@ Page({
// context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit);
//---二维吗图---
context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
- break; //普通商品的展示
+ break;//普通商品的展示
case 4:
- if (th.data.share_b_img && th.data.poster.show_quality == 1 && type != 4) {
+ if(th.data.share_b_img && th.data.poster.show_quality==1 && type!=4){
var g_path = "../../../images/share/s_gou.png";
context.drawImage(g_path, 56 * unit, 660 * unit, 22 * unit, 22 * unit);
context.setFillStyle("red")
@@ -5845,7 +5851,7 @@ Page({
//---二维吗图---
//-- 自定义海报 --
- if (th.data.share_b_img || th.data.poster) {
+ if (th.data.share_b_img || 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);
@@ -5857,32 +5863,32 @@ Page({
break;
case 1: //秒杀商品的展示
- if (!th.data.share_b_img) {
+ if(!th.data.share_b_img){
break
}
//---画线---
context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 690 * unit)
- context.lineTo(520 * unit, 690 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
context.stroke();
//画秒杀的图片
var miaos_path = '../../../images/share/miao_share.png';
- context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
+ context.drawImage(miaos_path, 43 * unit, 690 * unit, 222 * unit, 40 * unit);
context.setFillStyle("black")
context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 770 * unit);
//---文字---
context.setFontSize(22 * unit)
context.setFillStyle("black")
- context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
+ context.fillText("特惠好物,限时秒杀", 40 * unit, 807 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 844 * unit);
//---二维吗图---
//-- 自定义海报 --
- if (th.data.share_b_img || th.data.poster) {
+ if (th.data.share_b_img || 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, 135 * unit, 135 * unit);
@@ -5893,7 +5899,7 @@ Page({
break;
case 2: //会员团和商家团的展示
- if (!th.data.share_b_img) {
+ if(!th.data.share_b_img){
break
}
//---画线---
@@ -5931,7 +5937,7 @@ Page({
//---二维吗图---
//-- 自定义海报 --
- if (th.data.share_b_img || th.data.poster) {
+ if (th.data.share_b_img || 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);
@@ -5941,7 +5947,7 @@ Page({
}
break
case 3: //阶梯团的展示
- if (!th.data.share_b_img) {
+ if(!th.data.share_b_img){
break
}
//---画线---
@@ -5979,7 +5985,7 @@ Page({
//-- 自定义海报 --
- if (th.data.share_b_img || th.data.poster) {
+ if (th.data.share_b_img || 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);
@@ -6010,7 +6016,7 @@ Page({
//---二维吗图---
//-- 自定义海报 --
- if (th.data.share_b_img || th.data.poster) {
+ if (th.data.share_b_img || 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, 135 * unit, 135 * unit);
@@ -6025,7 +6031,7 @@ Page({
//--- 如果是自定义海报的时候 ---
- if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
@@ -6070,6 +6076,15 @@ Page({
}
+
+ //-- 自定义的时候 --
+ if(th.data.share_b_img && act_time && th.data.poster.show_time){
+ context.setFillStyle("red")
+ getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit);
+ }
+
+
+
//把画板内容绘制成图片,并回调 画板图片路径
context.draw(false, function () {
setTimeout(function () {