Commit d4373af5fe40f3dc363fe22579c24b6f903cb146

Authored by yvan.ni
1 parent bdd4fa47

~~多促销优化~~

components/promate_pop/promate_pop.js
@@ -3,14 +3,15 @@ Component({ @@ -3,14 +3,15 @@ Component({
3 data: { 3 data: {
4 type:0, //0只显示再商品详情页面 1显示再有选择按钮 4 type:0, //0只显示再商品详情页面 1显示再有选择按钮
5 pro_pop:0, //是否弹出 5 pro_pop:0, //是否弹出
  6 + cx_prom_group:[], //弹出框的内容展示
6 }, 7 },
7 methods: { 8 methods: {
8 //-- 初始化弹出框 -- 9 //-- 初始化弹出框 --
9 - set_init(type){ 10 + set_init(type,cx_prom_group){
10 if(!type) type=0; 11 if(!type) type=0;
11 12
12 this.setData({ 13 this.setData({
13 - type:type,pro_pop:1 14 + type:type,pro_pop:1,cx_prom_group
14 }) 15 })
15 }, 16 },
16 17
@@ -18,5 +19,34 @@ Component({ @@ -18,5 +19,34 @@ Component({
18 close_pro_pop: async function (event) { 19 close_pro_pop: async function (event) {
19 this.setData({pro_pop: 0}); 20 this.setData({pro_pop: 0});
20 }, 21 },
  22 +
  23 +
  24 + go_the_url:function (e){
  25 + var prom_id = e.currentTarget.dataset.id;
  26 + var prom_type = e.currentTarget.dataset.prom_type;
  27 + var url='';
  28 + switch (parseInt(prom_type)){
  29 + case 3:
  30 + url = "/pages/goods/goodsList/goodsList?prom_type=3&prom_id=" + prom_id;
  31 + break;
  32 + case 5:
  33 + url = "/packageA/pages/prom_list/prom_list?goods_id=" + this.data.gid;
  34 + var room_id = getApp().globalData.room_id;
  35 + if (room_id && this.data.gid == getApp().globalData.room_goods_id) {
  36 + url += "&room_id=" + room_id;
  37 + }
  38 + break;
  39 + case 7:
  40 + url="/packageB/pages/zuhegou/index/index?id=" + id
  41 + break;
  42 + case 10:
  43 + url="/pages/goods/goodsList/goodsList?ladder_id=" + prom_id;
  44 + break;
  45 + }
  46 + getApp().goto(url);
  47 +
  48 +
  49 + }
  50 +
21 } 51 }
22 }) 52 })
23 \ No newline at end of file 53 \ No newline at end of file
components/promate_pop/promate_pop.wxml
  1 +<wxs module="p_fil" src="p_filter.wxs"></wxs>
1 <!-- --弹起领券-- --> 2 <!-- --弹起领券-- -->
2 <view wx:if='{{pro_pop==1}}'> 3 <view wx:if='{{pro_pop==1}}'>
3 <view class="cover-layer flex-center" bindtap="close_pro_pop"></view> 4 <view class="cover-layer flex-center" bindtap="close_pro_pop"></view>
@@ -9,82 +10,32 @@ @@ -9,82 +10,32 @@
9 <view class="xc-frame"> 10 <view class="xc-frame">
10 <view class="top-frame"> 11 <view class="top-frame">
11 <view class="xc-coupon-frame "> 12 <view class="xc-coupon-frame ">
12 - <!-- 优惠促销 -->  
13 - <view class="item_pro flex ai-center">  
14 - <view class="tab_bx fs24">优惠</view>  
15 - <view class="item_pro_left flex jc-center ai-center">  
16 - <view class="fs34 left_f_box" >优惠促销</view>  
17 - </view>  
18 13
19 - <view class="item_pro_right">  
20 - <view class="fs26">消费满100元享受优惠</view>  
21 - <view class="fs22" style="max-width: 430rpx; color: #b9b6b6">  
22 - <text class="tick pdr20" >减价10元</text>  
23 - <text class="tick pdr20" >减价10元</text>  
24 - <text class="tick pdr20" >减价10元</text>  
25 - <text class="tick pdr20" >减价10元</text>  
26 - <text class="tick pdr20" >减价10元</text>  
27 - <text class="tick pdr20" >减价10元</text>  
28 - <text class="tick pdr20" >减价10元</text>  
29 - </view>  
30 -  
31 -  
32 -  
33 - </view>  
34 - <view class="xq_btn fs30">详情</view>  
35 -  
36 - </view>  
37 - <!-- 搭配促销 -->  
38 - <view class="item_pro flex ai-center">  
39 - <view class="tab_bx fs24">搭配</view> 14 + <!-- for循环显示内容 -->
  15 + <view wx:for="{{cx_prom_group}}" class="item_pro flex ai-center">
  16 + <view class="tab_bx fs24">{{p_fil.set_tab_title(item)}}</view>
40 <view class="item_pro_left flex jc-center ai-center"> 17 <view class="item_pro_left flex jc-center ai-center">
41 - <view class="fs36 left_f_box">搭配促销</view> 18 + <view class="fs34 left_f_box" >{{p_fil.set_title(item)}}</view>
42 </view> 19 </view>
43 20
44 <view class="item_pro_right"> 21 <view class="item_pro_right">
45 - <view class="fs26">活动名称</view>  
46 - <view class="fs26">搭配价:<text class="c-red">¥101.00-210.00</text></view>  
47 - <view class="fs22" style="color: #b9b6b6">  
48 - 2022.12.19 00:00:00 至 2022.12.31 23:59:59 22 + <view wx:if="{{item.prom_type!=3}}" class="fs26">{{item.title}}</view>
  23 + <view wx:else class="fs26">{{item.title}}
  24 + 消费满<text class="c-red">{{item.condition}}</text>享优惠({{item.limit}})
49 </view> 25 </view>
50 - </view>  
51 - <view class="xq_btn fs30">详情</view> 26 + <view wx:if="{{item.prom_type!=5}}" class="fs26">搭配价:<text class="c-red">{{item.show_price}}</text></view>
52 27
53 - </view>  
54 - <!-- 组合购 -->  
55 - <view class="item_pro flex ai-center">  
56 - <view class="tab_bx fs24">组合</view>  
57 - <view class="item_pro_left flex jc-center ai-center">  
58 - <view class="fs36 left_f_box">组合购</view>  
59 - </view>  
60 -  
61 - <view class="item_pro_right">  
62 - <view class="fs26">活动名称</view>  
63 - <view class="fs22" style="color: #b9b6b6">  
64 - 2022.12.19 00:00:00 至 2022.12.31 23:59:59 28 + <view wx:if="{{item.prom_type!=3}}" class="fs22" style="color: #b9b6b6">
  29 + {{item.show_time}}
65 </view> 30 </view>
66 - </view>  
67 - <view class="xq_btn fs30">详情</view>  
68 -  
69 - </view>  
70 - <!-- 阶梯促销 -->  
71 - <view class="item_pro flex ai-center">  
72 - <view class="tab_bx fs24">阶梯</view>  
73 - <view class="item_pro_left flex jc-center ai-center">  
74 - <view class="fs36 left_f_box">阶梯促销</view>  
75 - </view>  
76 -  
77 - <view class="item_pro_right">  
78 - <view class="fs26">第1件8折,第2件7折,第3件6折</view>  
79 - <view class="fs22" style="color: #b9b6b6">  
80 - 2022.12.19 00:00:00 至 2022.12.31 23:59:59 31 + <view wx:else class="fs22" style="max-width: 430rpx; color: #b9b6b6">
  32 + <text wx:for="{{item.more}}" wx:for-item="bm" class="tick pdr20" >{{bm}}</text>
81 </view> 33 </view>
82 - </view>  
83 - <view class="xq_btn fs30">详情</view>  
84 34
  35 + </view>
  36 + <view bindtap="go_the_url" data-id="{{item.id}}" data-prom_type="{{item.prom_type}}" class="xq_btn fs30">详情</view>
85 </view> 37 </view>
86 38
87 -  
88 </view> 39 </view>
89 </view> 40 </view>
90 </view> 41 </view>
packageE/pages/cart/cart2/cart2.js
@@ -925,10 +925,9 @@ Page({ @@ -925,10 +925,9 @@ Page({
925 } 925 }
926 } 926 }
927 927
928 - //-- 判断一下,获取搭配购的消息 --  
929 - if ((item1.prom_type == 0 || item1.prom_type == 5) && (!carr[i].collocationList || !carr[i].collocationList.length)) {  
930 -  
931 - await th.set_collection(item1, carr, i); 928 + //-- 判断一下,获取搭配购的消息,只有prom_type==5才会判断优惠活动 --
  929 + if ( item1.prom_type == 5 && (!carr[i].collocationList || !carr[i].collocationList.length)) {
  930 + await th.set_collection(item1, carr, i);
932 } 931 }
933 } 932 }
934 933
@@ -1006,8 +1005,6 @@ Page({ @@ -1006,8 +1005,6 @@ Page({
1006 } 1005 }
1007 } 1006 }
1008 1007
1009 -  
1010 -  
1011 find = 1; 1008 find = 1;
1012 break; 1009 break;
1013 } 1010 }
@@ -1061,7 +1058,6 @@ Page({ @@ -1061,7 +1058,6 @@ Page({
1061 } 1058 }
1062 } 1059 }
1063 1060
1064 -  
1065 var ie = { 1061 var ie = {
1066 pickup_id: pcid, 1062 pickup_id: pcid,
1067 pname: pikname, 1063 pname: pikname,
@@ -1081,9 +1077,7 @@ Page({ @@ -1081,9 +1077,7 @@ Page({
1081 1077
1082 //-- 把等级卡会优惠多少钱装进去 -- 1078 //-- 把等级卡会优惠多少钱装进去 --
1083 if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1; 1079 if (car_item.cut_price1) ie.card_cut_price += car_item.cut_price1;
1084 -  
1085 if (car_item.collocationList) { 1080 if (car_item.collocationList) {
1086 -  
1087 ie.collocationList = car_item.collocationList; 1081 ie.collocationList = car_item.collocationList;
1088 } 1082 }
1089 1083
@@ -1172,7 +1166,7 @@ Page({ @@ -1172,7 +1166,7 @@ Page({
1172 } 1166 }
1173 1167
1174 if (cart_commission) { 1168 if (cart_commission) {
1175 - th.setData({ cart_commission }); 1169 + th.setData({ cart_commission });
1176 } 1170 }
1177 1171
1178 //每一个门店内的组合购要进行拆分, 1172 //每一个门店内的组合购要进行拆分,
@@ -1212,7 +1206,6 @@ Page({ @@ -1212,7 +1206,6 @@ Page({
1212 ladder_calc.fir_set_arr(u_item1, th); 1206 ladder_calc.fir_set_arr(u_item1, th);
1213 } 1207 }
1214 1208
1215 -  
1216 //-- 要判断总开关有没有同城配送 -- 1209 //-- 要判断总开关有没有同城配送 --
1217 if(th.data.is_same_city) { 1210 if(th.data.is_same_city) {
1218 //----- 判断每一个商品的配送方式,和门店的配送方式 ------- 1211 //----- 判断每一个商品的配送方式,和门店的配送方式 -------
@@ -1227,8 +1220,6 @@ Page({ @@ -1227,8 +1220,6 @@ Page({
1227 } 1220 }
1228 } 1221 }
1229 1222
1230 -  
1231 -  
1232 //深拷贝 1223 //深拷贝
1233 th.data.old_cartlist = JSON.parse(JSON.stringify(arr)); 1224 th.data.old_cartlist = JSON.parse(JSON.stringify(arr));
1234 th.setData({ 1225 th.setData({
@@ -1252,6 +1243,7 @@ Page({ @@ -1252,6 +1243,7 @@ Page({
1252 }); 1243 });
1253 }, 1244 },
1254 1245
  1246 +
1255 //-----获取立即购买的商品信息,入口---- 1247 //-----获取立即购买的商品信息,入口----
1256 get_buy_goods: function (e) { 1248 get_buy_goods: function (e) {
1257 var th = this; 1249 var th = this;
@@ -1358,8 +1350,6 @@ Page({ @@ -1358,8 +1350,6 @@ Page({
1358 th.setData({ card_cut_price: cut_p }); 1350 th.setData({ card_cut_price: cut_p });
1359 } 1351 }
1360 } 1352 }
1361 -  
1362 -  
1363 1353
1364 //-- 当是搭配购的时候 -- 1354 //-- 当是搭配购的时候 --
1365 gd.prom_type = gg.prom_type ? gg.prom_type : 0; 1355 gd.prom_type = gg.prom_type ? gg.prom_type : 0;
@@ -1760,6 +1750,37 @@ Page({ @@ -1760,6 +1750,37 @@ Page({
1760 } 1750 }
1761 }, 1751 },
1762 1752
  1753 + //-- 立即购买的时候,获取商品优惠活动 --
  1754 + async buy_pro_group(gd){
  1755 + var url = '/api/weshop/activitylist/listGoodActInfo2New';
  1756 + var user_id=getApp().globalData.user_id;
  1757 + var zh_id=0;
  1758 + var req_d = {
  1759 + "store_id": os.stoid,
  1760 + "goods_id": gd.goods_id,
  1761 + "user_id": user_id,
  1762 + }
  1763 +
  1764 + await getApp().request.promiseGet(url, {}).then(res=>{
  1765 +
  1766 + })
  1767 +
  1768 + //-- 如果有组合购的时候,同时还要判断单件商品的购买数量有没有满足组合购的条件 --
  1769 + if(zh_id){
  1770 + //获取活动信息
  1771 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + zh_id + "/" + user_id;
  1772 + getApp().request.promiseGet(url, {
  1773 +
  1774 + })
  1775 + }
  1776 +
  1777 + //调用接口判断订单优惠,
  1778 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gd.goods_id + "/0" + "/" + user_id, {
  1779 + }).then(async res=>{
  1780 +
  1781 + });
  1782 + },
  1783 +
1763 //---------------检查是否有收货地址------------------- 1784 //---------------检查是否有收货地址-------------------
1764 checkAddressList: function () { 1785 checkAddressList: function () {
1765 var t = this; 1786 var t = this;
@@ -1975,8 +1996,6 @@ Page({ @@ -1975,8 +1996,6 @@ Page({
1975 } 1996 }
1976 1997
1977 1998
1978 -  
1979 - //-- --  
1980 if (item_map.price != undefined && item_map.price != null 1999 if (item_map.price != undefined && item_map.price != null
1981 && item_map.prom_price != undefined && item_map.prom_price != null) 2000 && item_map.prom_price != undefined && item_map.prom_price != null)
1982 cart_item.cut_price += (item_map.price - item_map.prom_price); 2001 cart_item.cut_price += (item_map.price - item_map.prom_price);
pages/goods/goodsInfo/goodsInfo.js
@@ -1209,10 +1209,6 @@ Page({ @@ -1209,10 +1209,6 @@ Page({
1209 this.data.enterAddressPage && (this.data.enterAddressPage = !1); 1209 this.data.enterAddressPage && (this.data.enterAddressPage = !1);
1210 1210
1211 1211
1212 - setTimeout(()=>{  
1213 - var pro_pop = this.selectComponent("#pro_pop"); //组件的id  
1214 - pro_pop.set_init();  
1215 - },1500)  
1216 1212
1217 1213
1218 1214
@@ -1550,8 +1546,11 @@ Page({ @@ -1550,8 +1546,11 @@ Page({
1550 }, 1546 },
1551 //优惠促销用户参与次数 1547 //优惠促销用户参与次数
1552 async getUserBuyPromNum_pre(prom_id){ 1548 async getUserBuyPromNum_pre(prom_id){
  1549 + var user_id=0
1553 var userInfo = getApp().globalData.userInfo; 1550 var userInfo = getApp().globalData.userInfo;
1554 - 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}`; 1551 + if(userInfo) user_id=userInfo.user_id;
  1552 +
  1553 + var url = `/api/weshop/ordergoods/getUserBuyPromNum?is_all=1&store_id=${os.stoid}&user_id=${user_id}&prom_type=3&prom_id=${prom_id}`;
1555 let res = await getApp().request.promiseGet(url, { 1554 let res = await getApp().request.promiseGet(url, {
1556 data:{} 1555 data:{}
1557 }); 1556 });
@@ -1628,11 +1627,8 @@ Page({ @@ -1628,11 +1627,8 @@ Page({
1628 prom_type: th.data.sele_g.prom_type, 1627 prom_type: th.data.sele_g.prom_type,
1629 }; 1628 };
1630 1629
1631 -  
1632 -  
1633 -  
1634 //-- 代发商品不参加优惠 -- 1630 //-- 代发商品不参加优惠 --
1635 - if (th.data.sele_g.whsle_id && newd.prom_type == 3) { 1631 + if (th.data.sele_g.whsle_id) {
1636 newd.prom_type = 0; 1632 newd.prom_type = 0;
1637 newd.prom_id = 0; 1633 newd.prom_id = 0;
1638 } 1634 }
@@ -1673,6 +1669,8 @@ Page({ @@ -1673,6 +1669,8 @@ Page({
1673 newd.pricing_type = o.pricing_type; 1669 newd.pricing_type = o.pricing_type;
1674 } 1670 }
1675 1671
  1672 +
  1673 + //获取到优惠测序类型
1676 //-----如果是秒杀,团购,积分购,拼团----- 1674 //-----如果是秒杀,团购,积分购,拼团-----
1677 if (th.data.prom_type == 1 || th.data.prom_type == 2) { 1675 if (th.data.prom_type == 1 || th.data.prom_type == 2) {
1678 1676
@@ -1681,7 +1679,6 @@ Page({ @@ -1681,7 +1679,6 @@ Page({
1681 newd.prom_type = 0; 1679 newd.prom_type = 0;
1682 newd.prom_id = 0; 1680 newd.prom_id = 0;
1683 newd.is_pd_normal = 1; 1681 newd.is_pd_normal = 1;
1684 -  
1685 //---如果是线下门店销售的时候--- 1682 //---如果是线下门店销售的时候---
1686 if (th.data.sales_rules >= 2) { 1683 if (th.data.sales_rules >= 2) {
1687 var pick = th.get_pick_from_list(th.data.sto_sele_id) 1684 var pick = th.get_pick_from_list(th.data.sto_sele_id)
@@ -1729,10 +1726,9 @@ Page({ @@ -1729,10 +1726,9 @@ Page({
1729 return false; 1726 return false;
1730 } 1727 }
1731 1728
1732 -  
1733 newd.goods_price = th.data.prom_price; 1729 newd.goods_price = th.data.prom_price;
1734 newd.member_goods_price = th.data.prom_price, 1730 newd.member_goods_price = th.data.prom_price,
1735 - newd.prom_type = th.data.prom_type; 1731 + newd.prom_type = th.data.prom_type;
1736 newd.prom_id = th.data.prom_id; 1732 newd.prom_id = th.data.prom_id;
1737 1733
1738 if (o.store_count <= 0 ) { 1734 if (o.store_count <= 0 ) {
@@ -1752,158 +1748,17 @@ Page({ @@ -1752,158 +1748,17 @@ Page({
1752 }; 1748 };
1753 1749
1754 th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 1750 th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
1755 -  
1756 - } else if (o.prom_type == 7) {  
1757 -  
1758 - //判断进行中的活动,是不是要判断线下库存  
1759 - th.check_zh_acting(function (ee) {  
1760 - newd.prom_id = 0;  
1761 - newd.prom_type = 0;  
1762 - if (ee && th.data.sele_g.act) {  
1763 - newd.prom_id = th.data.sele_g.act.id;  
1764 - newd.prom_type = 7;  
1765 - if (o.store_count <= 0) {  
1766 - wx.showToast({  
1767 - title: '库存已为空!',  
1768 - icon: 'none',  
1769 - });  
1770 - return false;  
1771 - };  
1772 - if (o.store_count < e.data.goodsInputNum) {  
1773 - wx.showToast({  
1774 - title: '库存不足!',  
1775 - icon: 'none',  
1776 - });  
1777 - return false;  
1778 - //return s.my_warnning("库存不足!", 0, th);  
1779 - };  
1780 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
1781 - return false;  
1782 - } else {  
1783 - //---如果是线下门店销售的时候---  
1784 - if (th.data.sales_rules >= 2) {  
1785 - var pick = th.get_pick_from_list(th.data.sto_sele_id)  
1786 -  
1787 - th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {  
1788 - if (CanOutQty) {  
1789 -  
1790 - if (CanOutQty < e.data.goodsInputNum) {  
1791 - wx.showToast({  
1792 - title: '库存不足!',  
1793 - icon: 'none',  
1794 - });  
1795 - return false;  
1796 - }  
1797 -  
1798 - th.add_cart_next(e, t, a, o, newd, CanOutQty);  
1799 - } else {  
1800 - wx.showToast({  
1801 - title: '库存不足!',  
1802 - icon: 'none',  
1803 - });  
1804 - return false;  
1805 - }  
1806 - })  
1807 -  
1808 - } else {  
1809 - if (o.store_count <= 0) {  
1810 - wx.showToast({  
1811 - title: '库存已为空!',  
1812 - icon: 'none',  
1813 - });  
1814 - return false;  
1815 - //return s.my_warnning("库存已为空!", 0, th);  
1816 - };  
1817 - if (o.store_count < e.data.goodsInputNum) {  
1818 - wx.showToast({  
1819 - title: '库存不足!',  
1820 - icon: 'none',  
1821 - });  
1822 - return false;  
1823 - //return s.my_warnning("库存不足!", 0, th);  
1824 - };  
1825 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
1826 - }  
1827 - }  
1828 - })  
1829 -  
1830 } 1751 }
1831 1752
1832 - //要包含积分购的普通购买  
1833 - 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) { 1753 + //要包含积分购的普通购买0 3,5,7,10
  1754 + else if ( [0,3,5,7,10].indexOf(th.data.prom_type)>-1 || prom.prom_type == 7) {
1834 newd.prom_type = 0; 1755 newd.prom_type = 0;
1835 newd.prom_id = 0; 1756 newd.prom_id = 0;
1836 1757
1837 - if (th.data.prom_type == 10) {  
1838 - newd.prom_type = th.data.prom_type;  
1839 - newd.prom_id = th.data.prom_id;  
1840 - }  
1841 -  
1842 //---如果是线下门店销售的时候--- 1758 //---如果是线下门店销售的时候---
1843 if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) { 1759 if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) {
1844 var pick = th.get_pick_from_list(th.data.sto_sele_id) 1760 var pick = th.get_pick_from_list(th.data.sto_sele_id)
1845 //---通过接口获取门店的线下库存信息-- 1761 //---通过接口获取门店的线下库存信息--
1846 - // getApp().request.get("/api/weshop/goods/getWareStorages", {  
1847 - // data: {  
1848 - // storageNos: pick.pickup_no,  
1849 - // wareIds: encodeURIComponent(th.data.sele_g.erpwareid),  
1850 - // storeId: os.stoid  
1851 - // },  
1852 - // success: function (res) {  
1853 - // if (res.data.code == 0) {  
1854 - // if (res.data.data.pageData.length > 0) {  
1855 - // var CanOutQty = res.data.data.pageData[0].CanOutQty;  
1856 - // if (CanOutQty < e.data.goodsInputNum) {  
1857 - // wx.showToast({  
1858 - // title: '库存不足!',  
1859 - // icon: 'none',  
1860 - // });  
1861 - // return false;  
1862 - // //return s.my_warnning("库存不足!", 0, th);  
1863 - // }  
1864 - // //在调一次接口,读取商品的预出库的数量,lock  
1865 - // getApp().request.get("/api/weshop/order/ware/lock/page", {  
1866 - // data: {  
1867 - // store_id: os.stoid,  
1868 - // wareId: th.data.sele_g.goods_id,  
1869 - // storageId: pick.pickup_id,  
1870 - // pageSize: 1000  
1871 - // },  
1872 - // success: function (res_data) {  
1873 - // if (res_data.data.code == 0 && res_data.data.data.total > 0) {  
1874 - //  
1875 - // var lock = 0;  
1876 - // for (var i in res_data.data.data.pageData) {  
1877 - // lock += res_data.data.data.pageData[i].outQty;  
1878 - // }  
1879 - //  
1880 - // if (CanOutQty <= lock) {  
1881 - // wx.showToast({  
1882 - // title: '库存不足!',  
1883 - // icon: 'none',  
1884 - // });  
1885 - // return false;  
1886 - // //return s.my_warnning("库存不足!", 0, th);  
1887 - // }  
1888 - // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);  
1889 - // } else {  
1890 - // th.add_cart_next(e, t, a, o, newd, CanOutQty);  
1891 - // }  
1892 - // }  
1893 - // })  
1894 - // } else {  
1895 - // wx.showToast({  
1896 - // title: '库存不足!',  
1897 - // icon: 'none',  
1898 - // });  
1899 - // return false;  
1900 - // //return s.my_warnning("库存不足!", 0, th);  
1901 - // }  
1902 - //  
1903 - // }  
1904 - // }  
1905 - // })  
1906 -  
1907 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { 1762 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
1908 if (CanOutQty) { 1763 if (CanOutQty) {
1909 1764
@@ -1981,24 +1836,22 @@ Page({ @@ -1981,24 +1836,22 @@ Page({
1981 1836
1982 //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d); 1837 //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);
1983 if ("add" == t.currentTarget.dataset.action) { 1838 if ("add" == t.currentTarget.dataset.action) {
1984 -  
1985 -  
1986 - if( [3,5,10].indexOf(newd.prom_type)>-1){  
1987 - newd.prom_type=0;  
1988 - newd.prom_id=0;  
1989 - }  
1990 -  
1991 - //如果有搭配购的时候的时候  
1992 - if(th.data.collocationGoods && newd.prom_type==0){  
1993 - newd.prom_type = 5;  
1994 - newd.prom_id = th.data.collocationGoods.id;  
1995 - }  
1996 -  
1997 - //如果有搭配购的时候的时候  
1998 - 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){  
1999 - newd.prom_type = 7;  
2000 - newd.prom_id = th.data.zh_act.id;  
2001 - } 1839 + // if( [3,5,10].indexOf(newd.prom_type)>-1){
  1840 + // newd.prom_type=0;
  1841 + // newd.prom_id=0;
  1842 + // }
  1843 + //
  1844 + // //如果有搭配购的时候的时候
  1845 + // if(th.data.collocationGoods && newd.prom_type==0){
  1846 + // newd.prom_type = 5;
  1847 + // newd.prom_id = th.data.collocationGoods.id;
  1848 + // }
  1849 + //
  1850 + // //如果有搭配购的时候的时候
  1851 + // 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){
  1852 + // newd.prom_type = 7;
  1853 + // newd.prom_id = th.data.zh_act.id;
  1854 + // }
2002 1855
2003 //----先看会员在购物车中是否加入了该商品----- 1856 //----先看会员在购物车中是否加入了该商品-----
2004 i.get("/api/weshop/cart/page", { 1857 i.get("/api/weshop/cart/page", {
@@ -2033,7 +1886,6 @@ Page({ @@ -2033,7 +1886,6 @@ Page({
2033 1886
2034 if(item){ 1887 if(item){
2035 item = re.data.data.pageData[0]; 1888 item = re.data.data.pageData[0];
2036 -  
2037 //判断数量,要看下购物车中有没有该商品 1889 //判断数量,要看下购物车中有没有该商品
2038 if (CanOutQty) { 1890 if (CanOutQty) {
2039 if (item.goods_num + th.data.goodsInputNum > CanOutQty) { 1891 if (item.goods_num + th.data.goodsInputNum > CanOutQty) {
@@ -2087,7 +1939,6 @@ Page({ @@ -2087,7 +1939,6 @@ Page({
2087 updata['groupchat_id'] = getApp().globalData.groupchat_id; 1939 updata['groupchat_id'] = getApp().globalData.groupchat_id;
2088 } 1940 }
2089 1941
2090 -  
2091 getApp().request.put("/api/weshop/cart/update", { 1942 getApp().request.put("/api/weshop/cart/update", {
2092 data: updata, 1943 data: updata,
2093 success: function (t) { 1944 success: function (t) {
@@ -2115,196 +1966,14 @@ Page({ @@ -2115,196 +1966,14 @@ Page({
2115 } 1966 }
2116 }); 1967 });
2117 1968
2118 - } else {  
2119 -  
2120 - //-- 这一步主要是要让立即购买 走 购物车的逻辑 参与活动,如果有zh_act就强制组合购购买 --  
2121 - if(th.data.zh_act  
2122 - && th.data.zh_act.zhbuyqty <= th.data.goodsInputNum){  
2123 - wx.hideLoading();  
2124 -  
2125 - if((th.data.zh_act.buy_limit !=0 && th.data.zh_act.buy_limit <= th.data.userbuynum)){  
2126 - wx.showModal({  
2127 - title: '提示',  
2128 - // content: `商品${str},组合购活动,购买次数已超,将以普通商品购买?`,  
2129 - content: `${th.data.data.goods_name}超出组合购限购次数,将以普通商品购买`,  
2130 - success:res=>{  
2131 - if (res.confirm) {  
2132 - console.log('用户点击确定')  
2133 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
2134 - getApp().request.get("/api/weshop/cart/page", {  
2135 - data: {  
2136 - store_id: os.stoid,  
2137 - user_id: oo.user_id,  
2138 - state: 1  
2139 - },  
2140 - success: function (res) {  
2141 - //-------如果购物车中有相关的数据---------  
2142 - if (res.data.code == 0 && res.data.data.total > 0) {  
2143 - for (let j in res.data.data.pageData) {  
2144 - let item_j = res.data.data.pageData[j];  
2145 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
2146 - getApp().request.delete(url, {});  
2147 - }  
2148 - }  
2149 - newd.state = 1;  
2150 - newd.prom_type=0;  
2151 - newd.prom_id=0  
2152 - getApp().request.post("/api/weshop/cart/save", {  
2153 - data: newd,  
2154 - success: function (t) {  
2155 - th.closeSpecModal();  
2156 - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");  
2157 - }  
2158 - });  
2159 - }  
2160 - })  
2161 - } else if (res.cancel) {  
2162 -  
2163 - console.log('用户点击取消')  
2164 - }  
2165 - }  
2166 - })  
2167 - }else{  
2168 -  
2169 -  
2170 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
2171 - getApp().request.get("/api/weshop/cart/page", {  
2172 - data: {  
2173 - store_id: os.stoid,  
2174 - user_id: oo.user_id,  
2175 - state: 1  
2176 - },  
2177 - success: function (res) {  
2178 - //-------如果购物车中有相关的数据,先清理掉---------  
2179 - if (res.data.code == 0 && res.data.data.total > 0) {  
2180 - for (let j in res.data.data.pageData) {  
2181 - let item_j = res.data.data.pageData[j];  
2182 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
2183 - getApp().request.delete(url, {});  
2184 - }  
2185 - }  
2186 -  
2187 - newd.state = 1;  
2188 - newd.prom_type=7;  
2189 - newd.prom_id=th.data.zh_act.id;  
2190 - getApp().request.post("/api/weshop/cart/save", {  
2191 - data: newd,  
2192 - success: function (t) {  
2193 - th.closeSpecModal();  
2194 - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");  
2195 - }  
2196 - });  
2197 -  
2198 - }  
2199 - })  
2200 - }  
2201 -  
2202 -  
2203 - return false  
2204 - }else{  
2205 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
2206 - getApp().request.get("/api/weshop/cart/page", {  
2207 - data: {  
2208 - store_id: os.stoid,  
2209 - user_id: oo.user_id,  
2210 - state: 1  
2211 - },  
2212 - success: function (res) {  
2213 - //-------如果购物车中有相关的数据---------  
2214 - if (res.data.code == 0 && res.data.data.total > 0) {  
2215 - for (let j in res.data.data.pageData) {  
2216 - let item_j = res.data.data.pageData[j];  
2217 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
2218 - getApp().request.delete(url, {});  
2219 - }  
2220 - }  
2221 -  
2222 - }  
2223 - })  
2224 -  
2225 - }  
2226 -  
2227 - if (th.data.prom_goods && newd.prom_type!=4 && newd.prom_type!=6 ) {  
2228 - var prom_d = th.data.prom_goods;  
2229 - for (var i in prom_d) {  
2230 - //判断活动有俩种条件,0元 1件  
2231 - var condition_t = prom_d[i].prom_type;  
2232 - switch (condition_t) {  
2233 - case 0: //按钱  
2234 - if (newd.goods_price >= condition_t) {  
2235 - newd.prom_type = 3;  
2236 - newd.prom_id = prom_d[i].prom_id;  
2237 - }  
2238 - break  
2239 - case 1: //按购买数量  
2240 - if (newd.goods_num >= condition_t) {  
2241 - newd.prom_type = 3;  
2242 - newd.prom_id = prom_d[i].prom_id;  
2243 - }  
2244 - break;  
2245 - }  
2246 - }  
2247 - }  
2248 - //如果有阶梯促销的时候  
2249 - if(th.data.jieti_prom && (newd.prom_type==10 || newd.prom_type==0) ){  
2250 - newd.prom_type = 10;  
2251 - newd.prom_id = th.data.ladder_act_id; 1969 + }else{
2252 1970
2253 -  
2254 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
2255 - getApp().request.get("/api/weshop/cart/page", {  
2256 - data: {  
2257 - store_id: os.stoid,  
2258 - user_id: oo.user_id,  
2259 - state: 1  
2260 - },  
2261 - success: function (res) {  
2262 - //-------如果购物车中有相关的数据,先清理掉---------  
2263 - if (res.data.code == 0 && res.data.data.total > 0) {  
2264 - for (let j in res.data.data.pageData) {  
2265 - let item_j = res.data.data.pageData[j];  
2266 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
2267 - getApp().request.delete(url, {});  
2268 - }  
2269 - }  
2270 -  
2271 - newd.state = 1;  
2272 - getApp().request.post("/api/weshop/cart/save", {  
2273 - data: newd,  
2274 - success: function (t) {  
2275 - th.closeSpecModal();  
2276 - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");  
2277 - }  
2278 - });  
2279 -  
2280 - }  
2281 - })  
2282 - return false;  
2283 -  
2284 - }  
2285 -  
2286 -  
2287 - //如果有搭配购的时候的时候  
2288 - if(th.data.collocationGoods && newd.prom_type==0){  
2289 - newd.prom_type = 5;  
2290 - newd.prom_id = th.data.collocationGoods.id;  
2291 - newd.is_coupon= th.data.collocationGoods.is_coupon;  
2292 -  
2293 - }  
2294 -  
2295 - //如果有搭配购的时候的时候  
2296 - if(th.data.zh_act && (newd.prom_type==0 || newd.prom_type==3)){  
2297 - newd.prom_type = 7;  
2298 - newd.prom_id = th.data.zh_act.id;  
2299 - }  
2300 -  
2301 - //如果有搭配购的时候的时候  
2302 - if(th.data.jt && newd.prom_type==0){  
2303 - newd.prom_type = 7;  
2304 - newd.prom_id = th.data.zh_act.id; 1971 + //-- 优惠促销的商品,立即购买就判断了,就直接购买 --
  1972 + if([1,2,4,6].indexOf(newd.prom_type)==-1){
  1973 + newd.prom_type=0;
  1974 + newd.id=0;
2305 } 1975 }
2306 1976
2307 -  
2308 newd['pick_name'] = th.data.sto_sele_name; 1977 newd['pick_name'] = th.data.sto_sele_name;
2309 newd['pick_dis'] = th.data.sto_sele_distr; 1978 newd['pick_dis'] = th.data.sto_sele_distr;
2310 th.buyNow(newd); 1979 th.buyNow(newd);
@@ -2314,7 +1983,6 @@ Page({ @@ -2314,7 +1983,6 @@ Page({
2314 //因为在购物车 普通商品和 优惠促销,搭配购,组合购 阶梯购是一样的 1983 //因为在购物车 普通商品和 优惠促销,搭配购,组合购 阶梯购是一样的
2315 check_is_like(e,newd,idx){ 1984 check_is_like(e,newd,idx){
2316 if(e.prom_type ==newd.prom_type) return true; 1985 if(e.prom_type ==newd.prom_type) return true;
2317 -  
2318 if(!idx) { 1986 if(!idx) {
2319 if (e.prom_type == 0) { 1987 if (e.prom_type == 0) {
2320 if ([3, 5, 7, 10].indexOf(newd.prom_type) > -1) return true; 1988 if ([3, 5, 7, 10].indexOf(newd.prom_type) > -1) return true;
@@ -2365,40 +2033,55 @@ Page({ @@ -2365,40 +2033,55 @@ Page({
2365 } else { 2033 } else {
2366 //要判断积分购的普通购买有没有参加优惠活动 2034 //要判断积分购的普通购买有没有参加优惠活动
2367 if (e.is_integral_normal == 1 || e.is_pd_normal == 1) { 2035 if (e.is_integral_normal == 1 || e.is_pd_normal == 1) {
2368 - this.check_nor_promgood(e.goods_id, function (res) {  
2369 - if (res && res.cat_id) {  
2370 - e.prom_type = 3;  
2371 - e.prom_id = res.cat_id  
2372 - }  
2373 - s.set_b_now(e);  
2374 - /*--  
2375 - wx.redirectTo({  
2376 - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,  
2377 - });--*/  
2378 - getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id) 2036 + e.prom_type = 0;
  2037 + e.prom_id = 0
2379 2038
2380 - })  
2381 - } else {  
2382 - //搭配购特殊处理  
2383 - if( [3,5,7,10].indexOf(th.data.data.prom_type)>-1){  
2384 - e.prom_type=th.data.data.prom_type  
2385 - e.prom_id=th.data.data.prom_id  
2386 - e.collocation_goods=[]  
2387 - } 2039 + }
2388 2040
2389 - if(th.data.collocationGoods){  
2390 - e.prom_type=5  
2391 - e.prom_id=th.data.collocationGoods.id  
2392 - }  
2393 -  
2394 - s.set_b_now(e);  
2395 - /*--  
2396 - wx.redirectTo({  
2397 - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,  
2398 - });--*/  
2399 - getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id) 2041 + //秒杀等活动的直接跳转到cart2中的立即购买
  2042 + if([1,2,4,6].indexOf(e.prom_type)>-1){
  2043 + s.set_b_now(e);
  2044 + getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id)
  2045 + }else {
  2046 +
  2047 + //----其他就按照公众号的购物车立即购买形式来修改,先看会员在购物车中是否加入了该商品,立即购买的-----
  2048 + getApp().request.get("/api/weshop/cart/page", {
  2049 + data: {
  2050 + store_id: os.stoid,
  2051 + user_id: oo.user_id,
  2052 + state: 1
  2053 + },
  2054 + success: function (res) {
  2055 + //-------如果购物车中有相关的数据---------
  2056 + if (res.data.code == 0 && res.data.data.total > 0) {
  2057 + for (let j in res.data.data.pageData) {
  2058 + let item_j = res.data.data.pageData[j];
  2059 + var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id;
  2060 + getApp().request.delete(url, {});
  2061 + }
  2062 + }
  2063 +
  2064 + //-- 推迟一下,因为删除没有那么快 --
  2065 + setTimeout( ()=>{
  2066 + e.state = 1;
  2067 + e.prom_type = 0;
  2068 + e.prom_id = 0
  2069 + getApp().request.post("/api/weshop/cart/save", {
  2070 + data: e,
  2071 + success: function (t) {
  2072 + th.closeSpecModal();
  2073 + getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");
  2074 + }
  2075 + });
  2076 + },500)
  2077 +
  2078 + }
  2079 + })
2400 } 2080 }
2401 2081
  2082 +
  2083 +
  2084 +
2402 } 2085 }
2403 }, 2086 },
2404 2087
@@ -7371,12 +7054,12 @@ Page({ @@ -7371,12 +7054,12 @@ Page({
7371 7054
7372 //-- 如果有组合购的时候 -- 7055 //-- 如果有组合购的时候 --
7373 if(th.data.zh_act){ 7056 if(th.data.zh_act){
  7057 + var show_time=ut.formatTime(th.data.zh_act.start_time)+"至"+ ut.formatTime(th.data.zh_act.end_time);
7374 //-- 开始组装数据 -- 7058 //-- 开始组装数据 --
7375 th.add_cx_prom_group({ 7059 th.add_cx_prom_group({
7376 - id: fir_act.prom_id,  
7377 - condition: fir_act.condition + (item.prom_type == 1 ? '件' : '元'),  
7378 - limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),  
7379 - more: more_arr, 7060 + id: th.data.zh_act.id,
  7061 + title: th.data.zh_act.name,
  7062 + show_time: show_time,
7380 prom_type:7 7063 prom_type:7
7381 }); 7064 });
7382 } 7065 }
@@ -7431,10 +7114,11 @@ Page({ @@ -7431,10 +7114,11 @@ Page({
7431 7114
7432 // th.data.prom_type = 10; 7115 // th.data.prom_type = 10;
7433 // th.data.prom_id = act_id; 7116 // th.data.prom_id = act_id;
7434 - // th.setData({  
7435 - // jieti_prom: prom_content,  
7436 - // ladder_act_id: act_id  
7437 - // }) 7117 +
  7118 + th.setData({
  7119 + jieti_prom: prom_content,
  7120 + ladder_act_id: act_id
  7121 + })
7438 7122
7439 var s_time=res.data.data.start_time; 7123 var s_time=res.data.data.start_time;
7440 var e_time=res.data.data.end_time; 7124 var e_time=res.data.data.end_time;
@@ -7451,34 +7135,41 @@ Page({ @@ -7451,34 +7135,41 @@ Page({
7451 7135
7452 //优惠促销的时候 7136 //优惠促销的时候
7453 if (r_data.promGoodsLists) { 7137 if (r_data.promGoodsLists) {
  7138 +
7454 var fir_act = r_data.promGoodsLists[0]; 7139 var fir_act = r_data.promGoodsLists[0];
7455 - var more_arr = [];  
7456 - //减价  
7457 - if (fir_act.money > 0) more_arr.push('减价'+fir_act.money+'元');  
7458 - if (fir_act.sale > 0) more_arr.push('打'+fir_act.sale+'折');  
7459 - if (fir_act.past ==1) more_arr.push('包邮');  
7460 - if (fir_act.intValue > 0) more_arr.push('送'+fir_act.intValue+'积分');  
7461 - if (fir_act.couponId > 0) more_arr.push('送'+fir_act.couponMoney+'元优惠券');  
7462 - if (fir_act.gift_id) {  
7463 - var is_more_gf=fir_act.gift_id.split(',')  
7464 - if(is_more_gf.length>1){  
7465 - more_arr.push('送赠品');  
7466 - }else{  
7467 - more_arr.push('送'+fir_act.goods_name+' x'+fir_act.zp_num);  
7468 - }  
7469 - }  
7470 - if (fir_act.lb_id) more_arr.push('送'+fir_act.lbtitle);  
7471 - if (fir_act.zxlb_id) more_arr.push('送'+fir_act.zxlbtitle); 7140 + //-- 计算一下限购,满足限购数才显示 --
  7141 + await this.getUserBuyPromNum_pre(fir_act.prom_id);
  7142 +
  7143 + if(!fir_act.limit_num || th.data.user_pre_buynum<fir_act.limit_num){
  7144 + var more_arr = [];
  7145 + //减价
  7146 + if (fir_act.money > 0) more_arr.push('减价'+fir_act.money+'元');
  7147 + if (fir_act.sale > 0) more_arr.push('打'+fir_act.sale+'折');
  7148 + if (fir_act.past ==1) more_arr.push('包邮');
  7149 + if (fir_act.intValue > 0) more_arr.push('送'+fir_act.intValue+'积分');
  7150 + if (fir_act.couponId > 0) more_arr.push('送'+fir_act.couponMoney+'元优惠券');
  7151 + if (fir_act.gift_id) {
  7152 + var is_more_gf=fir_act.gift_id.split(',')
  7153 + if(is_more_gf.length>1){
  7154 + more_arr.push('送赠品');
  7155 + }else{
  7156 + more_arr.push('送'+fir_act.goods_name+' x'+fir_act.zp_num);
  7157 + }
  7158 + }
  7159 + if (fir_act.lb_id) more_arr.push('送'+fir_act.lbtitle);
  7160 + if (fir_act.zxlb_id) more_arr.push('送'+fir_act.zxlbtitle);
  7161 +
  7162 + //-- 开始组装数据 --
  7163 + th.add_cx_prom_group( {
  7164 + id: fir_act.prom_id,
  7165 + condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'),
  7166 + limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
  7167 + more: more_arr,
  7168 + prom_type:3
7472 7169
7473 - //-- 开始组装数据 --  
7474 - th.add_cx_prom_group( {  
7475 - id: fir_act.prom_id,  
7476 - condition: fir_act.condition + (item.prom_type == 1 ? '件' : '元'),  
7477 - limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),  
7478 - more: more_arr,  
7479 - prom_type:3 7170 + });
  7171 + }
7480 7172
7481 - });  
7482 } 7173 }
7483 7174
7484 //普通购买不在界面显示 7175 //普通购买不在界面显示
@@ -7497,9 +7188,6 @@ Page({ @@ -7497,9 +7188,6 @@ Page({
7497 } 7188 }
7498 }) 7189 })
7499 7190
7500 -  
7501 -  
7502 -  
7503 }, 7191 },
7504 7192
7505 //获取促销活动的组合 7193 //获取促销活动的组合
@@ -7511,7 +7199,7 @@ Page({ @@ -7511,7 +7199,7 @@ Page({
7511 var auto_promote_sale=json_d.auto_promote_sale; 7199 var auto_promote_sale=json_d.auto_promote_sale;
7512 if(auto_promote_sale){ 7200 if(auto_promote_sale){
7513 var auto_promote_sale=auto_promote_sale.split(','); 7201 var auto_promote_sale=auto_promote_sale.split(',');
7514 - var fd=auto_promote_sale.indexOf(data.prom_type); 7202 + var fd=auto_promote_sale.indexOf(data.prom_type+'');
7515 data.sort=fd; 7203 data.sort=fd;
7516 }else{ 7204 }else{
7517 data.sort=data.prom_type; 7205 data.sort=data.prom_type;
@@ -7531,7 +7219,7 @@ Page({ @@ -7531,7 +7219,7 @@ Page({
7531 function comp(a, b) { 7219 function comp(a, b) {
7532 return a.sort-b.sort; //升序 7220 return a.sort-b.sort; //升序
7533 } 7221 }
7534 - var ppdata = this.data.cx_prom_group; 7222 + var ppdata = th.data.cx_prom_group;
7535 //使用sort排序 7223 //使用sort排序
7536 ppdata.sort(comp); 7224 ppdata.sort(comp);
7537 7225
@@ -7543,9 +7231,25 @@ Page({ @@ -7543,9 +7231,25 @@ Page({
7543 }, 7231 },
7544 7232
7545 //-- 获取默认的促销活动的默认活动 -- 7233 //-- 获取默认的促销活动的默认活动 --
7546 - check_prom_custom() {  
7547 - if (!this.data.cx_prom_group.length) return 3;  
7548 - return data[0].prom_type; 7234 + check_prom_custom(ind) {
  7235 + if(ind){
  7236 + if (!this.data.cx_prom_group.length) return 0;
  7237 + }else{
  7238 + if (!this.data.cx_prom_group.length) return {prom_type:0,id:0};
  7239 + }
  7240 + var prom=null;
  7241 + //-- 看有没有选中的活动 --
  7242 + var fd=this.data.cx_prom_group.findIndex(function (a){
  7243 + return a.sele==1;
  7244 + })
  7245 +
  7246 + prom=this.data.cx_prom_group[0];
  7247 + if(fd>-1) prom=this.data.cx_prom_group[fd];
  7248 +
  7249 + if(ind) {
  7250 + return prom.prom_type;
  7251 + }
  7252 + return prom;
7549 }, 7253 },
7550 7254
7551 closePoster() { 7255 closePoster() {
@@ -7569,7 +7273,7 @@ Page({ @@ -7569,7 +7273,7 @@ Page({
7569 var prom_goods = this.data.prom_goods; 7273 var prom_goods = this.data.prom_goods;
7570 if(!prom_goods) return false; 7274 if(!prom_goods) return false;
7571 //如果系统默认的顺序不是以优惠促销为默认第一位的时候 7275 //如果系统默认的顺序不是以优惠促销为默认第一位的时候
7572 - if(th.check_prom_custom()!==3){ 7276 + if(this.check_prom_custom(1)!==3){
7573 return false; 7277 return false;
7574 } 7278 }
7575 var per_price = this.data.sele_g.shop_price 7279 var per_price = this.data.sele_g.shop_price
@@ -7595,9 +7299,9 @@ Page({ @@ -7595,9 +7299,9 @@ Page({
7595 } 7299 }
7596 } 7300 }
7597 //获取用户参与优惠促销的次数 7301 //获取用户参与优惠促销的次数
7598 - if(con && con.prom_id){  
7599 - await this.getUserBuyPromNum_pre(con.prom_id);  
7600 - } 7302 + //if(con && con.prom_id){
  7303 + //await this.getUserBuyPromNum_pre(con.prom_id);
  7304 + //}
7601 this.setData({ 7305 this.setData({
7602 hui_condition: con 7306 hui_condition: con
7603 }); 7307 });
@@ -7815,9 +7519,10 @@ Page({ @@ -7815,9 +7519,10 @@ Page({
7815 item = this.data.sele_g; 7519 item = this.data.sele_g;
7816 } 7520 }
7817 7521
  7522 + var prom_id=this.check_prom_custom().id;
7818 7523
7819 //如果有组合购 7524 //如果有组合购
7820 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id; 7525 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + prom_id + "/" + getApp().globalData.user_id;
7821 getApp().request.promiseGet(url, {}).then(res => { 7526 getApp().request.promiseGet(url, {}).then(res => {
7822 if (res.data.code == 0 && res.data.data) { 7527 if (res.data.code == 0 && res.data.data) {
7823 if (res.data.data.is_show != 1) { 7528 if (res.data.data.is_show != 1) {
@@ -8237,6 +7942,12 @@ Page({ @@ -8237,6 +7942,12 @@ Page({
8237 current: url, // 当前显示图片的http链接 7942 current: url, // 当前显示图片的http链接
8238 urls: url_arr, // 需要预览的图片http链接列表 7943 urls: url_arr, // 需要预览的图片http链接列表
8239 }); 7944 });
  7945 + },
  7946 +
  7947 + //开始显示活动的弹出
  7948 + switch_cx_group:function (){
  7949 + var pro_pop = this.selectComponent("#pro_pop"); //组件的id
  7950 + pro_pop.set_init(0,this.data.cx_prom_group);
8240 } 7951 }
8241 7952
8242 7953
pages/goods/goodsInfo/goodsInfo.wxml
@@ -637,21 +637,16 @@ @@ -637,21 +637,16 @@
637 </block> 637 </block>
638 </block> 638 </block>
639 639
640 -  
641 <!-- 新增促销多活动的排版 --> 640 <!-- 新增促销多活动的排版 -->
642 <view class="bdt16" wx:if="{{ prom_type!=1 && prom_type!=2 && prom_type!=4 && prom_type!=6 && cx_prom_group.length>0}}"> 641 <view class="bdt16" wx:if="{{ prom_type!=1 && prom_type!=2 && prom_type!=4 && prom_type!=6 && cx_prom_group.length>0}}">
643 - <view data-coupon="1" bindtap="switchCoupon" class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> 642 + <view data-coupon="1" bindtap="switch_cx_group" class="cx-frame flex" style="position: relative">
644 <view class="cx-sizs fs30">促销</view> 643 <view class="cx-sizs fs30">促销</view>
645 <view class="flex ai_c f1 pdh20"> 644 <view class="flex ai_c f1 pdh20">
646 <view class="xc-coupon-fram" wx:for="{{cx_prom_group}}" > 645 <view class="xc-coupon-fram" wx:for="{{cx_prom_group}}" >
647 - <view class="circle xc-circular xc-one"></view>  
648 -  
649 <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view> 646 <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view>
650 <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view> 647 <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view>
651 <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view> 648 <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view>
652 <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word">阶梯促销</view> 649 <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word">阶梯促销</view>
653 -  
654 - <view class="circle xc-circular xc-two"></view>  
655 </view> 650 </view>
656 </view> 651 </view>
657 <view class="cx-obtain-coupon wsize"> 652 <view class="cx-obtain-coupon wsize">
@@ -662,8 +657,8 @@ @@ -662,8 +657,8 @@
662 657
663 658
664 <!-- 许程 7.24暂时注释 --> 659 <!-- 许程 7.24暂时注释 -->
665 - <view class="bdt16" wx:if="{{ prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && sele_g.is_xz_yh !=1}}">  
666 - <view data-coupon="1" bindtap="switchCoupon" class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> 660 + <view class="bdt16" wx:if="{{ prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && sele_g.is_xz_yh !=1 && fir_quan.length>0 }}">
  661 + <view data-coupon="1" bindtap="switchCoupon" class="cx-frame flex" style="position: relative">
667 <view class="cx-sizs fs30">领券</view> 662 <view class="cx-sizs fs30">领券</view>
668 <view class="flex ai_c f1 pdh20"> 663 <view class="flex ai_c f1 pdh20">
669 <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="id"> 664 <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="id">
@@ -680,8 +675,6 @@ @@ -680,8 +675,6 @@
680 </view> 675 </view>
681 </view> 676 </view>
682 677
683 -  
684 -  
685 <!-- 门店收货地址 --> 678 <!-- 门店收货地址 -->
686 <view class="xc-address_frame bdt16 flex-vertical xc-ash {{def_pick_store!=null?'sn_height':'on_height'}}"> 679 <view class="xc-address_frame bdt16 flex-vertical xc-ash {{def_pick_store!=null?'sn_height':'on_height'}}">
687 <view class="address_frame" bindtap="choice_store" data-ind="0"> 680 <view class="address_frame" bindtap="choice_store" data-ind="0">