diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js
index cd8b892..2032b38 100644
--- a/packageA/pages/goodsInfo/goodsInfo.js
+++ b/packageA/pages/goodsInfo/goodsInfo.js
@@ -853,6 +853,13 @@ Page({
}
+ if(this.data.goodsInputNum==0){
+ getApp().my_warnning('请输入购买数量', 1, th, 450);
+ return false;
+ }
+
+
+
if(!ind) ind = t.currentTarget.dataset.openspecmodal_ind;
th.setData({
@@ -870,6 +877,8 @@ Page({
var limitNum = 0;
// 已购买数量
var boughtNum = 0;
+
+ var is_ok=1;
// 秒杀活动
if(this.data.prom_type == 1) {
@@ -895,6 +904,7 @@ Page({
// title: '超出活动库存',
// });
getApp().my_warnning('超出活动库存', 0, self);
+ is_ok=0;
return false;
} else {
// 可购买数量>0
@@ -922,8 +932,9 @@ Page({
// });
getApp().my_warnning('超出活动库存', 0, self);
th.setData({
- goodsInputNum: res,
+ goodsInputNum: res || 1
});
+ is_ok=0;
return false;
};
};
@@ -935,8 +946,9 @@ Page({
// });
getApp().my_warnning('超出限购数量', 0, self);
th.setData({
- goodsInputNum: canBuyNum,
+ goodsInputNum: canBuyNum || 1,
});
+ is_ok=0;
return false;
};
};
@@ -955,7 +967,10 @@ Page({
};
-
+ if(!is_ok) return false;
+
+
+
if(action=="buy"){
//--------------此时操作的数据------------
var newd = {
@@ -1243,7 +1258,7 @@ Page({
// });
getApp().my_warnning('超出活动库存', 0, self);
th.setData({
- goodsInputNum: res,
+ goodsInputNum: res || 1,
});
return false;
};
@@ -1256,7 +1271,7 @@ Page({
// });
getApp().my_warnning('超出限购数量', 0, self);
th.setData({
- goodsInputNum: canBuyNum,
+ goodsInputNum: canBuyNum || 1,
});
return false;
};
diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js
index 69f769b..dcc4b7f 100644
--- a/packageB/pages/zuhegou/index/index.js
+++ b/packageB/pages/zuhegou/index/index.js
@@ -358,12 +358,17 @@ Page({
}
}
//获取购物车的内容
- th.get_cart_val(e);
+ setTimeout(function(){
+ th.get_cart_val(e);
+ },1000)
+
})
} else {
//获取购物车的内容
- th.get_cart_val(e);
+ setTimeout(function(){
+ th.get_cart_val(e);
+ },1000)
}
}, 1);
@@ -659,7 +664,8 @@ Page({
async check_pk_store_conut(func,is_no_msg,gd,by_num){
var th=this;
if(this.data.sales_rules!=2){
- func();
+ if(func) func();
+ return false;
}
//门店库存no
var pkno= gd && gd.pickup_no?gd.pickup_no:this.data.def_pick_store.pickup_no;
@@ -2242,11 +2248,15 @@ Page({
var map = {};
var mlist = e.data.data.pageData;
th.data.cart_list = mlist;
-
for (let i in mlist) {
let item = mlist[i];
if (item.prom_type != 7) continue;
if (item.prom_id != th.data.act.id) continue;
+ if(th.data.def_pick_store && th.data.def_pick_store.pickup_id){
+ if(item.pick_id!=th.data.def_pick_store.pickup_id){
+ continue;
+ }
+ }
map[item.goods_id] = item;
}
diff --git a/packageC/pages/goods/distributionCategoryList/index.js b/packageC/pages/goods/distributionCategoryList/index.js
index bce472c..13e3a79 100644
--- a/packageC/pages/goods/distributionCategoryList/index.js
+++ b/packageC/pages/goods/distributionCategoryList/index.js
@@ -143,9 +143,9 @@ Page({
that.setData({ store_config: e, is_do: 1 });
//---有勾品类---
- if (that.data.is_show_pl) {
- that.getGoodsCategoris();
- }
+ //if (that.data.is_show_pl) {
+ // that.getGoodsCategoris();
+ //}
if (that.data.is_show_gb != 1 && that.data.is_show_pp != 1 && that.data.is_show_pl) {
that.data.pl_timer = setInterval(function () {
if (that.data.catelist.length > 0) {
@@ -521,6 +521,7 @@ Page({
let { currentData } = this.data;
currentData.cat_id = this.data.cat_id;
currentData.page = this.data.stylePage;
+ currentData.parent_id = 0;
let url = '/api/weshop/users/distribut/pagemyshop';
getApp().promiseGet(url, {
diff --git a/packageC/pages/goods/distributionCategoryList/index.wxml b/packageC/pages/goods/distributionCategoryList/index.wxml
index ad0d7cb..f34a559 100644
--- a/packageC/pages/goods/distributionCategoryList/index.wxml
+++ b/packageC/pages/goods/distributionCategoryList/index.wxml
@@ -33,7 +33,8 @@
-
+
{{item.name}}
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
index 2c13749..65d3955 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -317,6 +317,39 @@ Page({
//检查测肤
getApp().check_skin_face(t,0,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);
+ console.log('自定义海报参数-------');
+ console.log(json_data);
+ 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})
+
+ }
+ }
+ })
+
//---获取手机地址坐标--
//--如果tg_id是空的话,分享回来--
// console.log('扫描海报gid');
@@ -714,7 +747,7 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
@@ -722,7 +755,24 @@ Page({
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if(fir_quan.length > 0 ){
+ let goodInfo = ee.data.data
+ for (let index = fir_quan.length-1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index,1)
+ }
+ }
+ }
+ }
+ let arr=[]
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr=fir_quan
+ }else{
+ arr=fir_quan.splice(0,3);
+ }
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -748,7 +798,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -4450,7 +4500,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length-1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype==20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index,1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
@@ -4620,7 +4681,7 @@ Page({
// 8.商品标题
context.setFontSize(20 * unit);
context.setFillStyle('#898989');
- this.draw_Text(context, this.data.data.goods_name,
+ getApp().draw_Text(context, this.data.data.goods_name,
54 * unit, 770 * unit, 240 * unit, 240 * unit, unit);
// 9.小程序码
context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
@@ -4717,7 +4778,7 @@ Page({
// context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
- if (type == 0) { // 如果是普通商品,绘制新海报
+ if (!th.data.share_b_img && (type == 9)) { // 如果是普通商品,绘制新海报
th.drawPoster(context, unit, th.data.share_goods_img, vpath);
} else {
context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
@@ -4727,7 +4788,7 @@ Page({
//-- 是自定义海报的情况下 --
- if (type != 0) {
+ if (th.data.share_b_img || type != 0) {
@@ -4758,10 +4819,10 @@ Page({
}
} else {
//--昵称---
- context.setFontSize(24 * unit);
- context.setFillStyle("black");
- context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit);
- var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
+ // context.setFontSize(24 * unit);
+ // context.setFillStyle("black");
+ // context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit);
+ // var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
//强烈推荐 改许程
// var tj_path = "../../../../images/share/q_tj.png";
// let txt_gn = th.data.luckGoInfo.group_num + '人团';
@@ -4772,9 +4833,9 @@ Page({
// context.setFillStyle("white");
// context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit);
// 发出幸运购活动邀请
- context.setFillStyle("#7f7f7f")
- context.setFontSize(21.3 * unit)
- context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
+ // context.setFillStyle("#7f7f7f")
+ // context.setFontSize(21.3 * unit)
+ // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
}
@@ -4791,7 +4852,7 @@ Page({
//---产品名称---
//文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if (type != 4 && type != 0) {
+ if (th.data.share_b_img || (type != 4 && type != 9)) {
context.setFillStyle("black");
context.setFontSize(21.3 * unit)
th.draw_Text(context, share_title,
@@ -4852,11 +4913,29 @@ Page({
}
//---中间大图---
- if (type != 0) {
+ if ( th.data.share_b_img || type != 9) {
context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
};
+ //---自定义海报 产品质量保证
+ if(th.data.share_b_img && th.data.poster.show_quality==1 ){
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+ }
//-------大图后面就不一样了-----------
switch (type) {
@@ -5073,74 +5152,76 @@ Page({
case 9:
+ if(th.data.share_b_img){
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 680 * unit)
- context.lineTo(520 * unit, 680 * unit)
- context.stroke();
-
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.font = 'normal bold 18px';
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //还差N人,即可成团
- let group_num = th.data.luckGoInfo.group_num;
- let num_joined = th.data.luckGoInfo.num;
- let delta1 = group_num - num_joined;
- let width_delta1 = ut.measureText(delta1, 15);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit);
- context.setFillStyle("#FF6768");
- context.setFontSize(21.3 * unit);
- context.fillText(delta1, 160 * unit, 772 * unit);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit);
-
- // N人得商品,N人全额退款
- let group_win = th.data.luckGoInfo.group_win;
- let delta2 = group_num - group_win;
- let width_delta2 = ut.measureText(delta2, 16);
- let width_groupNum = ut.measureText(group_num, 15);
- let width_groupWin = ut.measureText(group_win, 15);
- context.setFillStyle("#FF6768");
- context.setFontSize(21.3 * unit);
- context.fillText(group_win, 40 * unit, 806 * unit);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit);
- context.setFillStyle("#FF6768");
- context.setFontSize(21.3 * unit);
- context.fillText(delta2, 160 * unit, 806 * unit);
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit);
- context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit);
-
- // 并得帮团惊喜礼品
- context.setFillStyle("black")
- context.setFontSize(21.3 * unit)
- context.fillText("并得帮团", 40 * unit, 840 * unit);
- context.setFillStyle("#FF6768")
- context.setFontSize(21.3 * unit)
- context.fillText("惊喜礼品", 130 * unit, 840 * unit);
- context.setFillStyle("black")
- context.setFontSize(21.3 * unit)
- context.fillText("!", 220 * unit, 840 * unit);
+
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 680 * unit)
+ context.lineTo(520 * unit, 680 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.font = 'normal bold 18px';
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
+
+ //还差N人,即可成团
+ let group_num = th.data.luckGoInfo.group_num;
+ let num_joined = th.data.luckGoInfo.num;
+ let delta1 = group_num - num_joined;
+ let width_delta1 = ut.measureText(delta1, 15);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit);
+ context.setFillStyle("#FF6768");
+ context.setFontSize(21.3 * unit);
+ context.fillText(delta1, 160 * unit, 772 * unit);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit);
+
+ // N人得商品,N人全额退款
+ let group_win = th.data.luckGoInfo.group_win;
+ let delta2 = group_num - group_win;
+ let width_delta2 = ut.measureText(delta2, 16);
+ let width_groupNum = ut.measureText(group_num, 15);
+ let width_groupWin = ut.measureText(group_win, 15);
+ context.setFillStyle("#FF6768");
+ context.setFontSize(21.3 * unit);
+ context.fillText(group_win, 40 * unit, 806 * unit);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit);
+ context.setFillStyle("#FF6768");
+ context.setFontSize(21.3 * unit);
+ context.fillText(delta2, 160 * unit, 806 * unit);
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit);
+ context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit);
+
+ // 并得帮团惊喜礼品
+ context.setFillStyle("black")
+ context.setFontSize(21.3 * unit)
+ context.fillText("并得帮团", 40 * unit, 840 * unit);
+ context.setFillStyle("#FF6768")
+ context.setFontSize(21.3 * unit)
+ context.fillText("惊喜礼品", 130 * unit, 840 * unit);
+ context.setFillStyle("black")
+ context.setFontSize(21.3 * unit)
+ context.fillText("!", 220 * unit, 840 * unit);
+ }
//---二维吗图---
//-- 自定义海报 --
- if (th.data.poster) {
+ if (th.data.share_b_img && th.data.poster) {
var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
} else {
//---二维吗图---
- context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
}
break;
@@ -5150,7 +5231,7 @@ Page({
//--- 如果是自定义海报的时候 ---
- if (type != 0) {
+ if ( th.data.share_b_img || type != 9) {
if (th.data.poster && parseInt(th.data.poster.style) == 2) {
@@ -5324,7 +5405,7 @@ Page({
- //--获取头像的本地缓存,回调写法--
+ //--获取头像的本地缓存,回调写法--
get_head_temp: function (tt, func) {
var ee = this;
if (ee.data.share_head) {
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
index ba1fc77..2ea6553 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
@@ -899,7 +899,7 @@
- {{cartGoodsNum}}
+
购物车
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js
index 0ee31fa..32ff65a 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -7,7 +7,7 @@ var ut = require("../../../../utils/util.js"),
oo = s.globalData,
o = s.globalData.setting,
os = o;
-//评价加载更多
+//评价加载更多
var more = function (e) {
return e && e.__esModule ? e : {
default: e
@@ -250,13 +250,13 @@ Page({
share_hidden: false,
pre_arr: null,
-
- hiddenCS: true,
+
+ hiddenCS: true,
},
//------初始化加载----------
onLoad: function (t) {
- self = this;
+ self = this;
var ee = this, that = ee, th = ee,
pre_id = t.pre_id,
gid = t.goods_id,
@@ -264,8 +264,8 @@ Page({
first_leader = t.first_leader,
room_id = t.room_id,
room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
- //检查测肤
- getApp().check_skin_face(t,0,gid);
+ //检查测肤
+ getApp().check_skin_face(t, 0, gid);
//-- 自定义海报 --
getApp().request.promiseGet("/api/weshop/goods/poster/page", {
@@ -314,7 +314,7 @@ Page({
}
this.setData({
- gid:gid,pre_id:pre_id,presell_id:presell_id
+ gid: gid, pre_id: pre_id, presell_id: presell_id
})
if (first_leader) {
@@ -561,7 +561,7 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
@@ -569,7 +569,24 @@ Page({
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if (fir_quan.length > 0) {
+ let goodInfo = ee.data.data || {}
+ for (let index = fir_quan.length - 1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype == 20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index, 1)
+ }
+ }
+ }
+ }
+ let arr = []
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr = fir_quan
+ } else {
+ arr = fir_quan.splice(0, 3);
+ }
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -587,7 +604,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -597,7 +614,7 @@ Page({
//---展示---
onShow: function () {
- getApp().check_can_share();
+ getApp().check_can_share();
var goods_list = null, th = this, that = this;
//-- 如果是预览图片,页面不重新更新 --
@@ -672,8 +689,8 @@ Page({
//-- 把商品的赋值 --
ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
- ee.data.sele_g_id=t.data.data.goods_id;
- ee.data.sele_g=t.data.data;
+ ee.data.sele_g_id = t.data.data.goods_id;
+ ee.data.sele_g = t.data.data;
//获取用户的默认门店
getApp().get_user_store(function (e) {
@@ -681,7 +698,7 @@ Page({
th.data.fir_def_store = {}; //赋值空对象
return false;
}
- if(getApp().globalData.is_dj_pk) th.setData({has_def:1})
+ if (getApp().globalData.is_dj_pk) th.setData({ has_def: 1 })
var ee = JSON.parse(JSON.stringify(e));
@@ -1045,7 +1062,7 @@ Page({
newd.goods_price = th.data.prom_price;
newd.member_goods_price = th.data.prom_price,
- newd.prom_type = 8;
+ newd.prom_type = 8;
newd.prom_id = o.prom_id;
if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
@@ -1084,8 +1101,8 @@ Page({
return s.my_warnning("库存不足!", 0, th);
}
- if (item.goods_num + th.data.goodsInputNum >th.data.pre_arr.presell_sumqty-th.data.pre_arr.buy_goodnum) {
- return s.my_warnning("库存不足!", 0, th);
+ if (item.goods_num + th.data.goodsInputNum > th.data.pre_arr.presell_sumqty - th.data.pre_arr.buy_goodnum) {
+ return s.my_warnning("库存不足!", 0, th);
}
var updata = {
@@ -1156,10 +1173,10 @@ Page({
app.set_b_now(e);
//如果是全额付款的话
- if(this.data.presellForm.presell_type==1){
- getApp().goto("/packageC/pages/presell/cart/cart2")
- }else{
- getApp().goto("/packageC/pages/presell/cart/cart2_pre");
+ if (this.data.presellForm.presell_type == 1) {
+ getApp().goto("/packageC/pages/presell/cart/cart2")
+ } else {
+ getApp().goto("/packageC/pages/presell/cart/cart2_pre");
}
},
@@ -1213,8 +1230,8 @@ Page({
}
var e = th.data.sele_g.store_count;
- var e2=th.data.pre_arr.presell_sumqty-th.data.pre_arr.buy_goodnum;
- if(e2 {
+ getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => {
if (res.data.code == 0) {
var r_data = res.data.data;
th.data.prom_goods = r_data.promGoodsLists;
@@ -1444,38 +1461,38 @@ Page({
contactService: function () {
getApp().com_call(this);
},
-
- // 获取客服电话
- getTel() {
- return new Promise((resolve, reject) => {
- s.getConfig(function (t) {
- if (t.store_tel == undefined) {
- getApp().request.get("/api/weshop/store/get/" + os.stoid, {
- isShowLoading: 1,
- data: {},
- success: function (rs) {
- getApp().globalData.config = rs.data.data;
- if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
- getApp().my_warnning("商家未设置电话", 0, th);
- return false;
- }
- self.setData({
- store_tel: rs.data.data.store_tel,
- });
- // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
- }
- })
- } else {
- self.setData({
- store_tel: t.store_tel,
- });
- // s.confirmBox("请联系客服:" + t.store_tel);
- };
- resolve();
- });
- });
- },
-
+
+ // 获取客服电话
+ getTel() {
+ return new Promise((resolve, reject) => {
+ s.getConfig(function (t) {
+ if (t.store_tel == undefined) {
+ getApp().request.get("/api/weshop/store/get/" + os.stoid, {
+ isShowLoading: 1,
+ data: {},
+ success: function (rs) {
+ getApp().globalData.config = rs.data.data;
+ if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) {
+ getApp().my_warnning("商家未设置电话", 0, th);
+ return false;
+ }
+ self.setData({
+ store_tel: rs.data.data.store_tel,
+ });
+ // s.confirmBox("请联系客服:" + rs.data.data.store_tel);
+ }
+ })
+ } else {
+ self.setData({
+ store_tel: t.store_tel,
+ });
+ // s.confirmBox("请联系客服:" + t.store_tel);
+ };
+ resolve();
+ });
+ });
+ },
+
//-------获取购物车数量----------
requestCardNum: function () {
var t = this;
@@ -1515,7 +1532,7 @@ Page({
b[i] = this.data.iurl + e[i];
}
this.data.show_prew_img = 1;
- getApp().pre_img2(b,t)
+ getApp().pre_img2(b, t)
},
@@ -1526,16 +1543,16 @@ Page({
b[i] = this.data.iurl + e[i];
}
this.data.show_prew_img = 1;
- getApp().pre_img2(b,t)
+ getApp().pre_img2(b, t)
},
previewGoodsCommentImgs: function (t) {
var e = this,
a = this.data.data.comment[t.currentTarget.dataset.cidx].img;
- getApp().globalData.no_clear=1;
+ getApp().globalData.no_clear = 1;
a = a.map(function (t) {
return e.data.url + t;
- }), getApp().pre_img2(a,t);
+ }), getApp().pre_img2(a, t);
this.data.show_prew_img = 1;
},
closePromModal: function () {
@@ -1550,19 +1567,20 @@ Page({
},
//--点击分享事件---
- onShareAppMessage: function (t) { getApp().globalData.no_clear=1;
+ onShareAppMessage: function (t) {
+ getApp().globalData.no_clear = 1;
var th = this;
- var price = th.data.pre_arr.presell_price;
+ var price = th.data.pre_arr.presell_price;
var img = th.data.data.original_img;
- var title = th.data.presellForm.share_title;
+ 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;
//if (th.data.presellForm.share_img)
// img = th.data.iurl + th.data.presellForm.share_img;
- var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid+"&pre_id="+th.data.pre_arr.id;
+ var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid + "&pre_id=" + th.data.pre_arr.id;
if (getApp().globalData.user_id) {
url += "&first_leader=" + getApp().globalData.user_id;
}
@@ -1580,13 +1598,13 @@ Page({
path: url,
imageUrl: img,
};
-
+
ob.title += '\n' + th.data.presellForm.share_remark;
-
-
- console.log(ob,888);
-
+
+ console.log(ob, 888);
+
+
return ob;
},
@@ -1609,22 +1627,22 @@ Page({
//----------装载同一活动中的商品----------
async get_sku(stoid, gd, g_id, is_normal, func) {
- var tt = this, arrdata = null;
- var now = ut.gettimestamp();
- var rq_data={
- store_id: o.stoid,
- sku: gd.sku,
- more_spec: gd.more_spec,
- isonsale: 1,
- is_on_sale: 1,
- pageSize: 500,
- orderField: 'gg_ordid,goods_spec,sort',
- prom_type: 8,
- };
+ var tt = this, arrdata = null;
+ var now = ut.gettimestamp();
+ var rq_data = {
+ store_id: o.stoid,
+ sku: gd.sku,
+ more_spec: gd.more_spec,
+ isonsale: 1,
+ is_on_sale: 1,
+ pageSize: 500,
+ orderField: 'gg_ordid,goods_spec,sort',
+ prom_type: 8,
+ };
- if(tt.data.presellForm && tt.data.presellForm.id){
- rq_data.prom_id=tt.data.presellForm.id;
- }
+ if (tt.data.presellForm && tt.data.presellForm.id) {
+ rq_data.prom_id = tt.data.presellForm.id;
+ }
await getApp().request.promiseGet("/api/weshop/goods/page", {
data: rq_data
@@ -1755,31 +1773,31 @@ Page({
//选择了不同的规格的时候要判断是不是有活动正在进行中
async sele_spec_chech_activity() {
- var prom = null, goodsinfo = this.data.sele_g, th = this;
-
- var all_pre_goods=th.data.all_pre_goods;
- if(all_pre_goods){
- var userInfo = getApp().globalData.userInfo;
- var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid };
- if (userInfo) {
- pre_data.user_id = userInfo.user_id;
- }
- await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
- data: pre_data,
- }).then(e => {
- if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
- all_pre_goods=e.data.data.pageData;
- th.data.all_pre_goods=e.data.data.pageData;
- }
- })
+ var prom = null, goodsinfo = this.data.sele_g, th = this;
+
+ var all_pre_goods = th.data.all_pre_goods;
+ if (all_pre_goods) {
+ var userInfo = getApp().globalData.userInfo;
+ var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid };
+ if (userInfo) {
+ pre_data.user_id = userInfo.user_id;
}
-
- var idx=all_pre_goods.findIndex(function (ele) {
- return ele.goods_id==goodsinfo.goods_id;
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
+ data: pre_data,
+ }).then(e => {
+ if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
+ all_pre_goods = e.data.data.pageData;
+ th.data.all_pre_goods = e.data.data.pageData;
+ }
})
- var pre_arr =all_pre_goods[idx];
- th.setData({ pre_arr: pre_arr })
- th.data.prom_buy_limit=pre_arr.vip_butyqty;
+ }
+
+ var idx = all_pre_goods.findIndex(function (ele) {
+ return ele.goods_id == goodsinfo.goods_id;
+ })
+ var pre_arr = all_pre_goods[idx];
+ th.setData({ pre_arr: pre_arr })
+ th.data.prom_buy_limit = pre_arr.vip_butyqty;
},
@@ -1870,7 +1888,7 @@ Page({
th.setData({ all_pick_list: e.data.data.pageData });
//--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售--
- if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type !=8 ) || is_normal == 1)) {
+ if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type != 8) || is_normal == 1)) {
setTimeout(function () {
th.deal_pickup_dline(e);
}, 800)
@@ -1906,15 +1924,15 @@ Page({
success: function (ee) {
if (ee.data.code == 0) {
- var check_all_cate=0;
- if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){
- for(let i in ee.data.data.pageData){
- let item=ee.data.data.pageData[i];
- if(item.is_show==1){
- check_all_cate=1;break
- }
- }
+ var check_all_cate = 0;
+ if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
+ for (let i in ee.data.data.pageData) {
+ let item = ee.data.data.pageData[i];
+ if (item.is_show == 1) {
+ check_all_cate = 1; break
+ }
}
+ }
if (check_all_cate) {
@@ -1923,29 +1941,29 @@ Page({
var newarr = new Array();
var qita = new Array();
- var is_del_pk=0;
+ var is_del_pk = 0;
//----要进行门店分组--------
for (var i = 0; i < sto_arr.length; i++) {
//找一下这个门店有没有在分类数组内
var find2 = 0, find2name = "", sort = 0;
- is_del_pk=0;
+ is_del_pk = 0;
for (var m = 0; m < sto_cate.length; m++) {
- if (sto_arr[i].category_id == sto_cate[m].cat_id) {
- if (sto_cate[m].is_show != 1) {
- is_del_pk = 1;
- sto_arr.splice(i, 1);
- i--;
- } else {
- find2 = sto_cate[m].cat_id;
- find2name = sto_cate[m].cat_name;
- sort = sto_cate[m].sort;
- is_del_pk = 0;
- }
- break;
+ if (sto_arr[i].category_id == sto_cate[m].cat_id) {
+ if (sto_cate[m].is_show != 1) {
+ is_del_pk = 1;
+ sto_arr.splice(i, 1);
+ i--;
+ } else {
+ find2 = sto_cate[m].cat_id;
+ find2name = sto_cate[m].cat_name;
+ sort = sto_cate[m].sort;
+ is_del_pk = 0;
}
+ break;
+ }
}
- if(is_del_pk) continue;
+ if (is_del_pk) continue;
if (newarr.length > 0) {
var find = 0;
@@ -1991,17 +2009,17 @@ Page({
}
- var def_arr = new Array();
- //-- 开始就看10个门店 --
- for (var k = 0; k < 10; k++) {
- if (k == sto_arr.length) break;
- def_arr.push(sto_arr[k]);
- }
+ var def_arr = new Array();
+ //-- 开始就看10个门店 --
+ for (var k = 0; k < 10; k++) {
+ if (k == sto_arr.length) break;
+ def_arr.push(sto_arr[k]);
+ }
- th.setData({
- def_pickpu_list: def_arr,
- pickpu_list: ee.data.data.pageData
- });
+ th.setData({
+ def_pickpu_list: def_arr,
+ pickpu_list: ee.data.data.pageData
+ });
//门店分类要排序下
function compare(property) {
return function (a, b) {
@@ -2025,15 +2043,15 @@ Page({
}
- var sd={
- all_sto: newarr,
- is_show_sto_cat:1
- }
- if(!sto_arr || sto_arr.length<=10){
- sd.is_show_sto_cat=-1;
- sd.only_pk=sto_arr;
- }
- th.setData(sd);
+ var sd = {
+ all_sto: newarr,
+ is_show_sto_cat: 1
+ }
+ if (!sto_arr || sto_arr.length <= 10) {
+ sd.is_show_sto_cat = -1;
+ sd.only_pk = sto_arr;
+ }
+ th.setData(sd);
} else {
th.setData({
@@ -2382,21 +2400,21 @@ Page({
}
} else {
- //活动已结束,全部设置为'00'
- obj = {
- day: '00',
- hou: '00',
- min: '00',
- sec: '00'
- }
- th.setData({
- prom_time_text: '活动已经结束:',
- prom_st: 3
- })
- th.setData({
- djs: obj
- });
- return false;
+ //活动已结束,全部设置为'00'
+ obj = {
+ day: '00',
+ hou: '00',
+ min: '00',
+ sec: '00'
+ }
+ th.setData({
+ prom_time_text: '活动已经结束:',
+ prom_st: 3
+ })
+ th.setData({
+ djs: obj
+ });
+ return false;
}
@@ -2410,56 +2428,56 @@ Page({
//-------------获取购买数量的总函数----------------
- get_buy_num: function (gd, func) {
- var map = this.data.g_buy_num,
- th = this,
- user_id = getApp().globalData.user_id;
- if (user_id == null) {
- map.set(gd.goods_id, 0);
+ get_buy_num: function (gd, func) {
+ var map = this.data.g_buy_num,
+ th = this,
+ user_id = getApp().globalData.user_id;
+ if (user_id == null) {
+ map.set(gd.goods_id, 0);
+ th.setData({
+ g_buy_num: map,
+ prom_buy_num: 0,
+ });
+ "function" == typeof func && func();
+ return false;
+ }
+
+ if (map.has(gd.goods_id)) {
+ "function" == typeof func && func();
+ } else {
+ //----获取商品购买数----
+ getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: {
+ store_id: os.stoid,
+ user_id: user_id,
+ goods_id: gd.goods_id,
+ },
+ success: function (t) {
+ if (t.data.code == 0) {
+ var g_buy_num = t.data.data.goodsbuynum;
+ map.set(gd.goods_id, g_buy_num);
th.setData({
- g_buy_num: map,
- prom_buy_num: 0,
+ g_buy_num: map,
});
- "function" == typeof func && func();
- return false;
- }
-
- if (map.has(gd.goods_id)) {
- "function" == typeof func && func();
- } else {
- //----获取商品购买数----
- getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
- data: {
- store_id: os.stoid,
- user_id: user_id,
- goods_id: gd.goods_id,
- },
- success: function (t) {
- if (t.data.code == 0) {
- var g_buy_num = t.data.data.goodsbuynum;
- map.set(gd.goods_id, g_buy_num);
- th.setData({
- g_buy_num: map,
- });
- getApp().request.get("/api/weshop/order/orderPresell/countBuyGoodsSum",{
- data: {store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, prom_id: gd.prom_id},
- success: function (e) {
- if (e.data.code == 0) {
- th.setData({prom_buy_num: e.data.data.sumgoodsnum})
- "function" == typeof func && func();
- } else {
- th.setData({prom_buy_num: 0,})
- "function" == typeof func && func();
- }
-
- }
- });
-
- }
+ getApp().request.get("/api/weshop/order/orderPresell/countBuyGoodsSum", {
+ data: { store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, prom_id: gd.prom_id },
+ success: function (e) {
+ if (e.data.code == 0) {
+ th.setData({ prom_buy_num: e.data.data.sumgoodsnum })
+ "function" == typeof func && func();
+ } else {
+ th.setData({ prom_buy_num: 0, })
+ "function" == typeof func && func();
}
+
+ }
});
+
+ }
}
- },
+ });
+ }
+ },
//--拼单推荐的显示---
tj_Click: function (e) {
@@ -2471,7 +2489,7 @@ Page({
//-------跳转pt商品-------
go_to_nopay: function () {
- var th =this,url = "/pages/user/order_detail/order_detail?order_id=" + th.data.buy_order.order_id;
+ var th = this, url = "/pages/user/order_detail/order_detail?order_id=" + th.data.buy_order.order_id;
getApp().goto(url);
},
@@ -2615,7 +2633,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length - 1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype == 20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index, 1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
@@ -2712,7 +2741,13 @@ Page({
}
})
},
-
+ saveImageFn(){
+ if(this.data.share_b_img){
+ this.saveImageToPhotosAlbum()
+ }else{
+ this.saveImageToPhotosAlbumDef()
+ }
+ },
//--定义的保存图片方法,分享团---
saveImageToPhotosAlbum: function () {
//--先判断会员状态--
@@ -3038,7 +3073,608 @@ Page({
}
});
},
+ //--定义的保存图片方法,分享团---
+ 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 + "";
+ scene += "." + th.data.sele_g.prom_type + "." + th.data.sele_g.prom_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/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";
+
+
+ //-- 如果有自定义海报的时候,判断背景的图片 --
+ if (th.data.share_b_img) {
+ pg_path = th.data.share_b_img;
+ }
+ // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
+ console.log('海报类型-----')
+ console.log(type);
+
+ if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报
+ th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
+ } else {
+ context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
+ // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
+ };
+
+ // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
+
+
+ //-- 是自定义海报的情况下 --
+ if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+
+ if (th.data.poster && parseInt(th.data.poster.style) == 2) {
+ //在线上分享人的情况下
+ if (parseInt(th.data.poster.show_headpic)) {
+ //获取坐标
+ var x = parseFloat(th.data.poster.head_x) * 2;
+ var y = parseFloat(th.data.poster.head_y) * 2;
+ var x1 = (x + 90) * unit;
+ var y1 = (y + 50) * unit;
+ //--昵称---
+ context.setFontSize(24 * unit)
+ context.setFillStyle("black")
+ context.fillText(app.globalData.userInfo.nickname, x1, y1);
+ var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
+ //强烈推荐 改许程
+ var tj_path = "../../../../images/share/q_tj.png";
+ context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit);
+ context.setLineJoin('round'); //交点设置成圆角
+ context.setFillStyle("white");
+ context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit);
+
+ //context.setFillStyle("black")
+ //context.setFontSize(24 * unit)
+ //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
+ }
+ } else {
+ //--昵称---
+ context.setFontSize(24 * unit);
+ context.setFillStyle("black");
+ context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
+ var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
+ //强烈推荐 改许程
+ var tj_path = "../../../../images/share/q_tj.png";
+ context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit);
+ context.setLineJoin('round'); //交点设置成圆角
+ context.setFillStyle("white");
+ context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
+ }
+
+ };
+
+
+ var share_title = th.data.data.goods_name;
+ if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) {
+ share_title = th.data.prom_act.share_title;
+ if (!share_title) share_title = th.data.prom_act.title;
+ if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
+ }
+
+ //---产品名称---
+ //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
+ if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit)
+ getApp().draw_Text(context, share_title,
+ 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
+
+ //------产品的价格-------
+ context.setFontSize(23 * unit)
+ context.setFillStyle("red")
+
+ var pri0 = th.data.data.shop_price;
+ if (th.data.card_field && th.data.data[th.data.card_field]) {
+ pri0 = th.data.data[th.data.card_field];
+ }
+
+ if (th.data.prom_act)
+ pri0 = th.data.prom_price;
+ pri0 = parseFloat(pri0).toFixed(2);
+ var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
+ context.fillText("¥", wd1 - 15, 185 * unit);
+ context.setFontSize(31 * unit)
+ context.fillText(pri0, wd1, 185 * unit);
+
+ //---市场价划掉---
+ /*--
+ context.setFillStyle("gray")
+ context.setFontSize(22 * unit)
+ pri0 = "¥" + th.data.data.market_price.toFixed(2);
+ var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
+ context.fillText(pri0, wd2, 213 * unit);
+
+ context.setStrokeStyle('gray');
+ context.setLineWidth(1 * unit);
+ context.moveTo(wd2 - 5, 206 * unit);
+ context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
+ context.stroke();--*/
+
+ } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) {
+ context.setFillStyle("black");
+ context.setFontSize(21.3 * unit)
+ getApp().draw_Text(context, share_title,
+ 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
+ //------ 产品的价格 -----
+ var pri0 = th.data.prom_act.addmoney;
+ var integral = th.data.prom_act.integral;
+ var text = "";
+ if (integral) {
+ text = integral + "积分";
+ }
+ if (pri0 && integral) {
+ text += "+";
+ }
+ if (pri0) {
+ text += "¥" + pri0;
+ }
+
+ if (!pri0 && !integral) {
+ text = "0积分";
+ }
+ context.setFillStyle("red");
+ context.fillText(text, 38 * unit, 235 * unit);
+ }
+
+ //---中间大图---
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+ context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
+ }
+ ;
+
+ //---自定义海报 产品质量保证
+ if(th.data.share_b_img && th.data.poster.show_quality==1 ){
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+
+ }
+ //-------大图后面就不一样了-----------
+ switch (type) {
+ case 0:
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 710 * unit)
+ context.lineTo(520 * unit, 710 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(22 * unit)
+ // 原来start --->
+ context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
+ // <--- 原来end
+ // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit);
+ // context.setFontSize(18 * unit)
+ // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit);
+ //---二维吗图---
+ context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
+ break;//普通商品的展示
+ case 4:
+ // 中间的几个字
+ if (th.data.poster && parseInt(th.data.poster.style) == 2) {
+ if (parseInt(th.data.poster.show_quality)) {
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+ }
+
+ } else {
+ var g_path = "../../../../images/share/s_gou.png";
+ context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 690 * unit);
+
+ context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 690 * unit);
+
+ context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 690 * unit);
+ }
+
+
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 710 * unit)
+ context.lineTo(520 * unit, 710 * unit)
+ context.stroke();
+
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(22 * unit)
+
+ if (type == 0 || type == -1) {
+ // 原来start --->
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
+
+ context.setFontSize(22 * unit)
+ context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
+
+ } else {
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
+ context.setFontSize(22 * unit)
+ context.fillText("长按识别二维码", 40 * unit, 806 * unit);
+ context.fillText("立即开始兑换", 40 * unit, 846 * unit);
+
+ }
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ }
+ ;
+
+ break;
+ case 1: //秒杀商品的展示
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+
+ //画秒杀的图片
+ var miaos_path = '../../../../images/share/miao_share.png';
+ context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
+
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
+ //---文字---
+ context.setFontSize(22 * unit)
+ context.setFillStyle("black")
+ context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
+
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
+ }
+ break;
+
+ case 2: //会员团和商家团的展示
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
+
+ //绘制成团图片
+ var ct_img = "../../../../images/share/ct_num.png";
+ context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);
+ var ct_num = th.data.prom_act.ct_num;
+ context.setFontSize(14 * unit)
+ context.font = 'normal';
+ context.setFillStyle("red")
+ if (ct_num < 10) {
+ context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
+ } else {
+ context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
+ }
+ context.setFontSize(22 * unit)
+ context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
+
+ context.setFillStyle("gray")
+ context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);
+ context.setFillStyle("black")
+ context.font = 'normal bold 18px sans-serif';
+ context.setFontSize(21.3 * unit)
+ context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit);
+
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ }
+ break
+ case 3: //阶梯团的展示
+ if(!th.data.share_b_img){
+ break
+ }
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+ //---文字---
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
+
+ //---绘制中间阶梯的价格---
+ var list = th.data.prom_act.ct_rylist;
+ for (var i = 0; i < list.length; i++) {
+ var item = list[i];
+ var wi = i * 90 * unit;
+ context.font = 'normal';
+ context.setFontSize(16 * unit)
+ context.setFillStyle("red")
+ context.fillText("¥", 40 * unit + wi, 756 * unit);
+ context.setFontSize(22 * unit)
+ var pri = parseFloat(item.price).toFixed(2);
+ context.fillText(pri, 56 * unit + wi, 756 * unit);
+ context.setFillStyle("gray")
+ context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
+ }
+ //----------------下面部分----------------
+
+ context.setFillStyle("black")
+ context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
+ //context.font = 'normal bold 18px sans-serif';
+ context.setFontSize(21 * unit)
+ context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit);
+
+
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
+ }
+ break
+
+
+ case -1: //秒杀商品的展示
+ //---画线---
+ context.setLineWidth(1 * unit)
+ context.moveTo(32 * unit, 670 * unit)
+ context.lineTo(520 * unit, 670 * unit)
+ context.stroke();
+
+
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 744 * unit);
+ //---文字---
+ context.setFontSize(22 * unit)
+ context.setFillStyle("black")
+ context.fillText("长按识别二维码", 40 * unit, 800 * unit);
+ context.fillText("立即开始抢购", 40 * unit, 846 * unit);
+
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ if (th.data.share_b_img || th.data.poster) {
+ var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
+ var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
+ context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);
+ } else {
+ //---二维吗图---
+ context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
+ }
+ break;
+
+
+ }
+
+
+ //--- 如果是自定义海报的时候 ---
+ if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) {
+
+ if (th.data.poster && parseInt(th.data.poster.style) == 2) {
+
+ //如果显示会员信息的话
+ if (parseInt(th.data.poster.show_headpic)) {
+ //获取坐标
+ var x = parseFloat(th.data.poster.head_x) * 2;
+ var y = parseFloat(th.data.poster.head_y) * 2;
+ //---绘制圆形要放在最后----
+ context.save();
+ context.beginPath();
+ var h_x = x * unit;
+ var h_y = y * unit;
+ var h_r = 40 * unit;
+ var cx = h_x + h_r;
+ var cy = h_y + h_r;
+ context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
+ context.closePath();
+ context.fill();
+ context.clip();
+ context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
+ context.restore();
+ }
+
+ } else {
+ //---绘制圆形要放在最后----
+ context.save();
+ context.beginPath();
+ var h_x = 60 * unit;
+ var h_y = 24 * unit;
+ var h_r = 40 * unit;
+ var cx = h_x + h_r;
+ var cy = h_y + h_r;
+ context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
+ context.closePath();
+ context.fill();
+ context.clip();
+ context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
+ context.restore();
+ }
+
+ }
+ ;
+
+
+ //把画板内容绘制成图片,并回调 画板图片路径
+ 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) {
@@ -3067,7 +3703,144 @@ Page({
}
}
},
+ drawPoster(context, unit, img, vpath, type) {
+ // 1.灰色背景
+ context.setFillStyle('#f2f1f6');
+ context.rect(0, 0, 554 * unit, 899 * unit);
+ context.fill();
+
+ // 2.商城名称
+ let shopName = this.data.sto_sele_name_1;
+ context.setTextAlign('center');
+ context.setFontSize(26 * unit);
+ context.setFillStyle('black');
+ context.fillText(shopName, 277 * unit, 60 * unit);
+
+ // 3.推荐来源
+ let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`;
+ context.setTextAlign('center');
+ context.setFontSize(22 * unit);
+ context.setFillStyle('#96959a');
+ context.fillText(fromText, 277 * unit, 105 * unit);
+
+ // 4.海报背景
+ context.setFillStyle('white');
+ context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit);
+
+ // 5.商品图片
+ // 图片的x坐标
+ let bg_x = 37 * unit
+ // 图片的y坐标
+ let bg_y = 157 * unit
+ // 图片宽度
+ let bg_w = 480 * unit
+ // 图片高度
+ let bg_h = 474 * unit
+ // 图片圆角
+ let bg_r = 4
+ // 绘制海报背景图片圆角
+ context.save()
+ context.beginPath()
+ context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5)
+ context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2)
+ context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5)
+ context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI)
+ context.clip()
+ context.drawImage(img, bg_x, bg_y, bg_w, bg_h);
+ context.restore();
+
+ // 6.强烈推荐
+ let src = '';
+ context.beginPath();
+ if(type == 0) { // 普通
+ src = '../../../../images/share/q_tj.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit)
+ context.setFillStyle("white")
+ context.setTextAlign('left');
+ context.fillText('强烈推荐', 64 * unit, 668 * unit);
+ };
+ if(type == 1) { // 秒杀
+ src = '../../../images/share/miao_share.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit);
+ context.setTextAlign('left');
+ };
+ if(type == 2) { // 商家和会员团
+ src = '../../../images/share/ct_num.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 120 * unit, 30 * unit);
+ context.setTextAlign('left');
+
+ let ct_num = self.data.prom_act.ct_num;
+ context.setFontSize(16 * unit)
+ context.font = 'normal';
+ context.setFillStyle("red")
+ if (ct_num < 10) {
+ context.fillText(ct_num + "人拼团", 100 * unit, 670 * unit);
+ } else {
+ context.fillText(ct_num + "人拼团", 96 * unit, 670 * unit);
+ }
+ context.setFontSize(22 * unit)
+ context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit);
+ };
+ if(type == 3) { // 阶梯团
+ let list = self.data.prom_act.ct_rylist;
+ for (let i = 0; i < list.length; i++) {
+ let item = list[i];
+ let wi = i * 90 * unit;
+ context.font = 'normal';
+ context.setTextAlign('left');
+ context.setFontSize(16 * unit)
+ context.setFillStyle("red")
+ context.fillText("¥", 50 * unit + wi, 680 * unit);
+ context.setFontSize(22 * unit)
+ let pri = parseFloat(item.price).toFixed(2);
+ context.fillText(pri, 66 * unit + wi, 680 * unit);
+ context.setFillStyle("gray")
+ context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit);
+ }
+ };
+
+ // 7.商品价格
+ if(type != 3) {
+ let price = this.data.data.shop_price;
+ if (this.data.card_field && this.data.data[this.data.card_field]) {
+ price = this.data.data[this.data.card_field];
+ }
+ if (this.data.prom_act) price = this.data.prom_price;
+ price = parseFloat(price).toFixed(2);
+ context.setFontSize(32 * unit);
+ context.setFillStyle('#DE1117');
+ if (this.data.prom_type == 4 && this.data.prom_integral){
+ context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit);
+ }else{
+ if(this.data.prom_type ==8){
+ price = this.data.presellList.presell_price
+ context.fillText('¥' + price, 54 * unit, 735 * unit);
+ }else{
+ context.fillText('¥' + price, 54 * unit, 735 * unit);
+ }
+ }
+
+ };
+
+ // 8.商品标题
+ context.setFontSize(20 * unit);
+ context.setFillStyle('#898989');
+ getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
+
+ // 9.小程序码
+ context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
+ context.setFontSize(16 * unit);
+ context.setFillStyle('#777');
+ context.fillText('长按识别二维码', 378 * unit, 810 * unit);
+
+ // 10.竖线
+ context.beginPath();
+ context.setFillStyle('#eee');
+ context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit);
+ context.fill();
+ },
// ----视频图片----
// 图片计数器
swiperChange: function (e) {
@@ -3153,7 +3926,7 @@ Page({
tt();
return false;
}
- var img_url = ee.data.data.original_img;
+ var img_url = ee.data.data.original_img;
//var img_url = ee.data.presellForm.share_img;
//img_url?img_url:ee.data.data.original_img;
@@ -3168,8 +3941,8 @@ Page({
fail: function (res) {
//获取默认空白图
wx.getImageInfo({
- src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
- success: function(res) {
+ src: ee.data.iurl + '/miniapp/images/default_g_img.gif',
+ success: function (res) {
ee.data.share_goods_img = res.path; //分享的图片不能用网络的
tt();
}
@@ -3213,22 +3986,22 @@ Page({
getHistoryBuy() {
let _this = this;
let req_data = {
- store_id: os.stoid,
- goods_id: this.data.gid,
- pay_status: 1,
- rndid: 1
+ store_id: os.stoid,
+ goods_id: this.data.gid,
+ pay_status: 1,
+ rndid: 1
};
getApp().request.promiseGet('/api/weshop/ordergoods/list', {
- data: req_data,
+ data: req_data,
})
- .then(res => {
- if (ut.ajax_ok(res)) {
- _this.setData({
- historyBuyInfo: res.data.data.pageData,
- })
- }
- })
-},
+ .then(res => {
+ if (ut.ajax_ok(res)) {
+ _this.setData({
+ historyBuyInfo: res.data.data.pageData,
+ })
+ }
+ })
+ },
//--调用更新阶梯团的接口--
update_jiti: function (id) {
@@ -3256,8 +4029,8 @@ Page({
var bconfig = th.data.bconfig;
//如果开启了,则不在选择门店
- if(this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store){
- return false;
+ if (this.data.sys_switch.is_pricing_open_store && getApp().globalData.pk_store) {
+ return false;
}
if (!th.data.only_pk && !th.data.def_pickpu_list) {
@@ -3881,7 +4654,7 @@ Page({
onShareTimeline() {
- getApp().globalData.no_clear=1;
+ getApp().globalData.no_clear = 1;
var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
if (!store_name)
store_name = getApp().globalData.setting.appName;
@@ -3896,10 +4669,10 @@ Page({
},
clickShare() {
- if(!getApp().globalData.user_id){
- getApp().goto("/packageE/pages/togoin/togoin");
- return false;
- }
+ if (!getApp().globalData.user_id) {
+ getApp().goto("/packageE/pages/togoin/togoin");
+ return false;
+ }
this.setData({ share_hidden: true, });
},
@@ -3930,206 +4703,206 @@ Page({
},
//获取预售的信息
- async get_pre_prom(func) {
- var th = this;
- var presell_id = null;
- var pre_arr = null;
-
- if (!th.data.pre_id) {
- var presell_id = th.data.presell_id;
- var url = "/api/weshop/marketing/marketingPresellList/list"
- var rd = {
- store_id: os.stoid,
- presell_id: presell_id,
- goods_id: th.data.gid
- }
- //------获取预售从表----------
- await getApp().request.promiseGet(url, {
- data: rd
- }).then(res => {
- if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
- var arr = res.data.data[0];
- presell_id = arr.presell_id;
- th.setData({
- presellList: arr,
- })
- }
- })
+ async get_pre_prom(func) {
+ var th = this;
+ var presell_id = null;
+ var pre_arr = null;
- } else {
- //------获取预售从表----------
- await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
- if (res.data.code == 0 && res.data.data) {
- var arr = res.data.data;
- presell_id = arr.presell_id;
- th.setData({
- presellList: arr,
- })
- }
- })
+ if (!th.data.pre_id) {
+ var presell_id = th.data.presell_id;
+ var url = "/api/weshop/marketing/marketingPresellList/list"
+ var rd = {
+ store_id: os.stoid,
+ presell_id: presell_id,
+ goods_id: th.data.gid
+ }
+ //------获取预售从表----------
+ await getApp().request.promiseGet(url, {
+ data: rd
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
+ var arr = res.data.data[0];
+ presell_id = arr.presell_id;
+ th.setData({
+ presellList: arr,
+ })
}
+ })
- if (!presell_id) {
- wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000});
- ut.wx_back();
- return false;
+ } else {
+ //------获取预售从表----------
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ var arr = res.data.data;
+ presell_id = arr.presell_id;
+ th.setData({
+ presellList: arr,
+ })
}
+ })
+ }
- var gnext=1;
- //------获取预售主表----------
- await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
- if (res.data.code == 0 && res.data.data) {
- var act_data = res.data.data;
- if (act_data.is_end) {
- wx.showToast({title: "活动已经结束", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
- if (act_data.isuse == 0) {
- wx.showToast({title: "活动未启用", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
-
- var err_txt="活动定金时间已经结束";
- var end_time = act_data.end_time;
- if (act_data.presell_type == 1) {
- err_txt="活动时间已经结束";
- }
- if (end_time < ut.gettimestamp()) {
- wx.showToast({title:err_txt, icon: 'none', duration: 3000});
- setTimeout(function () {
- getApp().goto("/pages/index/index/index");
- }, 2000)
- gnext=0;
- return false;
- }
-
- if (act_data.presell_type == 0) {
- end_time = act_data.pay_enddate;
- err_txt="活动尾款时间已经结束";
- }
- if (end_time < ut.gettimestamp()) {
- wx.showToast({title:err_txt, icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
-
- if (act_data.start_time > ut.gettimestamp()) {
- wx.showToast({title:"活动还未开始", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- gnext=0;
- return false;
- }
+ if (!presell_id) {
+ wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 });
+ ut.wx_back();
+ return false;
+ }
- th.setData({
- presellForm: res.data.data,
- });
- th.countDown(res.data.data.end_time)
- }
- })
+ var gnext = 1;
+ //------获取预售主表----------
+ await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ var act_data = res.data.data;
+ if (act_data.is_end) {
+ wx.showToast({ title: "活动已经结束", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
+ }
+ if (act_data.isuse == 0) {
+ wx.showToast({ title: "活动未启用", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
+ }
- if(!gnext){
- return false;
+ var err_txt = "活动定金时间已经结束";
+ var end_time = act_data.end_time;
+ if (act_data.presell_type == 1) {
+ err_txt = "活动时间已经结束";
+ }
+ if (end_time < ut.gettimestamp()) {
+ wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ getApp().goto("/pages/index/index/index");
+ }, 2000)
+ gnext = 0;
+ return false;
}
- var userInfo = getApp().globalData.userInfo;
- var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, prom_type: 8, prom_id: presell_id,pageSize:1000};
- if (userInfo) {
- pre_data.user_id = userInfo.user_id;
+ if (act_data.presell_type == 0) {
+ end_time = act_data.pay_enddate;
+ err_txt = "活动尾款时间已经结束";
}
- await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
- data: pre_data,
- }).then(e => {
- if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
-
- th.data.all_pre_goods = e.data.data.pageData;
- var idx = e.data.data.pageData.findIndex(function (ele) {
- return ele.id == th.data.presellList.id;
- })
-
- pre_arr = e.data.data.pageData[idx];
- th.setData({pre_arr: pre_arr,show:1})
- th.data.prom_buy_limit = pre_arr.vip_butyqty;
- }
- })
- if (!pre_arr) {
- wx.showToast({title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000});
- setTimeout(function () {
- ut.wx_back();
- }, 2000)
- return false;
+ if (end_time < ut.gettimestamp()) {
+ wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
}
- if (func) {
- func();
+
+ if (act_data.start_time > ut.gettimestamp()) {
+ wx.showToast({ title: "活动还未开始", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ gnext = 0;
+ return false;
}
- },
- con_weixin:function () {
- getApp().con_wx(this);
- },
-
- // 预览海报
- previewPoster() {
- getApp().globalData.no_clear=1;
- wx.previewImage({
- current: this.data.shareImgPath, // 当前显示图片的http链接
- urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表
- });
- },
-
-
- click_contact:function () {
- getApp().globalData.no_clear=1;
- },
-
- //打开客服操作菜单
- openCS() {
- // 判断会员状态
- let user_info = getApp().globalData.userInfo;
- if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
- wx.navigateTo({
- url: '/packageE/pages/togoin/togoin',
- })
- return false;
- };
- // csType/在线客服设置:
- // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
- // 1小程序客服、
- // 2企业微信客服
- if(this.data.sys_switch) {
- let csType = this.data.sys_switch.weapp_customertype;
- if(csType == 0) {
- // 拨打电话号码
- this.contactService();
- } else {
- this.getTel()
- .then(() => {
- self.setData({
- hiddenCS: false,
- });
- });
- };
- };
-
- },
-
- //关闭客服操作菜单
- closeCS() {
- this.setData({
- hiddenCS: true,
- });
- },
+ th.setData({
+ presellForm: res.data.data,
+ });
+ th.countDown(res.data.data.end_time)
+ }
+ })
+
+ if (!gnext) {
+ return false;
+ }
+
+ var userInfo = getApp().globalData.userInfo;
+ var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, prom_type: 8, prom_id: presell_id, pageSize: 1000 };
+ if (userInfo) {
+ pre_data.user_id = userInfo.user_id;
+ }
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
+ data: pre_data,
+ }).then(e => {
+ if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
+
+ th.data.all_pre_goods = e.data.data.pageData;
+ var idx = e.data.data.pageData.findIndex(function (ele) {
+ return ele.id == th.data.presellList.id;
+ })
+
+ pre_arr = e.data.data.pageData[idx];
+ th.setData({ pre_arr: pre_arr, show: 1 })
+ th.data.prom_buy_limit = pre_arr.vip_butyqty;
+ }
+ })
+ if (!pre_arr) {
+ wx.showToast({ title: "当前会员身份不符或者时间已过期,无法参与", icon: 'none', duration: 3000 });
+ setTimeout(function () {
+ ut.wx_back();
+ }, 2000)
+ return false;
+ }
+ if (func) {
+ func();
+ }
+ },
+
+ con_weixin: function () {
+ getApp().con_wx(this);
+ },
+
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath],// 需要预览的图片http链接列表
+ });
+ },
+
+
+ click_contact: function () {
+ getApp().globalData.no_clear = 1;
+ },
+
+ //打开客服操作菜单
+ openCS() {
+ // 判断会员状态
+ let user_info = getApp().globalData.userInfo;
+ if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) {
+ wx.navigateTo({
+ url: '/packageE/pages/togoin/togoin',
+ })
+ return false;
+ };
+ // csType/在线客服设置:
+ // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
+ // 1小程序客服、
+ // 2企业微信客服
+ if (this.data.sys_switch) {
+ let csType = this.data.sys_switch.weapp_customertype;
+ if (csType == 0) {
+ // 拨打电话号码
+ this.contactService();
+ } else {
+ this.getTel()
+ .then(() => {
+ self.setData({
+ hiddenCS: false,
+ });
+ });
+ };
+ };
+
+ },
+
+ //关闭客服操作菜单
+ closeCS() {
+ this.setData({
+ hiddenCS: true,
+ });
+ },
});
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
index cbcef19..9c34892 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -939,7 +939,7 @@
-
+
@@ -951,7 +951,10 @@
-
+
+
+
+
diff --git a/packageC/pages/presell/pregoodsInfo/goodsInfo.js b/packageC/pages/presell/pregoodsInfo/goodsInfo.js
index 5625eb8..243429b 100644
--- a/packageC/pages/presell/pregoodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/pregoodsInfo/goodsInfo.js
@@ -556,7 +556,7 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
@@ -564,7 +564,25 @@ Page({
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if(fir_quan.length > 0 ){
+ let goodInfo = ee.data.data
+ for (let index = fir_quan.length-1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index,1)
+ }
+ }
+ }
+ }
+ let arr=[]
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr=fir_quan
+ }else{
+ arr=fir_quan.splice(0,3);
+ }
+ //--------获取视频图片---------
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -580,7 +598,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -2578,7 +2596,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length-1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype==20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index,1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
diff --git a/packageD/pages/user/coupons/coupons.js b/packageD/pages/user/coupons/coupons.js
index 4b40c14..680eb67 100644
--- a/packageD/pages/user/coupons/coupons.js
+++ b/packageD/pages/user/coupons/coupons.js
@@ -118,7 +118,7 @@ Page({
let url = `/pages/goods/goodsInfo/goodsInfo?goods_id=${item.goods_id}&prom_type=${item.prom_type}&prom_id=${item.prom_id}`
getApp().goto(url)
}else{
- getApp().showWarning("未找到该商品");
+ getApp().showWarning("该商品不存在");
}
}
}
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index 1b51ae9..f23d607 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -49,9 +49,9 @@ Page({
},
onLoad: function () {
+
var a = this,
ee = a;
-
wx.setNavigationBarTitle({
title: "购物车",
@@ -268,53 +268,67 @@ Page({
},
//清空失效宝贝
delInva(obj=null){
- let ainvalid='';
- let binvalid='';
- var user_id = getApp().globalData.user_id;
- var th = this;
- let ab = 0; //选中
- let abc = 0; //
- let arr = obj.id ? [obj] : this.data.invalidList
- console.log('失效-----')
- console.log(arr);
- arr.map(item=>{
- if (item.classType ==0 ) {
- ainvalid+=item.id + ',';
- ab = 1;
- }
- if (item.classType ==1 ) {
- binvalid+=item.id + ',';
- abc = 1;
- }
- });
+
+ var th = this;
+ wx.showModal({
+ title: '提示',
+ content: '确认要清空全部失效商品吗?',
+ success(res) {
+ if (res.confirm) {
+ let ainvalid='';
+ let binvalid='';
+ var user_id = getApp().globalData.user_id;
+
+ let ab = 0; //选中
+ let abc = 0; //
+ let arr = obj.id ? [obj] : th.data.invalidList
+ console.log('失效-----')
+ console.log(arr);
+ arr.map(item=>{
+ if (item.classType ==0 ) {
+ ainvalid+=item.id + ',';
+ ab = 1;
+ }
+ if (item.classType ==1 ) {
+ binvalid+=item.id + ',';
+ abc = 1;
+ }
+ });
+
+
+ if (ab == 0 && abc == 0 ) {
+ t.my_warnning('没有需要清空的失效宝贝', 0, th);
+ return false;
+ }
+ if (ab) {
+ ainvalid = ainvalid.substring(0, ainvalid.length - 1);
+ //要删除购物车中的商品
+ var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid;
+ getApp().request.delete(url, {
+ success: function (t) {
+ th.getCardList();
+ getApp().requestCardNum(th);
+ }
+ });
+ }
+ if (abc) {
+ binvalid = binvalid.substring(0, binvalid.length - 1);
+ //要删除购物车中的商品
+ var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid;
+ getApp().request.delete(url, {
+ success: function (t) {
+ th.getCardList();
+ getApp().requestCardNum(th);
+ }
+ });
+ }
+
+ }
+ }
+ })
+
- if (ab == 0 && abc == 0 ) {
- t.my_warnning('没有需要清空的失效宝贝', 0, th);
- return false;
- }
- if (ab) {
- ainvalid = ainvalid.substring(0, ainvalid.length - 1);
- //要删除购物车中的商品
- var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + '/' + ainvalid;
- getApp().request.delete(url, {
- success: function (t) {
- th.getCardList();
- getApp().requestCardNum(th);
- }
- });
- }
- if (abc) {
- binvalid = binvalid.substring(0, binvalid.length - 1);
- //要删除购物车中的商品
- var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + '/' + binvalid;
- getApp().request.delete(url, {
- success: function (t) {
- th.getCardList();
- getApp().requestCardNum(th);
- }
- });
- }
},
//---------点击收藏------------
@@ -619,7 +633,7 @@ Page({
else if(item.prom_type ==2){
var prom = null;
var now = ut.gettimestamp();
- await getApp().request.promiseGet('/api/weshop/goods/groupBuy/getActInfo/' + item.goods_id + '/' + user_id + '/' + item.prom_id, {}).then(res => {
+ await getApp().request.promiseGet('/api/weshop/goods/groupBuy/getActInfo/'+ oo.stoid + '/' + item.goods_id + '/' + item.prom_id, {}).then(res => {
if (res.data.code == 0) {
prom = res.data.data;
prom.price = prom.user_price;
@@ -666,26 +680,35 @@ Page({
if (!r_data.promGoodsLists) {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item);
//商品已经无活动
- isok = 0;
+ // th.disInvalid(item);
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
} else {
//如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item);
//商品已经下架
- isok = 0;
+ // th.disInvalid(item);
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
}
} else {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item);
- //商品已经下架
- isok = 0;
+ // th.disInvalid(item);
+ // //商品已经下架
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
})
@@ -696,43 +719,51 @@ Page({
if (!r_data.promGoodsLists) {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item);
- //商品已经无活动
- isok = 0;
+ // th.disInvalid(item);
+ // //商品已经无活动
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
} else {
//如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item);
- //商品已经下架
- isok = 0;
+ // th.disInvalid(item);
+ // //商品已经下架
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
}
} else {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item,1);
- //商品已经下架
- isok = 0;
+ // th.disInvalid(item,1);
+ // //商品已经下架
+ // isok = 0;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
}
})
-
}
-
- if (!isok) continue;
+ // if (!isok) continue;
}
else if (item.prom_type == 7) {
+ console.log('组合购------------');
if(!th.data.zuhe_map[item.prom_id]){
-
+ console.log('组1')
//如果有组合购
var isok = 1;
var is_flag = 1;
var act = null;
var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id;
await getApp().request.promiseGet(url, {}).then(res => {
- console.log(res, 1000);
+ console.log(res);
if (res.data.code == 0 && res.data.data) {
if (res.data.data.is_show != 1) {
isok = 0;
@@ -759,38 +790,44 @@ Page({
if (!isok) {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item);
- th.data.zuhe_map[item.prom_id] = -1;
- continue;
- }
- th.data.zuhe_map[item.prom_id] = act;
- var url1 = "/api/weshop/prom/zhbuyGoods/page";
- var req_data = {
- page: 1,
- pageSize: 2000,
- store_id: os.stoid,
- zh_id: item.prom_id,
+ //组合购失效不处理
+ // th.disInvalid(item);
+ // th.data.zuhe_map[item.prom_id] = -1;
+ // continue;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
+ }else{
+ th.data.zuhe_map[item.prom_id] = act;
+ var url1 = "/api/weshop/prom/zhbuyGoods/page";
+ var req_data = {
+ page: 1,
+ pageSize: 2000,
+ store_id: os.stoid,
+ zh_id: item.prom_id,
+ }
+ await getApp().request.promiseGet(url1, {
+ data: req_data
+ }).then(res => {
+ console.log(res, 2000);
+ if (ut.ajax_ok(res)) {
+ var gdlist = res.data.data.pageData;
+ gdlist.forEach(i => {
+ if (item.goods_id == i.goods_id && !is_flag) {
+ item.prom_type = 0;
+ item.prom_type1 = 0;
+ item.prom_id = 0;
+ item.prom_id1 = 0
+ }
+ })
+ th.data.zuhe_map_good[item.prom_id] = gdlist;
+ }
+ })
}
- await getApp().request.promiseGet(url1, {
- data: req_data
- }).then(res => {
- console.log(res, 2000);
- if (ut.ajax_ok(res)) {
- var gdlist = res.data.data.pageData;
- gdlist.forEach(i => {
- if (item.goods_id == i.goods_id && !is_flag) {
- item.prom_type = 0;
- item.prom_type1 = 0;
- item.prom_id = 0;
- item.prom_id1 = 0
- }
- })
- th.data.zuhe_map_good[item.prom_id] = gdlist;
- }
- })
}
-
+ console.log('组2')
if (th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id] != -1) {
+ console.log('组3')
var gdlist = th.data.zuhe_map_good[item.prom_id];
var t_item = gdlist.find(function (ele) {
return ele.goods_id == item.goods_id
@@ -798,13 +835,18 @@ Page({
if (!t_item) {
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
- th.disInvalid(item,1);
- th.data.zuhe_map[item.prom_id] = -1;
- continue;
- }
- item.buyqty = t_item.buyqty;
- item.zh_b_num = promgoodsbuynum;
- item.act = th.data.zuhe_map[item.prom_id];
+ //组合购不处理
+ // th.disInvalid(item,1);
+ // th.data.zuhe_map[item.prom_id] = -1;
+ // continue;
+ item.prom_type = 0
+ //购物车更新
+ th.cartUpFn(item)
+ }else{
+ item.buyqty = t_item.buyqty;
+ item.zh_b_num = promgoodsbuynum;
+ item.act = th.data.zuhe_map[item.prom_id];
+ }
} //else{
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
@@ -1082,7 +1124,19 @@ Page({
}
});
},
-
+ //商品购物车修改
+ cartUpFn(item){
+ let updata1 = {
+ id: item.id,
+ prom_type: 0,
+ prom_id:item.prom_id,
+ store_id: os.stoid,
+ user_id: getApp().globalData.userInfo.user_id
+ };
+ getApp().request.put("/api/weshop/cart/update", {
+ data: updata1,
+ })
+ },
//-----真的获取购物车--------
get_ser_cart: function () {
var th = this;
@@ -3202,6 +3256,21 @@ Page({
});
}
+ setTimeout(()=>{
+ if ((!th.data.requestData|| th.data.requestData.length==0) && (!th.data.service_data|| th.data.service_data.length==0)){
+
+ console.log('---1111---bb');
+ var goods_list = th.selectComponent("#goods_list"); //组件的id
+ if (goods_list) {
+ goods_list.init();
+ goods_list.get_list();
+ }
+
+ }
+
+ },1200)
+
+
},
//跳到首页
goto: function (e) {
diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml
index b9dadfd..82571d8 100644
--- a/pages/cart/cart/cart.wxml
+++ b/pages/cart/cart/cart.wxml
@@ -23,7 +23,7 @@
-
+
@@ -276,7 +276,7 @@
-
+
@@ -306,7 +306,7 @@
-
+
diff --git a/pages/cart/cart/cart.wxss b/pages/cart/cart/cart.wxss
index 7a4bfb3..699321e 100644
--- a/pages/cart/cart/cart.wxss
+++ b/pages/cart/cart/cart.wxss
@@ -30,6 +30,9 @@ page {
align-items: center;
justify-content: center;
background-color: rgb(255, 255, 255);
+ /*margin-bottom: 160rpx;*/
+}
+.container.margin_b{
margin-bottom: 160rpx;
}
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 6c6eee2..ae82373 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -417,6 +417,7 @@ Page({
is_show_gb: 1
});
}
+ console.log('获取系统参数');
console.log(e);
var json_d = JSON.parse(e.switch_list);
ee.setData({
@@ -740,15 +741,33 @@ Page({
data: {
store_id: os.stoid,
type: 1,
- pageSize: 3,
+ pageSize: 100,
page: 1,
is_share: 0,
},
}).then(res1 => {
+
fir_quan = res1.data.data.pageData;
})
}
-
+ //过滤不是本商品的单品优惠券-------------------
+ if(fir_quan.length > 0 ){
+ let goodInfo = ee.data.data
+ for (let index = fir_quan.length-1; index >= 0; index--) {
+ if (fir_quan[index].useobjecttype==20) { //判断是单品优惠券
+ if (fir_quan[index].useobjectno != goodInfo.goods_sn) {
+ fir_quan.splice(index,1)
+ }
+ }
+ }
+ }
+ let arr=[]
+ let length = fir_quan.length
+ if (length <= 3) {
+ arr=fir_quan
+ }else{
+ arr=fir_quan.splice(0,3);
+ }
//--------获取视频图片---------
await getApp().request.promiseGet("/api/weshop/goodsVideos/get/" + os.stoid + "/" + ee.data.gid, {
1: 1
@@ -764,7 +783,7 @@ Page({
is_collect: is_collect,
collect_id: collect_id,
categories3: categories3,
- fir_quan: fir_quan,
+ fir_quan: arr,
fir_comments: fir_com,
mapurl_f_img: mapurl_f_img,
mapurl: mapurl,
@@ -1844,6 +1863,7 @@ Page({
goods_price: newd.goods_price,
member_goods_price: newd.goods_price,
store_id: th.data.stoid,
+ prom_id:newd.prom_id //把活动id带上去(用于购物车失效变成有效商品)
};
//---是不是从收藏夹出来的---
@@ -1856,6 +1876,7 @@ Page({
updata['guide_type'] = 0;
}
}
+
i.put("/api/weshop/cart/update", {
data: updata,
@@ -2271,7 +2292,7 @@ Page({
sort_store: 0,
open_ind_store: open_store,
})
- //--先判断会员状态--
+ //--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
@@ -2924,7 +2945,8 @@ Page({
}
})
}
-
+ console.log('活动详情------------');
+ console.log(prom);
//----------如果有活动,并且在进行中,就不计算线下库存---------------
var now = ut.gettimestamp();
if (prom) {
@@ -3587,7 +3609,7 @@ Page({
prom_end_time: prom_end_time,
prom_start_time: prom_start_time,
isshow: 1,
- prom_act: t.data.data
+ // prom_act: t.data.data
});
ee.get_sto();
@@ -4768,7 +4790,18 @@ Page({
wx.hideLoading();
quan_list = res.data.data.pageData;
})
-
+ //过滤不是本商品的单品优惠券
+ if (quan_list.length > 0) {
+ let goodInfo = th.data.data
+ for (let index = quan_list.length-1; index >= 0; index--) {
+ if (quan_list[index].useobjecttype==20) { //判断是单品优惠券
+ if (quan_list[index].useobjectno != goodInfo.goods_sn) {
+ quan_list.splice(index,1)
+ }
+ }
+ }
+ }
+ //------------------------
if (quan_list) {
for (var ind in quan_list) {
var ep = quan_list[ind];
@@ -4997,11 +5030,15 @@ Page({
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;
+ if (this.data.prom_act) price = this.data.prom_price;
price = parseFloat(price).toFixed(2);
context.setFontSize(32 * unit);
- context.setFillStyle('#DE1117');
- context.fillText('¥' + price, 54 * unit, 735 * unit);
+ context.setFillStyle('#DE1117');
+ if (this.data.prom_type == 4 && this.data.prom_integral){
+ context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit);
+ }else{
+ context.fillText('¥' + price, 54 * unit, 735 * unit);
+ }
};
@@ -5192,6 +5229,11 @@ Page({
var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
context.fillText("¥", wd1 - 15, 185 * unit);
context.setFontSize(31 * unit)
+ // if(th.data.prom_type==4){
+ // context.fillText(th.data.prom_integral+'积分'+pri0, wd1, 185 * unit);
+ // }else{
+ // context.fillText(pri0, wd1, 185 * unit);
+ // }
context.fillText(pri0, wd1, 185 * unit);
//---市场价划掉---
diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml
index a9f23a8..9b90aa1 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxml
+++ b/pages/goods/goodsInfo/goodsInfo.wxml
@@ -169,7 +169,7 @@
{{djs.min}}
分
-
+
{{djs.sec}}
秒
@@ -264,7 +264,7 @@
¥{{filters.toFix(data.shop_price,2)}}
-
+
@@ -604,7 +604,7 @@
-
+
领券