Commit 185b5102c1876fd648d149843377e40911dd1116

Authored by taiyuan
1 parent 397285c5

幸运购

packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml
... ... @@ -15,7 +15,7 @@
15 15 ¥ {{sele_g[card_field]}}
16 16 </block>
17 17 <block wx:else>
18   - ¥ {{sele_g.shop_price}}
  18 + ¥ {{sele_g.market_price}}
19 19 </block>
20 20 </view>
21 21 <view class="spec-goods-price" wx:else>¥ {{prom_price || filters.div100(luckGoInfo.group_price)}}</view>
... ... @@ -195,7 +195,7 @@
195 195 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
196 196 </block>
197 197 <block wx:else>
198   - <view bindtap="addCart" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
  198 + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
199 199 </block>
200 200  
201 201 </block>
... ... @@ -212,7 +212,7 @@
212 212 <view class="spec-cart-btn spec-buy w100" style="background-color: #dcdcdc;color: #999;">配送不匹配</view>
213 213 </block>
214 214 <block wx:else>
215   - <view bindtap="addCart" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view>
  215 + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view>
216 216 </block>
217 217 </block>
218 218  
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -303,7 +303,7 @@ Page({
303 303 prom_id,
304 304 });
305 305 }
306   - console.log('type********>>',this.data.prom_type);
  306 + // console.log('type********>>',this.data.prom_type);
