diff --git a/components/promate_pop/promate_pop.js b/components/promate_pop/promate_pop.js
index b264dac..adfcc05 100644
--- a/components/promate_pop/promate_pop.js
+++ b/components/promate_pop/promate_pop.js
@@ -3,14 +3,15 @@ Component({
data: {
type:0, //0只显示再商品详情页面 1显示再有选择按钮
pro_pop:0, //是否弹出
+ cx_prom_group:[], //弹出框的内容展示
},
methods: {
//-- 初始化弹出框 --
- set_init(type){
+ set_init(type,cx_prom_group){
if(!type) type=0;
this.setData({
- type:type,pro_pop:1
+ type:type,pro_pop:1,cx_prom_group
})
},
@@ -18,5 +19,34 @@ Component({
close_pro_pop: async function (event) {
this.setData({pro_pop: 0});
},
+
+
+ go_the_url:function (e){
+ var prom_id = e.currentTarget.dataset.id;
+ var prom_type = e.currentTarget.dataset.prom_type;
+ var url='';
+ switch (parseInt(prom_type)){
+ case 3:
+ url = "/pages/goods/goodsList/goodsList?prom_type=3&prom_id=" + prom_id;
+ break;
+ case 5:
+ url = "/packageA/pages/prom_list/prom_list?goods_id=" + this.data.gid;
+ var room_id = getApp().globalData.room_id;
+ if (room_id && this.data.gid == getApp().globalData.room_goods_id) {
+ url += "&room_id=" + room_id;
+ }
+ break;
+ case 7:
+ url="/packageB/pages/zuhegou/index/index?id=" + id
+ break;
+ case 10:
+ url="/pages/goods/goodsList/goodsList?ladder_id=" + prom_id;
+ break;
+ }
+ getApp().goto(url);
+
+
+ }
+
}
})
\ No newline at end of file
diff --git a/components/promate_pop/promate_pop.wxml b/components/promate_pop/promate_pop.wxml
index 054d7db..cd562bf 100644
--- a/components/promate_pop/promate_pop.wxml
+++ b/components/promate_pop/promate_pop.wxml
@@ -1,3 +1,4 @@
+
@@ -9,82 +10,32 @@
-
-
- 优惠
-
- 优惠促销
-
-
- 消费满100元享受优惠
-
- 减价10元
- 减价10元
- 减价10元
- 减价10元
- 减价10元
- 减价10元
- 减价10元
-
-
-
-
-
- 详情
-
-
-
-
- 搭配
+
+
+ {{p_fil.set_tab_title(item)}}
- 搭配促销
+ {{p_fil.set_title(item)}}
- 活动名称
- 搭配价:¥101.00-210.00
-
- 2022.12.19 00:00:00 至 2022.12.31 23:59:59
+ {{item.title}}
+ {{item.title}}
+ 消费满{{item.condition}}享优惠({{item.limit}})
-
- 详情
+ 搭配价:{{item.show_price}}
-
-
-
- 组合
-
- 组合购
-
-
-
- 活动名称
-
- 2022.12.19 00:00:00 至 2022.12.31 23:59:59
+
+ {{item.show_time}}
-
- 详情
-
-
-
-
- 阶梯
-
- 阶梯促销
-
-
-
- 第1件8折,第2件7折,第3件6折
-
- 2022.12.19 00:00:00 至 2022.12.31 23:59:59
+
+ {{bm}}
-
- 详情
+
+ 详情
-
diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js
index 1889b9b..ff26391 100644
--- a/packageE/pages/cart/cart2/cart2.js
+++ b/packageE/pages/cart/cart2/cart2.js
@@ -925,10 +925,9 @@ Page({
}
}
- //-- 判断一下,获取搭配购的消息 --
- if ((item1.prom_type == 0 || item1.prom_type == 5) && (!carr[i].collocationList || !carr[i].collocationList.length)) {
-
- await th.set_collection(item1, carr, i);
+ //-- 判断一下,获取搭配购的消息,只有prom_type==5才会判断优惠活动 --
+ if ( item1.prom_type == 5 && (!carr[i].collocationList || !carr[i].collocationList.length)) {
+ await th.set_collection(item1, carr, i);
}
}
@@ -1006,8 +1005,6 @@ Page({
}
}
-
-
find = 1;
break;
}
@@ -1061,7 +1058,6 @@ Page({
}
}
-
var ie = {
pickup_id: pcid,
pname: pikname,
@@ -1081,9 +1077,7 @@ Page({
//-- 把等级卡会优惠多少钱装进去 --
if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1;
-
if (car_item.collocationList) {
-
ie.collocationList = car_item.collocationList;
}
@@ -1172,7 +1166,7 @@ Page({
}
if (cart_commission) {
- th.setData({ cart_commission });
+ th.setData({ cart_commission });
}
//每一个门店内的组合购要进行拆分,
@@ -1212,7 +1206,6 @@ Page({
ladder_calc.fir_set_arr(u_item1, th);
}
-
//-- 要判断总开关有没有同城配送 --
if(th.data.is_same_city) {
//----- 判断每一个商品的配送方式,和门店的配送方式 -------
@@ -1227,8 +1220,6 @@ Page({
}
}
-
-
//深拷贝
th.data.old_cartlist = JSON.parse(JSON.stringify(arr));
th.setData({
@@ -1252,6 +1243,7 @@ Page({
});
},
+
//-----获取立即购买的商品信息,入口----
get_buy_goods: function (e) {
var th = this;
@@ -1358,8 +1350,6 @@ Page({
th.setData({ card_cut_price: cut_p });
}
}
-
-
//-- 当是搭配购的时候 --
gd.prom_type = gg.prom_type ? gg.prom_type : 0;
@@ -1760,6 +1750,37 @@ Page({
}
},
+ //-- 立即购买的时候,获取商品优惠活动 --
+ async buy_pro_group(gd){
+ var url = '/api/weshop/activitylist/listGoodActInfo2New';
+ var user_id=getApp().globalData.user_id;
+ var zh_id=0;
+ var req_d = {
+ "store_id": os.stoid,
+ "goods_id": gd.goods_id,
+ "user_id": user_id,
+ }
+
+ await getApp().request.promiseGet(url, {}).then(res=>{
+
+ })
+
+ //-- 如果有组合购的时候,同时还要判断单件商品的购买数量有没有满足组合购的条件 --
+ if(zh_id){
+ //获取活动信息
+ var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + zh_id + "/" + user_id;
+ getApp().request.promiseGet(url, {
+
+ })
+ }
+
+ //调用接口判断订单优惠,
+ await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gd.goods_id + "/0" + "/" + user_id, {
+ }).then(async res=>{
+
+ });
+ },
+
//---------------检查是否有收货地址-------------------
checkAddressList: function () {
var t = this;
@@ -1975,8 +1996,6 @@ Page({
}
-
- //-- --
if (item_map.price != undefined && item_map.price != null
&& item_map.prom_price != undefined && item_map.prom_price != null)
cart_item.cut_price += (item_map.price - item_map.prom_price);
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 00566c4..2b1f557 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -1209,10 +1209,6 @@ Page({
this.data.enterAddressPage && (this.data.enterAddressPage = !1);
- setTimeout(()=>{
- var pro_pop = this.selectComponent("#pro_pop"); //组件的id
- pro_pop.set_init();
- },1500)
@@ -1550,8 +1546,11 @@ Page({
},
//优惠促销用户参与次数
async getUserBuyPromNum_pre(prom_id){
+ var user_id=0
var userInfo = getApp().globalData.userInfo;
- var url = `/api/weshop/ordergoods/getUserBuyPromNum?is_all=1&store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
+ if(userInfo) user_id=userInfo.user_id;
+
+ var url = `/api/weshop/ordergoods/getUserBuyPromNum?is_all=1&store_id=${os.stoid}&user_id=${user_id}&prom_type=3&prom_id=${prom_id}`;
let res = await getApp().request.promiseGet(url, {
data:{}
});
@@ -1628,11 +1627,8 @@ Page({
prom_type: th.data.sele_g.prom_type,
};
-
-
-
//-- 代发商品不参加优惠 --
- if (th.data.sele_g.whsle_id && newd.prom_type == 3) {
+ if (th.data.sele_g.whsle_id) {
newd.prom_type = 0;
newd.prom_id = 0;
}
@@ -1673,6 +1669,8 @@ Page({
newd.pricing_type = o.pricing_type;
}
+
+ //获取到优惠测序类型
//-----如果是秒杀,团购,积分购,拼团-----
if (th.data.prom_type == 1 || th.data.prom_type == 2) {
@@ -1681,7 +1679,6 @@ Page({
newd.prom_type = 0;
newd.prom_id = 0;
newd.is_pd_normal = 1;
-
//---如果是线下门店销售的时候---
if (th.data.sales_rules >= 2) {
var pick = th.get_pick_from_list(th.data.sto_sele_id)
@@ -1729,10 +1726,9 @@ Page({
return false;
}
-
newd.goods_price = th.data.prom_price;
newd.member_goods_price = th.data.prom_price,
- newd.prom_type = th.data.prom_type;
+ newd.prom_type = th.data.prom_type;
newd.prom_id = th.data.prom_id;
if (o.store_count <= 0 ) {
@@ -1752,158 +1748,17 @@ Page({
};
th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
-
- } else if (o.prom_type == 7) {
-
- //判断进行中的活动,是不是要判断线下库存
- th.check_zh_acting(function (ee) {
- newd.prom_id = 0;
- newd.prom_type = 0;
- if (ee && th.data.sele_g.act) {
- newd.prom_id = th.data.sele_g.act.id;
- newd.prom_type = 7;
- if (o.store_count <= 0) {
- wx.showToast({
- title: '库存已为空!',
- icon: 'none',
- });
- return false;
- };
- if (o.store_count < e.data.goodsInputNum) {
- wx.showToast({
- title: '库存不足!',
- icon: 'none',
- });
- return false;
- //return s.my_warnning("库存不足!", 0, th);
- };
- th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
- return false;
- } else {
- //---如果是线下门店销售的时候---
- if (th.data.sales_rules >= 2) {
- var pick = th.get_pick_from_list(th.data.sto_sele_id)
-
- th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
- if (CanOutQty) {
-
- if (CanOutQty < e.data.goodsInputNum) {
- wx.showToast({
- title: '库存不足!',
- icon: 'none',
- });
- return false;
- }
-
- th.add_cart_next(e, t, a, o, newd, CanOutQty);
- } else {
- wx.showToast({
- title: '库存不足!',
- icon: 'none',
- });
- return false;
- }
- })
-
- } else {
- if (o.store_count <= 0) {
- wx.showToast({
- title: '库存已为空!',
- icon: 'none',
- });
- return false;
- //return s.my_warnning("库存已为空!", 0, th);
- };
- if (o.store_count < e.data.goodsInputNum) {
- wx.showToast({
- title: '库存不足!',
- icon: 'none',
- });
- return false;
- //return s.my_warnning("库存不足!", 0, th);
- };
- th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
- }
- }
- })
-
}
- //要包含积分购的普通购买
- else if (th.data.prom_type == 0 || th.data.prom_type == 3 || newd.is_integral_normal || th.data.prom_type == 5 || th.data.prom_type == 10) {
+ //要包含积分购的普通购买0 3,5,7,10
+ else if ( [0,3,5,7,10].indexOf(th.data.prom_type)>-1 || prom.prom_type == 7) {
newd.prom_type = 0;
newd.prom_id = 0;
- if (th.data.prom_type == 10) {
- newd.prom_type = th.data.prom_type;
- newd.prom_id = th.data.prom_id;
- }
-
//---如果是线下门店销售的时候---
if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) {
var pick = th.get_pick_from_list(th.data.sto_sele_id)
//---通过接口获取门店的线下库存信息--
- // getApp().request.get("/api/weshop/goods/getWareStorages", {
- // data: {
- // storageNos: pick.pickup_no,
- // wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
- // storeId: os.stoid
- // },
- // success: function (res) {
- // if (res.data.code == 0) {
- // if (res.data.data.pageData.length > 0) {
- // var CanOutQty = res.data.data.pageData[0].CanOutQty;
- // if (CanOutQty < e.data.goodsInputNum) {
- // wx.showToast({
- // title: '库存不足!',
- // icon: 'none',
- // });
- // return false;
- // //return s.my_warnning("库存不足!", 0, th);
- // }
- // //在调一次接口,读取商品的预出库的数量,lock
- // getApp().request.get("/api/weshop/order/ware/lock/page", {
- // data: {
- // store_id: os.stoid,
- // wareId: th.data.sele_g.goods_id,
- // storageId: pick.pickup_id,
- // pageSize: 1000
- // },
- // success: function (res_data) {
- // if (res_data.data.code == 0 && res_data.data.data.total > 0) {
- //
- // var lock = 0;
- // for (var i in res_data.data.data.pageData) {
- // lock += res_data.data.data.pageData[i].outQty;
- // }
- //
- // if (CanOutQty <= lock) {
- // wx.showToast({
- // title: '库存不足!',
- // icon: 'none',
- // });
- // return false;
- // //return s.my_warnning("库存不足!", 0, th);
- // }
- // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
- // } else {
- // th.add_cart_next(e, t, a, o, newd, CanOutQty);
- // }
- // }
- // })
- // } else {
- // wx.showToast({
- // title: '库存不足!',
- // icon: 'none',
- // });
- // return false;
- // //return s.my_warnning("库存不足!", 0, th);
- // }
- //
- // }
- // }
- // })
-
th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
if (CanOutQty) {
@@ -1981,24 +1836,22 @@ Page({
//if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);
if ("add" == t.currentTarget.dataset.action) {
-
-
- if( [3,5,10].indexOf(newd.prom_type)>-1){
- newd.prom_type=0;
- newd.prom_id=0;
- }
-
- //如果有搭配购的时候的时候
- if(th.data.collocationGoods && newd.prom_type==0){
- newd.prom_type = 5;
- newd.prom_id = th.data.collocationGoods.id;
- }
-
- //如果有搭配购的时候的时候
- if(th.data.zh_act && (!th.data.zh_act.zh_num || th.data.zh_act.zh_buy_num>th.data.zh_act.zh_num ) && newd.prom_type==0){
- newd.prom_type = 7;
- newd.prom_id = th.data.zh_act.id;
- }
+ // if( [3,5,10].indexOf(newd.prom_type)>-1){
+ // newd.prom_type=0;
+ // newd.prom_id=0;
+ // }
+ //
+ // //如果有搭配购的时候的时候
+ // if(th.data.collocationGoods && newd.prom_type==0){
+ // newd.prom_type = 5;
+ // newd.prom_id = th.data.collocationGoods.id;
+ // }
+ //
+ // //如果有搭配购的时候的时候
+ // if(th.data.zh_act && (!th.data.zh_act.zh_num || th.data.zh_act.zh_buy_num>th.data.zh_act.zh_num ) && newd.prom_type==0){
+ // newd.prom_type = 7;
+ // newd.prom_id = th.data.zh_act.id;
+ // }
//----先看会员在购物车中是否加入了该商品-----
i.get("/api/weshop/cart/page", {
@@ -2033,7 +1886,6 @@ Page({
if(item){
item = re.data.data.pageData[0];
-
//判断数量,要看下购物车中有没有该商品
if (CanOutQty) {
if (item.goods_num + th.data.goodsInputNum > CanOutQty) {
@@ -2087,7 +1939,6 @@ Page({
updata['groupchat_id'] = getApp().globalData.groupchat_id;
}
-
getApp().request.put("/api/weshop/cart/update", {
data: updata,
success: function (t) {
@@ -2115,196 +1966,14 @@ Page({
}
});
- } else {
-
- //-- 这一步主要是要让立即购买 走 购物车的逻辑 参与活动,如果有zh_act就强制组合购购买 --
- if(th.data.zh_act
- && th.data.zh_act.zhbuyqty <= th.data.goodsInputNum){
- wx.hideLoading();
-
- if((th.data.zh_act.buy_limit !=0 && th.data.zh_act.buy_limit <= th.data.userbuynum)){
- wx.showModal({
- title: '提示',
- // content: `商品${str},组合购活动,购买次数已超,将以普通商品购买?`,
- content: `${th.data.data.goods_name}超出组合购限购次数,将以普通商品购买`,
- success:res=>{
- if (res.confirm) {
- console.log('用户点击确定')
- //----先看会员在购物车中是否加入了该商品,立即购买的-----
- getApp().request.get("/api/weshop/cart/page", {
- data: {
- store_id: os.stoid,
- user_id: oo.user_id,
- state: 1
- },
- success: function (res) {
- //-------如果购物车中有相关的数据---------
- if (res.data.code == 0 && res.data.data.total > 0) {
- for (let j in res.data.data.pageData) {
- let item_j = res.data.data.pageData[j];
- var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;
- getApp().request.delete(url, {});
- }
- }
- newd.state = 1;
- newd.prom_type=0;
- newd.prom_id=0
- getApp().request.post("/api/weshop/cart/save", {
- data: newd,
- success: function (t) {
- th.closeSpecModal();
- getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");
- }
- });
- }
- })
- } else if (res.cancel) {
-
- console.log('用户点击取消')
- }
- }
- })
- }else{
-
-
- //----先看会员在购物车中是否加入了该商品,立即购买的-----
- getApp().request.get("/api/weshop/cart/page", {
- data: {
- store_id: os.stoid,
- user_id: oo.user_id,
- state: 1
- },
- success: function (res) {
- //-------如果购物车中有相关的数据,先清理掉---------
- if (res.data.code == 0 && res.data.data.total > 0) {
- for (let j in res.data.data.pageData) {
- let item_j = res.data.data.pageData[j];
- var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;
- getApp().request.delete(url, {});
- }
- }
-
- newd.state = 1;
- newd.prom_type=7;
- newd.prom_id=th.data.zh_act.id;
- getApp().request.post("/api/weshop/cart/save", {
- data: newd,
- success: function (t) {
- th.closeSpecModal();
- getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");
- }
- });
-
- }
- })
- }
-
-
- return false
- }else{
- //----先看会员在购物车中是否加入了该商品,立即购买的-----
- getApp().request.get("/api/weshop/cart/page", {
- data: {
- store_id: os.stoid,
- user_id: oo.user_id,
- state: 1
- },
- success: function (res) {
- //-------如果购物车中有相关的数据---------
- if (res.data.code == 0 && res.data.data.total > 0) {
- for (let j in res.data.data.pageData) {
- let item_j = res.data.data.pageData[j];
- var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;
- getApp().request.delete(url, {});
- }
- }
-
- }
- })
-
- }
-
- if (th.data.prom_goods && newd.prom_type!=4 && newd.prom_type!=6 ) {
- var prom_d = th.data.prom_goods;
- for (var i in prom_d) {
- //判断活动有俩种条件,0元 1件
- var condition_t = prom_d[i].prom_type;
- switch (condition_t) {
- case 0: //按钱
- if (newd.goods_price >= condition_t) {
- newd.prom_type = 3;
- newd.prom_id = prom_d[i].prom_id;
- }
- break
- case 1: //按购买数量
- if (newd.goods_num >= condition_t) {
- newd.prom_type = 3;
- newd.prom_id = prom_d[i].prom_id;
- }
- break;
- }
- }
- }
- //如果有阶梯促销的时候
- if(th.data.jieti_prom && (newd.prom_type==10 || newd.prom_type==0) ){
- newd.prom_type = 10;
- newd.prom_id = th.data.ladder_act_id;
+ }else{
-
- //----先看会员在购物车中是否加入了该商品,立即购买的-----
- getApp().request.get("/api/weshop/cart/page", {
- data: {
- store_id: os.stoid,
- user_id: oo.user_id,
- state: 1
- },
- success: function (res) {
- //-------如果购物车中有相关的数据,先清理掉---------
- if (res.data.code == 0 && res.data.data.total > 0) {
- for (let j in res.data.data.pageData) {
- let item_j = res.data.data.pageData[j];
- var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;
- getApp().request.delete(url, {});
- }
- }
-
- newd.state = 1;
- getApp().request.post("/api/weshop/cart/save", {
- data: newd,
- success: function (t) {
- th.closeSpecModal();
- getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");
- }
- });
-
- }
- })
- return false;
-
- }
-
-
- //如果有搭配购的时候的时候
- if(th.data.collocationGoods && newd.prom_type==0){
- newd.prom_type = 5;
- newd.prom_id = th.data.collocationGoods.id;
- newd.is_coupon= th.data.collocationGoods.is_coupon;
-
- }
-
- //如果有搭配购的时候的时候
- if(th.data.zh_act && (newd.prom_type==0 || newd.prom_type==3)){
- newd.prom_type = 7;
- newd.prom_id = th.data.zh_act.id;
- }
-
- //如果有搭配购的时候的时候
- if(th.data.jt && newd.prom_type==0){
- newd.prom_type = 7;
- newd.prom_id = th.data.zh_act.id;
+ //-- 优惠促销的商品,立即购买就判断了,就直接购买 --
+ if([1,2,4,6].indexOf(newd.prom_type)==-1){
+ newd.prom_type=0;
+ newd.id=0;
}
-
newd['pick_name'] = th.data.sto_sele_name;
newd['pick_dis'] = th.data.sto_sele_distr;
th.buyNow(newd);
@@ -2314,7 +1983,6 @@ Page({
//因为在购物车 普通商品和 优惠促销,搭配购,组合购 阶梯购是一样的
check_is_like(e,newd,idx){
if(e.prom_type ==newd.prom_type) return true;
-
if(!idx) {
if (e.prom_type == 0) {
if ([3, 5, 7, 10].indexOf(newd.prom_type) > -1) return true;
@@ -2365,40 +2033,55 @@ Page({
} else {
//要判断积分购的普通购买有没有参加优惠活动
if (e.is_integral_normal == 1 || e.is_pd_normal == 1) {
- this.check_nor_promgood(e.goods_id, function (res) {
- if (res && res.cat_id) {
- e.prom_type = 3;
- e.prom_id = res.cat_id
- }
- s.set_b_now(e);
- /*--
- wx.redirectTo({
- url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
- });--*/
- getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id)
+ e.prom_type = 0;
+ e.prom_id = 0
- })
- } else {
- //搭配购特殊处理
- if( [3,5,7,10].indexOf(th.data.data.prom_type)>-1){
- e.prom_type=th.data.data.prom_type
- e.prom_id=th.data.data.prom_id
- e.collocation_goods=[]
- }
+ }
- if(th.data.collocationGoods){
- e.prom_type=5
- e.prom_id=th.data.collocationGoods.id
- }
-
- s.set_b_now(e);
- /*--
- wx.redirectTo({
- url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
- });--*/
- getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id)
+ //秒杀等活动的直接跳转到cart2中的立即购买
+ if([1,2,4,6].indexOf(e.prom_type)>-1){
+ s.set_b_now(e);
+ getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id)
+ }else {
+
+ //----其他就按照公众号的购物车立即购买形式来修改,先看会员在购物车中是否加入了该商品,立即购买的-----
+ getApp().request.get("/api/weshop/cart/page", {
+ data: {
+ store_id: os.stoid,
+ user_id: oo.user_id,
+ state: 1
+ },
+ success: function (res) {
+ //-------如果购物车中有相关的数据---------
+ if (res.data.code == 0 && res.data.data.total > 0) {
+ for (let j in res.data.data.pageData) {
+ let item_j = res.data.data.pageData[j];
+ var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id;
+ getApp().request.delete(url, {});
+ }
+ }
+
+ //-- 推迟一下,因为删除没有那么快 --
+ setTimeout( ()=>{
+ e.state = 1;
+ e.prom_type = 0;
+ e.prom_id = 0
+ getApp().request.post("/api/weshop/cart/save", {
+ data: e,
+ success: function (t) {
+ th.closeSpecModal();
+ getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");
+ }
+ });
+ },500)
+
+ }
+ })
}
+
+
+
}
},
@@ -7371,12 +7054,12 @@ Page({
//-- 如果有组合购的时候 --
if(th.data.zh_act){
+ var show_time=ut.formatTime(th.data.zh_act.start_time)+"至"+ ut.formatTime(th.data.zh_act.end_time);
//-- 开始组装数据 --
th.add_cx_prom_group({
- id: fir_act.prom_id,
- condition: fir_act.condition + (item.prom_type == 1 ? '件' : '元'),
- limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
- more: more_arr,
+ id: th.data.zh_act.id,
+ title: th.data.zh_act.name,
+ show_time: show_time,
prom_type:7
});
}
@@ -7431,10 +7114,11 @@ Page({
// th.data.prom_type = 10;
// th.data.prom_id = act_id;
- // th.setData({
- // jieti_prom: prom_content,
- // ladder_act_id: act_id
- // })
+
+ th.setData({
+ jieti_prom: prom_content,
+ ladder_act_id: act_id
+ })
var s_time=res.data.data.start_time;
var e_time=res.data.data.end_time;
@@ -7451,34 +7135,41 @@ Page({
//优惠促销的时候
if (r_data.promGoodsLists) {
+
var fir_act = r_data.promGoodsLists[0];
- var more_arr = [];
- //减价
- if (fir_act.money > 0) more_arr.push('减价'+fir_act.money+'元');
- if (fir_act.sale > 0) more_arr.push('打'+fir_act.sale+'折');
- if (fir_act.past ==1) more_arr.push('包邮');
- if (fir_act.intValue > 0) more_arr.push('送'+fir_act.intValue+'积分');
- if (fir_act.couponId > 0) more_arr.push('送'+fir_act.couponMoney+'元优惠券');
- if (fir_act.gift_id) {
- var is_more_gf=fir_act.gift_id.split(',')
- if(is_more_gf.length>1){
- more_arr.push('送赠品');
- }else{
- more_arr.push('送'+fir_act.goods_name+' x'+fir_act.zp_num);
- }
- }
- if (fir_act.lb_id) more_arr.push('送'+fir_act.lbtitle);
- if (fir_act.zxlb_id) more_arr.push('送'+fir_act.zxlbtitle);
+ //-- 计算一下限购,满足限购数才显示 --
+ await this.getUserBuyPromNum_pre(fir_act.prom_id);
+
+ if(!fir_act.limit_num || th.data.user_pre_buynum 0) more_arr.push('减价'+fir_act.money+'元');
+ if (fir_act.sale > 0) more_arr.push('打'+fir_act.sale+'折');
+ if (fir_act.past ==1) more_arr.push('包邮');
+ if (fir_act.intValue > 0) more_arr.push('送'+fir_act.intValue+'积分');
+ if (fir_act.couponId > 0) more_arr.push('送'+fir_act.couponMoney+'元优惠券');
+ if (fir_act.gift_id) {
+ var is_more_gf=fir_act.gift_id.split(',')
+ if(is_more_gf.length>1){
+ more_arr.push('送赠品');
+ }else{
+ more_arr.push('送'+fir_act.goods_name+' x'+fir_act.zp_num);
+ }
+ }
+ if (fir_act.lb_id) more_arr.push('送'+fir_act.lbtitle);
+ if (fir_act.zxlb_id) more_arr.push('送'+fir_act.zxlbtitle);
+
+ //-- 开始组装数据 --
+ th.add_cx_prom_group( {
+ id: fir_act.prom_id,
+ condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'),
+ limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
+ more: more_arr,
+ prom_type:3
- //-- 开始组装数据 --
- th.add_cx_prom_group( {
- id: fir_act.prom_id,
- condition: fir_act.condition + (item.prom_type == 1 ? '件' : '元'),
- limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
- more: more_arr,
- prom_type:3
+ });
+ }
- });
}
//普通购买不在界面显示
@@ -7497,9 +7188,6 @@ Page({
}
})
-
-
-
},
//获取促销活动的组合
@@ -7511,7 +7199,7 @@ Page({
var auto_promote_sale=json_d.auto_promote_sale;
if(auto_promote_sale){
var auto_promote_sale=auto_promote_sale.split(',');
- var fd=auto_promote_sale.indexOf(data.prom_type);
+ var fd=auto_promote_sale.indexOf(data.prom_type+'');
data.sort=fd;
}else{
data.sort=data.prom_type;
@@ -7531,7 +7219,7 @@ Page({
function comp(a, b) {
return a.sort-b.sort; //升序
}
- var ppdata = this.data.cx_prom_group;
+ var ppdata = th.data.cx_prom_group;
//使用sort排序
ppdata.sort(comp);
@@ -7543,9 +7231,25 @@ Page({
},
//-- 获取默认的促销活动的默认活动 --
- check_prom_custom() {
- if (!this.data.cx_prom_group.length) return 3;
- return data[0].prom_type;
+ check_prom_custom(ind) {
+ if(ind){
+ if (!this.data.cx_prom_group.length) return 0;
+ }else{
+ if (!this.data.cx_prom_group.length) return {prom_type:0,id:0};
+ }
+ var prom=null;
+ //-- 看有没有选中的活动 --
+ var fd=this.data.cx_prom_group.findIndex(function (a){
+ return a.sele==1;
+ })
+
+ prom=this.data.cx_prom_group[0];
+ if(fd>-1) prom=this.data.cx_prom_group[fd];
+
+ if(ind) {
+ return prom.prom_type;
+ }
+ return prom;
},
closePoster() {
@@ -7569,7 +7273,7 @@ Page({
var prom_goods = this.data.prom_goods;
if(!prom_goods) return false;
//如果系统默认的顺序不是以优惠促销为默认第一位的时候
- if(th.check_prom_custom()!==3){
+ if(this.check_prom_custom(1)!==3){
return false;
}
var per_price = this.data.sele_g.shop_price
@@ -7595,9 +7299,9 @@ Page({
}
}
//获取用户参与优惠促销的次数
- if(con && con.prom_id){
- await this.getUserBuyPromNum_pre(con.prom_id);
- }
+ //if(con && con.prom_id){
+ //await this.getUserBuyPromNum_pre(con.prom_id);
+ //}
this.setData({
hui_condition: con
});
@@ -7815,9 +7519,10 @@ Page({
item = this.data.sele_g;
}
+ var prom_id=this.check_prom_custom().id;
//如果有组合购
- var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id;
+ var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + prom_id + "/" + getApp().globalData.user_id;
getApp().request.promiseGet(url, {}).then(res => {
if (res.data.code == 0 && res.data.data) {
if (res.data.data.is_show != 1) {
@@ -8237,6 +7942,12 @@ Page({
current: url, // 当前显示图片的http链接
urls: url_arr, // 需要预览的图片http链接列表
});
+ },
+
+ //开始显示活动的弹出
+ switch_cx_group:function (){
+ var pro_pop = this.selectComponent("#pro_pop"); //组件的id
+ pro_pop.set_init(0,this.data.cx_prom_group);
}
diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml
index 77b20f0..147377d 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxml
+++ b/pages/goods/goodsInfo/goodsInfo.wxml
@@ -637,21 +637,16 @@
-
-
+
促销
-
-
优惠促销
搭配促销
组合购
阶梯促销
-
-
@@ -662,8 +657,8 @@
-
-
+
+
领券
@@ -680,8 +675,6 @@
-
-