diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js
index 10d2a0b..d99a0e6 100644
--- a/packageA/pages/goodsInfo/goodsInfo.js
+++ b/packageA/pages/goodsInfo/goodsInfo.js
@@ -27,6 +27,7 @@ Page({
color_type: 0, //线条控制
color_type_one: 0,
color_type_two: 1,
+ is_share_text: 1,
gid: "",
stoid: o.stoid,
@@ -38,6 +39,8 @@ Page({
data: null,
content: "", //商品详情
+
+
gallery: null, //图片滚动
is_collect: 0,
collect_id: 0,
@@ -236,6 +239,8 @@ Page({
th = ee,
gid = t.goods_id,
first_leader=t.first_leader,
+ prom_type=t.prom_type,
+ prom_id=t.prom_id,
room_id = t.room_id,
room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
@@ -250,21 +255,27 @@ Page({
var gid_str = decodeURIComponent(t.scene);
gid_str=gid_str.split("_");
gid=gid_str[0];
- if(gid_str.length>1){
+ if(gid_str.length>1 && gid_str[1] && parseInt(gid_str[1])>0){
first_leader=gid_str[1];
}
//-- 如果有room_id的获取 --
- if(gid_str.length>2 && gid_str[2]) {
+ if(gid_str.length>2 && gid_str[2] && parseInt(gid_str[2])>0) {
room_id=gid_str[2];
room_user_share=1;
};
+
+ if(gid_str.length>3 && gid_str[3] && parseInt(gid_str[3])>0) {
+ prom_type=gid_str[3];
+ prom_id=gid_str[4];
+ }
+
};
//-- 设置顶部高度 --
let height= getApp().globalData.navBarHeight;
ee.setData({ gid: gid,top_nav:height});
- if(first_leader) {
+ if(first_leader>0) {
getApp().globalData.first_leader=first_leader;
//调用接口判断是不是会员
getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{
@@ -347,7 +358,37 @@ Page({
}
});
- },
+ //-- 自定义海报 --
+ getApp().request.promiseGet("/api/weshop/goods/poster/page", {
+ data: { store_id: os.stoid, type: 1, is_use: 1 }
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) {
+
+ var poster_data = res.data.data.pageData[0];
+ var json_str = poster_data.jsonStr;
+
+ if (json_str) {
+ var json_data = JSON.parse(json_str);
+ if (json_data.bg_img) {
+
+ //-- 把图片那到本地 --
+ wx.getImageInfo({
+ src: json_data.bg_img,
+ success: function (res) {
+ var path = res.path;
+ th.setData({ share_b_img: path })
+ },
+ fail: function (res) { }
+ });
+ }
+ th.setData({ poster: json_data })
+
+ }
+ }
+ })
+
+
+ },
//-- 获取直播的分享人的导购信息 --
async get_room_share_guide(share_openid) {
@@ -568,14 +609,13 @@ Page({
// gid 在onload阶段已经保存在this.data中
onShow: function() {
+ getApp().check_can_share(this);
//-- 看一下隐私政策要不要显示 --
var privacy_pop = this.selectComponent("#privacy_pop"); //组件的id
if (privacy_pop) {
privacy_pop.check_pri_show();
}
- getApp().check_can_share();
-
var that=this;var th=this;
var ee = this,gid = this.data.gid, i = getApp().request;
@@ -1386,6 +1426,9 @@ Page({
},
openSpecModel: function(t) {
+
+ if(this.data.get_sto_ing) return false;
+
var th=this; var open_store = t.currentTarget.dataset.ind;
if(getApp().is_sp_hao() && open_store==1){
wx.showToast({
@@ -1657,6 +1700,8 @@ Page({
})
}
+ this.data.get_sto_ing=1;
+
var timer_get = setInterval(function() {
if (th.data.is_get_local_ok == 0) return false;
if (!th.data.fir_def_store) return false;
@@ -1772,6 +1817,7 @@ Page({
th.deal_pickup(e);
}
else{
+ th.data.get_sto_ing=0;
th.setData({
isshow:1
})
@@ -1901,160 +1947,162 @@ Page({
orderType:'asc',
},
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
+ 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
+ }
}
}
- }
-
- if (check_all_cate) {
-
-
- var sto_cate = ee.data.data.pageData;
- var sto_arr = e.data.data.pageData;
- var newarr = new Array();
- var qita = new Array();
-
- var is_del_pk=0;
-
- //----要进行门店分组--------
- for (var i = 0; i < sto_arr.length; i++) {
- //找一下这个门店有没有在分类数组内
- var find2 = 0, find2name = "",sort=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;
+
+ if (check_all_cate) {
+
+
+ var sto_cate = ee.data.data.pageData;
+ var sto_arr = e.data.data.pageData;
+ var newarr = new Array();
+ var qita = new Array();
+
+ var is_del_pk=0;
+
+ //----要进行门店分组--------
+ for (var i = 0; i < sto_arr.length; i++) {
+ //找一下这个门店有没有在分类数组内
+ var find2 = 0, find2name = "",sort=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;
}
- break;
}
- }
- if(is_del_pk) continue;
-
- if (newarr.length > 0) {
- var find = 0;
- //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
- if (find2 != 0) {
- for (var ii = 0; ii < newarr.length; ii++) {
- if (sto_arr[i].category_id == newarr[ii].cat_id) {
- newarr[ii].s_arr.push(sto_arr[i]);
- find = 1;
- break;
+ if(is_del_pk) continue;
+
+ if (newarr.length > 0) {
+ var find = 0;
+ //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
+ if (find2 != 0) {
+ for (var ii = 0; ii < newarr.length; ii++) {
+ if (sto_arr[i].category_id == newarr[ii].cat_id) {
+ newarr[ii].s_arr.push(sto_arr[i]);
+ find = 1;
+ break;
+ }
+ }
+ if (find == 0) {
+ var arr0 = new Array();
+ arr0.push(sto_arr[i]);
+ var item = {
+ cat_id: find2,
+ name: find2name,
+ sort:sort,
+ s_arr: arr0
+ };
+ newarr.push(item);
+ }
+ } else {
+ qita.push(sto_arr[i]);
+ }
+ } else {
+ //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
+ if (find2 != 0) {
+ var arr0 = new Array();
+ arr0.push(sto_arr[i]);
+ var item = {
+ cat_id: find2,
+ name: find2name,
+ sort:sort,
+ s_arr: arr0
+ };
+ newarr.push(item);
+ } else {
+ qita.push(sto_arr[i]);
}
}
- if (find == 0) {
- var arr0 = new Array();
- arr0.push(sto_arr[i]);
- var item = {
- cat_id: find2,
- name: find2name,
- sort:sort,
- s_arr: arr0
- };
- newarr.push(item);
+ }
+
+ 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]);
}
- } else {
- qita.push(sto_arr[i]);
+
+ th.setData({
+ def_pickpu_list: def_arr,
+ pickpu_list: ee.data.data.pageData
+ });
+
+ //门店分类要排序下
+ function compare(property){
+ return function(a,b){
+ var value1 = a[property];
+ var value2 = b[property];
+ return value1 - value2;
+ }
}
- } else {
- //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
- if (find2 != 0) {
- var arr0 = new Array();
- arr0.push(sto_arr[i]);
+ if(newarr.length>0)
+ newarr.sort(compare("sort"));
+
+ //----安排其他的分类-----
+ if (qita.length > 0) {
var item = {
- cat_id: find2,
- name: find2name,
- sort:sort,
- s_arr: arr0
+ cat_id: -1,
+ name: "其他",
+ s_arr: qita
};
newarr.push(item);
- } else {
- qita.push(sto_arr[i]);
}
- }
- }
- 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 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({
+ is_show_sto_cat: -1,
+ only_pk: e.data.data.pageData
+ });
+ //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
+ if (!th.data.def_pick_store) {
+ th.setData({def_pick_store:e.data.data.pageData[0]})
+ }
+ }
+ } else {
th.setData({
- def_pickpu_list: def_arr,
- pickpu_list: ee.data.data.pageData
+ is_show_sto_cat: -1,
+ only_pk: e.data.data.pageData
});
-
- //门店分类要排序下
- function compare(property){
- return function(a,b){
- var value1 = a[property];
- var value2 = b[property];
- return value1 - value2;
- }
- }
- if(newarr.length>0)
- newarr.sort(compare("sort"));
-
- //----安排其他的分类-----
- if (qita.length > 0) {
- var item = {
- cat_id: -1,
- name: "其他",
- s_arr: qita
- };
- newarr.push(item);
- }
-
- 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;
+ //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
+ if (!th.data.def_pick_store) {
+ th.setData({def_pick_store:e.data.data.pageData[0]})
}
- th.setData(sd);
-
- } else {
- th.setData({
- is_show_sto_cat: -1,
- only_pk: e.data.data.pageData
- });
- //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
- if (!th.data.def_pick_store) {
- th.setData({def_pick_store:e.data.data.pageData[0]})
}
- }
- } else {
- th.setData({
- is_show_sto_cat: -1,
- only_pk: e.data.data.pageData
- });
- //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
- if (!th.data.def_pick_store) {
- th.setData({def_pick_store:e.data.data.pageData[0]})
- }
-
- }
+ th.data.get_sto_ing=0;
}
});
- } else {
+ } else {
+ th.data.get_sto_ing=0;
+
th.setData({
is_show_sto_cat: 0,
only_pk: e.data.data.pageData
@@ -2092,494 +2140,7 @@ Page({
return param < 10 ? '0' + param : param;
},
-
- //--定义的保存图片方法,分享团---
- saveImageToPhotosAlbum: function() {
- //--先判断会员状态--
- // var user_info = getApp().globalData.userInfo;
- // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- // //getApp().my_warnning("请先登录",0,this);
- // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', })
- // return false;
- // }
-
- //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
- var type = this.data.prom_type;
- if (type == 6) type = 2;
- if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
- wx.showLoading({
- title: '生成中...',
- })
- var that = this,
- th = that;
- //设置画板显示,才能开始绘图
- that.setData({
- canvasHidden: false
- })
-
- var app = getApp();
- var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
- var path2 = that.data.data.original_img;
- var scene = th.data.gid+"";
- var user_id = getApp().globalData.user_id?getApp().globalData.user_id:0;
- if(user_id>0) {
- scene+="_"+user_id;
- }
- //-- 如果不是会员分享过来的要分享给别人 --
- if(getApp().globalData.room_id && th.data.data.goods_id==getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
- //固定房间是第3个字符
- if(!user_id) scene+="_0";
- scene+="_"+getApp().globalData.room_id ;
- }
- ///二微码
- var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
- os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
-
- console.log(path3);
-
- //读取文件成功则OK--
- wx.getImageInfo({
- src: path3,
- success: function(res) {
- //回调写法
- th.get_head_temp(th.get_goods_temp, function() {
- var vpath = res.path;
- var context = wx.createCanvasContext('share');
- //先画背景
- var pg_path = "../../../images/share/share_bg.png";
-
- // context.fillStyle="#FFFFFF";
- // context.fillRect(0,0,554 * unit, 899 * unit);
-
- //-- 如果有自定义海报的时候,判断背景的图片 --
- if(th.data.share_b_img){
- pg_path=th.data.share_b_img;
- }
- context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
-
- //-- 是自定义海报的情况下 --
- if(th.data.poster && parseInt(th.data.poster.style)==2) {
- //在线上分享人的情况下
- if(parseInt(th.data.poster.show_headpic)){
- //获取坐标
- var x=parseFloat(th.data.poster.head_x)*2;
- var y=parseFloat(th.data.poster.head_y)*2;
- var x1=(x+90) *unit;
- var y1=(y+50) *unit;
- //--昵称---
- context.setFontSize(24 * unit)
- context.setFillStyle("black")
- context.fillText(app.globalData.userInfo.nickname, x1, y1);
- var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
- //强烈推荐 改许程
- var tj_path = "../../../images/share/q_tj.png";
- context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit);
- context.setFontSize(16 * unit)
- context.setLineJoin('round'); //交点设置成圆角
- context.setFillStyle("white")
- context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit);
-
- //context.setFillStyle("black")
- //context.setFontSize(24 * unit)
- //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
- }
- } else {
- //--昵称---
- context.setFontSize(24 * unit)
- context.setFillStyle("black")
- context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
- var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
- //强烈推荐 改许程
- var tj_path = "../../../images/share/q_tj.png";
- context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
- context.setFontSize(16 * unit);
- context.setLineJoin('round'); //交点设置成圆角
- context.setFillStyle("white");
- context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
- }
-
-
- //---产品名称---
- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- if(type!=4){
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- th.draw_Text(context, th.data.data.goods_name,
- 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
- //------产品的价格-------
- context.setFontSize(23 * unit)
- context.setFillStyle("red")
- context.fillText("¥", 416 * unit, 185 * unit);
- context.setFontSize(31 * unit)
- var pri0 = th.data.data.shop_price;
- if (th.data.prom_act)
- pri0 = th.data.prom_act.price;
- pri0 = parseFloat(pri0).toFixed(2);
- context.fillText(pri0, 438 * unit, 185 * unit);
- //---市场价划掉---
- context.setFillStyle("gray")
- context.setFontSize(22 * unit)
- context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit);
- context.setStrokeStyle('gray');
- context.setLineWidth(1 * unit);
- context.moveTo(426 * unit, 206 * unit);
- context.lineTo(510 * unit, 206 * unit);
- context.stroke();
-
- }else{
- context.setFillStyle("black");
- context.setFontSize(21.3 * unit)
- th.draw_Text(context, th.data.data.goods_name,
- 38 * unit, 170 * unit, 20 * unit, 300*unit, unit);
- //------ 产品的价格 -----
- var pri0 = th.data.prom_act.addmoney;
- var integral=th.data.prom_act.integral;
- var text= "";
- if(integral){text=integral+"积分"; }
- if(pri0 && integral){ text+="+";}
- if(pri0){ text+="¥"+pri0;}
-
- if(!pri0 && !integral){ text="0积分";}
- context.setFillStyle("red");
- context.fillText(text, 38 * unit, 235 * unit);
-
- }
-
- //---中间大图---
- context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
- //-------大图后面就不一样了-----------
- switch (type) {
- case 0: //普通商品的展示
- case 4:
- //中间的几个字
- if(th.data.poster && parseInt(th.data.poster.style)==2 ){
- if(parseInt(th.data.poster.show_quality)){
- var g_path = "../../../images/share/s_gou.png";
- context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("正品保证", 84 * unit, 690 * unit);
-
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
-
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
- }
-
- }else{
- var g_path = "../../../images/share/s_gou.png";
- context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("正品保证", 84 * unit, 690 * unit);
-
- context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("纯实体店", 246 * unit, 690 * unit);
-
- context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
- context.setFillStyle("red")
- context.setFontSize(18 * unit)
- context.fillText("官方验证", 420 * unit, 690 * unit);
- }
-
-
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 710 * unit)
- context.lineTo(520 * unit, 710 * unit)
- context.stroke();
-
- //---文字---
- context.setFillStyle("black")
- context.setFontSize(22 * unit)
-
- if(type==0){
- // 原来start --->
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
-
- context.setFontSize(22 * unit)
- context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
-
- }else{
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
- context.setFontSize(22 * unit)
- context.fillText("长按识别二维码", 40 * unit, 806 * unit);
- context.fillText("立即开始兑换", 40 * unit, 846 * unit);
-
-
- }
-
- //---二维吗图---
- //-- 自定义海报 --
- if(th.data.poster){
- var erm_x= parseFloat(th.data.poster.ewm_x)*2;
- var erm_y= parseFloat(th.data.poster.ewm_y)*2;
- context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 410 * unit, 726 * unit, 115 * unit, 125 * unit);
- }
-
- break;
- case 1: //秒杀商品的展示
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
-
- //画秒杀的图片
- var miaos_path = '../../../images/share/miao_share.png';
- context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
-
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
- //---文字---
- context.setFontSize(22 * unit)
- context.setFillStyle("black")
- context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
- context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
-
-
- //---二维吗图---
- //-- 自定义海报 --
- if(th.data.poster){
- var erm_x= parseFloat(th.data.poster.ewm_x)*2;
- var erm_y= parseFloat(th.data.poster.ewm_y)*2;
- context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
- }
- break;
-
- case 2: //会员团和商家团的展示
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
- //---文字---
-
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //绘制成团图片
- var ct_img = "../../../images/share/ct_num.png";
- context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);
- var ct_num = th.data.prom_act.ct_num;
- context.setFontSize(14 * unit)
- context.font = 'normal';
- context.setFillStyle("red")
- if (ct_num < 10) {
- context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
- } else {
- context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
- }
- context.setFontSize(22 * unit)
- context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
-
- context.setFillStyle("gray")
- context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);
- context.setFillStyle("black")
- context.font = 'normal bold 18px sans-serif';
- context.setFontSize(21.3 * unit)
- context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit);
-
-
- //---二维吗图---
- //-- 自定义海报 --
- if(th.data.poster){
- var erm_x= parseFloat(th.data.poster.ewm_x)*2;
- var erm_y= parseFloat(th.data.poster.ewm_y)*2;
- context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
- }
- break
- case 3: //阶梯团的展示
- //---画线---
- context.setLineWidth(1 * unit)
- context.moveTo(32 * unit, 670 * unit)
- context.lineTo(520 * unit, 670 * unit)
- context.stroke();
- //---文字---
-
- context.setFillStyle("black")
- context.setFontSize(24 * unit)
- context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
-
- //---绘制中间阶梯的价格---
- var list = th.data.prom_act.ct_rylist;
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- var wi = i * 90 * unit;
- context.font = 'normal';
- context.setFontSize(16 * unit)
- context.setFillStyle("red")
- context.fillText("¥", 40 * unit + wi, 756 * unit);
- context.setFontSize(22 * unit)
- var pri = parseFloat(item.price).toFixed(2);
- context.fillText(pri, 56 * unit + wi, 756 * unit);
- context.setFillStyle("gray")
- context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
- }
- //----------------下面部分----------------
- // context.setFillStyle("gray")
- // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);
- // context.setFillStyle("black")
- // context.font = 'normal bold 18px sans-serif';
- // context.setFontSize(22 * unit)
- // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
- //context.setFillStyle("gray")
- context.setFillStyle("black")
- context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
- //context.font = 'normal bold 18px sans-serif';
- context.setFontSize(22 * unit)
- context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit);
-
-
- //-- 自定义海报 --
- if(th.data.poster){
- var erm_x= parseFloat(th.data.poster.ewm_x)*2;
- var erm_y= parseFloat(th.data.poster.ewm_y)*2;
- context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
- }else{
- //---二维吗图---
- context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
- }
- break
-
-
- }
-
-
- //--- 如果是自定义海报的时候 ---
- if(th.data.poster && parseInt(th.data.poster.style)==2){
-
- //如果显示会员信息的话
- if(parseInt(th.data.poster.show_headpic)){
- //获取坐标
- var x= parseFloat(th.data.poster.head_x)*2;
- var y=parseFloat(th.data.poster.head_y)*2;
- //---绘制圆形要放在最后----
- context.save();
- context.beginPath();
- var h_x = x* unit;
- var h_y = y * unit;
- var h_r = 40 * unit;
- var cx = h_x + h_r;
- var cy = h_y + h_r;
- context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
- context.closePath();
- context.fill();
- context.clip();
- context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
- context.restore();
- }
-
- }else{
- //---绘制圆形要放在最后----
- context.save();
- context.beginPath();
- var h_x = 60 * unit;
- var h_y = 24 * unit;
- var h_r = 40 * unit;
- var cx = h_x + h_r;
- var cy = h_y + h_r;
- context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
- context.closePath();
- context.fill();
- context.clip();
- context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
- context.restore();
- }
-
-
- //把画板内容绘制成图片,并回调 画板图片路径
- context.draw(false, function() {
- setTimeout(function() {
- wx.canvasToTempFilePath({
- x: 0,
- y: 0,
- width: 750,
- height: 1217,
- destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
- destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
- canvasId: 'share',
- success: function(res) {
- that.setData({
- shareImgPath: res.tempFilePath,
- canvasHidden: true
- })
- if (!res.tempFilePath) {
- wx.showModal({
- title: '提示',
- content: '图片绘制中,请稍后重试',
- showCancel: false
- })
- return false;
- }
- // wx.previewImage({
- // //将图片预览出来
- // urls: [that.data.shareImgPath]
- // });
- that.setData({
- showPoster: true,
- });
- wx.hideLoading();
- }
- })
- }, 500)
-
- });
- });
- }
- });
- },
-
-
- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
- draw_Text: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
- var lineWidth = 0;
- var lastSubStrIndex = 0; //每次开始截取的字符串的索引
- var han = 0;
- for (let i = 0; i < str.length; i++) {
- if (han == 2) return;
- //lineWidth += ctx.measureText(str[i]).width;
- lineWidth += ut.measureText(str[i], 21.3 * unit);
- if (lineWidth > canvasWidth) {
- han++;
-
- if (han == 2)
- ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
- else
- ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
-
- initHeight += 22; //22为字体的高度
- lineWidth = 0;
- lastSubStrIndex = i;
- titleHeight += 20;
- }
- if (i == str.length - 1) { //绘制剩余部分
- ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
- }
- }
- },
// ----视频图片----
// 图片计数器
@@ -2636,7 +2197,7 @@ Page({
return false;
}
//---获取分享图片的本地地址,头像和商品图片----
- var path2 = getApp().globalData.userInfo.head_pic;
+ var path2 = getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:'';
if (path2 == "") {
ee.data.share_head = "../../../images/share/hui_hear_pic.png";
tt(func);
@@ -2657,37 +2218,44 @@ Page({
});
}
},
+
//--获取商品图片的本地缓存,回调写法--
get_goods_temp: function(tt) {
- var ee = this;
- if (ee.data.share_goods_img) {
- tt();
- return false;
- }
- //获取商品是分享图信息
- wx.getImageInfo({
- src: ee.data.data.original_img,
- success: function(res) {
- //res.path是网络图片的本地地址
- ee.data.share_goods_img = res.path;
- tt();
- },
- fail: function(res) {
- //获取默认空白图
- wx.getImageInfo({
- src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
- success: function(res) {
- ee.data.share_goods_img = res.path; //分享的图片不能用网络的
- tt();
- }
- })
+ var ee = this;
+ if (ee.data.share_goods_img) {
+ tt();
+ return false;
+ }
- }
- });
- },
+ var img=ee.data.iurl+ee.data.data.image_url;
+ if(ee.data.prom_act && ee.data.prom_act.share_img){
+ img=ee.data.iurl+ee.data.prom_act.share_img;
+ }
+
+ //获取商品是分享图信息
+ wx.getImageInfo({
+ src: img,
+ success: function(res) {
+ //res.path是网络图片的本地地址
+ ee.data.share_goods_img = res.path;
+ tt();
+ },
+ fail: function(res) {
+ //获取默认空白图
+ wx.getImageInfo({
+ src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
+ success: function(res) {
+ ee.data.share_goods_img = res.path; //分享的图片不能用网络的
+ tt();
+ }
+ })
+ }
+ });
+ },
- //--跳转到商品详情页面--
+
+ //--跳转到商品详情页面--
go_goods: function(e) {
var gid = e.currentTarget.dataset.gid;
var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid;
@@ -2713,12 +2281,12 @@ Page({
//--先判断会员状态--
var 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;
- }
+ // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ // wx.navigateTo({
+ // url: '/packageE/pages/togoin/togoin',
+ // })
+ // return false;
+ // }
//如果开启了,则不在选择门店
@@ -3673,7 +3241,7 @@ Page({
ee.get_normal(gid);
return false;
}
-
+
var t_gd = ee.data.data;
var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss");
var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss");
@@ -3686,6 +3254,7 @@ Page({
prom_act: t.data.data,
prom_end_time: prom_end_time,
prom_start_time: prom_start_time,
+ is_share_text: t.data.data.is_share_text
});
ee.get_sto();
@@ -3957,6 +3526,8 @@ Page({
openSpecModel_Nor: function () {
var th=this;
+ if(th.data.get_sto_ing) return false;
+
// 是否授权登陆
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
@@ -4095,9 +3666,776 @@ Page({
})
}
},
-
-
-
+
+ clickShare() {
+ this.setData({
+ share_hidden: true,
+ });
+ },
+ send() {
+ this.setData({
+ share_hidden: false,
+ });
+ },
+ cancel() {
+ this.setData({
+ share_hidden: false,
+ });
+ },
+
+
+ saveImageFn(){
+ if(this.data.share_b_img){
+ this.saveImageToPhotosAlbum()
+ }else{
+ this.saveImageToPhotosAlbumDef()
+ }
+ },
+
+
+ //--定义的保存图片方法,分享团---
+ saveImageToPhotosAlbum: function () {
+ //--先判断会员状态--
+ // var user_info = getApp().globalData.userInfo;
+ // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ // //getApp().my_warnning("请先登录",0,this);
+ // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', })
+ // return false;
+ // }
+
+ if (this.data.share_hidden) {
+ this.setData({
+ share_hidden: false,
+ });
+ };
+
+ //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
+ var type = this.data.prom_type || 0;
+ console.log('商品类型-----');
+ console.log(type);
+ // if (type == 2) type = -1;
+ if (type == 4) type = 0;
+ if (type == 8) type = 0;
+ if (type == 2) type = 0;
+ if (type == 6) type = 2; // 6拼团 2团购
+ if (type == 10) type = -1;
+
+ wx.showLoading({
+ title: '生成中...',
+ })
+ var that = this,
+ th = that;
+ //设置画板显示,才能开始绘图
+ that.setData({
+ canvasHidden: false
+ })
+
+ var app = getApp();
+ var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
+ var path2 = that.data.data.original_img;
+
+ var scene = th.data.gid;
+ var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
+ if (user_id > 0) {
+ scene += "_" + user_id;
+ }
+ //-- 如果不是会员分享过来的要分享给别人 --
+ if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
+ //固定房间是第3个字符
+ if (!user_id) scene += "_0";
+ scene += "_" + getApp().globalData.room_id;
+ }else{
+ if (!user_id) scene += "_0";
+ scene += "_0";
+ }
+ if(this.data.prom_type){
+ scene += "_" + this.data.prom_type+"_"+th.data.prom_id;
+ }
+
+
+ ///二微码
+ var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
+ os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/goodsInfo/goodsInfo";
+
+
+ console.log(path3);
+
+ //读取文件成功则OK--
+ wx.getImageInfo({
+ src: path3,
+ success: function (res) {
+ //回调写法
+ th.get_head_temp(th.get_goods_temp, function () {
+ var vpath = res.path;
+ var context = wx.createCanvasContext('share');
+ //先画背景
+ var pg_path = "../../../images/share/share_bg.png";
+
+ //-- 如果有自定义海报的时候,判断背景的图片 --
+ if (th.data.share_b_img) {
+ pg_path = th.data.share_b_img;
+ }
+ context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
+
+ let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:'';
+
+ //-- 是自定义海报的情况下 --
+ if (th.data.poster && parseInt(th.data.poster.style) == 2) {
+ //在线上分享人的情况下
+ if (parseInt(th.data.poster.show_headpic)) {
+ //获取坐标
+ var x = parseFloat(th.data.poster.head_x) * 2;
+ var y = parseFloat(th.data.poster.head_y) * 2;
+ var x1 = (x + 90) * unit;
+ var y1 = (y + 50) * unit;
+ //--昵称---
+ context.setFontSize(24 * unit)
+ context.setFillStyle("black")
+ context.fillText(nick, x1, y1);
+ var width = 24 * nick.length * unit + 4 * unit;
+ //强烈推荐 改许程
+ var tj_path = "../../../images/share/q_tj.png";
+ context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit)
+ context.setLineJoin('round'); //交点设置成圆角
+ context.setFillStyle("white")
+ context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit);
+
+ //context.setFillStyle("black")
+ //context.setFontSize(24 * unit)
+ //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
+ }
+ } else {
+ //--昵称---
+ context.setFontSize(24 * unit)
+ context.setFillStyle("black")
+ context.fillText(nick, 152 * unit, 76 * unit);
+ var width = 24 * nick.length * unit + 2 * unit;
+ //强烈推荐 改许程
+ var tj_path = "../../../images/share/q_tj.png";
+ context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit);
+ context.setLineJoin('round'); //交点设置成圆角
+ context.setFillStyle("white");
+ context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
+ }
+
+ var share_title = th.data.data.goods_name;
+
+ if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) {
+ share_title = th.data.prom_act.share_title;
+ if (!share_title) share_title = th.data.prom_act.title;
+ if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
+
+ //-- 显示活动时间 --
+ if (th.data.share_b_img) {
+ act_time = "截止时间:" + ut.formatTime(th.data.prom_act.end_time);
+ }
+ }
+
+ //---产品名称---
+ //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
+
+ 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(23 * unit)
+ context.setFillStyle("red")
+
+ // 7.商品价格
+ let price = th.data.data.shop_price;
+ if (th.data.card_field && th.data.data[th.data.card_field]) {
+ price = th.data.data[th.data.card_field];
+ }
+ if (th.data.prom_act) price = th.data.prom_price;
+ price = parseFloat(price).toFixed(2);
+
+ var wd1 = th.data.screenWidth - ut.measureText(price, 31 * unit) - 25;
+ context.fillText("¥", wd1 - 15, 160 * unit);
+ context.setFontSize(31 * unit)
+ context.fillText(price, wd1, 165 * unit);
+
+ //---市场价划掉---
+ // context.setFillStyle("red")
+ // context.setFontSize(22 * unit)
+ // pri0 = "¥" + th.data.data.market_price.toFixed(2);
+ // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
+
+
+
+ // context.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 = wd1;
+ var hp = 203 * unit;
+ if (th.data.prom_type != 4) wp -= 12;
+ th.draw_pos_price(context,wp,hp,th.data.data.show_price,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, 220 * 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, 644 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("正品保证", 84 * unit, 664 * unit);
+
+ context.drawImage(g_path, 218 * unit, 644 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("纯实体店", 246 * unit, 664 * unit);
+
+ context.drawImage(g_path, 388 * unit, 644 * unit, 22 * unit, 22 * unit);
+ context.setFillStyle("red")
+ context.setFontSize(18 * unit)
+ context.fillText("官方验证", 420 * unit, 664 * unit);
+
+ }
+
+ //---画线---
+ // context.setLineWidth(1 * unit)
+ // context.moveTo(32 * unit, 662 * unit)
+ // context.lineTo(520 * unit, 662 * unit)
+ // context.stroke();
+
+ //-- 图片底部文字 --
+ switch (type){
+ case 0:
+ //---文字---
+ //---文字---
+ context.setFillStyle("black");
+ context.setFontSize(22 * unit);
+
+ context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
+
+ break;
+
+ case 1:
+
+ //画秒杀的图片
+ if (th.data.is_share_text) {
+ var miaos_path = '../../../images/share/miao_share.png';
+ context.drawImage(miaos_path, 43 * unit, 690 * unit, 222 * unit, 40 * unit);
+ }
+
+ context.setFillStyle("black")
+ context.setFontSize(24 * unit)
+ context.fillText(th.data.sto_sele_name_1, 40 * unit, 770 * unit);
+ //---文字---
+ context.setFontSize(22 * unit)
+ context.setFillStyle("black")
+ if (th.data.is_share_text) {
+ context.fillText("特惠好物,限时秒杀", 40 * unit, 807 * unit);
+ }
+ context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 844 * unit);
+
+ break;
+
+ }
+
+
+
+ //---二维吗图---
+ //-- 自定义海报 --
+ 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 && th.data.prom_act){
+ var act_time='';
+ act_time="截止时间:"+ ut.formatTime(th.data.prom_act.end_time);
+ context.setFillStyle("red")
+ getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit);
+ }
+
+ //把画板内容绘制成图片,并回调 画板图片路径
+ context.draw(false, function () {
+ setTimeout(function () {
+ wx.canvasToTempFilePath({
+ x: 0,
+ y: 0,
+ width: 750,
+ height: 1217,
+ destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
+ destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
+ canvasId: 'share',
+ success: function (res) {
+
+ that.setData({
+ shareImgPath: res.tempFilePath,
+ canvasHidden: true
+ })
+
+ if (!res.tempFilePath) {
+ wx.showModal({
+ title: '提示',
+ content: '图片绘制中,请稍后重试',
+ showCancel: false
+ })
+ return false;
+ }
+
+ // wx.previewImage({
+ // //将图片预览出来
+ // urls: [that.data.shareImgPath]
+ // });
+ that.setData({
+ showPoster: true,
+ });
+ wx.hideLoading();
+ }
+ })
+ }, 500)
+
+ });
+ });
+ },
+ fail: function (res) {
+ console.log(res);
+ wx.hideLoading();
+
+ }
+ });
+ },
+ //--定义的保存图片方法,分享团---
+ saveImageToPhotosAlbumDef: function () {
+ //--先判断会员状态--
+ // var user_info = getApp().globalData.userInfo;
+ // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ // //getApp().my_warnning("请先登录",0,this);
+ // wx.navigateTo({url: '/packageE/pages/togoin/togoin',})
+ // return false;
+ // }
+
+ if (this.data.share_hidden) {
+ this.setData({share_hidden: false,});
+ };
+
+ //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
+ var type = this.data.prom_type || 0;
+ console.log('商品类型-----');
+ console.log(type);
+ // if (type == 2) type = -1;
+ if (type == 4) type = 0;
+ if (type == 8) type = 0;
+ if (type == 2) type = 0;
+ if (type == 6) type = 2; // 6拼团 2团购
+ if (type == 10) type = -1;
+
+ if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
+ console.log('商品类型。。。。。');
+ console.log(type);
+ wx.showLoading({title: '生成中...',})
+ var that = this, th = that;
+ //设置画板显示,才能开始绘图
+ that.setData({
+ canvasHidden: false
+ })
+
+ var app = getApp();
+ var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
+ var path2 = that.data.data.original_img;
+
+ var scene = th.data.gid;
+ var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
+ if (user_id > 0) {
+ scene += "_" + user_id;
+ }
+ //-- 如果不是会员分享过来的要分享给别人 --
+ if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
+ //固定房间是第3个字符
+ if (!user_id) scene += "_0";
+ scene += "_" + getApp().globalData.room_id;
+ }else{
+ if (!user_id) scene += "_0";
+ scene += "_0";
+ }
+ if(this.data.prom_type){
+ scene += "_" + this.data.prom_type+"_"+th.data.prom_id;
+ }
+
+ ///二微码
+ var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
+ os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/goodsInfo/goodsInfo";
+
+ console.log(path3);
+
+
+ // 读取文件成功则OK--
+ wx.getImageInfo({
+ src: path3,
+ success: function (res) {
+ // 回调写法
+ th.get_head_temp(th.get_goods_temp, function () {
+ var vpath = res.path;
+ var context = wx.createCanvasContext('share');
+ // 先画背景
+ var pg_path = "../../../../images/share/share_bg.png";
+ th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
+
+ //把画板内容绘制成图片,并回调 画板图片路径
+ context.draw(false, function () {
+ setTimeout(function () {
+ wx.canvasToTempFilePath({
+ x: 0,
+ y: 0,
+ width: 750,
+ height: 1217,
+ destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
+ destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
+ canvasId: 'share',
+ success: function (res) {
+
+ that.setData({
+ shareImgPath: res.tempFilePath,
+ canvasHidden: true
+ })
+
+ if (!res.tempFilePath) {
+ wx.showModal({
+ title: '提示',
+ content: '图片绘制中,请稍后重试',
+ showCancel: false
+ })
+ return false;
+ }
+
+ that.setData({
+ showPoster: true,
+ });
+ wx.hideLoading();
+ }
+ })
+ }, 500)
+
+ });
+ });
+ },
+ fail: function (res) {
+ console.log(res);
+ wx.hideLoading();
+
+ }
+ });
+ },
+
+ //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
+ draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
+ var lineWidth = 0;
+ var lastSubStrIndex = 0; //每次开始截取的字符串的索引
+ var han = 0;
+ for (let i = 0; i < str.length; i++) {
+ if (han == 2) return;
+ //lineWidth += ctx.measureText(str[i]).width;
+ lineWidth += ut.measureText(str[i], 21.3 * unit);
+ if (lineWidth > canvasWidth) {
+ han++;
+
+ if (han == 2)
+ ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
+ else
+ ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
+
+ initHeight += 22; //22为字体的高度
+ lineWidth = 0;
+ lastSubStrIndex = i;
+ titleHeight += 20;
+ }
+ if (i == str.length - 1) { //绘制剩余部分
+ ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
+ }
+ }
+ },
+
+ drawPoster(context, unit, img, vpath, type) {
+ // 1.灰色背景
+ context.setFillStyle('#f2f1f6');
+ context.rect(0, 0, 554 * unit, 899 * unit);
+ context.fill();
+
+ // 2.商城名称
+ let shopName = this.data.sto_sele_name_1;
+ context.setTextAlign('center');
+ context.setFontSize(26 * unit);
+ context.setFillStyle('black');
+ context.fillText(shopName, 277 * unit, 60 * unit);
+
+ // 3.推荐来源
+ if(getApp().globalData.userInfo) {
+ let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`;
+ context.setTextAlign('center');
+ context.setFontSize(22 * unit);
+ context.setFillStyle('#96959a');
+ context.fillText(fromText, 277 * unit, 105 * unit);
+ }
+ // 4.海报背景
+ context.setFillStyle('white');
+ context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit);
+
+ // 5.商品图片
+ // 图片的x坐标
+ let bg_x = 37 * unit
+ // 图片的y坐标
+ let bg_y = 157 * unit
+ // 图片宽度
+ let bg_w = 480 * unit
+ // 图片高度
+ let bg_h = 474 * unit
+ // 图片圆角
+ let bg_r = 4
+ // 绘制海报背景图片圆角
+ context.save()
+ context.beginPath()
+ context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5)
+ context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2)
+ context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5)
+ context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI)
+ context.clip()
+ context.drawImage(img, bg_x, bg_y, bg_w, bg_h);
+ context.restore();
+
+ // 6.强烈推荐
+ let src = '';
+ context.beginPath();
+ if (type == 0) { // 普通
+ src = '../../../images/share/q_tj.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit);
+ context.setFontSize(16 * unit)
+ context.setFillStyle("white")
+ context.setTextAlign('left');
+ context.fillText('强烈推荐', 64 * unit, 668 * unit);
+ }
+ if (type == 1) { // 秒杀
+
+ if (this.data.is_share_text == 1) {
+ src = '../../../images/share/miao_share.png';
+ context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit);
+ }
+ context.setTextAlign('left');
+ }
+
+
+ // 7.商品价格
+ let price = this.data.data.shop_price;
+ if (this.data.card_field && this.data.data[this.data.card_field]) {
+ price = this.data.data[this.data.card_field];
+ }
+ if (this.data.prom_act) price = this.data.prom_price;
+ price = parseFloat(price).toFixed(2);
+ context.setFontSize(32 * unit);
+ context.setFillStyle('#DE1117');
+
+ //price = this.data.presellList.presell_price
+ context.fillText('¥' + price, 54 * unit, 735 * unit);
+ //-- 零售价的优化 --
+ var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit);
+ var hp=735 * unit
+ this.draw_pos_price(context,wp,hp,this.data.data.show_price,unit);
+
+
+ // 8.商品标题
+ context.setFontSize(20 * unit);
+ context.setFillStyle('#898989');
+ getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
+
+ // 9.小程序码
+ context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
+ context.setFontSize(16 * unit);
+ context.setFillStyle('#777');
+ context.fillText('长按识别二维码', 378 * unit, 810 * unit);
+
+ // 10.竖线
+ context.beginPath();
+ context.setFillStyle('#eee');
+ context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit);
+ context.fill();
+ },
+
+ //---市场价划掉---
+ draw_pos_price(context,w,h,market_price,unit){
+
+ if(!this.data.sys_switch) return false;
+ if(!this.data.sys_switch.is_retail_price) return false;
+
+ context.setFillStyle("gray")
+ context.setFontSize(22 * unit)
+ var pri0 = "¥" + market_price.toFixed(2);
+ context.fillText(pri0, w, h);
+
+ var c_h=h-6;
+ context.setStrokeStyle('gray');
+ context.setLineWidth(1 * unit);
+ context.moveTo(w - 5, c_h);
+ context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h);
+ context.stroke();
+
+ },
+
+
+ closePoster() {
+ this.setData({
+ showPoster: false,
+ });
+ },
+
+ // 保存图片到手机
+ savePic() {
+ console.log('保存图片');
+ var self = this;
+ // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限
+ this.getSetting().then((res) => {
+ // 判断用户是否授权了保存到相册的权限,如果没有发起授权
+ if (!res.authSetting['scope.writePhotosAlbum']) {
+ this.authorize().then(() => {
+ // 同意授权后保存下载文件
+ this.saveImage(self.data.shareImgPath)
+ .then(() => {
+ self.setData({
+ showPoster: false
+ });
+ });
+ })
+ } else {
+ // 如果已经授权,保存下载文件
+ this.saveImage(self.data.shareImgPath)
+ .then(() => {
+ self.setData({
+ showPoster: false
+ });
+ });
+ }
+
+ })
+ },
+
+ // 发起首次授权请求
+ authorize() {
+ // isFirst 用来记录是否为首次发起授权,
+ // 如果首次授权拒绝后,isFirst赋值为1
+ let isFirst = wx.getStorageSync('isFirst') || 0;
+ return new Promise((resolve, reject) => {
+ wx.authorize({
+ scope: 'scope.writePhotosAlbum',
+ // 同意授权
+ success: () => {
+ resolve();
+ },
+ // 拒绝授权,这里是用户拒绝授权后的回调
+ fail: res => {
+ if (isFirst === 0) {
+ wx.setStorageSync('isFirst', 1);
+ wx.showToast({
+ title: '保存失败',
+ icon: 'none',
+ duration: 1000
+ })
+ } else {
+ this.showModal();
+ }
+ console.log('拒绝授权');
+ reject();
+ }
+ })
+ })
+ },
+
+
+ // 保存图片到系统相册
+ saveImage(saveUrl) {
+ var self = this;
+ return new Promise((resolve, reject) => {
+ wx.saveImageToPhotosAlbum({
+ filePath: saveUrl,
+ success: (res) => {
+ wx.showToast({
+ title: '保存成功',
+ duration: 1000,
+ });
+ self.setData({
+ showPlaybill: 'true'
+ });
+ resolve();
+ },
+ fail: () => {
+ wx.showToast({
+ title: '保存失败',
+ duration: 1000,
+ });
+ }
+ })
+ })
+ },
+
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
+ });
+ },
+
});
diff --git a/packageA/pages/goodsInfo/goodsInfo.json b/packageA/pages/goodsInfo/goodsInfo.json
index 5b20c87..57137c1 100644
--- a/packageA/pages/goodsInfo/goodsInfo.json
+++ b/packageA/pages/goodsInfo/goodsInfo.json
@@ -6,7 +6,8 @@
"warn": "/components/long_warn/long_warn",
"serviceCard_recommend": "/components/serviceCard_list/serviceCard_list",
"privacy_pop": "/components/privacy_pop/privacy_pop",
- "top_nav": "/components/diy_top_nav/diy_top_nav"
+ "top_nav": "/components/diy_top_nav/diy_top_nav",
+ "share": "/components/share/share"
},
"navigationStyle": "custom"
}
\ No newline at end of file
diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml
index 451107d..9a2d0e9 100644
--- a/packageA/pages/goodsInfo/goodsInfo.wxml
+++ b/packageA/pages/goodsInfo/goodsInfo.wxml
@@ -11,7 +11,7 @@
-
@@ -106,16 +106,25 @@
-
-
- ¥{{filters.toFix(prom_price,2)}}
-
- ¥{{filters.toFix(data.shop_price,2)}}
-
-
- {{data.goods_name}}
+
+
+
+
+ ¥{{filters.toFix(prom_price,2)}}
+
+ ¥{{filters.toFix(data.shop_price,2)}}
+
+
+ {{data.goods_name}}
+
+
+
+
+
+
+ 分享
@@ -970,14 +979,20 @@
-
-
+
+
-
+
+
+
+
+
+
+
@@ -1015,3 +1030,5 @@
+
+
diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
index fda382d..c2d1534 100644
--- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
+++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
@@ -12,6 +12,7 @@ var more = function (e) {
}(require("../../../../utils/LoadMore.js")),
n = new more.default();
var regeneratorRuntime = require('../../../../utils/runtime.js');
+var self=null;
Page({
data: {
@@ -1256,6 +1257,8 @@ Page({
})
}
+ this.data.get_sto_ing=1;
+
var timer_get = setInterval(function () {
if (th.data.is_get_local_ok == 0) return false;
if (!th.data.fir_def_store) return false;
@@ -1374,13 +1377,19 @@ Page({
th.setData({all_pick_list: e.data.data.pageData});
th.deal_pickup(e);
}else{
+ th.data.get_sto_ing=0;
th.setData({all_pick_list: null, only_pk:null,def_pickpu_list:null });
-
wx.hideLoading();
}
}, 800)
}
+ else{
+ th.data.get_sto_ing=0;
+ th.setData({all_pick_list: null, only_pk:null,def_pickpu_list:null });
+
+ wx.hideLoading();
+ }
})
}, 200)
},
@@ -1554,9 +1563,11 @@ Page({
}
}
+ th.data.get_sto_ing=0;
}
});
} else {
+ th.data.get_sto_ing=0;
th.setData({
is_show_sto_cat: 0,
only_pk: e.data.data.pageData
@@ -1605,6 +1616,12 @@ Page({
// return false;
// }
+ if (this.data.share_hidden) {
+ this.setData({
+ share_hidden: false,
+ });
+ };
+
//类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4积分购
var type = 2
if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
@@ -3569,6 +3586,9 @@ Page({
});
},
+ send() {
+ this.setData({ share_hidden: false, });
+ },
cancel() {
this.setData({
share_hidden: false,
@@ -3965,6 +3985,15 @@ Page({
}
},
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
+ });
+ },
+
});
diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
index 904d6e7..196a2b7 100644
--- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
+++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
@@ -807,14 +807,20 @@
-
-
+
+
-
+
+
+
+
+
+
+
diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss
index d38ba36..de42797 100644
--- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss
+++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss
@@ -2744,7 +2744,7 @@ button.custom-service::after{
left: 50%;
transform: translate(-50%, -50%);
width: calc(100% - 120rpx);
- z-index: 1000;
+ z-index: 10001;
}
.mask {
position: fixed;
@@ -2752,7 +2752,7 @@ button.custom-service::after{
left: 0;
width: 100%;
height: 100%;
- z-index: 999;
+ z-index: 10000;
background-color: rgba(0,0,0,.4);
}
.poster-wrapper {
diff --git a/packageA/pages/serviceCard_pd/team_success/team_success.js b/packageA/pages/serviceCard_pd/team_success/team_success.js
index 7da1340..459d929 100644
--- a/packageA/pages/serviceCard_pd/team_success/team_success.js
+++ b/packageA/pages/serviceCard_pd/team_success/team_success.js
@@ -823,7 +823,7 @@ Page({
tt(func);;
},
fail: function (res) {
- ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
+ ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
tt(func);
}
});
diff --git a/packageB/pages/luckactivity/luckinfo/luckinfo.js b/packageB/pages/luckactivity/luckinfo/luckinfo.js
index 8548579..a8cf2f4 100644
--- a/packageB/pages/luckactivity/luckinfo/luckinfo.js
+++ b/packageB/pages/luckactivity/luckinfo/luckinfo.js
@@ -262,9 +262,9 @@ Page({
let first_leader = null;
this.data.options = options;
- // wx.setNavigationBarTitle({
- // title: options.title,
- // });
+ wx.setNavigationBarTitle({
+ title: options.title,
+ });
this.setData({l_title:options.title})
app.isLogin().then(function (data) {//进入页面前已经授权登录成功
diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
index c9601f9..b32f387 100644
--- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
+++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -80,6 +80,13 @@ Page({
bconfig: null,
showFold:true,
template_id:[],
+
+ //-- 订单促销判断积累 ---2024-2-20
+ order_prom_map_ck: {},
+ //能不能使用订单促销
+ can_use_ord_prom:{},
+ //存储订单促销的取价,按照门店进行索引
+ show_ord_prom:{},
},
@@ -513,6 +520,7 @@ Page({
}
+ t.data.data.shop_price_y = t.data.data.shop_price;
t.data.data.shop_price = gg.goods_price;
//--如果是普通购买的时候--
if (gg.is_normal == 1) {
@@ -569,7 +577,10 @@ Page({
}
+ t.data.data.goods_price=th.data.param.goods_price;
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(t.data.data);
th.setData({
bn_goods: t.data.data,
@@ -642,6 +653,9 @@ Page({
}
+ t.data.data.goods_price=th.data.param.goods_price;
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(t.data.data);
th.setData({
bn_goods: t.data.data,
@@ -651,7 +665,6 @@ Page({
bn_exp_type: et
});
-
//计算价格
th.calculatePrice2();
}
@@ -842,7 +855,9 @@ Page({
//-----------计算商品总价--------------
//var allpice = th.data.param.goods_price;
var allpice = (th.data.act.group_price/100).toFixed(2);
-
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ allpice=th.data.param.goods_price*th.data.bn_goods.buynum;
+ }
allpice = parseFloat(allpice).toFixed(2);
var txt = "formData.all_price";
@@ -868,14 +883,18 @@ Page({
var ord_prom=null;
var o_condition=allpice;
if(th.data.act.is_order_yh){
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // ord_prom = res.data.data;
+ // }
+ // })
+
+ th.set_by_now_ord_prom(th.data.bn_goods);
+ th.data.order_prom_map_ck[th.data.bn_pick].goods_price_all=o_condition;
+ ord_prom=await th.get_cur_ord_prom(th.data.bn_pick);
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- ord_prom = res.data.data;
- }
- })
}
@@ -964,7 +983,7 @@ Page({
title: "物流配置未启用物流公司", icon: 'none', duration: 2000
})
//th.setData({ show_submit:0, });
- th.setData({show_submit:1, submit: 0,same_ok:0 })
+ th.setData({show_submit:1, submit: 0,same_ok:0,sub:0 })
return false;
}
@@ -996,7 +1015,7 @@ Page({
wx.showToast({
title: "计算物流错误", icon: 'none', duration: 2000
})
- th.setData({show_submit:1, submit: 0,same_ok:0 })
+ th.setData({show_submit:1, submit: 0,same_ok:0,sub:0 })
return false;
}
@@ -1289,7 +1308,7 @@ Page({
// 提交订单前弹出确认对话框
submitConfirm(e) {
// is_show为0不显示温馨提示,为1显示温馨提示
- if (this.data.param.is_show == 1) {
+ if (this.data.param.is_show == 1 && !this.data.can_use_ord_prom[this.data.bn_pick]) {
wx.showModal({
title: '温馨提示',
content: this.data.param.alert,
@@ -1451,6 +1470,61 @@ Page({
'prom_id': th.data.param.group_id, //促销活动id
};
+
+ if(th.data.bn_goods.discount_field){
+ goods.discount_field=th.data.bn_goods.discount_field;
+ }
+
+ //如果有参与非实收的订单促销,那么就相当于是普通购买
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ goods.is_integral_normal=1;
+ goods.prom_type=0;
+ goods.prom_id=0;
+
+ //如果是指定门店,就要判断
+ if (th.data.bn_goods.pick_group_ids) {
+ var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) {
+ return e.pickup_id == th.data.bn_pick;
+ })
+ if (idx0 < 0) {
+ getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th);
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+ if (th.data.sales_rules==1 && th.data.bn_goods.store_count= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) {
+ var isok = 1;
+ await th.check_store_num(goods.goods_id, th.data.bn_pick, goods.goods_num, function (res) {
+ isok = res;
+ });
+ if (!isok) {
+ getApp().confirmBox("商品的门店库存不足");
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+
+
+
+ }
+
if (getApp().globalData.skinface_id) {
goods.skinface_id = getApp().globalData.skinface_id;
}
@@ -2085,9 +2159,191 @@ Page({
th.calculatePrice2();
},
+ //-- 获取订单促销的判断结构 --
+ set_by_now_ord_prom(item){
+ let pickid=this.data.bn_pick;
+ let order_prom_map_ck= this.data.order_prom_map_ck;
+ order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
+ }
+
+ let pk_ord_map=order_prom_map_ck[pickid];
+ pk_ord_map.shop_price_all += item.shop_price_y * item.buynum;
+ pk_ord_map.market_price_all += item.market_price * item.buynum;
+
+ },
+
+ //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的
+ async get_cur_ord_prom(pickid) {
+ let ord_prom = null;
+ let order_prom_map_ck = this.data.order_prom_map_ck[pickid];
+ if(!order_prom_map_ck) return null;
+
+ //获取当前进行中的优惠促销
+ await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", {
+ data: {
+ store_id: os.stoid,
+ orderAmount: -1, //-1为不判断金额条件
+ user_id: getApp().globalData.user_id
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ ord_prom = res.data.data;
+ }
+ })
+
+ if (!ord_prom) return null;
+ //用于计算订单促销的金额
+ let calculate_price=0;
+
+ let txt1='show_ord_prom['+pickid+']';
+ //-- 此时判断活动的金额满足与否 --
+ switch (ord_prom.discount_field) {
+ //实收价的时候
+ case 0:
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+
+ if (ord_prom.money > order_prom_map_ck.goods_price_all){
+ return null;
+ }
+ break;
+ //手店价的时候
+ case 1:
+ if (ord_prom.money > order_prom_map_ck.shop_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 1
+ });
+ break;
+ //市场价的时候
+ case 2:
+ if (ord_prom.money > order_prom_map_ck.market_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 2
+ });
+ break;
+ }
+ //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候)
+ if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){
+ return null;
+ }
+ return ord_prom;
+ },
+
+ //立即购买的时候,点击订单促销的参与
+ set_can_use_ord_prom_now:function (e){
+
+ if(this.data.sub) return false;
+ this.setData({ sub: 1,same_ok:1 });
+
+ let pickid=this.data.bn_pick;
+ let txt = 'can_use_ord_prom[' + pickid + ']';
+ let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0;
+ this.setData({
+ [txt]: !can_use
+ })
+
+ let th=this;
+ let good=th.data.bn_goods;
+ let param=th.data.param;
+
+ //如果有要参与订单促销的按钮点击后,要修改商品的价格
+ if(th.data.can_use_ord_prom[pickid]){
+ let discount_field=th.data.show_ord_prom[pickid];
+ switch (discount_field){
+ case 1:
+ good.shop_price=good.shop_price_y;
+ param.goods_price=good.shop_price_y;
+ break;
+ case 2:
+ good.shop_price=good.market_price;
+ param.goods_price=good.market_price;
+ break;
+ }
+ //-- 转成普通商品 ---
+ good.prom_type=0;
+ good.prom_id=0;
+ good.discount_field=discount_field;
+
+ }else{
+ good=ut.deep_cp(th.data.old_bn_goods);
+ param.goods_price=good.goods_price;
+ }
+ th.setData({
+ bn_goods:good,
+ param
+ })
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ th.calculatePrice2()
+ },
+ //---确认线下门店的数量足不足---
+ async check_store_num(goods_id, pick, goods_num, func) {
+ var lock = 0, pick_no, plist, erpwareid;
+ //先读取门店的lock
+ await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
+ data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data.total > 0) {
+ for (var i in res.data.data.pageData)
+ lock += res.data.data.pageData[i].outQty;
+ }
+ })
+ //先获取门店的编号
+ await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
+ data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
+ }).then(res => {
+ if (res.data.code == 0) {
+ pick_no = res.data.data.pickup_no;
+ }
+ })
+ //先获取商品的线下库存
+ await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
+ data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
+ }).then(res => {
+ if (res.data.code == 0) {
+ erpwareid = res.data.data.erpwareid;
+ }
+ })
+ //读取线下的门店库存
+ await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
+ data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid }
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) {
+ plist = res.data.data.pageData[0];
+ }
+ })
+ var isok = 1;
+ if (!plist || goods_num > plist.CanOutQty - lock) {
+ isok = 0;
+ }
+ func(isok);
+ },
});
diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
index 71a9765..12ca5c8 100644
--- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
+++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
@@ -100,6 +100,14 @@
{{order.store_prom}}
+
+
+
+
+ 参与订单促销
+
+
+
diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
index 34cd8ba..8a9bf21 100644
--- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
+++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -3129,6 +3129,7 @@ Page({
//---------拿出门店分类和门店------------
get_sto(e,func) {
+
var th = this, that = this;
var is_normal = e;
@@ -3137,12 +3138,13 @@ Page({
} else {
th.setData({ is_normal: 0 })
}
+ th.data.get_sto_ing=1;
var timer_get = setInterval(function () {
if (th.data.is_get_local_ok == 0) return false;
if (!th.data.fir_def_store) return false;
var dd = null, i = getApp().request;
- if (!th.data.sele_g) return false;
+ if (!th.data.sele_g){th.data.get_sto_ing=0; return false;}
var g_distr_type = th.data.sele_g.distr_type;
if (g_distr_type != 0) {
@@ -3277,6 +3279,7 @@ Page({
}
},err=>{
+ th.data.get_sto_ing=0;
ut.m_toast('网络繁忙,请稍后重试');
wx.hideLoading();
})
@@ -3403,12 +3406,15 @@ Page({
front_is_show_sto_cat:th.data.is_show_sto_cat,
})
}
+
+ this.data.get_sto_ing=0;
+
},
//------------处理门店---------------
deal_pickup(e) {
var th = this;
- if (!th.data.sele_g) return false
+ if (!th.data.sele_g){th.data.get_sto_ing=0;return false}
var g_distr_type = th.data.sele_g.distr_type;
wx.hideLoading();
@@ -3580,7 +3586,7 @@ Page({
//------------处理线下门店库存--------
deal_pickup_dline(e) {
var pkno = [], th = this;
- if (!th.data.sele_g) return false;
+ if (!th.data.sele_g){th.data.get_sto_ing=0;return false;}
if (this.data.def_pick_store) {
pkno.push(this.data.def_pick_store.pickup_no);
@@ -3673,6 +3679,7 @@ Page({
} else {
+ th.data.get_sto_ing=0;
th.setData({
all_sto: null,
only_pk: null,
@@ -3739,9 +3746,11 @@ Page({
//---把数组组装进去---
th.deal_pickup(em);
} else {
+ th.data.get_sto_ing=0;
th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null })
}
} else {
+ th.data.get_sto_ing=0;
th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null })
}
})
@@ -4504,6 +4513,7 @@ Page({
// ind == 1 为普通购买
openSpecModel_pt: function (e) {
+ if(this.data.get_sto_ing) return false;
this.setData({ open_ind_store: 9 });
// 判断是否有待支付订单
var aid = this.data.group_id;
@@ -4546,7 +4556,11 @@ Page({
var th = this;
var ind = parseInt(e.currentTarget.dataset.ind);
- th.setData({def_pick_store: ut.deep_cp(th.data.front_pick)});
+ if(th.data.front_pick && th.data.front_pick.pickup_id){
+ th.setData({def_pick_store: ut.deep_cp(th.data.front_pick)});
+ }
+
+
//ind == 1是普通购买
if (ind == 1) {
@@ -5981,12 +5995,12 @@ Page({
})
//--先判断会员状态--
var 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;
- }
+ // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ // wx.navigateTo({
+ // url: '/packageE/pages/togoin/togoin',
+ // })
+ // return false;
+ // }
var th = this;
var ind = ee.currentTarget.dataset.ind;
diff --git a/packageC/pages/presell/cardInfo/goodsInfo.js b/packageC/pages/presell/cardInfo/goodsInfo.js
index cad10c2..05f2a54 100644
--- a/packageC/pages/presell/cardInfo/goodsInfo.js
+++ b/packageC/pages/presell/cardInfo/goodsInfo.js
@@ -1186,6 +1186,9 @@ Page({
},
openSpecModel: function(t) {
+
+ if(this.data.get_sto_ing) return false;
+
var th=this; var open_store = t.currentTarget.dataset.ind;
if(getApp().is_sp_hao() && open_store==1){
wx.showToast({
@@ -1443,6 +1446,8 @@ Page({
})
}
+ this.data.get_sto_ing=1;
+
var timer_get = setInterval(function() {
if (th.data.is_get_local_ok == 0) return false;
if (!th.data.fir_def_store) return false;
@@ -1557,6 +1562,9 @@ Page({
th.deal_pickup(e);
}
else{
+
+ th.data.get_sto_ing=0;
+
th.setData({
isshow:1
})
@@ -1835,11 +1843,14 @@ Page({
if (!th.data.def_pick_store) {
th.setData({def_pick_store:e.data.data.pageData[0]})
}
-
}
+
+ th.data.get_sto_ing=0;
}
});
- } else {
+ } else {
+
+ th.data.get_sto_ing=0;
th.setData({
is_show_sto_cat: 0,
only_pk: e.data.data.pageData
@@ -1991,8 +2002,8 @@ Page({
return false;
}
- var img=ee.data.iurl+ee.data.data.img_url;
- if(ee.data.prom_act){
+ var img=ee.data.iurl+ee.data.data.image_url;
+ if(ee.data.prom_act && ee.data.prom_act.share_img){
img=ee.data.iurl+ee.data.prom_act.share_img;
}
@@ -2045,12 +2056,12 @@ Page({
//--先判断会员状态--
var 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;
- }
+ // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ // wx.navigateTo({
+ // url: '/packageE/pages/togoin/togoin',
+ // })
+ // return false;
+ // }
//如果开启了,则不在选择门店
@@ -4062,7 +4073,14 @@ Page({
})
},
-
+ // 预览海报
+ previewPoster() {
+ getApp().globalData.no_clear = 1;
+ wx.previewImage({
+ current: this.data.shareImgPath, // 当前显示图片的http链接
+ urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
+ });
+ },
diff --git a/packageC/pages/presell/cardInfo/goodsInfo.wxml b/packageC/pages/presell/cardInfo/goodsInfo.wxml
index c0e78b1..cd988ad 100644
--- a/packageC/pages/presell/cardInfo/goodsInfo.wxml
+++ b/packageC/pages/presell/cardInfo/goodsInfo.wxml
@@ -990,6 +990,7 @@
+
diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js
index 6d9994d..6ec4ec6 100644
--- a/packageC/pages/presell/cart/cart.js
+++ b/packageC/pages/presell/cart/cart.js
@@ -2198,6 +2198,9 @@ Page({
}).then(res => {
if (res.data.code == 0) {
prom_ord = res.data.data;
+
+ //如果订单促销的取价不是实收,清空订单促销
+ if(prom_ord && prom_ord.discount_field>0) prom_ord=null;
}
})
diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js
index ec9aed5..1d0894c 100644
--- a/packageC/pages/presell/cart/cart2.js
+++ b/packageC/pages/presell/cart/cart2.js
@@ -134,7 +134,14 @@ Page({
bconfig:null,
showFold:true,
- is_fwk:0 //-- 判断是不是服务卡项订单 --
+ is_fwk:0, //-- 判断是不是服务卡项订单 --
+
+ //-- 订单促销判断积累 ---2024-2-20
+ order_prom_map_ck: {},
+ //能不能使用订单促销
+ can_use_ord_prom:{},
+ //存储订单促销的取价,按照门店进行索引
+ show_ord_prom:{},
},
@@ -595,7 +602,7 @@ Page({
});
},
- //-- 获取到服务卡项的详情 --
+ //-- 获取到商品的详情 --
get_goods_detail(act, prelist,gg){
var th = this;
//--------如果goods_id一样,就是要立即购买-----
@@ -728,7 +735,10 @@ Page({
}
//这个位置要拿活动的预售价
+ t.data.data.shop_price_y = t.data.data.shop_price;
t.data.data.shop_price = prelist.presell_money;
+ th.data.old_bn_goods=ut.deep_cp(t.data.data);
+
th.setData({
bn_goods: t.data.data,
bn_pickname: gg.pick_name,
@@ -832,6 +842,7 @@ Page({
// }
th.setData({dis_btn:1})
+ this.data.submit=0;
wx.showLoading({
title: "处理中.",mask:true
@@ -901,20 +912,24 @@ Page({
//-- 判断订单优惠的叠加 --
var ord_prom=null;
var o_condition=allpice;
- if (o_condition > 0 && th.data.act.is_useorderyh) {
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- ord_prom = res.data.data;
- }
- })
+ if (th.data.act.is_useorderyh) {
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // ord_prom = res.data.data;
+ // }
+ // })
+
+ th.set_by_now_ord_prom(th.data.bn_goods);
+ th.data.order_prom_map_ck[bn_pick].goods_price_all=o_condition;
+ ord_prom=await th.get_cur_ord_prom(bn_pick);
}
//-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮,同时商品购买时候,服务卡项购买不计算运费----------
if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_past != 1 && th.data.act.goods_type==0) {
//看是不是有调用过包邮券
- if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) {
+ if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1 && !th.data.can_use_ord_prom[th.data.bn_pick] ) {
var condition = allpice - cut_price - quan_price;
//--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱---
getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", {
@@ -944,6 +959,12 @@ Page({
})
}
+ //要让包邮券消失,在使用非实收包邮券的时候
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ th.setData({ get_by_quan_list: null });
+ th.data.isget_by_quan[th.data.bn_pick] = 0;
+ }
+
var shipping_price =0;
if(good.is_free_shipping == 0 ) {
//-- 在没有使用包邮券的时候 --
@@ -1568,6 +1589,57 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
+ if(th.data.bn_goods.discount_field){
+ goods.discount_field=th.data.bn_goods.discount_field;
+ }
+
+ //如果有参与非实收的订单促销,那么就相当于是普通购买
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ goods.is_integral_normal=1;
+ //如果是指定门店,就要判断
+ if (th.data.bn_goods.pick_group_ids) {
+ var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) {
+ return e.pickup_id == th.data.bn_pick;
+ })
+ if (idx0 < 0) {
+ getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th);
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+ if (th.data.sales_rules==1 && th.data.bn_goods.store_count= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) {
+ var isok = 1;
+ await th.check_store_num(goods.goods_id, th.data.bn_pick, goods.goods_num, function (res) {
+ isok = res;
+ });
+ if (!isok) {
+ getApp().confirmBox("商品的门店库存不足");
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+
+ }
+
+
+
if(getApp().globalData.skinface_id){
goods.skinface_id=getApp().globalData.skinface_id;
}
@@ -2107,7 +2179,7 @@ Page({
}
})
var isok = 1;
- if (goods_num > plist.CanOutQty - lock) {
+ if (!plist || goods_num > plist.CanOutQty - lock) {
isok = 0;
}
func(isok);
@@ -3179,8 +3251,158 @@ Page({
url= "/pages/goods/goodsInfo/goodsInfo?goods_id="+gid;
}
getApp().goto(url);
+ },
+
+
+ //-- 获取订单促销的判断结构 --
+ set_by_now_ord_prom(item){
+ let pickid=this.data.bn_pick;
+ let order_prom_map_ck= this.data.order_prom_map_ck;
+ order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
+ }
+
+ let pk_ord_map=order_prom_map_ck[pickid];
+ pk_ord_map.shop_price_all += item.shop_price_y * item.buynum;
+ pk_ord_map.market_price_all += item.market_price * item.buynum;
+
+ },
+
+ //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的
+ async get_cur_ord_prom(pickid) {
+ let ord_prom = null;
+ let order_prom_map_ck = this.data.order_prom_map_ck[pickid];
+ if(!order_prom_map_ck) return null;
+
+ //获取当前进行中的优惠促销
+ await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", {
+ data: {
+ store_id: os.stoid,
+ orderAmount: -1, //-1为不判断金额条件
+ user_id: getApp().globalData.user_id
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ ord_prom = res.data.data;
+ }
+ })
+
+ if (!ord_prom) return null;
+ //用于计算订单促销的金额
+ let calculate_price=0;
+
+ let txt1='show_ord_prom['+pickid+']';
+ //-- 此时判断活动的金额满足与否 --
+ switch (ord_prom.discount_field) {
+ //实收价的时候
+ case 0:
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+
+ if (ord_prom.money > order_prom_map_ck.goods_price_all){
+ return null;
+ }
+ break;
+ //手店价的时候
+ case 1:
+ if (ord_prom.money > order_prom_map_ck.shop_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 1
+ });
+ break;
+ //市场价的时候
+ case 2:
+ if (ord_prom.money > order_prom_map_ck.market_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 2
+ });
+ break;
+ }
+ //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候)
+ if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){
+ return null;
+ }
+ return ord_prom;
+ },
+
+ //立即购买的时候,点击订单促销的参与
+ set_can_use_ord_prom_now:function (e){
+
+ if(this.data.submit || this.data.dis_btn) return false;
+ this.data.submit=1;
+
+ let pickid=this.data.bn_pick;
+ let txt = 'can_use_ord_prom[' + pickid + ']';
+ let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0;
+ this.setData({
+ [txt]: !can_use
+ })
+
+ let th=this;
+ let good=th.data.bn_goods;
+
+ //如果有要参与订单促销的按钮点击后,要修改商品的价格
+ if(th.data.can_use_ord_prom[pickid]){
+ let discount_field=th.data.show_ord_prom[pickid];
+ switch (discount_field){
+ case 1:
+ good.shop_price=good.shop_price_y;
+ break;
+ case 2:
+ good.shop_price=good.market_price;
+ break;
+ }
+ //-- 转成普通商品 ---
+ good.prom_type=0;
+ good.prom_id=0;
+ good.integral=0;
+ good.discount_field=discount_field;
+
+ //把优惠券的使用还原
+ th.setData({
+ selected_quan_list: null,
+ using_quan: {}
+ })
+
+ }else{
+ good=ut.deep_cp(th.data.old_bn_goods);
+ }
+
+ th.setData({
+ bn_goods:good
+ })
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ th.calculatePrice2()
+
+ if(!th.data.can_use_ord_prom[pickid]){
+ th.get_buy_now_quan();
+ }
}
+
});
diff --git a/packageC/pages/presell/cart/cart2.wxml b/packageC/pages/presell/cart/cart2.wxml
index c7636bb..15374ba 100644
--- a/packageC/pages/presell/cart/cart2.wxml
+++ b/packageC/pages/presell/cart/cart2.wxml
@@ -150,6 +150,15 @@
{{order.store_prom}}
+
+
+
+
+ 参与订单促销
+
+
+
+
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js
index a43f787..3c7a7ce 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1439,6 +1439,9 @@ Page({
},
openSpecModel: function (t) {
+
+ if(this.data.get_sto_ing) return false;
+
var th = this;
var open_store = t.currentTarget.dataset.ind;
this.setData({
@@ -1993,6 +1996,9 @@ Page({
//---------拿出门店分类和门店------------
get_sto(e) {
+
+ this.data.get_sto_ing=1;
+
var th = this, is_normal = e;
var that=th;
@@ -2007,7 +2013,7 @@ Page({
if (!th.data.fir_def_store) return false;
var dd = null, i = getApp().request;
- if (!th.data.sele_g) return false;
+ if (!th.data.sele_g) {th.data.get_sto_ing=0; return false;}
var g_distr_type = th.data.sele_g.distr_type;
if (g_distr_type != 0) {
@@ -2149,10 +2155,12 @@ Page({
}
}
else{
+ th.data.get_sto_ing=0;
wx.hideLoading();
}
}
else{
+ th.data.get_sto_ing=0;
wx.hideLoading();
}
})
@@ -2263,7 +2271,7 @@ Page({
//------------处理门店---------------
deal_pickup(e) {
var th = this;
- if (!th.data.sele_g) return false
+ if (!th.data.sele_g) { th.data.get_sto_ing=0; return false }
var g_distr_type = th.data.sele_g.distr_type;
wx.hideLoading();
@@ -2419,6 +2427,9 @@ Page({
th.setData({ def_pick_store: e.data.data.pageData[0] })
}
}
+
+ th.data.get_sto_ing=0;
+
} else {
th.setData({
is_show_sto_cat: -1,
@@ -2429,10 +2440,12 @@ Page({
th.setData({ def_pick_store: e.data.data.pageData[0] })
}
+ th.data.get_sto_ing=0;
}
}
});
} else {
+ th.data.get_sto_ing=0;
th.setData({
is_show_sto_cat: 0,
only_pk: e.data.data.pageData
@@ -2453,7 +2466,7 @@ Page({
deal_pickup_dline(e) {
var pkno = [],
th = this;
- if (!th.data.sele_g) return false;
+ if (!th.data.sele_g){ th.data.get_sto_ing=0; return false;}
if (this.data.def_pick_store) {
pkno.push(this.data.def_pick_store.pickup_no);
@@ -2539,6 +2552,7 @@ Page({
}
} else {
+ th.data.get_sto_ing=0;
th.setData({
all_sto: null,
only_pk: null,
@@ -2613,6 +2627,7 @@ Page({
th.deal_pickup(em);
} else {
+ th.data.get_sto_ing=0;
th.setData({
all_sto: null,
only_pk: null,
@@ -2621,6 +2636,7 @@ Page({
}
} else {
+ th.data.get_sto_ing=0;
th.setData({
all_sto: null,
only_pk: null,
@@ -3998,12 +4014,12 @@ Page({
})
//--先判断会员状态--
var 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;
- }
+ // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ // wx.navigateTo({
+ // url: '/packageE/pages/togoin/togoin',
+ // })
+ // return false;
+ // }
var th = this;
var ind = ee.currentTarget.dataset.ind;
diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js
index d26912b..01b9d44 100644
--- a/packageE/pages/cart/cart2/cart2.js
+++ b/packageE/pages/cart/cart2/cart2.js
@@ -178,7 +178,15 @@ Page({
yhcx_act_map: {},
//优惠促销购买次数
- yhcx_buy_map:{}
+ yhcx_buy_map:{},
+
+ //-- 订单促销判断积累 ---2024-2-20
+ order_prom_map_ck: {},
+ //能不能使用订单促销
+ can_use_ord_prom:{},
+ //存储订单促销的取价,按照门店进行索引
+ show_ord_prom:{},
+
},
@@ -944,7 +952,8 @@ Page({
// }
// })
- th.data.cartlist_y =JSON.parse(JSON.stringify(carr)); //存储原始购物车列表
+ th.data.cartlist_y =JSON.parse(JSON.stringify(carr)); //存储原始购物车列表,这个数据还会收到污染
+ th.data.cartlist_old =JSON.parse(JSON.stringify(carr)); //存储原始购物车列表
wx.showLoading();
th.get_cart_next(carr);
@@ -1028,33 +1037,35 @@ Page({
var no_zh_num={};
//-- 多促销活动调用接口需要的参数,和商品的购买数量和活动的购买数量的请求参数 --
- if(!is_change){
+ if(!is_change) {
+ //-- 多促销活动调用接口需要的参数,和商品的购买数量和活动的购买数量的请求参数 --
var dug_cx_arr = [];
//获取 限购 和 多活动的促销---2024-2-1
- for (var i = 0; i < carr.length; i++) {
+ for (var iv = 0; iv < carr.length; iv++) {
- let item1 = carr[i];
+ let item1 = carr[iv];
//如果不是活动的时候,不是代发商品的时候,不是赠品的时候,不是阶梯商品拆分的,不是组合购拆分的
- if([1, 2, 4, 6, 8, 9].indexOf(item1.prom_type)== -1 && !item1.whsle_id
- && !item1.is_gift && !item1.is_ld_split && !item1.is_zh_split ){
+ if ([1, 2, 4, 6, 8, 9].indexOf(item1.prom_type) == -1 && !item1.whsle_id
+ && !item1.is_gift && !item1.is_ld_split && !item1.is_zh_split) {
//-- 快速查找,组装查询多活动的列表 --
- let f_idx=dug_cx_arr.findIndex(function (ele) {
+ let f_idx = dug_cx_arr.findIndex(function (ele) {
return ele.goods_id == item1.goods_id
});
- if(f_idx==-1) {
- let gd_ite={
- goods_id:carr[i].goods_id,
- goods_num:1,
- is_limit_show:1,
- is_state:0
+ if (f_idx == -1) {
+ let gd_ite = {
+ goods_id: carr[iv].goods_id,
+ goods_num: 1,
+ is_limit_show: 0,
+ is_state: 0
}
dug_cx_arr.push(gd_ite);
}
}
- if(is_change){
- carr[i].collocationList=null;
+
+ if (is_change) {
+ carr[iv].collocationList = null;
}
}
//-- 对商品的多促销进行判断 ---2024-2-1--
@@ -1062,11 +1073,45 @@ Page({
await th.buy_pro_group(dug_cx_arr,carr);
}
}
-
-
//在分组的时候,就不要再调用接口,await
for (var i = 0; i < carr.length; i++) {
var item = carr[i];
+
+ //如果有户有点击参与订单促销的话,那么可以参与订单促销的商品的活动都要清理成0,订单促销在使用过程中的重要方法
+ if (this.data.can_use_ord_prom[item.pick_id]) {
+ //从订单促销的order_prom_map_ck数据结构中获取到可以参与的商品列表
+ let gdlist = this.data.order_prom_map_ck[item.pick_id] ? this.data.order_prom_map_ck[item.pick_id].goodsList : null;
+ if (gdlist && gdlist.length) {
+ //查找商品item1有没有在gdlist中,就要把商品的prom_type清理0
+ let f_idx = gdlist.findIndex(function (ele) {
+ return ele.id == item.id
+ });
+ if (f_idx != -1) {
+ //开始变换商品的价格显示
+ switch (th.data.show_ord_prom[item.pick_id]) {
+ case 1:
+ carr[i].goods_price = item.shop_price;
+ break;
+ case 2:
+ carr[i].goods_price = item.goods_market_price;
+ break;
+ }
+
+ if(!carr[i].prom_type) carr[i].prom_type=0;
+ switch (parseInt(carr[i].prom_type)){
+ case 4:
+ carr[i].is_integral_normal = 1;
+ break;
+ default:
+ carr[i].is_pd_normal = 1;
+ break;
+ }
+ carr[i].prom_type = 0;
+ carr[i].discount_field = th.data.show_ord_prom[item.pick_id];
+ }
+ }
+ }
+
//-- 如果是等级会员注册返回 --
if (is_card_back) {
th.data.card_name = th.data.userinfo.card_field;
@@ -1192,7 +1237,8 @@ Page({
pickup_id:item.pick_id,
pickup_name:pikname,
distr_type:item.pickup_distr_type,
- keyid:item.keyid
+ keyid:item.keyid,
+ is_same_city:item.is_same_city,
};
var e_t = 0, dis_t = 0;//物流方式,配送方式
if (item.distr_type == 0) {
@@ -1290,11 +1336,8 @@ Page({
if (ie.exp_type == 0 || ie.exp_type == 2) is_a_zt= 0;
}
th.setData({ is_all_zt: is_a_zt});
-
}
-
-
var cart_commission = 0;
//-- 循环计算一下线下取价 --
for (var k = 0; k < arr.length; k++) {
@@ -1344,6 +1387,24 @@ Page({
//-- 如果初始活动在计算的时候,是不满足的时候,就要把活动清理掉 --
var is_no_ok=arr[k].show_can_cx[key_o].cur_act.is_no_ok;
if(is_no_ok==1){
+
+ let temp_id=arr[k].show_can_cx[key_o].cur_act.prom_id;
+ switch (parseInt(arr[k].show_can_cx[key_o].cur_act.prom_type+'')){
+ case 3:
+ var yhcx_act_map=th.data.yhcx_act_map?th.data.yhcx_act_map[temp_id]:null;
+ if(yhcx_act_map && !yhcx_act_map.is_order_yh){
+ item1.is_no_order_yh=1;
+ }
+ break;
+ case 7:
+ var zhhe_act=th.data.zhhe_act_map?th.data.zhhe_act_map[temp_id]:null;
+ if(zhhe_act && !zhhe_act.is_orderyh){
+ item1.is_no_order_yh=1;
+ }
+ break;
+ }
+
+
item1.prom_id = 0;
item1.prom_type = 0;
@@ -1352,6 +1413,16 @@ Page({
item1.is_act_last=1; //这个是要在前端显示按钮切换的
}
+ }else{
+
+ let obj=arr[k].show_can_cx[key_o];
+ //不是优惠促销的不参与 不是订单促销参与(订单促销不是实收价的时候)
+ let ck1=obj.no_cj_prom && obj.cur_act.prom_type==3;
+ let ck2=th.data.can_use_ord_prom[arr[k].pickup_id];
+ if( !ck1 && !ck2){
+ item1.prom_id = arr[k].show_can_cx[key_o].cur_act.prom_id;
+ item1.prom_type = arr[k].show_can_cx[key_o].cur_act.prom_type;
+ }
}
}
}
@@ -1463,8 +1534,6 @@ Page({
} else {
-
-
item1.act = th.data.zhhe_act_map[item1.prom_id];
}
}
@@ -1609,7 +1678,6 @@ Page({
prom_type: item[c].prom_type,
prom_id: item[c].prom_id,
}
- //单个就不调用了
// let req_d1 = {
// user_id: getApp().globalData.user_id, goods_ids: [hr], store_id: os.stoid
// }
@@ -1701,6 +1769,7 @@ Page({
ladder_calc.fir_set_arr(u_item1, th);
}
+
//-- 要判断总开关有没有同城配送 --
if(th.data.is_same_city) {
//----- 判断每一个商品的配送方式,和门店的配送方式 -------
@@ -2094,6 +2163,8 @@ Page({
success: async function (tt) {
if (tt.data.code == 0) {
//t.data.data.shop_price = tt.data.data.prom_price;
+
+ gd.shop_price_y=gd.shop_price;
gd.shop_price=t.data.data.shop_price = tt.data.data.prom_user_price;
th.data.ckeck_quan_price = 0;
@@ -2142,6 +2213,9 @@ Page({
}
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(gd);
+
th.setData({
bn_goods: gd,
bn_pickname: gg.pick_name,
@@ -2170,6 +2244,7 @@ Page({
ut.get_active_info(2,gd.prom_id,os.stoid,function(e){
//t.data.data.shop_price = tt.data.data.prom_price;
+ gd.shop_price_y=gd.shop_price;
gd.shop_price=t.data.data.shop_price = tt.data.data.price;
t.data.data.fir_rate = tt.data.data.fir_rate;
@@ -2209,6 +2284,10 @@ Page({
gd.is_xz_yh = 1;
}
+
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(gd);
+
th.setData({
bn_goods: gd,
bn_pickname: gg.pick_name,
@@ -2980,6 +3059,9 @@ Page({
}
}
+ //重置订单促销判断累计
+ this.re_set_order_prom_map_ck();
+
for (var i in c_arr) {
var cart_item = c_arr[i];
cart_item.prom_pt_json=[];
@@ -2996,6 +3078,7 @@ Page({
}
+
//调用函数计算每件商品的单价
await th.calc_per(c_arr);
@@ -3009,7 +3092,7 @@ Page({
//-- 经纬度不循环调用接口 --
var lon = 0; var lat = 0;
- //---循环购物车---
+ //---循环购物车,按照门店订单进行循环---
for (var i in c_arr) {
//因为搭配购买也是再这里计算,搭配购的is_b_now==1
if (th.data.is_b_now == 0) {
@@ -3047,15 +3130,15 @@ Page({
var no_order_yh = 0; //-- 有些活动不能和订单优惠叠加的金额 --
var no_post_temp = 0; //-- 有些活动不能和包邮模板的金额 --
+ var no_post_temp_shop_price = 0; //-- 有些活动不能和包邮模板的金额 --因为订单促销有手店价取价
+ var no_post_temp_market_price = 0; //-- 有些活动不能和包邮模板的金额 --因为订单促销有市场价取价
if (th.data.using_quan[pickid] != null && th.data.using_quan[pickid] != undefined)
quan_no = th.data.using_quan[pickid].coupon_no;
//普通券的时候
if (quan_no && th.data.using_quan[pickid].isby != 1) {
-
var IsUserWare=1;
-
//---获取优惠券优惠---
await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", {
data: {
@@ -3076,13 +3159,10 @@ Page({
quan_price=0;
break;
}
-
}
-
}
})
-
if(!IsUserWare){
wx.showToast({
@@ -3112,6 +3192,11 @@ Page({
//--------循环计算总价-----------
for (var jc = 0; jc < item.length; jc++) {
+ //如果item的prom_type==0,没有如果活动的时候,如果是优惠促销和组合促销不满足的时候
+ //或者是组合购和阶梯购多出来的商品
+ if (item[jc].prom_type == 0 && !item[jc].whsle_id && !item[jc].is_no_order_yh) {
+ th.get_order_prom_map_ck(item[jc],pickid);
+ }
if (item[jc].whsle_id > 0) {
whsle_goods_price += item[jc].goods_price * item[jc].goods_num;
@@ -3124,11 +3209,13 @@ Page({
if (item[jc].prom_type == 7 && th.data.zhhe_act_map && th.data.zhhe_act_map[item[jc].prom_id]
&& th.data.zhhe_act_map[item[jc].prom_id].is_orderyh) {
is_no_zh = 1;
+ th.get_order_prom_map_ck(item[jc],pickid); //有订单优惠叠加的时候,就要构建数据解救
}
//阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加,就要累积阶梯促销的金额
if (item[jc].prom_type == 10 && ladder_prom_goods && ladder_prom_goods[item[jc].prom_id]
&& th.data.ladder_map[item[jc].prom_id].is_useorderyh) {
is_no_zh = 1;
+ th.get_order_prom_map_ck(item[jc],pickid); //有订单优惠叠加的时候,就要构建数据解救
}
if (is_no_zh) {
@@ -3144,20 +3231,28 @@ Page({
var gd_price=item[jc].goods_price;
if(item[jc].account_fir) gd_price=item[jc].account_fir;
-
- //组合购和阶梯购是订单优惠是另外算的
+ //组合购和阶梯购是订单优惠是另外算的,不参与订单促销的时候
if(!item[jc].is_order_yh && !item[jc].whsle_id && item[jc].prom_type!=7 && item[jc].prom_type!=10){
no_order_yh+=gd_price * item[jc].goods_num;
if(item[jc].quan_num) no_order_yh-=item[jc].quan_num; //券要把他补回去
-
}
+ //参与订单促销的时候
+ if(item[jc].is_order_yh && !item[jc].whsle_id && item[jc].prom_type!=7 && item[jc].prom_type!=10){
+ th.get_order_prom_map_ck(item[jc],pickid); //有订单优惠叠加的时候,就要构建数据解救
+ }
+
if(!item[jc].is_post_temp){
no_post_temp+=gd_price * item[jc].goods_num;
+ no_post_temp_shop_price+=item[jc].shop_price * item[jc].goods_num;
+ no_post_temp_market_price+=item[jc].goods_market_price * item[jc].goods_num;
if(item[jc].quan_num) no_post_temp-=item[jc].quan_num; //券要把他补回去
}
}
+
}
+
+
//判断是不是有组合购的金额
var f_o_price = o_price;
//如果又优惠的钱,就要减价
@@ -3236,26 +3331,38 @@ Page({
ord_prom_condition=o_price - quan_price - whsle_goods_price - no_order_yh;
}
- //---判断是不是有订单优惠---
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: parseFloat(ord_prom_condition).toFixed(2), user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- ord_prom = res.data.data;
+ //判断订单促销的实收价的累计
+ if(!this.data.order_prom_map_ck[pickid]){
+ this.data.order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
}
- })
+ }
+ this.data.order_prom_map_ck[pickid].goods_price_all=ord_prom_condition;
+ //---判断是不是有订单优惠---
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: parseFloat(ord_prom_condition).toFixed(2), user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // ord_prom = res.data.data;
+ // }
+ // })
+ //获取当前时间段的进行中的订单促销
+ ord_prom=await th.get_cur_ord_prom(pickid);
//如果有使用优惠券,如何订单促销有控制使用优惠券不参与此活动的话
if(quan_price>0 && ord_prom && ord_prom.is_xz_yh ){
ord_prom=null;
}
-
//--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额--
if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) {
- //看是不是有调用过包邮券
- if (!th.data.isget_by_quan[pickid]) {
+ //看是不是有调用过包邮券,同时有使用非实收的订单促销,就也不能显示包邮券
+ if (!th.data.isget_by_quan[pickid] && !this.data.can_use_ord_prom[pickid]) {
//--判断要不要显示包邮券,调用接口,因为有for循环---
await getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", {
data: {
@@ -3297,13 +3404,24 @@ Page({
})
}
+ //要让包邮券消失,在使用非实收包邮券的时候
+ if(th.data.can_use_ord_prom[pickid]){
+ var tt_by='get_by_quan_list_cart['+pickid+']';
+ th.setData({ [tt_by]: null });
+ th.data.isget_by_quan[pickid] = 0;
+ }
+
//-- 如果没有订单优惠,或者订单优惠中有勾选包邮模板 --
if (!ord_prom || ord_prom.is_post_temp) {
- var user_addr = th.data.user_addr;
+
+ let user_addr = th.data.user_addr;
+ let c_wuliu=parseFloat(o_price - quan_price - whsle_goods_price - no_post_temp).toFixed(2);
+
+
var req_d = {
province: user_addr.province, city: user_addr.city, district: user_addr.district,
- wuliu: parseFloat(o_price - quan_price - whsle_goods_price - no_post_temp).toFixed(2), store_id: os.stoid
+ wuliu: c_wuliu, store_id: os.stoid
}
await getApp().request.promisePost("/api/weshop/order/areaFreight", {
is_json: 1, data: req_d
@@ -3313,7 +3431,6 @@ Page({
}
}
-
//如果是包邮券的时候,要看看券的情况
if (quan_no && th.data.using_quan[pickid].isby == 1) {
var quan = th.data.using_quan[pickid];
@@ -3504,24 +3621,25 @@ Page({
}
var order_m = 0;
-
//么有使用券,或者活动没有限制使用优惠券
if (ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)) {
- order_prom_id = ord_prom['id'];
- switch (ord_prom['type']) {
- case 0:
- order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
- order_prom_amount = (o_condition - order_m).toFixed(2);
- break;
- case 1:
- //order_m = o_condition - ord_prom['expression'];//满额优惠金额
- var bs = 1;
- if (ord_prom.is_bz) {
- bs = Math.floor(o_condition / ord_prom.money);
- }
- order_prom_amount = ord_prom['expression'];
- break;
- }
+ order_prom_id = ord_prom['id'];
+ //-- 订单促销是按照实收价格进行计算的时候 --
+ switch (ord_prom['type']) {
+ case 0:
+ order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
+ order_prom_amount = (o_condition - order_m).toFixed(2);
+ break;
+ case 1:
+ //order_m = o_condition - ord_prom['expression'];//满额优惠金额
+ var bs = 1;
+ if (ord_prom.is_bz) {
+ bs = Math.floor(o_condition / ord_prom.money);
+ }
+ order_prom_amount = ord_prom['expression'];
+ break;
+ }
+
}
cart_item.order_prom_amount = 0;
@@ -3930,7 +4048,7 @@ Page({
//---如果有选择优惠券的情况下---
var quan_price = 0, bn_pick = th.data.bn_pick;
var quan_no = null;
- if (th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
+ if (th.data.using_quan && th.data.using_quan[bn_pick] != null && th.data.using_quan[bn_pick] != undefined)
quan_no = th.data.using_quan[bn_pick].coupon_no;
if (quan_no) {
@@ -3964,15 +4082,22 @@ Page({
var ord_prom = null;
var is_ord_prom_post = 0;
- if (condition > 0 && th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- var data = res.data.data;
- ord_prom = data;
- }
- })
+ //一件代发商品不参与订单优惠, 本身商品的活动也有要不要参与优惠促销的设置bn_is_order_yh
+ if (th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
+
+ th.set_by_now_ord_prom(th.data.bn_goods);
+ th.data.order_prom_map_ck[bn_pick].goods_price_all=condition;
+
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // var data = res.data.data;
+ // ord_prom = data;
+ // }
+ // })
+ ord_prom=await th.get_cur_ord_prom(bn_pick);
+
if (ord_prom && ord_prom.is_post_temp) {
is_ord_prom_post = 1;
}
@@ -3985,8 +4110,8 @@ Page({
//-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮----------
if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_past != 1) {
- //看是不是有调用过包邮券
- if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) {
+ //看是不是有调用过包邮券,同时非实收订单促销也不用使用包邮券
+ if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1 && !th.data.can_use_ord_prom[th.data.bn_pick]) {
//--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱---
getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", {
@@ -4019,6 +4144,14 @@ Page({
})
}
+
+ //要让包邮券消失,在使用非实收包邮券的时候
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ th.setData({ get_by_quan_list: null });
+ th.data.isget_by_quan[th.data.bn_pick] = 0;
+ }
+
+
var shipping_price = 0;
var quan_no_goods_arr = null;
var is_by_quan = 0;
@@ -4280,6 +4413,10 @@ Page({
goods_sn: th.data.bn_goods.goods_sn,
goods_price: th.data.bn_goods.shop_price || th.data.bn_goods.goods_price,
goods_num: th.data.bn_goods.buynum || th.data.bn_goods.goods_num,
+
+ account_fir:th.data.bn_goods.shop_price || th.data.bn_goods.goods_price,
+ account_yu_fir:0
+
}],
sto: {
keyid: th.data.bn_goods.keyid
@@ -4717,6 +4854,9 @@ Page({
if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
getApp().my_warnning("读取物流失败", 0, th);
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
@@ -4853,6 +4993,29 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
+ //如果有参与非实收的订单促销,那么就相当于是普通购买
+ if (th.data.can_use_ord_prom[th.data.bn_pick]) {
+ goods.is_pd_normal = 1;
+ goods.discount_field = th.data.show_ord_prom[th.data.bn_pick];
+
+ //如果是指定门店,就要判断
+ if (th.data.bn_goods.pick_group_ids) {
+ var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) {
+ return e.pickup_id == th.data.bn_pick;
+ })
+ if (idx0 < 0) {
+ getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th);
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+ }
+
+
+
if (th.data.bn_goods.whsle_id) {
item.is_whsle = 1;
item.whsle_id = th.data.bn_goods.whsle_id;
@@ -4903,11 +5066,17 @@ Page({
if(mo_num>goods.goods_num){
getApp().confirmBox(goods.goods_name + "的未达到起订数量");
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){
getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数");
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
}
@@ -4916,16 +5085,21 @@ Page({
if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2
&& th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) {
var isok = 1;
+
await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) {
isok = res;
});
if (!isok) {
getApp().confirmBox("商品的门店库存不足");
th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
return false;
}
}
+
//-- 如果有线下取价的话 --
if (th.data.bn_goods.is_offline) {
item.sum_offline_cut = (th.data.bn_goods.shop_price - th.data.bn_goods.offline_price).toFixed(2);
@@ -5040,6 +5214,9 @@ Page({
if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
th.data.is_summit_ing = 0;
getApp().confirmBox("读取物流失败");
+ th.setData({
+ submit: 0
+ })
return false;
}
}
@@ -5246,6 +5423,26 @@ Page({
'store_id': oo.stoid,
};
+ //订单促销取价规则使用
+ if (g_item.discount_field) {
+ goods.discount_field =g_item.discount_field;
+ //此时要判断商品的门店是不是匹配
+ if(g_item.prom_type==0 && g_item.pick_group_ids){
+ var idx0 = g_item.pick_up_lists.findIndex(function (e) {
+ return e.pickup_id == item.pickup_id;
+ })
+ if (idx0 < 0) {
+ getApp().my_warnning(g_item.goods_name + "的门店不可售", 0, th);
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+ }
+
if (g_item.is_pd_normal) {
goods.is_pd_normal = 1;
}
@@ -5841,7 +6038,7 @@ Page({
})
var isok = 1;
- if (goods_num > plist.CanOutQty - lock) {
+ if (!plist || goods_num > plist.CanOutQty - lock) {
isok = 0;
}
func(isok);
@@ -6531,6 +6728,7 @@ Page({
get_cart_quan: async function (order_prom_list_cart) {
var th = this;
var user_id = getApp().globalData.user_id;
+
//等待值的出现
//getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () {
//var arr=th.data.order_prom_list_cart;
@@ -6542,6 +6740,12 @@ Page({
//------------开始计算使用优惠券相关------------
for (var ind in arr) {
var ep = arr[ind];
+
+ //如果门店订单使用订单促销(此订单促销取价规则不是实收价的时候)
+ if(th.data.can_use_ord_prom[ep.pickup_id]){
+ continue;
+ }
+
var goodlist = ep.goods;
var pickup_id = ep.pickup_id;
//--更优惠券抵用有关,立即购买的,如果是购物车,如果有等级价还有考虑等级价的东西
@@ -8423,10 +8627,13 @@ Page({
var cx_prom_group=this.data.cartlist[idx].show_can_cx[gd_key].act_arr;
+ //-- 切换活动的时候,让订单促销参与不选中 --
+ let tt_wd="can_use_ord_prom["+pk+"]";
th.setData({
send_lb:{},
month_lb:{},
- send_gf:{}
+ send_gf:{},
+ [tt_wd]:0
})
th.data.prom_goods_map={};
@@ -8635,6 +8842,9 @@ Page({
//--- 不参与优惠促销的开关 ---
no_cj_prom: function (e) {
+ //避免重复点击
+ if(this.data.submit) return false;
+ this.setData({ submit: 1,same_ok:1 });
//重新调用cart_next,进行下一步计算
wx.showLoading({
@@ -8719,16 +8929,244 @@ Page({
if(!goods[ig].is_gift){
n_goods.push(goods[ig]);
}
- }
+ }
+
//原始数据要有深拷贝不能有地址的牵连
th.data.cartlist_y = JSON.parse(JSON.stringify(n_goods))
+ //重新调用cart_next,进行下一步计算
+ wx.showLoading({
+ title: "处理中.",
+ })
+ this.get_cart_next(null, 1, {prom_type: 0, prom_id: 0});
+
+ },
+
+ //---订单促销累计的数据结构的构建,购物车计算流程的那一部分
+ get_order_prom_map_ck(item,pickid) {
+
+ //赠品不计算
+ if(item.is_gift) return false;
+
+ var order_prom_map_ck= this.data.order_prom_map_ck;
+ if(!order_prom_map_ck[pickid]){
+ order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
+ }
+ }
+
+ let pk_ord_map=order_prom_map_ck[pickid];
+ pk_ord_map.shop_price_all += item.shop_price * item.goods_num;
+ pk_ord_map.market_price_all += item.goods_market_price * item.goods_num;
+
+ let ite = {
+ id: item.id,
+ goods_id: item.goods_id,
+ goods_num: item.goods_num,
+ prom_type: item.prom_type
+ }
+ pk_ord_map.goodsList.push(ite);
+ },
+
+
+ //-- 秒杀和团购使用 --
+ set_by_now_ord_prom(item){
+ let pickid=this.data.bn_pick;
+ let order_prom_map_ck= this.data.order_prom_map_ck;
+ order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
+ }
+
+ let pk_ord_map=order_prom_map_ck[pickid];
+ pk_ord_map.shop_price_all += item.shop_price_y * item.buynum;
+ pk_ord_map.market_price_all += item.market_price * item.buynum;
+
+ },
+
+ //重置订单促销判断累计
+ re_set_order_prom_map_ck() {
+ this.data.order_prom_map_ck = {}
+ },
+
+ //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的
+ async get_cur_ord_prom(pickid) {
+ let ord_prom = null;
+ let order_prom_map_ck = this.data.order_prom_map_ck[pickid];
+ if(!order_prom_map_ck) return null;
+
+ //获取当前进行中的优惠促销
+ await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", {
+ data: {
+ store_id: os.stoid,
+ orderAmount: -1, //-1为不判断金额条件
+ user_id: getApp().globalData.user_id
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ ord_prom = res.data.data;
+ }
+ })
+
+ if (!ord_prom) return null;
+ //用于计算订单促销的金额
+ let calculate_price=0;
+
+ let txt1='show_ord_prom['+pickid+']';
+ //-- 此时判断活动的金额满足与否 --
+ switch (ord_prom.discount_field) {
+ //实收价的时候
+ case 0:
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+
+ if (ord_prom.money > order_prom_map_ck.goods_price_all){
+ return null;
+ }
+ break;
+ //手店价的时候
+ case 1:
+ if (ord_prom.money > order_prom_map_ck.shop_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 1
+ });
+ break;
+ //市场价的时候
+ case 2:
+ if (ord_prom.money > order_prom_map_ck.market_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 2
+ });
+ break;
+ }
+ //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候)
+ if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){
+ return null;
+ }
+ return ord_prom;
+ },
+
+ //设置能够参与订单促销
+ set_can_use_ord_prom: function (e) {
+ if(this.data.submit) return false;
+ this.setData({ submit: 1,same_ok:1 });
+
+ let pickid = e.currentTarget.dataset.pd;
+ let txt = 'can_use_ord_prom[' + pickid + ']';
+ let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0;
+ this.setData({
+ [txt]: !can_use
+ })
+
+ //购物车进行还原,一下数据的清理的必须的
+ this.setData({
+ send_lb: {},
+ month_lb: {},
+ send_gf: {}
+ })
+ //清空优惠促销的内容
+ this.data.prom_goods_map = {};
+ //处理一下商品
+ let goods0 = JSON.parse(JSON.stringify(this.data.cartlist_y));
+ let goods = [];
+ for (var ik = 0; ik < goods0.length; ik++) {
+ var item_c = goods0[ik];
+ if(item_c.pick_id == pickid && item_c.is_collocation) continue;
+ if(item_c.is_gift) continue
+ goods.push(item_c);
+ }
+ //原始数据要有深拷贝不能有地址的牵连
+ this.data.cartlist_y = JSON.parse(JSON.stringify(goods))
+ //重新调用cart_next,进行下一步计算
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ //-- 重新计算一下价格 --
this.get_cart_next(null, 1, {prom_type: 0, prom_id: 0});
+ },
+ //立即购买的时候,点击订单促销的参与
+ set_can_use_ord_prom_now:function (e){
+ if(this.data.submit) return false;
+ this.setData({ submit: 1,same_ok:1 });
+
+ let pickid=this.data.bn_pick;
+ let txt = 'can_use_ord_prom[' + pickid + ']';
+ let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0;
+ this.setData({
+ [txt]: !can_use
+ })
+
+ let th=this;
+ let good=th.data.bn_goods;
+
+ //如果有要参与订单促销的按钮点击后,要修改商品的价格
+ if(th.data.can_use_ord_prom[pickid]){
+ let discount_field=th.data.show_ord_prom[pickid];
+ switch (discount_field){
+ case 1:
+ good.shop_price=good.shop_price_y;
+ break;
+ case 2:
+ good.shop_price=good.market_price;
+ break;
+ }
+
+ //-- 转成普通商品 ---
+ good.prom_type=0;
+ good.prom_id=0;
+
+ th.setData({
+ selected_quan_list: null,
+ using_quan:{}
+ })
+
+ }else{
+ good=ut.deep_cp(th.data.old_bn_goods);
+ }
+
+ th.setData({
+ bn_goods:good
+ })
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ th.calculatePrice2()
+
+ if(!th.data.can_use_ord_prom[pickid]){
+ th.get_buy_now_quan();
+ }
}
+
+
});
diff --git a/packageE/pages/cart/cart2/cart2.wxml b/packageE/pages/cart/cart2/cart2.wxml
index 0952a49..789083f 100644
--- a/packageE/pages/cart/cart2/cart2.wxml
+++ b/packageE/pages/cart/cart2/cart2.wxml
@@ -104,9 +104,9 @@
{{filters.show_gui_ge(items.goods_spec,items.goods_color)}}
-
+
¥{{filters.toFix(items.goods_price,2)}}({{items.discount}}折)
¥{{filters.toFix(items.goods_price,2)}}
佣金:{{filters.toFix(items.use_commission/items.goods_num,2)}}*{{items.goods_num}}
@@ -171,8 +171,10 @@
-
-
+
+
+
+
参与优惠活动
@@ -180,6 +182,7 @@
+
@@ -234,12 +237,15 @@
-
-
-
- 参与优惠活动
+
+
+
+
+
+ 参与优惠活动
+
-
+
@@ -348,6 +354,14 @@
+
+
+
+
+ 参与订单促销
+
+
+
@@ -679,6 +693,14 @@
{{order.store_prom}}
+
+
+
+
+ 参与订单促销
+
+
+
@@ -1096,7 +1118,7 @@
一
-
+
+
diff --git a/packageE/pages/cart/cart2/filter.wxs b/packageE/pages/cart/cart2/filter.wxs
index d32491d..dbd7d77 100644
--- a/packageE/pages/cart/cart2/filter.wxs
+++ b/packageE/pages/cart/cart2/filter.wxs
@@ -49,14 +49,11 @@ function check_is_last(index,goods_id){
return true;
}
return false;
-
}
-
-
module.exports = {
format: format,
is_more_act:is_more_act,
check_show:check_show,
- check_is_last:check_is_last
+ check_is_last:check_is_last,
}
diff --git a/packageE/pages/cart/cart2/ladder_calculate.js b/packageE/pages/cart/cart2/ladder_calculate.js
index 6beb282..d0a066c 100644
--- a/packageE/pages/cart/cart2/ladder_calculate.js
+++ b/packageE/pages/cart/cart2/ladder_calculate.js
@@ -115,6 +115,11 @@ module.exports = {
})
//goods[idx].goods_num -= num;
let new_g = JSON.parse(JSON.stringify(goods[idx]));
+
+ //多余的商品如果活动不参与订单促销,那么变成普通商品的也不能参与订单促销,2024-2-26
+ if(!ladder_map.is_useorderyh){
+ new_g.is_no_order_yh=1;
+ }
new_g.goods_num = num;
new_g.prom_type = 0;
new_g.prom_id = 0;
diff --git a/packageE/pages/cart/cart2/zh_calculate.js b/packageE/pages/cart/cart2/zh_calculate.js
index 3b89844..f240e6f 100644
--- a/packageE/pages/cart/cart2/zh_calculate.js
+++ b/packageE/pages/cart/cart2/zh_calculate.js
@@ -270,6 +270,11 @@ module.exports = {
let new_g = JSON.parse(JSON.stringify(goods[idx]));
if(new_g.more_cx) delete new_g.more_cx;
+
+ //多余的商品如果活动不参与订单促销,那么变成普通商品的也不能参与订单促销,2024-2-26
+ if(!act.is_orderyh){
+ new_g.is_no_order_yh=1;
+ }
new_g.goods_num = num;
new_g.prom_type = 0;
new_g.prom_id = 0;
@@ -331,6 +336,11 @@ module.exports = {
offline_price += item.goods_price - item.offline_price;
offline_num += 1;
}
+
+ //多余的商品如果活动不参与订单促销,那么变成普通商品的也不能参与订单促销,2024-2-26
+ if(!act.is_orderyh){
+ item.is_no_order_yh=1;
+ }
item.prom_type = 0;
item.prom_id = 0;
}
diff --git a/packageE/pages/cart/cart2_inte/cart2_inte.js b/packageE/pages/cart/cart2_inte/cart2_inte.js
index 2503b41..3fe3185 100644
--- a/packageE/pages/cart/cart2_inte/cart2_inte.js
+++ b/packageE/pages/cart/cart2_inte/cart2_inte.js
@@ -85,7 +85,14 @@ Page({
same_ok:1, //同城配送的控制,默认ok
bconfig: null,
showFold:true,
- template_id:[]
+ template_id:[],
+
+ //-- 订单促销判断积累 ---2024-2-20
+ order_prom_map_ck: {},
+ //能不能使用订单促销
+ can_use_ord_prom:{},
+ //存储订单促销的取价,按照门店进行索引
+ show_ord_prom:{},
},
@@ -632,6 +639,8 @@ Page({
success: async function (tt) {
if (tt.data.code == 0 && tt.data.data && tt.data.data.pageData) {
var inte_data = tt.data.data.pageData[0];
+
+ gd.shop_price_y=gd.shop_price;
t.data.data.shop_price = inte_data.addmoney;
t.data.data.integral = inte_data.integral;
@@ -658,6 +667,9 @@ Page({
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(t.data.data);
+
th.setData({
bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, index: m_wind,
bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et,inv_is_post:inte_data.is_post
@@ -742,16 +754,23 @@ Page({
var condition = parseFloat(allpice-cut_price).toFixed(2);
var ord_prom = null;
var is_ord_prom_post = 0;
+ //---如果有选择优惠券的情况下---
+ var quan_price = 0, bn_pick = th.data.bn_pick;
+
+ if (th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // var data = res.data.data;
+ // ord_prom = data;
+ // }
+ // })
+
+ th.set_by_now_ord_prom(th.data.bn_goods);
+ th.data.order_prom_map_ck[bn_pick].goods_price_all=condition;
+ ord_prom=await th.get_cur_ord_prom(bn_pick);
- if (condition > 0 && th.data.bn_is_order_yh && !th.data.bn_goods.whsle_id) {
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- var data = res.data.data;
- ord_prom = data;
- }
- })
if (ord_prom && ord_prom.is_post_temp) {
is_ord_prom_post = 1;
}
@@ -894,8 +913,7 @@ Page({
var wl_txt = "formData.shipping_price";
th.setData({ [wl_txt]: 0, })
}
- //---如果有选择优惠券的情况下---
- var quan_price = 0, bn_pick = th.data.bn_pick;
+
//-----------------支付价,优惠券不减物流-----------------
var total_m = (parseFloat(allpice)).toFixed(2);
@@ -1281,7 +1299,6 @@ Page({
item.samecity_order_amount=th.data.bn_samecity_order_amount;
}
-
//获取立即购买的商品的信息
var gg = to.get_b_now();
//--商品的房间号--
@@ -1319,6 +1336,56 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
+ if(th.data.bn_goods.discount_field){
+ goods.discount_field=th.data.bn_goods.discount_field;
+ }
+
+ //如果有参与非实收的订单促销,那么就相当于是普通购买
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ goods.is_integral_normal=1;
+
+ //如果是指定门店,就要判断
+ if (th.data.bn_goods.pick_group_ids) {
+ var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) {
+ return e.pickup_id == th.data.bn_pick;
+ })
+ if (idx0 < 0) {
+ getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th);
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+
+ if (th.data.sales_rules==1 && th.data.bn_goods.store_count= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) {
+ var isok = 1;
+ await th.check_store_num(goods.goods_id, th.data.bn_pick, goods.goods_num, function (res) {
+ isok = res;
+ });
+ if (!isok) {
+ getApp().confirmBox("商品的门店库存不足");
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+ }
+
if(getApp().globalData.skinface_id){
goods.skinface_id=getApp().globalData.skinface_id;
}
@@ -1535,7 +1602,7 @@ Page({
}
})
var isok = 1;
- if (goods_num > plist.CanOutQty - lock) {
+ if (!plist || goods_num > plist.CanOutQty - lock) {
isok = 0;
}
func(isok);
@@ -1757,7 +1824,146 @@ Page({
var th = this;
th.setData({bn_use_commission: !th.data.bn_use_commission});
th.calculatePrice2();
+ },
+
+ //-- 获取订单促销的判断结构 --
+ set_by_now_ord_prom(item){
+ let pickid=this.data.bn_pick;
+ let order_prom_map_ck= this.data.order_prom_map_ck;
+ order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
+ }
+
+ let pk_ord_map=order_prom_map_ck[pickid];
+ pk_ord_map.shop_price_all += item.shop_price_y * item.buynum;
+ pk_ord_map.market_price_all += item.market_price * item.buynum;
+
+ },
+
+ //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的
+ async get_cur_ord_prom(pickid) {
+ let ord_prom = null;
+ let order_prom_map_ck = this.data.order_prom_map_ck[pickid];
+ if(!order_prom_map_ck) return null;
+
+ //获取当前进行中的优惠促销
+ await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", {
+ data: {
+ store_id: os.stoid,
+ orderAmount: -1, //-1为不判断金额条件
+ user_id: getApp().globalData.user_id
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ ord_prom = res.data.data;
+ }
+ })
+
+ if (!ord_prom) return null;
+ //用于计算订单促销的金额
+ let calculate_price=0;
+
+ let txt1='show_ord_prom['+pickid+']';
+ //-- 此时判断活动的金额满足与否 --
+ switch (ord_prom.discount_field) {
+ //实收价的时候
+ case 0:
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+
+ if (ord_prom.money > order_prom_map_ck.goods_price_all){
+ return null;
+ }
+ break;
+ //手店价的时候
+ case 1:
+ if (ord_prom.money > order_prom_map_ck.shop_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 1
+ });
+ break;
+ //市场价的时候
+ case 2:
+ if (ord_prom.money > order_prom_map_ck.market_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 2
+ });
+ break;
+ }
+ //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候)
+ if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){
+ return null;
+ }
+ return ord_prom;
+ },
+
+ //立即购买的时候,点击订单促销的参与
+ set_can_use_ord_prom_now:function (e){
+
+ if(this.data.submit) return false;
+ this.setData({ submit: 1,same_ok:1 });
+
+ let pickid=this.data.bn_pick;
+ let txt = 'can_use_ord_prom[' + pickid + ']';
+ let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0;
+ this.setData({
+ [txt]: !can_use
+ })
+
+ let th=this;
+ let good=th.data.bn_goods;
+
+ //如果有要参与订单促销的按钮点击后,要修改商品的价格
+ if(th.data.can_use_ord_prom[pickid]){
+ let discount_field=th.data.show_ord_prom[pickid];
+ switch (discount_field){
+ case 1:
+ good.shop_price=good.shop_price_y;
+ break;
+ case 2:
+ good.shop_price=good.market_price;
+ break;
+ }
+ //-- 转成普通商品 ---
+ good.prom_type=0;
+ good.prom_id=0;
+ good.integral=0;
+ good.discount_field=discount_field;
+
+ }else{
+ good=ut.deep_cp(th.data.old_bn_goods);
+ }
+
+ th.setData({
+ bn_goods:good
+ })
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ th.calculatePrice2()
}
+
});
diff --git a/packageE/pages/cart/cart2_inte/cart2_inte.wxml b/packageE/pages/cart/cart2_inte/cart2_inte.wxml
index dd18640..b3bce8a 100644
--- a/packageE/pages/cart/cart2_inte/cart2_inte.wxml
+++ b/packageE/pages/cart/cart2_inte/cart2_inte.wxml
@@ -94,6 +94,14 @@
{{order.store_prom}}
+
+
+
+
+ 参与订单促销
+
+
+
diff --git a/packageE/pages/cart/cart2_pt/cart2_pt.js b/packageE/pages/cart/cart2_pt/cart2_pt.js
index 394d22c..b3237ab 100644
--- a/packageE/pages/cart/cart2_pt/cart2_pt.js
+++ b/packageE/pages/cart/cart2_pt/cart2_pt.js
@@ -90,6 +90,13 @@ Page({
is_no_by: {},
is_by: {},
is_quan_by: {},
+
+ //-- 订单促销判断积累 ---2024-2-20
+ order_prom_map_ck: {},
+ //能不能使用订单促销
+ can_use_ord_prom:{},
+ //存储订单促销的取价,按照门店进行索引
+ show_ord_prom:{},
},
@@ -444,7 +451,9 @@ Page({
et = 2;
}
+ t.data.data.shop_price_y=t.data.data.shop_price
t.data.data.shop_price = gg.goods_price;
+
//--如果是普通购买的时候--
if (gg.is_normal == 1) {
t.data.data.prom_id = 0;
@@ -485,6 +494,8 @@ Page({
}
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(t.data.data);
th.setData({
bn_goods: t.data.data, bn_pickname: gg.pick_name,
@@ -568,7 +579,6 @@ Page({
et = th.data.bn_exp_type;
}
-
//-- 计算获得佣金的金额 --
if (getApp().globalData.userInfo.is_distribut
&& th.data.dis_config && th.data.dis_config.is_yongjin_dk) {
@@ -591,6 +601,8 @@ Page({
}
+ //用深拷贝把商品缓存起来,方便后面使用
+ th.data.old_bn_goods=ut.deep_cp(t.data.data);
th.setData({
bn_goods: t.data.data, bn_pickname: gg.pick_name,
@@ -834,13 +846,17 @@ Page({
if(th.data.bn_is_order_yh && th.data.kt_type != 3 ){
- await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
- }).then(res => {
- if (res.data.code == 0) {
- ord_prom = res.data.data;
- }
- })
+ // await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ // data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
+ // }).then(res => {
+ // if (res.data.code == 0) {
+ // ord_prom = res.data.data;
+ // }
+ // })
+
+ th.set_by_now_ord_prom(th.data.bn_goods);
+ th.data.order_prom_map_ck[bn_pick].goods_price_all=o_condition;
+ ord_prom=await th.get_cur_ord_prom(bn_pick);
}
@@ -853,7 +869,7 @@ Page({
if (th.data.user_addr != null && th.data.bn_exp_type == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
//看是不是有调用过包邮券
- if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) {
+ if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1 && !th.data.can_use_ord_prom[th.data.bn_pick] ) {
//--判断要不要显示包邮券,链式调用接口,调取包邮券,已经是减了优惠的金额,见到优惠券的钱---
getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea", {
@@ -886,6 +902,12 @@ Page({
})
}
+ //要让包邮券消失,在使用非实收包邮券的时候
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ th.setData({ get_by_quan_list: null });
+ th.data.isget_by_quan[th.data.bn_pick] = 0;
+ }
+
if(good.is_free_shipping){
var wl_txt = "formData.shipping_price";
th.setData({ [wl_txt]: 0 })
@@ -1468,6 +1490,55 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
+ if(th.data.bn_goods.discount_field){
+ goods.discount_field=th.data.bn_goods.discount_field;
+ }
+
+ //如果有参与非实收的订单促销,那么就相当于是普通购买
+ if(th.data.can_use_ord_prom[th.data.bn_pick]){
+ goods.is_integral_normal=1;
+
+ //如果是指定门店,就要判断
+ if (th.data.bn_goods.pick_group_ids) {
+ var idx0 = th.data.bn_goods.pick_up_lists.findIndex(function (e) {
+ return e.pickup_id == th.data.bn_pick;
+ })
+ if (idx0 < 0) {
+ getApp().my_warnning(th.data.bn_goods.goods_name + "的门店不可售", 0, th);
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+ if (th.data.sales_rules==1 && th.data.bn_goods.store_count= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) {
+ var isok = 1;
+ await th.check_store_num(goods.goods_id, th.data.bn_pick, goods.goods_num, function (res) {
+ isok = res;
+ });
+ if (!isok) {
+ getApp().confirmBox("商品的门店库存不足");
+ th.data.is_summit_ing = 0;
+ th.setData({
+ submit: 0
+ })
+ return false;
+ }
+ }
+
+ }
+
if (getApp().globalData.skinface_id) {
goods.skinface_id = getApp().globalData.skinface_id;
}
@@ -2260,6 +2331,214 @@ Page({
th.setData({ open_quan: 0 });
},
+ //-- 获取订单促销的判断结构 --
+ set_by_now_ord_prom(item){
+ let pickid=this.data.bn_pick;
+ let order_prom_map_ck= this.data.order_prom_map_ck;
+ order_prom_map_ck[pickid]={
+ shop_price_all:0, //手店价的累计
+ market_price_all:0, //市场价的累计
+ goods_price_all:0, //实收价的累计
+ no_ord_price:0, //要累计上不参与订单促销的金额
+ goodsList:[],
+ }
+
+ let pk_ord_map=order_prom_map_ck[pickid];
+ pk_ord_map.shop_price_all += item.shop_price_y * item.buynum;
+ pk_ord_map.market_price_all += item.market_price * item.buynum;
+
+ },
+
+ //获取当前进行中订单促销,同时带入相应的金额判断订单促销是不是运行,同时订单促销的条件不是实收价判断的话,默认的时候,订单促销是不参与运算的
+ async get_cur_ord_prom(pickid) {
+ let ord_prom = null;
+ let order_prom_map_ck = this.data.order_prom_map_ck[pickid];
+ if(!order_prom_map_ck) return null;
+
+ //获取当前进行中的优惠促销
+ await getApp().request.promiseGet("/api/weshop/promorder/getPromOrder", {
+ data: {
+ store_id: os.stoid,
+ orderAmount: -1, //-1为不判断金额条件
+ user_id: getApp().globalData.user_id
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ ord_prom = res.data.data;
+ }
+ })
+
+ if (!ord_prom) return null;
+ //用于计算订单促销的金额
+ let calculate_price=0;
+
+ let txt1='show_ord_prom['+pickid+']';
+ //-- 此时判断活动的金额满足与否 --
+ switch (ord_prom.discount_field) {
+ //实收价的时候
+ case 0:
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+
+ if (ord_prom.money > order_prom_map_ck.goods_price_all){
+ return null;
+ }
+ break;
+ //手店价的时候
+ case 1:
+ if (ord_prom.money > order_prom_map_ck.shop_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 1
+ });
+ break;
+ //市场价的时候
+ case 2:
+ if (ord_prom.money > order_prom_map_ck.market_price_all){
+ //要先还原
+ this.setData({
+ [txt1]: 0
+ });
+ return null;
+ }
+ //要显示订单促销使用的按钮
+ this.setData({
+ [txt1]: 2
+ });
+ break;
+ }
+ //如果订单促销是不参与订单促销的,那么就直接返回null(订单促销不是实收价的时候)
+ if(ord_prom.discount_field>0 && !this.data.can_use_ord_prom[pickid]){
+ return null;
+ }
+ return ord_prom;
+ },
+
+ //立即购买的时候,点击订单促销的参与
+ set_can_use_ord_prom_now:function (e){
+
+ if(this.data.submit) return false;
+ this.setData({ submit: 1,same_ok:1 });
+
+ let pickid=this.data.bn_pick;
+ let txt = 'can_use_ord_prom[' + pickid + ']';
+ let can_use = this.data.can_use_ord_prom[pickid] ? this.data.can_use_ord_prom[pickid] : 0;
+ this.setData({
+ [txt]: !can_use
+ })
+
+ let th=this;
+ let good=th.data.bn_goods;
+
+ //如果有要参与订单促销的按钮点击后,要修改商品的价格
+ if(th.data.can_use_ord_prom[pickid]){
+ let discount_field=th.data.show_ord_prom[pickid];
+ switch (discount_field){
+ case 1:
+ good.shop_price=good.shop_price_y;
+ break;
+ case 2:
+ good.shop_price=good.market_price;
+ break;
+ }
+ //-- 转成普通商品 ---
+ good.prom_type=0;
+ good.prom_id=0;
+ good.discount_field=discount_field;
+
+ //把优惠券的使用还原
+ th.setData({
+ selected_quan_list: null,
+ using_quan: {}
+ })
+ }else{
+ good=ut.deep_cp(th.data.old_bn_goods);
+ }
+
+ th.setData({
+ bn_goods:good
+ })
+ wx.showLoading({
+ title: "处理中.",
+ mark:true
+ })
+ th.calculatePrice2()
+
+ if(!th.data.can_use_ord_prom[pickid]){
+ th.get_buy_now_quan();
+ }
+ },
+
+ //---确认线下门店的数量足不足---
+ async check_store_num(goods_id, pick, goods_num, func) {
+ var lock = 0, pick_no, plist, erpwareid;
+
+ var lock_rq = { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 };
+ if (this.data.sales_rules == 3) {
+ lock_rq.appoint_pick_keyid = this.data.appoint_pick_keyid;
+ delete lock_rq.storageId
+ }
+ //先读取门店的lock
+ await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
+ data: lock_rq
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data.total > 0) {
+ for (var i in res.data.data.pageData)
+ lock += res.data.data.pageData[i].outQty;
+ }
+ })
+
+ if (this.data.sales_rules == 2) {
+ //先获取门店的编号
+ await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
+ data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
+ }).then(res => {
+ if (res.data.code == 0) {
+ pick_no = res.data.data.pickup_no;
+ }
+ })
+ }
+
+ //先获取商品的线下库存
+ await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
+ data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
+ }).then(res => {
+ if (res.data.code == 0) {
+ erpwareid = res.data.data.erpwareid;
+ }
+ })
+
+
+ var sto_rq = { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 };
+ if (this.data.sales_rules == 3) {
+ sto_rq.storageIds = this.data.appoint_pick_keyid;
+ delete sto_rq.storageNos
+ }
+
+ //读取线下的门店库存
+ await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
+ data: sto_rq
+ }).then(res => {
+ if (res.data.code == 0) {
+ plist = res.data.data.pageData[0];
+ }
+ })
+
+ var isok = 1;
+ if (!plist || goods_num > plist.CanOutQty - lock) {
+ isok = 0;
+ }
+ func(isok);
+ },
+
diff --git a/packageE/pages/cart/cart2_pt/cart2_pt.wxml b/packageE/pages/cart/cart2_pt/cart2_pt.wxml
index 2cd0b09..c0002b3 100644
--- a/packageE/pages/cart/cart2_pt/cart2_pt.wxml
+++ b/packageE/pages/cart/cart2_pt/cart2_pt.wxml
@@ -102,6 +102,13 @@
{{order.store_prom}}
+
+
+
+
+ 参与订单促销
+
+
diff --git a/packageE/pages/cart/cart_wk/cart_wk.js b/packageE/pages/cart/cart_wk/cart_wk.js
index d4363e5..e55b4b3 100644
--- a/packageE/pages/cart/cart_wk/cart_wk.js
+++ b/packageE/pages/cart/cart_wk/cart_wk.js
@@ -539,6 +539,9 @@ Page({
}).then(res => {
if (res.data.code == 0) {
ord_prom = res.data.data;
+
+ //如果订单促销的取价不是实收,清空订单促销
+ if(ord_prom && ord_prom.discount_field>0) ord_prom=null;
}
})
}
diff --git a/packageE/pages/togoin/togoin.js b/packageE/pages/togoin/togoin.js
index e9b413f..35ef6ca 100644
--- a/packageE/pages/togoin/togoin.js
+++ b/packageE/pages/togoin/togoin.js
@@ -578,9 +578,9 @@ Page({
//弹出框的同意的优化
agree_pri:function (){
- this.setData({
- isAgree:1,
- });
+ // this.setData({
+ // isAgree:1,
+ // });
},
//通过路径跳转到其他页面
goto: function (e) {
diff --git a/packageG/pages/goods/search/search.wxml b/packageG/pages/goods/search/search.wxml
index 1b7c591..9f45d1e 100644
--- a/packageG/pages/goods/search/search.wxml
+++ b/packageG/pages/goods/search/search.wxml
@@ -178,4 +178,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packageG/pages/user/order_detail/order_detail.js b/packageG/pages/user/order_detail/order_detail.js
index 7616b41..0a174bf 100644
--- a/packageG/pages/user/order_detail/order_detail.js
+++ b/packageG/pages/user/order_detail/order_detail.js
@@ -1157,13 +1157,39 @@ Page({
//-- 优惠促销的时候控制取价规则 --
// gg.prom_type!=3 && gg.prom_type!=10 同时商品不是普通购买的时候,又参与优惠促销,阶梯促销
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; //如果线下价格比较贵,则不通过
- } else {
- if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+
+ //判断一下活动是不是有参与订单促销,并且订单促销的活动是不是实收取价,2024-2-23
+ let ordprom_price_type=0;
+ if(order.order_prom_id && good.prom_type==0){
+ let p_rs= await getApp().request.promiseGet("/api/weshop/promorder/get/"+os.stoid+"/"+order.order_prom_id, {});
+ if(p_rs && p_rs.data.code==0 && p_rs.data.data){
+ let ord_p=p_rs.data.data;
+ if(ord_p && ord_p.discount_field>0){
+ ordprom_price_type=ord_p.discount_field
+ }
+ }
+ }
+ if(ordprom_price_type>0){
+ //-- 看一下订单促销的取价规则 --
+ switch (ordprom_price_type){
+ case 1:
+ if (good.goods_price != gg.shop_price) isok = 0;
+ break;
+ case 2:
+ if (good.goods_price != gg.market_price) isok = 0;
+ break;
+ }
+
+ }else {
+ 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; //如果线下价格比较贵,则不通过
+
+ } else {
+ if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ }
}
}else{
if(good.prom_type==3 && good.prom_type==10){
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index 6495c93..73558ab 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -492,6 +492,21 @@ Page({
}
});
+ if(!app.globalData.user_id){
+
+ th.setData({
+ requestData: [],
+ all_num: 0,
+ is_load: 1,
+ is_edit: 0,
+ checkAllToggle:0
+ }),wx.stopPullDownRefresh();
+
+ wx.hideLoading();
+
+ return false;
+ }
+
getApp().request.get("/api/weshop/cart/listNew1", {
data: {
user_id: app.globalData.user_id,
@@ -503,8 +518,11 @@ Page({
success: async function (su) {
console.log(su, 10000);
//按门店分类的数组
- var arr = new Array(),
- carr = su.data.data.pageData;
+ var arr = new Array();
+ var carr=[];
+
+ if(ut.ajax_ok(su))
+ carr = su.data.data.pageData;
var all_num = 0;
if (carr && carr.length > 0) {
@@ -530,7 +548,7 @@ Page({
let gd_ite={
goods_id:carr[i].goods_id,
goods_num:1,
- is_limit_show:1,
+ is_limit_show:0,
is_state:0
}
g_arr.push(gd_ite);
@@ -1192,10 +1210,10 @@ Page({
// if (this.data.btn_click) {
// return false;
// }
+
setTimeout(() => {
if (this.data.up_dating == 1) return false;
this.data.up_dating=1
-
this.data.btn_click = 1;
var a = t.currentTarget.dataset.item;
var b = t.currentTarget.dataset.pitems;
@@ -2064,6 +2082,8 @@ Page({
//判断多门店,优惠促销次数的控制
async multiple_stores_pro(pitems, item) {
+ if(!this.data.requestData || !this.data.requestData[pitems]) return false
+
let a = this.data.requestData[pitems].goods[item];
let th = this
let arr_pro = []
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 07fdcc1..aca01f4 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -293,6 +293,8 @@ Page({
fir_set_sto:1, //最初始的一下,获取门店
front_pick:null, //在详情页面上显示的门店
+
+ get_sto_ing:1, //默认是不让弹出框的
},
//------初始化加载----------
@@ -2761,6 +2763,8 @@ Page({
},
openSpecModel: function (t) {
+
+ if(this.data.get_sto_ing) return false;
var th = this;
var open_store = t.currentTarget.dataset.ind;
@@ -2774,7 +2778,9 @@ Page({
return false;
}
- th.setData({def_pick_store: ut.deep_cp(th.data.front_pick)});
+ if(th.data.front_pick && th.data.front_pick.pickup_id>0 ){
+ th.setData({def_pick_store: ut.deep_cp(th.data.front_pick)});
+ }
this.setData({
store: 0,
@@ -3748,6 +3754,7 @@ Page({
sp_seleing:0
})
+
},
@@ -3758,6 +3765,8 @@ Page({
that = this;
var is_normal = e;
+ th.data.get_sto_ing=1;
+
if (e == 1) {
th.setData({
is_normal: 1
@@ -3772,9 +3781,10 @@ Page({
if (th.data.is_get_local_ok == 0) return false;
if (!th.data.fir_def_store) return false;
+
var dd = null,
i = getApp().request;
- if (!th.data.sele_g) return false;
+ if (!th.data.sele_g) {th.data.get_sto_ing=0; return false; }
var g_distr_type = th.data.sele_g.distr_type;
if (g_distr_type != 0) {
@@ -3959,12 +3969,14 @@ Page({
th.setData({sp_seleing:0})
wx.hideLoading();
th.data.fir_set_sto=0;
+ th.data.get_sto_ing=0;
}
} else {
if(func) func();
th.setData({sp_seleing:0})
wx.hideLoading();
th.data.fir_set_sto=0;
+ th.data.get_sto_ing=0;
}
},err=>{
ut.m_toast('网络繁忙,请稍后重试');
@@ -3972,6 +3984,7 @@ Page({
th.setData({sp_seleing:0})
wx.hideLoading();
th.data.fir_set_sto=0;
+ th.data.get_sto_ing=0;
})
}, 200)
@@ -4105,6 +4118,7 @@ Page({
var th = this;
if (!th.data.sele_g){
wx.hideLoading();
+ th.data.get_sto_ing=0;
return false
}
@@ -4337,6 +4351,8 @@ Page({
th.deal_front_pk();
}
+ th.data.get_sto_ing=0;
+
},
//------------处理线下门店库存--------
@@ -4443,6 +4459,7 @@ Page({
} else {
+ th.data.get_sto_ing=0;
th.data.fir_set_sto=0;
th.setData({
all_sto: null,
@@ -4542,6 +4559,7 @@ Page({
} else {
+ th.data.get_sto_ing=0;
th.data.fir_set_sto=0;
th.setData({
all_sto: null,
@@ -4552,6 +4570,7 @@ Page({
} else {
+ th.data.get_sto_ing=0;
th.data.fir_set_sto=0;
th.setData({
all_sto: null,
@@ -5488,6 +5507,8 @@ Page({
//--点击弹起拼单--
openSpecModel_pt:function (e) {
+ if(this.data.get_sto_ing) return false;
+
this.setData({
open_ind_store: 4,
goodsInputNum: 1
@@ -5507,7 +5528,7 @@ Page({
//如果是拼单活动的普通购买
if (ind == 1) {
- if(th.data.front_pick){
+ if(th.data.front_pick && th.data.front_pick.pickup_id){
th.setData({def_pick_store: ut.deep_cp(th.data.front_pick)});
}else if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ //要把不匹配还原
th.data.def_pick_store.is_no_dis_nor=0;
@@ -5710,7 +5731,7 @@ Page({
});
// s.my_warnning('超出商品限购', 0, th);
- var num = th.data.prom_buy_limit - th.data.prom_buy_num;
+ var num = 0;//th.data.prom_buy_limit - th.data.prom_buy_num;
if (num < 0) num = 0;
th.setData({
goodsInputNum: num
@@ -6842,8 +6863,17 @@ Page({
// 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);
+
+ 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, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
+ }
+
+
break; //普通商品的展示
case 4:
@@ -7415,12 +7445,12 @@ Page({
})
//--先判断会员状态--
var 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;
- }
+ // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
+ // wx.navigateTo({
+ // url: '/packageE/pages/togoin/togoin',
+ // })
+ // return false;
+ // }
//如果开启了,则不在选择门店
@@ -8559,7 +8589,8 @@ Page({
//-- 积分购购买弹出框 --
go_pay_integral: function () {
-
+
+ if(this.data.get_sto_ing) return false;
//-- 在打开弹出框的时候,front_pk门店要赋值 --
this.setData({def_pick_store: ut.deep_cp(this.data.front_pick)});
@@ -8574,10 +8605,11 @@ Page({
//-- 积分购普通购买弹出框 --
go_pay_integral_normal:async function () {
+ if(this.data.get_sto_ing) return false;
this.data.g_buy_num = new Map();
var th = this;
- if(th.data.front_pick){
+ if(th.data.front_pick && th.data.front_pick.pickup_id){
th.setData({def_pick_store: ut.deep_cp(th.data.front_pick)});
}else if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ //要把不匹配还原
th.data.def_pick_store.is_no_dis_nor=0;
@@ -9148,6 +9180,9 @@ Page({
//-- 秒杀的普通购买 --
openSpecModel_Nor: function () {
+
+ if(this.data.get_sto_ing) return false;
+
this.data.g_buy_num = new Map();
var th = this;
diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js
index 52944a3..a65e9c4 100644
--- a/pages/goods/goodsList/goodsList.js
+++ b/pages/goods/goodsList/goodsList.js
@@ -317,14 +317,14 @@ Page({
//-- 获取 --
await getApp().request.promiseGet("/api/weshop/prom/gift/page?id="+content.gift+"&store_id="+oo.stoid, {
}).then(res => {
- if(ut.ajax_ok(res))
+ if(ut.ajax_ok(res)) {
+ arr[i].content.gift_name = res.data.data.pageData[0].goods_name;
+ if (!content.zpname_type) content.zpname_type = '';
- arr[i].content.gift_name=res.data.data.pageData[0].goods_name;
- if(!content.zpname_type) content.zpname_type='';
-
- if(parseInt(content.zpname_type)>0){
- arr[i].content.gift_name=res.data.data.pageData[0].title;
+ if (parseInt(content.zpname_type) > 0) {
+ arr[i].content.gift_name = res.data.data.pageData[0].title;
}
+ }
})
}
diff --git a/pages/user/index/iconfont.ttf b/pages/user/index/iconfont.ttf
new file mode 100644
index 0000000..4b13094
--- /dev/null
+++ b/pages/user/index/iconfont.ttf
diff --git a/pages/user/index/index.js b/pages/user/index/index.js
index 1182193..3308413 100644
--- a/pages/user/index/index.js
+++ b/pages/user/index/index.js
@@ -55,14 +55,18 @@ Page({
showvipcode:false,
pshow:0,
-
is_show_yq:0, //是不是要显示邀请
+ show_erm_u:1,//弹出框显示会员二维码
},
goto_nav: function (e) {
var th = this;
var url = e.currentTarget.dataset.url;
- if (th.data.userInfo != null) {
- console.log('跳转');
+
+ //附件的门店不用判断会员
+ var is_fj_store= url.indexOf('store/index')>-1;
+
+ if (th.data.userInfo != null || is_fj_store) {
+ console.log('跳转');
getApp().goto(url);
} else {
wx.navigateTo({
@@ -542,22 +546,25 @@ Page({
})
//th.requestRecommend();
- //自定义组件一定要等到页面加载完了,才来调用selectComponnent
- setTimeout(function () {
- th.setData({ is_show_recommend:true })
- if (getApp().globalData.user_id) getApp().requestCardNum(th);
- var goods_list = th.selectComponent("#goods_recommend"); //组件的id
- if(goods_list){
- goods_list.init();
- goods_list.get_list();
- }
+ }
+ }
- }, 1200)
+ //自定义组件一定要等到页面加载完了,才来调用selectComponnent
+ setTimeout(function () {
+ th.setData({ is_show_recommend:true })
+ if (getApp().globalData.user_id) getApp().requestCardNum(th);
+ var goods_list = th.selectComponent("#goods_recommend"); //组件的id
+
+ if(goods_list){
+ goods_list.init();
+ goods_list.get_list();
}
- }
+
+ }, 1200)
+
setTimeout(()=>{
th.setData({ pshow:1 })
@@ -626,14 +633,14 @@ Page({
*/
onReachBottom: function () {
//!this.nomore && this.requestRecommend();
- var e = getApp().globalData.userInfo;
- if (e != undefined && e != null && e.mobile) {
+ //var e = getApp().globalData.userInfo;
+ //if (e != undefined && e != null && e.mobile) {
var goods_list = this.selectComponent("#goods_recommend"); //组件的id
goods_list.init();
setTimeout(function () {
goods_list.get_list();
}, 300)
- }
+ //}
},
/**
@@ -1237,6 +1244,38 @@ Page({
})
},
+ hide_u_ewm(){
+ this.setData({show_erm_u:0})
+ },
+ show_u_ewm(){
+ var th=this;
+
+ var getnowtime;
+ rq.get("/api/weshop/users/getServerTime", {
+ success: function (res) {
+ if (res.data.code == 0)
+ {
+ th.setData({show_erm_u:1})
+ getnowtime=res.data.data;
+ if (!getnowtime)
+ {
+ getApp().showWarning("获取服务时间失败");
+ return;
+ }
+ //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s')
+ var val = th.data.userInfo.mobile + "|" +getnowtime+"|"+th.data.getusercode_vailtime;
+ val = "^" + ut.base64_encode(val);
+
+ qrcode('qrcode', val, 350, 350, th);
+
+
+ }
+ }
+ })
+
+
+ }
+
diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml
index a5ffb04..28bbf37 100644
--- a/pages/user/index/index.wxml
+++ b/pages/user/index/index.wxml
@@ -435,7 +435,7 @@
-
+
@@ -448,11 +448,24 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+ 点击隐藏
+
+
+ 点击显示
+
-
+
+
diff --git a/pages/user/index/index.wxss b/pages/user/index/index.wxss
index 3c0992c..017b5d6 100644
--- a/pages/user/index/index.wxss
+++ b/pages/user/index/index.wxss
@@ -553,11 +553,15 @@
background: #fff;
/* margin-left: 73rpx; */
width: 600rpx;
- height: 860rpx;
+ height:860rpx;
border-radius: 8px;
text-align: center;
}
+.modal-body.low{
+ height:600rpx;
+}
+
.modal-content {
width: 480rpx;
margin: 0 auto;
@@ -784,4 +788,31 @@ button::after {
align-items: center;
justify-content: center;
/* margin-top: 20rpx; */
-}
\ No newline at end of file
+
+ position: relative;top: -10rpx;
+}
+
+
+@font-face {
+ font-family: "iconfont_yan"; /* Project id 4449681 */
+ src: url('data:font/woff2;charset=utf-8;base64,d09GMgABAAAAAANUAA0AAAAAB4wAAAL+AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4GYACCQhEICoJYgj4LDAABNgIkAxIEIAWFAgdQG38GyB6D424J0UpZYooBbRj+ksfDf2P97pt5s18lmcPpoknEknhJRJJ5pURKIorVLWF/8k/fFWKMLamk8Er8bJV3au6kCdLWTXPif+CcvCJMnkvmj2+Pokq7RgIdD3bMoCih64UOehC/MH1w3m4lM1lHIeC3CUcLwH9TUgD/bIRhzAJFqFJIFGSKFxrlWTkCnoP3R5ck+ilaxf8Lz7n74WWw/X30fWxI9AjqTwQCAEsQKirmILCfocAcI0tASkH3WE/3SD+9CxAQHQIQBQUAEMBLRU8BDQxiAE+AD4AEQGpDQwMj4w6OJvmk9yrt+rrvNvPmJqv3JuP2duA6/eoqo+9Sd9F7Rpz7957s6vZO+453iO2j0sBry1DODK6/bEGwYWlbwmG/ecakRRqB5EzuBJv6Helicpa7BMFXsZi/MnMbSSSVsstk+rTWrapglURr5h8V13LVe9MVDdOw6QQHe5ap9hFwBoc24h7lPhIFJ8Kprw4RzjHxR6kjcb74uSognogKm96bbHx6O0waqOCSev149g6kTa8g318RrJLE/eyNP9e5UO2pVq2z/mzCprlPUQ0fd1PCw6iGPxffn/XzAAJBefP7qdDW779/KHWS7dIRdaWsoF8BQcOOvZUAPqXcb4ZMQCK5LB1Cc4gxKBg0iB6ASS+AAFNYEAj9zkCg6PMAAlW/pwKkfl8EaIZ8E6Cj3w9AYNDO2A8IDJmKF6rIAWwAHQ3j/NBi1FW0GoeBRHrRZtYc2jFuHx10xde4IRvxEELVKlesXiOXISnRQlUohWlVtNWDA3t24GQH9hoQQnKeCxeUq9RArVgt+Jet2uDVQ9QrytWqo8glERMQgRVd/2KBKCpwdLBWudo6nlKnUSWJevUqkFSohWmQRCTxiXJqahhJtVqYUrlS9QTgMiCxrrFSUl9fsQZ0RWDtJG3iP4LdAA/Tp/nhZISEKlJ2C5TmacAC3aiIzI5x0hBaj0H8soZQokSdaCnWKhXaysJmRbG2rkpRiG1yi+ooLaZUDAAA') format('woff2'),
+ url('data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAU8AA0AAAAAB4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAFIAAAABoAAAAcohRq60dERUYAAAUAAAAAHgAAAB4AKQALT1MvMgAAAaAAAABGAAAAYEIBTpxjbWFwAAAB/AAAAEIAAAFCAA/veGdhc3AAAAT4AAAACAAAAAj//wADZ2x5ZgAAAkwAAAEsAAABWH3W0xtoZWFkAAABMAAAADAAAAA2JyyEpGhoZWEAAAFgAAAAHQAAACQHiQOFaG10eAAAAegAAAARAAAAEgxVAFVsb2NhAAACQAAAAAwAAAAMAEgArG1heHAAAAGAAAAAHgAAACABFABLbmFtZQAAA3gAAAFGAAACgl6CAQJwb3N0AAAEwAAAADYAAABQUf1A0HjaY2BkYGAAYqEpty7E89t8ZeBmYQCBR+wKdnA6lKGBeTXTaiCXg4EJJAoAB0UIyXjaY2BkYGBu+N/AEMPCAALMqxkYGVABCwBTpwMXAAAAeNpjYGRgYGBlsAdiEGACYi4gZGD4D+YzAAAPawFgAAB42mNgYWFgnMDAysDA1Ml0hoGBoR9CM75mMGLkAIoysDIzYAUBaa4pDAden3l9lrnhfwMDA/MdBiDJwIikRIGBEQCTww4iAAB42mNhgAAWCA5lCAUAAe4AtwAAAHjaY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+67P//wPJM///i5hDVTIwsjHAmAyMTECCiQEVMDIMewAAJFcIcgAAAAAAAAAAAAAASACseNotjzFLw0AUx9/LpYlIrVTTZJFD72yCBDrcpQ1UTUuhtQbqIHR1cUpNwbnTiZP9IF3yEbr6Ady6+xmci3fQB++/vN+D3x9smIMilaXgGFpAIQZA5rgURS/tIGFhlOGlHzQwEr0kZI7nB6yDSYaCotdAC1bb0Wj7Z2K13uX5Dj2Tay7ERAh+3WesPzVhzYuyLMzuY3WYyjATER8QHVDTPp9kY1VwCleQQB8ygHbqS+0TRqkx4U5krKQI3DAKubb1gwEaopt0DdPSYtwgqee2A4xwxh5y7Tl9ocXT4279/DMeasU7yc7O6xf6IIff9MjnAgltslvefCMTqWvTPbAN94vlu6CDD6Wc12Sh1AkjiItyJpvUFrxecx0a3Oie9pcc2+T+V39R+AdnzksMeNp9kM1Kw0AUhc/0T21BxILrWRVBSH+WpbtC3blwUddtOklbkkyYTAtdunXlA7j1MXwAn0Fw5YN4Gq8IFZqQyzfn3nNmJgAu8QmFn6eNa2GFU9wJV3CCWLhK/VG4Rn4RrqOFN+EG9Q/hJm7USLiFtnpmgqqdcdUp0/ascIGRcAXneBCuUrfCNfKTcB1XeBVuUH8XbmKKL+EWOmqJMRwMZvCsC2jMsWNdIWRuhqisHhg7M/Nmoec7vQptFtmM4r+pv9Y942JskDDacWniTTJzRy1HWlOmORQc2bc0+gjQo2xcsbKZ7ge9o/Zb2rMy4vCeBbY85oCqp1Hzc7SnpInEGF4hIWvkZW9NJaQeMNZkxv3+lWIbD7yPdORsqifc1iSJ1bmzaxN6Di/LPXIM0eUbHaQH5eFTjnmfD7vdSAKC0Kb4Bg9qcIcAAHjaY2BigAAuMMnIgA5YwaJMjEyMzIKViXlZmXnp8RWZiXnFGZnx+XCRysy85EQgnQ8ACQsOVgAAAAAAAf//AAIAAQAAAAwAAAAWAAAAAgABAAMABAABAAQAAAACAAAAAHjaY2BgYGQAgntsWnkg+hG7gh2MBgAurwQMAAA=') format('woff'),
+ url('iconfont.ttf?999') format('truetype');
+}
+.icon_yan{
+ font-family: "iconfont_yan" !important;
+ font-style: normal;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+.icon-yanjing_xianshi_o:before {
+ content: "\ebcc";
+}
+.icon-yanjing_yincang_o:before {
+ content: "\ebcd";
+}
+
+.fs36{ font-size: 36rpx}
+
+
+
diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js
index 58b871f..f36e3ed 100644
--- a/pages/user/order_list/order_list.js
+++ b/pages/user/order_list/order_list.js
@@ -1446,14 +1446,43 @@ Page({
//-- 优惠促销的时候控制取价规则 --
// gg.prom_type!=3 && gg.prom_type!=10 同时商品不是普通购买的时候,又参与优惠促销,阶梯促销
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; //如果线下价格比较贵,则不通过
- } else {
- if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ //判断一下活动是不是有参与订单促销,并且订单促销的活动是不是实收取价,2024-2-23
+ let ordprom_price_type=0;
+ if(order.order_prom_id && good.prom_type==0){
+ let p_rs= await getApp().request.promiseGet("/api/weshop/promorder/get/"+os.stoid+"/"+order.order_prom_id, {});
+ if(p_rs && p_rs.data.code==0 && p_rs.data.data){
+ let ord_p=p_rs.data.data;
+ if(ord_p && ord_p.discount_field>0){
+ ordprom_price_type=ord_p.discount_field
+ }
+ }
+ }
+ if(ordprom_price_type>0){
+ //-- 看一下订单促销的取价规则 --
+ switch (ordprom_price_type){
+ case 1:
+ if (good.goods_price != gg.shop_price) isok = 0;
+ break;
+ case 2:
+ if (good.goods_price != gg.market_price) isok = 0;
+ break;
+ }
+
+ }else{
+ 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; //如果线下价格比较贵,则不通过
+
+ } else {
+ if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ }
}
+
+
+
+
}else{
if(good.prom_type==3 || good.prom_type==10 ){
diff --git a/utils/more_cx.js b/utils/more_cx.js
index 05b3afe..e1f2e3c 100644
--- a/utils/more_cx.js
+++ b/utils/more_cx.js
@@ -36,6 +36,7 @@ module.exports = {
}
return 0;
}
+
var goods =gdlist;
var all_num=0;
var need_to_buy=0;