307 307 //-- 自定义海报 --
308 308 // getApp().request.promiseGet("/api/weshop/goods/poster/page", {
309 309 // data: { store_id: os.stoid, type: 1, is_use: 1 }
... ... @@ -448,7 +448,6 @@ Page({
448 448 var user = getApp().globalData.userInfo;
449 449 if (!user) return false;
450 450 clearInterval(ti);
451   -
452 451 if (user.card_field && user['card_expiredate']) {
453 452 var str = user['card_expiredate'].replace(/-/g, '/');
454 453 var end = new Date(str);
... ... @@ -1198,18 +1197,20 @@ Page({
1198 1197 open_ind_store: ind
1199 1198 });
1200 1199 //如果是秒杀的话,要看redis够不够
1201   - if (this.data.prom_type == 1) {
1202   - this.getactLen(function (num) {
1203   - if (num < th.data.goodsInputNum) {
1204   - getApp().my_warnning("秒杀库存不足!", 0, th);
1205   - return false;
1206   - } else {
1207   - th.add_cart_func(t);
1208   - }
1209   - });
1210   - } else {
1211   - th.add_cart_func(t);
1212   - }
  1200 + // if (this.data.prom_type == 1) {
  1201 + // this.getactLen(function (num) {
  1202 + // if (num < th.data.goodsInputNum) {
  1203 + // getApp().my_warnning("秒杀库存不足!", 0, th);
  1204 + // return false;
  1205 + // } else {
  1206 + // th.add_cart_func(t);
  1207 + // }
  1208 + // });
  1209 + // } else {
  1210 + // th.add_cart_func(t);
  1211 + // }
  1212 +
  1213 + th.add_cart_func(t);
1213 1214 },
1214 1215  
1215 1216  
... ... @@ -1662,13 +1663,13 @@ Page({
1662 1663 switch (condition_t) {
1663 1664 case 0: //按钱
1664 1665 if (newd.goods_price >= condition_t) {
1665   - newd.prom_type = 3;
  1666 + newd.prom_type = 9;
1666 1667 newd.prom_id = prom_d[i].prom_id;
1667 1668 }
1668 1669 break
1669 1670 case 1://按购买数量
1670 1671 if (newd.goods_num >= condition_t) {
1671   - newd.prom_type = 3;
  1672 + newd.prom_type = 9;
1672 1673 newd.prom_id = prom_d[i].prom_id;
1673 1674 }
1674 1675 break;
... ... @@ -1707,6 +1708,7 @@ Page({
1707 1708 // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, {
1708 1709 // action: "buy_now"
1709 1710 // }),
  1711 + var th = this;
1710 1712 this.setData({
1711 1713 openSpecModal: 0,
1712 1714 openSpecModal_inte: 0,
... ... @@ -1714,34 +1716,42 @@ Page({
1714 1716 openSpecModal_pt: 0,
1715 1717 })
1716 1718  
1717   - if (e.prom_type == 9) {
1718   - s.set_b_now(e);
1719   - var url = "/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id;
1720   - getApp().goto(url);
1721   - } else {
  1719 + // if (e.prom_type == 9) {
  1720 + // s.set_b_now(e);
  1721 + // // var url = '';
  1722 + // var url = "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id;
  1723 + // getApp().goto(url);
  1724 + // } else
  1725 +
  1726 + // if(e.prom_type == 9){
  1727 + if(true){
1722 1728 //要判断积分购的普通购买有没有参加优惠活动
1723   - if (e.is_integral_normal == 1) {
  1729 + if (e.is_normal == 1) {
1724 1730 this.check_nor_promgood(e.goods_id, function (res) {
1725 1731 if (res && res.cat_id) {
1726   - e.prom_type = 3;
1727   - e.prom_id = res.cat_id
  1732 + e.prom_type = 0;
  1733 + e.prom_id = res.cat_id;
1728 1734 }
1729 1735 s.set_b_now(e);
1730 1736 /*--
1731 1737 wx.redirectTo({
1732 1738 url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
1733 1739 });--*/
1734   - getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id)
  1740 +
  1741 + console.log('11111111111111111111111111======》');
  1742 + getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id);
  1743 + // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + th.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + th.data.luckGoInfo.lc_alert);
1735 1744  
1736 1745 })
1737 1746 } else {
1738   - // console.log('xxxxxxxxxxxxx======》', this.data.prom_id);
1739   - s.set_b_now(e);
  1747 + //console.log('222222222222222222222222222222======》');
  1748 + //s.set_b_now(e);
1740 1749 /*--
1741 1750 wx.redirectTo({
1742 1751 url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
1743 1752 });--*/
1744   - getApp().goto("/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert);
  1753 + //getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id)
  1754 + // getApp().goto("/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&group_id=" + this.data.group_id +"&goods_id=" + e.goods_id + "&alert=" + this.data.luckGoInfo.lc_alert);
1745 1755 }
1746 1756  
1747 1757 }
... ... @@ -3756,6 +3766,9 @@ Page({
3756 3766  
3757 3767 var th = this;
3758 3768 var ind = parseInt(e.currentTarget.dataset.ind);
  3769 +
  3770 + console.log('当前ind========>>>>', ind);
  3771 +
3759 3772 //ind == 1是普通购买
3760 3773 if (ind == 1) {
3761 3774 //如果拼单的sku data是空的,就要先获取一下
... ... @@ -3845,18 +3858,17 @@ Page({
3845 3858  
3846 3859 //-----------------拼单生成方法---------------------
3847 3860 addCart_pt: function () {
3848   - var th = this;
3849 3861 if (this.data.is_normal == 0) {
3850 3862 //看一下有没有起购数,如果有起购数,要计算起购数
3851   - var qnum = parseFloat(th.data.prom_act.minbuynum);
3852   - if (qnum > 0 && th.data.goodsInputNum < qnum) {
3853   - getApp().confirmBox("拼团商品至少要买" + qnum + "件!");
3854   - return false;
3855   - }
  3863 + // var qnum = parseFloat(th.data.prom_act.minbuynum);
  3864 + // if (qnum > 0 && th.data.goodsInputNum < qnum) {
  3865 + // getApp().confirmBox("拼团商品至少要买" + qnum + "件!");
  3866 + // return false;
  3867 + // }
3856 3868  
3857   - th.addcart_pt_func();
  3869 + this.addcart_pt_func();
3858 3870 } else {
3859   - th.addcart_pt_func();
  3871 + this.addcart_pt_func();
3860 3872 }
3861 3873 },
3862 3874  
... ... @@ -3868,73 +3880,75 @@ Page({
3868 3880 var e = this,
3869 3881 th = e,
3870 3882 o = this.data.sele_g;
3871   - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3883 + // if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
3872 3884  
3873 3885 //----------添加到购物车时,要判断限购数量,--------
3874 3886 e.get_buy_num(o, async function (ee) {
3875 3887  
3876 3888 //---判断商品是否超出限购---
3877   - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
3878   - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
3879   - wx.showModal({
3880   - title: '提示',
3881   - content: '超出商品限购'
3882   - });
3883   -
3884   - var num = th.data.prom_buy_limit - th.data.prom_buy_num;
3885   - if (num < 0) num = 0;
3886   - th.setData({ goodsInputNum: num })
3887   - return false;
3888   - }
3889   - }
  3889 + // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
  3890 + // if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
  3891 + // wx.showModal({
  3892 + // title: '提示',
  3893 + // content: '超出商品限购'
  3894 + // });
  3895 +
  3896 + // var num = th.data.prom_buy_limit - th.data.prom_buy_num;
  3897 + // if (num < 0) num = 0;
  3898 + // th.setData({ goodsInputNum: num })
  3899 + // return false;
  3900 + // }
  3901 + // }
  3902 +
3890 3903 //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购---
3891   - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) {
3892   - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
3893   - wx.showModal({
3894   - title: '提示',
3895   - content: '超出商品活动限购'
3896   - });
3897   -
3898   - var num = th.data.prom_buy_limit - th.data.prom_buy_num;
3899   - if (num < 0) num = 0;
3900   - th.setData({ goodsInputNum: num })
3901   - return false;
3902   - }
3903   - }
  3904 + // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) {
  3905 + // if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
  3906 + // wx.showModal({
  3907 + // title: '提示',
  3908 + // content: '超出商品活动限购'
  3909 + // });
  3910 +
  3911 + // var num = th.data.prom_buy_limit - th.data.prom_buy_num;
  3912 + // if (num < 0) num = 0;
  3913 + // th.setData({ goodsInputNum: num })
  3914 + // return false;
  3915 + // }
  3916 + // }
3904 3917  
3905 3918 var redis_num = 0
3906 3919 //不是普通购买的时候
3907   - if (th.data.is_normal != 1) {
3908   - //-------判断活动是否抢光---------
3909   - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, {
3910   - 1: 1
3911   - }).then(res => {
3912   - redis_num = res.data.data;
3913   - })
3914   -
3915   - if (th.data.goodsInputNum > redis_num) {
3916   - wx.showModal({
3917   - title: '提示',
3918   - content: '超出商品活动库存'
3919   - });
  3920 + // if (th.data.is_normal != 1) {
  3921 + // //-------判断活动是否抢光---------
  3922 + // await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, {
  3923 + // 1: 1
  3924 + // }).then(res => {
  3925 + // redis_num = res.data.data;
  3926 + // })
  3927 +
  3928 + // if (th.data.goodsInputNum > redis_num) {
  3929 + // wx.showModal({
  3930 + // title: '提示',
  3931 + // content: '超出商品活动库存'
  3932 + // });
  3933 +
  3934 + // th.setData({ goodsInputNum: redis_num })
  3935 +
  3936 + // return false;
  3937 + // }
  3938 + // }
3920 3939  
3921   - th.setData({ goodsInputNum: redis_num })
3922   -
3923   - return false;
3924   - }
3925   - }
3926   -
3927   - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
3928   - if (th.data.goodsInputNum > o.store_count) {
3929   - th.setData({ goodsInputNum: o.store_count })
3930   - return s.my_warnning("超出商品库存", 0, th);
3931   - }
  3940 + // if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
  3941 + // if (th.data.goodsInputNum > o.store_count) {
  3942 + // th.setData({ goodsInputNum: o.store_count })
  3943 + // return s.my_warnning("超出商品库存", 0, th);
  3944 + // }
3932 3945  
3933 3946 if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
3934 3947 this.setData({
3935 3948 sto_sele_name: ""
3936 3949 });
3937 3950 if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);
  3951 +
3938 3952 //--------------此时操作的数据------------
3939 3953 var newd = {
3940 3954 goods_id: o.goods_id,
... ... @@ -4006,10 +4020,12 @@ Page({
4006 4020 th.data.sto_sele_distr = 1;
4007 4021 }
4008 4022  
4009   - } else if (th.data.prom_type == 3) {
4010   - newd.prom_type = 0;
4011   - newd.prom_id = 0;
4012 4023 }
  4024 +
  4025 + // else if (th.data.prom_type == 3) {
  4026 + // newd.prom_type = 0;
  4027 + // newd.prom_id = 0;
  4028 + // }
4013 4029  
4014 4030 newd['pick_name'] = th.data.sto_sele_name;
4015 4031 newd['pick_dis'] = th.data.sto_sele_distr;
... ... @@ -4020,20 +4036,24 @@ Page({
4020 4036 //判断一下有没有全局优惠活动
4021 4037 th.check_nor_promgood(newd.goods_id, function (e) {
4022 4038 if (e && e.act_id) {
4023   - newd['prom_type'] = 3;
  4039 + newd['prom_type'] = 0;
4024 4040 newd['prom_id'] = e.act_id;
4025 4041 }
4026   - th.buyNow(newd)
4027   - })
  4042 + console.log('aaaaa');
  4043 + th.buyNow(newd);
  4044 + });
4028 4045 }
4029   - else th.buyNow_pt(newd);
  4046 + else {
  4047 + console.log('bbbb');
  4048 + th.buyNow_pt(newd);
  4049 + };
4030 4050 })
4031 4051 },
4032 4052 //----------立即购买_pt-----------
4033 4053 buyNow_pt: function (e) {
4034 4054 s.set_b_now(e);
4035 4055 wx.navigateTo({
4036   - url: "/packageC/pages/luckyGo_cart/luckyGo_cart/luckyGo_cart?is_bnow=1&goods_id=" + e.goods_id,
  4056 + url: "/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct?is_bnow=1&goods_id=" + e.goods_id,
4037 4057 });
4038 4058 },
4039 4059  
... ...