diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js
index cf04126..f1d85c3 100644
--- a/packageA/pages/goodsInfo/goodsInfo.js
+++ b/packageA/pages/goodsInfo/goodsInfo.js
@@ -27,6 +27,7 @@ Page({
color_type: 0, //线条控制
color_type_one: 0,
color_type_two: 1,
+ is_share_text: 1,
gid: "",
stoid: o.stoid,
@@ -38,6 +39,8 @@ Page({
data: null,
content: "", //商品详情
+
+
gallery: null, //图片滚动
is_collect: 0,
collect_id: 0,
@@ -236,6 +239,8 @@ Page({
th = ee,
gid = t.goods_id,
first_leader=t.first_leader,
+ prom_type=t.prom_type,
+ prom_id=t.prom_id,
room_id = t.room_id,
room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
@@ -250,21 +255,27 @@ Page({
var gid_str = decodeURIComponent(t.scene);
gid_str=gid_str.split("_");
gid=gid_str[0];
- if(gid_str.length>1){
+ if(gid_str.length>1 && gid_str[1] && parseInt(gid_str[1])>0){
first_leader=gid_str[1];
}
//-- 如果有room_id的获取 --
- if(gid_str.length>2 && gid_str[2]) {
+ if(gid_str.length>2 && gid_str[2] && parseInt(gid_str[2])>0) {
room_id=gid_str[2];
room_user_share=1;
};
+
+ if(gid_str.length>3 && gid_str[3] && parseInt(gid_str[3])>0) {
+ prom_type=gid_str[3];
+ prom_id=gid_str[4];
+ }
+
};
//-- 设置顶部高度 --
let height= getApp().globalData.navBarHeight;
ee.setData({ gid: gid,top_nav:height});
- if(first_leader) {
+ if(first_leader>0) {
getApp().globalData.first_leader=first_leader;
//调用接口判断是不是会员
getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{
@@ -347,7 +358,37 @@ Page({
}
});
- },
+ //-- 自定义海报 --
+ getApp().request.promiseGet("/api/weshop/goods/poster/page", {
+ data: { store_id: os.stoid, type: 1, is_use: 1 }
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) {
+
+ var poster_data = res.data.data.pageData[0];
+ var json_str = poster_data.jsonStr;
+
+ if (json_str) {
+ var json_data = JSON.parse(json_str);
+ if (json_data.bg_img) {
+
+ //-- 把图片那到本地 --
+ wx.getImageInfo({
+ src: json_data.bg_img,
+ success: function (res) {
+ var path = res.path;
+ th.setData({ share_b_img: path })
+ },
+ fail: function (res) { }
+ });
+ }
+ th.setData({ poster: json_data })
+
+ }
+ }
+ })
+
+
+ },
//-- 获取直播的分享人的导购信息 --
async get_room_share_guide(share_openid) {
@@ -568,14 +609,13 @@ Page({
// gid 在onload阶段已经保存在this.data中
onShow: function() {
+ getApp().check_can_share(this);
//-- 看一下隐私政策要不要显示 --
var privacy_pop = this.selectComponent("#privacy_pop"); //组件的id
if (privacy_pop) {
privacy_pop.check_pri_show();
}
- getApp().check_can_share();
-
var that=this;var th=this;
var ee = this,gid = this.data.gid, i = getApp().request;
@@ -2100,494 +2140,7 @@ Page({
return param < 10 ? '0' + param : param;
},
-
- //--定义的保存图片方法,分享团---
- saveImageToPhotosAlbum: function() {
- //--先判断会员状态--
- // 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', })
- // return false;
- // }
-
- //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
- var type = this.data.prom_type;
- if (type == 6) type = 2;
- if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
-
- wx.showLoading({
- title: '生成中...',
- })
- var that = this,
- th = that;
- //设置画板显示,才能开始绘图
- that.setData({
- canvasHidden: false
- })
-
- var app = getApp();
- var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
- var path2 = that.data.data.original_img;
- var scene = th.data.gid+"";
- var user_id = getApp().globalData.user_id?getApp().globalData.user_id:0;
- if(user_id>0) {
- scene+="_"+user_id;
- }
- //-- 如果不是会员分享过来的要分享给别人 --
- if(getApp().globalData.room_id && th.data.data.goods_id==getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
- //固定房间是第3个字符
- if(!user_id) scene+="_0";
- scene+="_"+getApp().globalData.room_id ;
- }
- ///二微码
- var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
- os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
-
- console.log(path3);
-
- //读取文件成功则OK--
- wx.getImageInfo({
- src: path3,
- success: function(res) {
- //回调写法
- th.get_head_temp(th.get_goods_temp, function() {
- var vpath = res.path;
- var context = wx.createCanvasContext('share');
- //先画背景
- 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;
- }
- context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
-
- //-- 是自定义海报的情况下 --
- 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);
- }
-
-
- //---产品名称---
- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if(type!=4){
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- th.draw_Text(context, th.data.data.goods_name,
- 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
- //------产品的价格-------
- context.setFontSize(23 * unit)
- context.setFillStyle("red")
- context.fillText("¥", 416 * unit, 185 * unit);
- context.setFontSize(31 * unit)
- var pri0 = th.data.data.shop_price;
- if (th.data.prom_act)
- pri0 = th.data.prom_act.price;
- pri0 = parseFloat(pri0).toFixed(2);
- context.fillText(pri0, 438 * unit, 185 * unit);
- //---市场价划掉---
- context.setFillStyle("gray")
- context.setFontSize(22 * unit)
- context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit);
- context.setStrokeStyle('gray');
- context.setLineWidth(1 * unit);
- context.moveTo(426 * unit, 206 * unit);
- context.lineTo(510 * unit, 206 * unit);
- context.stroke();
-
- }else{
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- th.draw_Text(context, th.data.data.goods_name,
- 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.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
- //-------大图后面就不一样了-----------
- switch (type) {
- case 0: //普通商品的展示
- 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, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 410 * unit, 726 * unit, 115 * unit, 125 * 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, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * 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, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * 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(22 * 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, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
- }
- break
-
-
- }
-
-
- //--- 如果是自定义海报的时候 ---
- 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();
- }
-
-
- //把画板内容绘制成图片,并回调 画板图片路径
- context.draw(false, function() {
- setTimeout(function() {
- wx.canvasToTempFilePath({
- x: 0,
- y: 0,
- width: 750,
- height: 1217,
- destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
- destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
- canvasId: 'share',
- success: function(res) {
- that.setData({
- shareImgPath: res.tempFilePath,
- canvasHidden: true
- })
- if (!res.tempFilePath) {
- wx.showModal({
- title: '提示',
- content: '图片绘制中,请稍后重试',
- showCancel: false
- })
- return false;
- }
- // wx.previewImage({
- // //将图片预览出来
- // urls: [that.data.shareImgPath]
- // });
- that.setData({
- showPoster: true,
- });
- wx.hideLoading();
- }
- })
- }, 500)
-
- });
- });
- }
- });
- },
-
- //文本换行 参数: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);
- }
- }
- },
// ----视频图片----
// 图片计数器
@@ -2665,37 +2218,45 @@ Page({
});
}
},
- //--获取商品图片的本地缓存,回调写法--
- get_goods_temp: function(tt) {
- var ee = this;
- if (ee.data.share_goods_img) {
- tt();
- return false;
- }
- //获取商品是分享图信息
- wx.getImageInfo({
- src: ee.data.data.original_img,
- success: function(res) {
- //res.path是网络图片的本地地址
- ee.data.share_goods_img = res.path;
- tt();
- },
- fail: function(res) {
- //获取默认空白图
- wx.getImageInfo({
- src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
- success: function(res) {
- ee.data.share_goods_img = res.path; //分享的图片不能用网络的
- tt();
- }
- })
- }
- });
- },
+ //--获取商品图片的本地缓存,回调写法--
+ get_goods_temp: function(tt) {
+ var ee = this;
+ if (ee.data.share_goods_img) {
+ tt();
+ return false;
+ }
+ var img=ee.data.iurl+ee.data.data.image_url;
+ if(ee.data.prom_act && ee.data.prom_act.share_img){
+ img=ee.data.iurl+ee.data.prom_act.share_img;
+ }
+
+ //获取商品是分享图信息
+ wx.getImageInfo({
+ src: img,
+ success: function(res) {
+ //res.path是网络图片的本地地址
+ ee.data.share_goods_img = res.path;
+ tt();
+ },
+ fail: function(res) {
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
+
+ }
+ });
+ },
- //--跳转到商品详情页面--
+
+
+ //--跳转到商品详情页面--
go_goods: function(e) {
var gid = e.currentTarget.dataset.gid;
var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid;
@@ -3681,7 +3242,7 @@ Page({
ee.get_normal(gid);
return false;
}
-
+
var t_gd = ee.data.data;
var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss");
var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss");
@@ -3694,6 +3255,7 @@ Page({
prom_act: t.data.data,
prom_end_time: prom_end_time,
prom_start_time: prom_start_time,
+ is_share_text: t.data.data.is_share_text
});
ee.get_sto();
@@ -4105,9 +3667,728 @@ Page({
})
}
},
-
-
-
+
+ clickShare() {
+ this.setData({
+ share_hidden: true,
+ });
+ },
+ send() {
+ this.setData({
+ share_hidden: false,
+ });
+ },
+ cancel() {
+ this.setData({
+ share_hidden: false,
+ });
+ },
+
+
+ saveImageFn(){
+ if(this.data.share_b_img){
+ this.saveImageToPhotosAlbum()
+ }else{
+ this.saveImageToPhotosAlbumDef()
+ }
+ },
+
+
+ //--定义的保存图片方法,分享团---
+ saveImageToPhotosAlbum: function () {
+ //--先判断会员状态--
+ // 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', })
+ // return false;
+ // }
+
+ if (this.data.share_hidden) {
+ this.setData({
+ share_hidden: false,
+ });
+ };
+
+ //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
+ var type = 8;
+ wx.showLoading({
+ title: '生成中...',
+ })
+ var that = this,
+ th = that;
+ //设置画板显示,才能开始绘图
+ that.setData({
+ canvasHidden: false
+ })
+
+ var app = getApp();
+ var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
+ var path2 = that.data.data.original_img;
+
+ var scene = th.data.gid + "_"+th.data.presellList.id;
+ var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
+ if (user_id > 0) {
+ scene += "_" + user_id;
+ }
+ //-- 如果不是会员分享过来的要分享给别人 --
+ if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
+ //固定房间是第3个字符
+ if (!user_id) scene += "_0";
+ scene += "_" + getApp().globalData.room_id;
+ }
+
+
+ ///二微码
+ var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
+ os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/cardInfo/goodsInfo";
+
+
+ console.log(path3);
+
+ //读取文件成功则OK--
+ wx.getImageInfo({
+ src: path3,
+ success: function (res) {
+ //回调写法
+ th.get_head_temp(th.get_goods_temp, function () {
+ var vpath = res.path;
+ var context = wx.createCanvasContext('share');
+ //先画背景
+ 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);
+
+ let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:'';
+
+ //-- 是自定义海报的情况下 --
+ 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(nick, x1, y1);
+ var width = 24 * nick.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(nick, 152 * unit, 76 * unit);
+ var width = 24 * nick.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.presellForm.share_title;
+ share_title=share_title ? share_title : th.data.data.goods_name;
+
+ //---产品名称---
+ //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
+
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit)
+ th.draw_Text(context, share_title,
+ 80 * unit, 160 * unit, 200 * unit, 279 * unit, unit);
+
+ //------产品的价格-------
+ context.setFontSize(22 * unit)
+ context.setFillStyle("red")
+
+
+ var pri0 = th.data.presellList.presell_money;
+ // if (th.data.prom_act)
+ // 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, 160 * unit);
+ context.setFontSize(22 * 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;
+
+
+ if(th.data.presellForm.presell_type==1){
+ // context.setStrokeStyle('gray');
+ // context.fillText(pri0, wd2, 213 * unit);
+ // context.setLineWidth(1 * unit);
+ // context.moveTo(wd2 - 5, 206 * unit);
+ // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
+ // context.stroke();
+
+ //-- 零售价的优化 --
+ 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.show_price,unit);
+
+ }else{
+ var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50;
+ context.fillText('定金', wd2, 190 * 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, 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, 630 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 650 * unit);
+
+ context.drawImage(g_path, 218 * unit, 630 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 650 * unit);
+
+ context.drawImage(g_path, 388 * unit, 630 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 650 * unit);
+
+ }
+
+ //---画线---
+ // context.setLineWidth(1 * 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, 700 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(20 * unit)
+ var presell_price = `预售价:${th.data.presellList.presell_price}`
+ context.fillText(presell_price, 40 * unit, 750 * unit);
+ context.setFillStyle("black")
+ context.setFontSize(22 * unit)
+ context.fillText("特惠好物,限时预售", 40 * unit, 800 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * 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, 746 * unit, 130 * unit, 116 * unit);
+ }
+
+ //--- 如果是自定义海报的时候 ---
+ 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();
+ }
+
+
+ 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 () {
+ wx.canvasToTempFilePath({
+ x: 0,
+ y: 0,
+ width: 750,
+ height: 1217,
+ destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
+ destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
+ canvasId: 'share',
+ success: function (res) {
+
+ that.setData({
+ shareImgPath: res.tempFilePath,
+ canvasHidden: true
+ })
+
+ if (!res.tempFilePath) {
+ wx.showModal({
+ title: '提示',
+ content: '图片绘制中,请稍后重试',
+ showCancel: false
+ })
+ return false;
+ }
+
+ // wx.previewImage({
+ // //将图片预览出来
+ // urls: [that.data.shareImgPath]
+ // });
+ that.setData({
+ showPoster: true,
+ });
+ wx.hideLoading();
+ }
+ })
+ }, 500)
+
+ });
+ });
+ },
+ fail: function (res) {
+ console.log(res);
+ wx.hideLoading();
+
+ }
+ });
+ },
+ //--定义的保存图片方法,分享团---
+ saveImageToPhotosAlbumDef: function () {
+ //--先判断会员状态--
+ // 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',})
+ // return false;
+ // }
+
+ if (this.data.share_hidden) {
+ this.setData({share_hidden: false,});
+ };
+
+ //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
+ var type = this.data.prom_type || 0;
+ console.log('商品类型-----');
+ console.log(type);
+ // if (type == 2) type = -1;
+ if (type == 4) type = 0;
+ if (type == 8) type = 0;
+ if (type == 2) type = 0;
+ if (type == 6) type = 2; // 6拼团 2团购
+ if (type == 10) type = -1;
+
+ 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;
+ //设置画板显示,才能开始绘图
+ that.setData({
+ canvasHidden: false
+ })
+
+ var app = getApp();
+ var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
+ var path2 = that.data.data.original_img;
+
+ var scene = th.data.gid;
+ var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
+ if (user_id > 0) {
+ scene += "_" + user_id;
+ }
+ //-- 如果不是会员分享过来的要分享给别人 --
+ if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
+ //固定房间是第3个字符
+ if (!user_id) scene += "_0";
+ scene += "_" + getApp().globalData.room_id;
+ }else{
+ if (!user_id) scene += "_0";
+ scene += "_0";
+ }
+ if(this.data.prom_type){
+ scene += "_" + this.data.prom_type+"_"+th.data.prom_id;
+ }
+
+ ///二微码
+ var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
+ os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/goodsInfo/goodsInfo";
+
+ console.log(path3);
+
+
+ // 读取文件成功则OK--
+ wx.getImageInfo({
+ src: path3,
+ success: function (res) {
+ // 回调写法
+ th.get_head_temp(th.get_goods_temp, function () {
+ var vpath = res.path;
+ var context = wx.createCanvasContext('share');
+ // 先画背景
+ var pg_path = "../../../../images/share/share_bg.png";
+ th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
+
+ //把画板内容绘制成图片,并回调 画板图片路径
+ context.draw(false, function () {
+ setTimeout(function () {
+ wx.canvasToTempFilePath({
+ x: 0,
+ y: 0,
+ width: 750,
+ height: 1217,
+ destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
+ destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
+ canvasId: 'share',
+ success: function (res) {
+
+ that.setData({
+ shareImgPath: res.tempFilePath,
+ canvasHidden: true
+ })
+
+ if (!res.tempFilePath) {
+ wx.showModal({
+ title: '提示',
+ content: '图片绘制中,请稍后重试',
+ showCancel: false
+ })
+ return false;
+ }
+
+ that.setData({
+ showPoster: true,
+ });
+ wx.hideLoading();
+ }
+ })
+ }, 500)
+
+ });
+ });
+ },
+ fail: function (res) {
+ console.log(res);
+ wx.hideLoading();
+
+ }
+ });
+ },
+
+ //文本换行 参数: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);
+ }
+ }
+ },
+
+ 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.推荐来源
+ if(getApp().globalData.userInfo) {
+ 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) { // 秒杀
+
+ if (this.data.is_share_text == 1) {
+ src = '../../../images/share/miao_share.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit);
+ }
+ context.setTextAlign('left');
+ }
+
+
+ // 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.show_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();
+
+ },
+
+
+ closePoster() {
+ this.setData({
+ showPoster: false,
+ });
+ },
+
+ // 保存图片到手机
+ savePic() {
+ console.log('保存图片');
+ var self = this;
+ // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限
+ this.getSetting().then((res) => {
+ // 判断用户是否授权了保存到相册的权限,如果没有发起授权
+ if (!res.authSetting['scope.writePhotosAlbum']) {
+ this.authorize().then(() => {
+ // 同意授权后保存下载文件
+ this.saveImage(self.data.shareImgPath)
+ .then(() => {
+ self.setData({
+ showPoster: false
+ });
+ });
+ })
+ } else {
+ // 如果已经授权,保存下载文件
+ this.saveImage(self.data.shareImgPath)
+ .then(() => {
+ self.setData({
+ showPoster: false
+ });
+ });
+ }
+
+ })
+ },
+
+ // 发起首次授权请求
+ authorize() {
+ // isFirst 用来记录是否为首次发起授权,
+ // 如果首次授权拒绝后,isFirst赋值为1
+ let isFirst = wx.getStorageSync('isFirst') || 0;
+ return new Promise((resolve, reject) => {
+ wx.authorize({
+ scope: 'scope.writePhotosAlbum',
+ // 同意授权
+ success: () => {
+ resolve();
+ },
+ // 拒绝授权,这里是用户拒绝授权后的回调
+ fail: res => {
+ if (isFirst === 0) {
+ wx.setStorageSync('isFirst', 1);
+ wx.showToast({
+ title: '保存失败',
+ icon: 'none',
+ duration: 1000
+ })
+ } else {
+ this.showModal();
+ }
+ console.log('拒绝授权');
+ reject();
+ }
+ })
+ })
+ },
+
+
+ // 保存图片到系统相册
+ saveImage(saveUrl) {
+ var self = this;
+ return new Promise((resolve, reject) => {
+ wx.saveImageToPhotosAlbum({
+ filePath: saveUrl,
+ success: (res) => {
+ wx.showToast({
+ title: '保存成功',
+ duration: 1000,
+ });
+ self.setData({
+ showPlaybill: 'true'
+ });
+ resolve();
+ },
+ fail: () => {
+ wx.showToast({
+ title: '保存失败',
+ duration: 1000,
+ });
+ }
+ })
+ })
+ },
+
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
+ });
+ },
+
});
diff --git a/packageA/pages/goodsInfo/goodsInfo.json b/packageA/pages/goodsInfo/goodsInfo.json
index 5b20c87..57137c1 100644
--- a/packageA/pages/goodsInfo/goodsInfo.json
+++ b/packageA/pages/goodsInfo/goodsInfo.json
@@ -6,7 +6,8 @@
"warn": "/components/long_warn/long_warn",
"serviceCard_recommend": "/components/serviceCard_list/serviceCard_list",
"privacy_pop": "/components/privacy_pop/privacy_pop",
- "top_nav": "/components/diy_top_nav/diy_top_nav"
+ "top_nav": "/components/diy_top_nav/diy_top_nav",
+ "share": "/components/share/share"
},
"navigationStyle": "custom"
}
\ No newline at end of file
diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml
index 451107d..9a2d0e9 100644
--- a/packageA/pages/goodsInfo/goodsInfo.wxml
+++ b/packageA/pages/goodsInfo/goodsInfo.wxml
@@ -11,7 +11,7 @@
-
@@ -106,16 +106,25 @@
-
-
- ¥{{filters.toFix(prom_price,2)}}
-
- ¥{{filters.toFix(data.shop_price,2)}}
-
-
- {{data.goods_name}}
+
+
+
+
+ ¥{{filters.toFix(prom_price,2)}}
+
+ ¥{{filters.toFix(data.shop_price,2)}}
+
+
+ {{data.goods_name}}
+
+
+
+
+
+
+ 分享
@@ -970,14 +979,20 @@
-
-
+
+
-
+
+
+
+
+
+
+
@@ -1015,3 +1030,5 @@
+
+
diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
index e238c5c..c2d1534 100644
--- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
+++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
@@ -12,6 +12,7 @@ var more = function (e) {
}(require("../../../../utils/LoadMore.js")),
n = new more.default();
var regeneratorRuntime = require('../../../../utils/runtime.js');
+var self=null;
Page({
data: {
@@ -1615,6 +1616,12 @@ Page({
// return false;
// }
+ if (this.data.share_hidden) {
+ this.setData({
+ share_hidden: false,
+ });
+ };
+
//类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4积分购
var type = 2
if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
@@ -3579,6 +3586,9 @@ Page({
});
},
+ send() {
+ this.setData({ share_hidden: false, });
+ },
cancel() {
this.setData({
share_hidden: false,
@@ -3975,6 +3985,15 @@ Page({
}
},
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
+ });
+ },
+
});
diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
index 904d6e7..196a2b7 100644
--- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
+++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
@@ -807,14 +807,20 @@
-
-
+
+
-
+
+
+
+
+
+
+
diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss
index d38ba36..de42797 100644
--- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss
+++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss
@@ -2744,7 +2744,7 @@ button.custom-service::after{
left: 50%;
transform: translate(-50%, -50%);
width: calc(100% - 120rpx);
- z-index: 1000;
+ z-index: 10001;
}
.mask {
position: fixed;
@@ -2752,7 +2752,7 @@ button.custom-service::after{
left: 0;
width: 100%;
height: 100%;
- z-index: 999;
+ z-index: 10000;
background-color: rgba(0,0,0,.4);
}
.poster-wrapper {
diff --git a/packageC/pages/presell/cardInfo/goodsInfo.js b/packageC/pages/presell/cardInfo/goodsInfo.js
index 5bafb14..7bd7ca4 100644
--- a/packageC/pages/presell/cardInfo/goodsInfo.js
+++ b/packageC/pages/presell/cardInfo/goodsInfo.js
@@ -2002,8 +2002,8 @@ Page({
return false;
}
- var img=ee.data.iurl+ee.data.data.img_url;
- if(ee.data.prom_act){
+ var img=ee.data.iurl+ee.data.data.image_url;
+ if(ee.data.prom_act && ee.data.prom_act.share_img){
img=ee.data.iurl+ee.data.prom_act.share_img;
}
@@ -4073,7 +4073,14 @@ Page({
})
},
-
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
+ });
+ },
diff --git a/packageC/pages/presell/cardInfo/goodsInfo.wxml b/packageC/pages/presell/cardInfo/goodsInfo.wxml
index c0e78b1..cd988ad 100644
--- a/packageC/pages/presell/cardInfo/goodsInfo.wxml
+++ b/packageC/pages/presell/cardInfo/goodsInfo.wxml
@@ -990,6 +990,7 @@
+