diff --git a/packageA/pages/cardList/cardList.wxml b/packageA/pages/cardList/cardList.wxml
index b094f55..5e71e57 100644
--- a/packageA/pages/cardList/cardList.wxml
+++ b/packageA/pages/cardList/cardList.wxml
@@ -58,9 +58,13 @@
-
-
-
+
+
+
+
+
+
+
diff --git a/packageA/pages/quan_pro/quan_pro.js b/packageA/pages/quan_pro/quan_pro.js
index 8113137..36d2762 100644
--- a/packageA/pages/quan_pro/quan_pro.js
+++ b/packageA/pages/quan_pro/quan_pro.js
@@ -35,7 +35,12 @@ Page({
}
var id=t.id;
+ //如果二维码分享过来的
+ if(!id){
+ id = decodeURIComponent(t.scene);
+ }
this.data.id=id;
+
var goods_list = this.selectComponent("#goods_list"); //组件的id
goods_list.init();
setTimeout(function() {
diff --git a/packageA/pages/quan_pro/quan_pro.wxml b/packageA/pages/quan_pro/quan_pro.wxml
index 664a246..467d6d4 100644
--- a/packageA/pages/quan_pro/quan_pro.wxml
+++ b/packageA/pages/quan_pro/quan_pro.wxml
@@ -79,7 +79,7 @@
- 恭喜您获得【{{q_data.name}}】优惠券
+ 恭喜您获得【{{q_data.name}}】优惠券
查看我的优惠券
diff --git a/packageA/pages/quan_pro/quan_pro.wxss b/packageA/pages/quan_pro/quan_pro.wxss
index fcd20cb..bf3560a 100644
--- a/packageA/pages/quan_pro/quan_pro.wxss
+++ b/packageA/pages/quan_pro/quan_pro.wxss
@@ -19,7 +19,7 @@ page{background-color: #f8f8f8;}
top:50%; margin-top: -150rpx;background-color: #fff; z-index: 999999;
}
-.suc_content .up{ height:200rpx;}
+.suc_content .up{ min-height:200rpx;}
.suc_content .up image{ width: 280rpx; height: 220rpx; margin-top: -130rpx}
.suc_content .down{ background-color: #c4182e; height:106rpx; line-height: 106rpx;
border-bottom-right-radius:25rpx;
@@ -29,3 +29,6 @@ page{background-color: #f8f8f8;}
.btn.gray{background-color: #dcdcdc; color: #adb3be;}
.coupon_remark{padding: 30rpx 0 10rpx 0; box-sizing: border-box; overflow: hidden;}
+.q_title{
+ margin-top:30rpx;color:#4e220b; padding: 0 10rpx; padding-bottom: 10rpx;
+}
\ No newline at end of file
diff --git a/packageC/pages/presell/cardInfo/goodsInfo.js b/packageC/pages/presell/cardInfo/goodsInfo.js
index 5e426ed..5ad72af 100644
--- a/packageC/pages/presell/cardInfo/goodsInfo.js
+++ b/packageC/pages/presell/cardInfo/goodsInfo.js
@@ -223,7 +223,8 @@ Page({
nav_backgroundColor: "#ffffff",
nav_type: 2, //导航类型
istop: 0, //是否置顶风格为1
- searchbox_transparent: 1
+ searchbox_transparent: 1,
+ prom_type: 8,
},
@@ -250,25 +251,56 @@ Page({
//检查测肤
getApp().check_skin_face(t,1,gid);
+
+ //-- 自定义海报 --
+ 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 })
+
+ }
+ }
+ })
+
//-- 设置顶部高度 --
let height= getApp().globalData.navBarHeight;
ee.setData({ top_nav:height});
- //---获取手机地址坐标--
- //--如果tg_id是空的话,分享回来--
- if (gid == undefined || gid == null || gid == "") {
- var gid_str = decodeURIComponent(t.scene);
- gid_str=gid_str.split("_");
- gid=gid_str[0];
- if(gid_str.length>1){
- first_leader=gid_str[1];
- }
- //-- 如果有room_id的获取 --
- if(gid_str.length>2 && gid_str[2]) {
- room_id=gid_str[2];
- room_user_share=1;
- };
- };
+
+ //--如果tg_id是空的话,分享回来--
+ if (gid == undefined || gid == null || gid == "") {
+ var gid_str = decodeURIComponent(t.scene);
+ gid_str = gid_str.split("_");
+ gid = gid_str[0];
+ if (gid_str.length > 1) {
+ pre_id = gid_str[1];
+ first_leader = gid_str[2];
+ }
+ //-- 如果有room_id的获取 --
+ if (gid_str.length > 2 && gid_str[3]) {
+ room_id = gid_str[3];
+ room_user_share = 1;
+ }
+ }
ee.setData({ gid: gid, pre_id: pre_id, presell_id: presell_id});
@@ -582,7 +614,7 @@ Page({
privacy_pop.check_pri_show();
}
- getApp().check_can_share();
+ getApp().check_can_share(this);
var that=this;var th=this;
var ee = this,gid = this.data.gid, i = getApp().request;
@@ -1845,466 +1877,6 @@ 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) {
@@ -2381,45 +1953,52 @@ Page({
}, 500)
},
- //--获取头像的本地缓存,回调写法--
- get_head_temp: function(tt, func) {
- var ee = this;
- if (ee.data.share_head) {
- tt(func);
- return false;
- }
- //---获取分享图片的本地地址,头像和商品图片----
- var path2 = getApp().globalData.userInfo.head_pic;
- if (path2 == "") {
- ee.data.share_head = "../../../images/share/hui_hear_pic.png";
- tt(func);
- } else {
- path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
- path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
- wx.getImageInfo({
- src: path2,
- success: function(res) {
- //res.path是网络图片的本地地址
- ee.data.share_head = res.path;
- tt(func);
- },
- fail: function(res) {
- ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
- tt(func);
+ //--获取头像的本地缓存,回调写法--
+ get_head_temp: function (tt, func) {
+ var ee = this;
+ if (ee.data.share_head) {
+ tt(func);
+ return false;
}
- });
- }
- },
- //--获取商品图片的本地缓存,回调写法--
+ //---获取分享图片的本地地址,头像和商品图片----
+ var path2 = getApp().globalData.userInfo.head_pic;
+ if (path2 == "") {
+ ee.data.share_head = "../../../../images/share/hui_hear_pic.png";
+ tt(func);
+ } else {
+ path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
+ path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
+ wx.getImageInfo({
+ src: path2,
+ success: function (res) {
+ //res.path是网络图片的本地地址
+ ee.data.share_head = res.path;
+ tt(func);
+ },
+ fail: function (res) {
+ ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
+ tt(func);
+ }
+ });
+ }
+ },
+
+ //--获取商品图片的本地缓存,回调写法--
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.img_url;
+ if(ee.data.prom_act){
+ img=ee.data.iurl+ee.data.prom_act.share_img;
+ }
+
//获取商品是分享图信息
wx.getImageInfo({
- src: ee.data.data.original_img,
+ src: img,
success: function(res) {
//res.path是网络图片的本地地址
ee.data.share_goods_img = res.path;
@@ -3349,13 +2928,7 @@ Page({
};
})
},
-
-
-
-
-
-
viewFlash(e) {
let prom_type = e.currentTarget.dataset.promtype;
let prom_id = e.currentTarget.dataset.promid;
@@ -3366,9 +2939,7 @@ Page({
}
getApp().goto(url);
},
-
-
-
+
//获取更多秒杀
get_more_flash: async function (func) {
var f_more = false;
@@ -3787,8 +3358,712 @@ Page({
}
},
+ clickShare() {
+ if (!getApp().globalData.user_id) {
+ getApp().goto("/packageE/pages/togoin/togoin");
+ return false;
+ }
+ 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);
+
+ //-- 是自定义海报的情况下 --
+ 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.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;
+ 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 + "_"+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";
+
+ 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.推荐来源
+ 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.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,
+ });
+ }
+ })
+ })
+ },
+
+
+
+
+
+
});
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js
index 3002697..f3a9be6 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1742,6 +1742,11 @@ Page({
var th = this;
var price = th.data.pre_arr.presell_price;
var img = th.data.data.original_img;
+ //如果活动有设置分享图的时候
+ if(this.data.presellForm.share_img){
+ img = this.data.iurl+this.data.presellForm.share_img;
+ }
+
var title = th.data.presellForm.share_title;
if (!title) title = th.data.prom_act.title;
if (th.data.prom_type == 4) title = th.data.prom_act.name;
@@ -3240,7 +3245,7 @@ Page({
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 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;
@@ -3349,7 +3354,7 @@ Page({
// 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);
@@ -3367,7 +3372,7 @@ Page({
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;
@@ -3393,7 +3398,7 @@ Page({
context.fillText("官方验证", 420 * unit, 650 * unit);
}
-
+
//---画线---
// context.setLineWidth(1 * unit)
// context.moveTo(32 * unit, 662 * unit)
@@ -3407,14 +3412,14 @@ Page({
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}`
+ 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;
@@ -3523,7 +3528,7 @@ Page({
}
});
},
- //--定义的保存图片方法,分享团---
+ //--定义的保存图片方法,分享团---
saveImageToPhotosAlbumDef: function () {
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
@@ -3867,6 +3872,7 @@ Page({
});
}
},
+
//--获取商品图片的本地缓存,回调写法--
get_goods_temp: function (tt) {
var ee = this;
@@ -4635,6 +4641,11 @@ Page({
url+="&groupchat_id="+getApp().globalData.groupchat_id
}
let img = this.data.data.original_img;
+ //如果活动有设置分享图的时候
+ if(this.data.presellForm.share_img){
+ img = this.data.iurl+this.data.presellForm.share_img;
+ }
+
return {
title: this.data.data.goods_name + '-' + store_name,
query: 'first_leader='+user_id+url,
diff --git a/packageD/pages/user/integral/integral.js b/packageD/pages/user/integral/integral.js
index 5525f1b..d8609c6 100644
--- a/packageD/pages/user/integral/integral.js
+++ b/packageD/pages/user/integral/integral.js
@@ -34,27 +34,60 @@ Page({
iurl: o.imghost,
is_show_jfcz:0,
+ tab:0,
+ is_no_more_e:0, //充值使用
+ current_page_e:0, //充值使
+ is_loading:0, //避免重复request请求
+ is_loading_c:0 //避免重复request请求
},
/**
* 刷出积分劵
*/
async exchange() {
- var e = this, result;
+
+ if (this.data.is_no_more_e) return;
+ if (this.data.is_loading_c) return;
+ this.data.current_page_e++;
+ this.data.is_loading_c=1;
+
+ var e = this, result=[];
var user_id = getApp().globalData.user_id;
var store_id = os.stoid;
var get_data = {
user_id: user_id, store_id: store_id,
- pageSize: 10, page: e.data.current_page
+ pageSize: 10, page: e.data.current_page_e
///api/weshop/users/listExchangeCoupons
}; //api/index/yuck
+
+ wx.showLoading();
await getApp().request.promiseGet("/api/weshop/users/listExchangeCoupons", {
data:get_data
}).then(res => {
- var msg = res.data;
- result = msg.data.pageData;
+
+ wx.hideLoading();
+ e.data.is_loading_c=0;
+ if(ut.ajax_ok(res)){
+ var msg = res.data;
+ let result2 = msg.data.pageData;
+ let arr=e.data.result;
+ result = arr.concat(result2);
+
+ //-- 显示没有更多的优化 --
+ if (msg.data.total <=10*e.data.current_page_e) {
+ e.setData({
+ is_no_more_e: 1
+ })
+ }
+
+ }else{
+ e.setData({
+ is_no_more_e: 1
+ })
+ }
+
})
e.setData({
- result: result
+ result: result,is_get_c:1
})
},
@@ -63,36 +96,57 @@ Page({
*/
async detaileds() {
if (this.data.is_no_more) return;
+ if (this.data.is_loading) return;
this.data.current_page++;
+ this.data.is_loading=1;
+
var e = this, details;
var user_id = getApp().globalData.user_id;
var store_id = os.stoid;
var get_data = {
user_id: user_id, store_id: store_id,
- pageSize: 10, page: e.data.current_page
+ pageSize: 15, page: e.data.current_page
};
var big_arr = this.data.details;
+
+ wx.showLoading();
+
await getApp().request.promiseGet("/api/weshop/users/listPoints", {
data: get_data
}).then(res => {
- var msg = res.data;
- if(!msg || !msg.data.pageData || msg.data.pageData.length == 0){
- this.data.is_no_more = 1;
- getApp().showWarning("未找更多数据");
- return false;
+ wx.hideLoading();
+ e.data.is_loading=0;
+
+ if(ut.ajax_ok(res)){
+ var msg = res.data;
+
+ details = msg.data.pageData;
+ details.forEach(function (val, ind) {
+ big_arr.push(val);
+ })
+
+ //-- 显示没有更多的优化 --
+ if (msg.data.total <=15*e.data.current_page) {
+ e.setData({
+ is_no_more: 1
+ })
+ }
+ }else{
+ e.setData({
+ is_no_more: 1
+ })
}
- details = msg.data.pageData;
- details.forEach(function (val, ind) {
- big_arr.push(val);
- })
- setTimeout(() => {
- this.setData({
- details: big_arr
- });
- }, 1500)
+
+
})
+
+
+ this.setData({
+ details: big_arr,is_get_d:1
+ });
+
var get_datas= {
user_id: user_id, store_id: store_id,
};
@@ -105,11 +159,18 @@ Page({
this.setData({number: integrals})
})
+
+
},
//---加载更多是靠这个函数----
onReachBottom: function () {
- console.log("加载跟多");
- this.detaileds();
+ //0是积分明细 1是积分充值
+ if(this.data.currentTab==0){
+ this.detaileds();
+ }else{
+ this.exchange();
+ }
+
},
//积分弹框控制器
@@ -180,14 +241,14 @@ Page({
console.log("积分明细", e.target.dataset.current);
var jfmx=true;
var jfcz= false;
- this.setData({ jfmx: jfmx, jfcz: jfcz, current_page: 0,details:[] });
+ this.setData({ jfmx: jfmx, jfcz: jfcz, current_page: 0,details:[],is_get_d:0,is_no_more:0 });
this.detaileds();
}else{
if(this.data.is_show_jfcz) {
console.log("积分充值", e.target.dataset.current);
var jfmx = false;
var jfcz = true;
- this.setData({jfmx: jfmx, jfcz: jfcz, current_page:1,result:[] });
+ this.setData({jfmx: jfmx, jfcz: jfcz, current_page_e:0,result:[],is_get_c:0,is_no_more_e:0});
this.exchange();
}else{
return false;
@@ -211,19 +272,25 @@ Page({
//定义第一次进入
this.data.fir_in=1;
- var th=this;
- getApp().request.get("/api/wx/weappSendlist/page", {
- data: {
- store_id: os.stoid,
- typeid: "1002"
- },
- success: function(res) {
- if (res.data.code == 0 && res.data.data.pageData.length > 0) {
- var template_id = res.data.data.pageData[0].template_id;
- th.setData({template_id:template_id});
- }
- }
- });
+ var th=this;
+ getApp().request.get("/api/wx/weappSendlist/page", {
+ data: {
+ store_id: os.stoid,
+ typeid: "1002"
+ },
+ success: function(res) {
+ if (res.data.code == 0 && res.data.data.pageData.length > 0) {
+ var template_id = res.data.data.pageData[0].template_id;
+ th.setData({template_id:template_id});
+ }
+ }
+ });
+
+ if(options.tab==1){
+ th.data.tab=1;
+ }
+
+
},
@@ -380,18 +447,31 @@ Page({
return false;
}
- this.exchange();
- this.detaileds();
wx.setNavigationBarTitle({
title: "我的积分",
})
+
+ if(this.data.has_init) return false;
+ this.data.has_init=1;
+
+ this.detaileds();
+
//要实时获取开关是显示
- var th=this;
- getApp().getConfig2(function(ee){
+ getApp().getConfig2(function(ee){
var json_d = JSON.parse(ee.switch_list);
th.setData({ is_show_jfcz: json_d.jfcz_switch });
- },1)
+ //-- 如果有开启积分充值,就调用积分充值的界面 --
+ if(json_d.jfcz_switch && th.data.tab==1 ){
+ th.data.tab=0;
+ var jfmx = false;
+ var jfcz = true;
+ th.setData({jfmx: jfmx, jfcz: jfcz, current_page_e:0,result:[],currentTab:1 });
+ th.exchange();
+
+ }
+
+ },1)
},
diff --git a/packageD/pages/user/integral/integral.json b/packageD/pages/user/integral/integral.json
index 8835af0..52632af 100644
--- a/packageD/pages/user/integral/integral.json
+++ b/packageD/pages/user/integral/integral.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "usingComponents": {
+ "nodata": "/components/nodata/nodata"
+ }
}
\ No newline at end of file
diff --git a/packageD/pages/user/integral/integral.wxml b/packageD/pages/user/integral/integral.wxml
index e980d75..2a05695 100644
--- a/packageD/pages/user/integral/integral.wxml
+++ b/packageD/pages/user/integral/integral.wxml
@@ -30,7 +30,7 @@
-
+
@@ -45,6 +45,11 @@
+
+
+
+ —— 已经到底了 ——
+
@@ -63,6 +68,10 @@
+
+
+ —— 已经到底了 ——
+
diff --git a/packageD/pages/user/integral/integral.wxss b/packageD/pages/user/integral/integral.wxss
index 9fec40e..d3694ab 100644
--- a/packageD/pages/user/integral/integral.wxss
+++ b/packageD/pages/user/integral/integral.wxss
@@ -466,4 +466,11 @@ line-height:85rpx;
.gd{
color: #999999;
font-size: 25rpx;
-}
\ No newline at end of file
+}
+
+ .noMore {
+ padding: 20rpx;
+ color: #bbb;
+ text-align: center;
+ font-size: 22rpx;
+ }
\ No newline at end of file
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index fdb1f8a..86d16f8 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -2443,7 +2443,35 @@ Page({
all_num += item[c].goods_num;
if (item[c].prom_type == 7) {
- item[c].act = th.data.zuhe_map[item[c].prom_id];
+ item[c].act = th.data.zuhe_map[item[c].prom_id];
+ if(item[c].zh_b_num===undefined || item[c].zh_b_num===null ){
+ var prom_goodsbuynum = 0;
+ //--要获得商品,该用户买了多少件,同步应用,用于限购的计算--
+ await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: {
+ store_id: oo.stoid,
+ user_id: getApp().globalData.user_id,
+ goods_id: item[c].goods_id,
+ prom_type: item[c].prom_type,
+ prom_id: item[c].prom_id,
+ isnew:1
+ },
+ }).then(res => {
+ if(res.data.code==0 && res.data.data)
+
+ if (res.data.data.promgoodsbuynum) {
+ promgoodsbuynum = res.data.data.promgoodsbuynum;
+ }
+
+ })
+
+ var txt = "requestData[" + a + "].goods[" + c + "].zh_b_num";
+ th.setData({
+ [txt]: prom_goodsbuynum
+ });
+
+
+ }
}
if (item[c].prom_type == 10) {
item[c].act = th.data.ladder_map[item[c].prom_id];
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 8493c46..7b396c3 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -1160,12 +1160,7 @@ Page({
// }
- //一件代发商品不去计算优惠
- //if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) {
- if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) {
- ee.check_is_youhui(ee.data.gid);
- }
-
+
t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
var cur_price = t.data.data.shop_price;
@@ -1207,6 +1202,12 @@ Page({
front_g: ut.deep_cp(t.data.data),
});
+ //一件代发商品不去计算优惠
+ //if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) {
+ if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) {
+ ee.check_is_youhui(ee.data.gid);
+ }
+
//获取统一条形码,普通商品和优惠促销的商品
if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) {
ee.get_sto();
@@ -3474,7 +3475,9 @@ Page({
break
}
}
+
console.log(item, 2000);
+
var cur_price = item.shop_price;
if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
var cfile = getApp().globalData.userInfo.card_field;
diff --git a/pages/user/my_service/i_service.js b/pages/user/my_service/i_service.js
index a222f93..b4f98f7 100644
--- a/pages/user/my_service/i_service.js
+++ b/pages/user/my_service/i_service.js
@@ -23,6 +23,7 @@ Page({
ismore: 0, //是否加载完毕
userinfo: null,
is_sub: 0, //是否重复提交预约
+
},
/**
@@ -39,6 +40,12 @@ Page({
});
var th = this;
th.query_service();
+
+ //顶部的高度
+ var h1=getApp().globalData.navBarHeight>0?getApp().globalData.navBarHeight:0;
+ this.setData({navBarHeight:h1})
+
+
},
/**
* 生命周期函数--监听页面显示
diff --git a/pages/user/my_service/i_service.wxml b/pages/user/my_service/i_service.wxml
index 744f9a3..c93b725 100644
--- a/pages/user/my_service/i_service.wxml
+++ b/pages/user/my_service/i_service.wxml
@@ -3,7 +3,7 @@
-
+
服务记录
历史预约
diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js
index f9a41e7..8d94c45 100644
--- a/pages/user/order_detail/order_detail.js
+++ b/pages/user/order_detail/order_detail.js
@@ -844,6 +844,28 @@ Page({
}
}
+ //阶梯促销获取取价规则
+ if(gg.prom_type==10){
+ var prom_ld=null;
+ //-- 获取阶梯规则 --
+ var url1 = "/api/weshop/prom/ladderList/list";
+ var req_data = {
+ store_id: os.stoid,
+ form_id: gg.prom_id,
+ }
+ await getApp().request.promiseGet(url1, {
+ data: req_data
+ }).then(rs1 => {
+ if (rs1.data.code == 0 && rs1.data.data && rs1.data.data.length ) {
+ prom_ld = rs1.data.data[0];
+ }
+ })
+
+ if(prom_ld){
+ gg.discount_field=prom_ld.discount_field;
+ }
+ }
+
if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9)
&& !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
var prom = null;
@@ -1122,7 +1144,7 @@ Page({
if (!good.is_gift && !good.is_collocation && gg.prom_type != 9) {
//-- 优惠促销的时候控制取价规则 --
- if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ) {
+ if((gg.prom_type!=3 && gg.prom_type!=10) || gg.discount_field==undefined || gg.discount_field==0 ) {
if (card_field && gg[card_field] > 0) {
if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
@@ -1132,7 +1154,7 @@ Page({
if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
}
}else{
- if(good.prom_type==3){
+ if(good.prom_type==3 && good.prom_type==10){
switch (gg.discount_field){
case 1:
if (good.goods_price != gg.shop_price) isok = 0;
diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js
index d0750bd..5226c44 100644
--- a/pages/user/order_list/order_list.js
+++ b/pages/user/order_list/order_list.js
@@ -1125,6 +1125,7 @@ Page({
})
+ //优惠促销获取取价规则
if(gg.prom_type==3){
var prom_pc=null;
await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
@@ -1136,6 +1137,27 @@ Page({
}
}
+ //阶梯促销获取取价规则
+ if(gg.prom_type==10){
+ var prom_ld=null;
+ //-- 获取阶梯规则 --
+ var url1 = "/api/weshop/prom/ladderList/list";
+ var req_data = {
+ store_id: os.stoid,
+ form_id: gg.prom_id,
+ }
+ await getApp().request.promiseGet(url1, {
+ data: req_data
+ }).then(rs1 => {
+ if (rs1.data.code == 0 && rs1.data.data && rs1.data.data.length ) {
+ prom_ld = rs1.data.data[0];
+ }
+ })
+
+ if(prom_ld){
+ gg.discount_field=prom_ld.discount_field;
+ }
+ }
if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9)
&& !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
@@ -1417,7 +1439,7 @@ Page({
//-- 优惠促销的时候控制取价规则 --
- if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ){
+ if( (gg.prom_type!=3 && gg.prom_type!=10 ) || gg.discount_field==undefined || gg.discount_field==0 ){
if (card_field && gg[card_field] > 0) {
if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
@@ -1428,7 +1450,7 @@ Page({
}
}else{
- if(good.prom_type==3){
+ if(good.prom_type==3 || good.prom_type==10 ){
switch (gg.discount_field){
case 1:
if (good.goods_price != gg.shop_price) isok = 0;