Commit 688493b9f7337864580f7553a618e43ab5584152

Authored by WXD-SEASON\season
2 parents 541e318e 7d79bebf

Merge branch 'dev_oa_fu16' into dev

packageA/pages/goodsInfo/goodsInfo.wxss
... ... @@ -2425,7 +2425,7 @@ margin: auto; */
2425 2425 }
2426 2426 .shop_name{
2427 2427 margin-right: 10rpx;
2428   - max-width: 375rpx;
  2428 + max-width: 370rpx;
2429 2429 }
2430 2430 .address{
2431 2431 /* width: 100%;
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -2763,6 +2763,14 @@ Page({
2763 2763 }
2764 2764 })
2765 2765  
  2766 + if(!presellList || !presellList.length){
  2767 + var content = good.goods_name + '未找到预售活动,请取消订单';
  2768 + th.toast(content);
  2769 + th.setData({ paying: 0 });
  2770 + return false;
  2771 + }
  2772 +
  2773 +
2766 2774 if (presellList) {
2767 2775  
2768 2776 if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) {
... ... @@ -2777,6 +2785,29 @@ Page({
2777 2785 return false;
2778 2786 }
2779 2787  
  2788 + var fres=await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellForm/get/"+os.stoid+"/"+presell_id, {});
  2789 + //接口调用成功的时候
  2790 + if(fres && fres.data.code==0 && fres.data.data){
  2791 + //如果有指定门店的时候
  2792 + if(fres.data.data.pick_up_lists){
  2793 + var idx0=fres.data.data.pick_up_lists.findIndex(function (e){
  2794 + return e.pickup_id==order.pickup_id;
  2795 + })
  2796 + if(idx0<0){
  2797 + getApp().confirmBox(good.goods_name+"预售活动的门店不可售");
  2798 + th.setData({ paying: 0 });
  2799 + return false;
  2800 + }
  2801 + }
  2802 +
  2803 + }else{
  2804 + var content = good.goods_name + '未找到预售活动,请取消订单';
  2805 + th.toast(content);
  2806 + th.setData({ paying: 0 });
  2807 + return false;
  2808 + }
  2809 +
  2810 +
2780 2811 }
2781 2812 }
2782 2813  
... ...
packageC/pages/presell/goodsInfo/goodsInfo.js
... ... @@ -878,6 +878,7 @@ Page({
878 878 sele_g: t.data.data,
879 879 userInfo: getApp().globalData.userInfo,
880 880 });
  881 +
881 882 ee.init(gid);
882 883 //获取门店
883 884 ee.get_sto();
... ... @@ -1912,6 +1913,7 @@ Page({
1912 1913 //---------拿出门店分类和门店------------
1913 1914 get_sto(e) {
1914 1915 var th = this, is_normal = e;
  1916 + var that=th;
1915 1917  
1916 1918 if (e == 1) {
1917 1919 th.setData({ is_normal: 1 })
... ... @@ -1921,6 +1923,8 @@ Page({
1921 1923  
1922 1924 var timer_get = setInterval(function () {
1923 1925 if (th.data.is_get_local_ok == 0) return false;
  1926 + if (!th.data.fir_def_store) return false;
  1927 +
1924 1928 var dd = null, i = getApp().request;
1925 1929 if (!th.data.sele_g) return false;
1926 1930  
... ... @@ -1968,44 +1972,107 @@ Page({
1968 1972 }).then(res => {
1969 1973 var e = res;
1970 1974  
  1975 + //确保门店的数量要>0时,才进行计算
1971 1976 if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
1972 1977  
1973   - //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
1974   - if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
1975   - th.setData({
1976   - def_pick_store: e.data.data.pageData[0],
1977   - sto_sele_name: e.data.data.pageData[0].pickup_name,
1978   - sto_sele_id: e.data.data.pageData[0].pickup_id,
1979   - sto_sele_distr: e.data.data.pageData[0].distr_type
1980   - });
1981   - th.data.fir_def_store = e.data.data.pageData[0];
1982   - }
1983 1978  
1984   - //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
1985   - if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
1986   - for (var k = 0; k < e.data.data.pageData.length; k++) {
1987   - if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
1988   - e.data.data.pageData.splice(k, 1); //删除
1989   - break;
  1979 +
  1980 + //指定门店判断, 不是普通购买的时候,秒杀的时候,秒杀有指定门店
  1981 + var pickup_ids=th.data.presellForm.pick_up_lists
  1982 + //-- 如果有指定门店的时候 --
  1983 + if(pickup_ids){
  1984 +
  1985 + var ok_arr=[];
  1986 + for (let i in e.data.data.pageData) {
  1987 + let ite = e.data.data.pageData[i];
  1988 + //-- 查找一下门店有没有在 --
  1989 + var idx=pickup_ids.findIndex(function (e){
  1990 + return e.pickup_id==ite.pickup_id;
  1991 + })
  1992 + if(idx>-1){
  1993 + ok_arr.push(ite)
  1994 + }
  1995 + }
  1996 +
  1997 + //判断会员的默认的门店是不是匹配指定的门店
  1998 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){
  1999 + //-- 查找一下门店有没有在 --
  2000 + var idx1=pickup_ids.findIndex(function (e){
  2001 + return e.pickup_id==th.data.def_pick_store.pickup_id;
  2002 + })
  2003 +
  2004 + if(idx1<0){
  2005 + //如果是秒杀的指定门店,就要设置秒杀的
  2006 + th.data.def_pick_store.is_no_dis_act=1;
  2007 + }else{
  2008 + th.data.def_pick_store.is_no_dis_act=0;
1990 2009 }
  2010 +
  2011 + that.setData({
  2012 + def_pick_store: th.data.def_pick_store
  2013 + })
  2014 +
  2015 + }
  2016 + e.data.data.pageData=ok_arr; //数组重新赋值
  2017 + e.data.data.total=ok_arr.length; //数组的长度
  2018 + }
  2019 + else{
  2020 + //-- 多规格指定门店优化 --
  2021 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){
  2022 + th.data.def_pick_store.is_no_dis_act=0;
  2023 + that.setData({
  2024 + def_pick_store: th.data.def_pick_store
  2025 + })
1991 2026 }
1992   - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
1993 2027 }
1994 2028  
  2029 + //确保门店的数量要>0时,才进行计算
  2030 + if(e.data.data.pageData.length > 0) {
1995 2031  
1996   - th.setData({ all_pick_list: e.data.data.pageData });
1997 2032  
1998   - //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售--
1999   - if(!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id
2000   - && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ([1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 || is_normal == 1)) {
2001   - setTimeout(function () {
2002   - th.deal_pickup_dline(e);
2003   - }, 800)
2004   - } else {
2005   - setTimeout(function () {
2006   - th.deal_pickup(e); //--普通门店排版--
2007   - }, 800)
  2033 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  2034 + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  2035 + th.setData({
  2036 + def_pick_store: e.data.data.pageData[0],
  2037 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  2038 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  2039 + sto_sele_distr: e.data.data.pageData[0].distr_type
  2040 + });
  2041 + th.data.fir_def_store = e.data.data.pageData[0];
  2042 + }
  2043 +
  2044 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
  2045 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
  2046 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  2047 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  2048 + e.data.data.pageData.splice(k, 1); //删除
  2049 + break;
  2050 + }
  2051 + }
  2052 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  2053 + }
  2054 +
  2055 +
  2056 + th.setData({all_pick_list: e.data.data.pageData});
  2057 +
  2058 + //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售--
  2059 + if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id
  2060 + && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 || is_normal == 1)) {
  2061 + setTimeout(function () {
  2062 + th.deal_pickup_dline(e);
  2063 + }, 800)
  2064 + } else {
  2065 + setTimeout(function () {
  2066 + th.deal_pickup(e); //--普通门店排版--
  2067 + }, 800)
  2068 + }
2008 2069 }
  2070 + else{
  2071 + wx.hideLoading();
  2072 + }
  2073 + }
  2074 + else{
  2075 + wx.hideLoading();
2009 2076 }
2010 2077 })
2011 2078 }, 200)
... ...
packageC/pages/presell/goodsInfo/goodsInfo.wxml
... ... @@ -192,7 +192,10 @@
192 192 </view>
193 193 <block wx:else>
194 194 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
195   - (配送不匹配2)
  195 + (配送不匹配)
  196 + </view>
  197 + <view class="no_store" wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act}}">
  198 + (该店不可售)
196 199 </view>
197 200 <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules>=2 && prom_type==0}}">
198 201 (库存不足)
... ... @@ -629,7 +632,8 @@
629 632 <block wx:else>
630 633 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
631 634 <block wx:else>
632   - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配1)</view>
  635 + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
  636 + <view class="no_store" wx:elif="{{def_pick_store.is_no_dis_act}}">(该店不可售)</view>
633 637 <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0}}">
634 638 (库存不足)
635 639 </view>
... ... @@ -671,9 +675,13 @@
671 675 </view>
672 676 </view>
673 677 <view class="spec-cart-btns">
674   - <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" >
  678 + <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">
675 679 门店的不匹配
676 680 </view>
  681 + <view wx:elif="{{def_pick_store && def_pick_store.is_no_dis_act}}" class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">
  682 + 该门店不可售
  683 + </view>
  684 +
677 685 <block wx:else>
678 686 <!-- 根本就找不到门店 -->
679 687 <block wx:if="{{!only_pk && !def_pickpu_list}}">
... ... @@ -855,7 +863,10 @@
855 863 <view class="address-frame xc-ash">
856 864 <view class="flex-vertical-between butttem5">
857 865 <view class="flex xc-ash">
858   - <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  866 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
  867 + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text>
  868 + <text class="c-red22" wx:elif="{{item.is_no_dis_act}}">(该点不可售)</text>
  869 + </view>
859 870 </view>
860 871 <view>
861 872 <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
... ... @@ -881,7 +892,10 @@
881 892 <view class="address-frame xc-ash">
882 893 <view class="flex-vertical-between ">
883 894 <view class="flex xc-ash">
884   - <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  895 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
  896 + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text>
  897 + <text class="c-red22" wx:elif="{{item.is_no_dis_act}}">(该点不可售)</text>
  898 + </view>
885 899 </view>
886 900 <view>
887 901 <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
... ... @@ -909,7 +923,10 @@
909 923 <view class="address-frame xc-ash">
910 924 <view class="flex-vertical-between ">
911 925 <view class="flex xc-ash">
912   - <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  926 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}
  927 + <text class="c-red22" wx:if="{{item.is_no_dis}}">(配送不匹配)</text>
  928 + <text class="c-red22" wx:elif="{{item.is_no_dis_act}}">(该点不可售)</text>
  929 + </view>
913 930 </view>
914 931 <view>
915 932 <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
... ...
packageC/pages/presell/goodsInfo/goodsInfo.wxss
... ... @@ -3016,4 +3016,6 @@ button.custom-service::after{
3016 3016 border: 2rpx solid rgb(238, 238, 238);
3017 3017 padding-left: 30rpx;
3018 3018 }
3019   -
  3019 +.c-red22{
  3020 + color: #d60021
  3021 +}
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -2333,6 +2333,7 @@ Page({
2333 2333 if (get_data.gift_id && parseInt(get_data.zp_mode) != 1
2334 2334 && get_data.zp_num * item_map.bs <= get_data.limit_num-other_gift
2335 2335 && get_data.zp_num * item_map.bs <= get_data.gift_storecount
  2336 + && get_data.zp_num>get_data.must_num //增加一个超量
2336 2337 ) {
2337 2338  
2338 2339 item_map.gift_id = get_data.gift_id;
... ... @@ -2371,7 +2372,17 @@ Page({
2371 2372 var can_zp_num = 0;
2372 2373 for (let iy in get_data.giftsinfo) {
2373 2374 let item = get_data.giftsinfo[iy];
2374   - can_zp_num += parseInt(item.gift_storecount) > parseInt(item.limit_num) ? parseInt(item.limit_num) : parseInt(item.gift_storecount);
  2375 +
  2376 + var c_zp=0;
  2377 + if(parseInt(item.limit_num)>0){
  2378 + c_zp= parseInt(item.gift_storecount) > parseInt(item.can_num) ? parseInt(item.can_num) : parseInt(item.gift_storecount);
  2379 + }else{
  2380 + c_zp= parseInt(item.gift_storecount);
  2381 + }
  2382 +
  2383 + if(c_zp<0) c_zp=0;
  2384 + can_zp_num +=c_zp;
  2385 +
2375 2386 }
2376 2387  
2377 2388 var t_zp_num = parseInt(get_data.zp_num) * parseInt(get_data.bs);
... ... @@ -4711,6 +4722,8 @@ Page({
4711 4722  
4712 4723 var order_prom_list_cart = th.data.order_prom_list_cart;
4713 4724  
  4725 + //优惠商品限购的优化
  4726 + var yh_lm_map={};
4714 4727 //--组装推送数据--
4715 4728 for (var i = 0; i < order_prom_list_cart.length; i++) {
4716 4729 var t_item = order_prom_list_cart[i];
... ... @@ -4877,8 +4890,6 @@ Page({
4877 4890 var check_map = {};
4878 4891 let groupchat_ids=[]
4879 4892  
4880   -
4881   -
4882 4893 //-------------让商品添加到商品列表--------------------
4883 4894 for (var k = 0; k < t_item.goods.length; k++) {
4884 4895  
... ... @@ -4975,6 +4986,7 @@ Page({
4975 4986 //--赠品的时候,阶梯促销会右重复的情况,还有组合购的时候拆分出去的 --
4976 4987 if (check_map[txt] && goods.prom_type != 10) {
4977 4988 getApp().confirmBox(goods.goods_name + "计算金额错误,请重新刷新");
  4989 + th.setData({ submit: 0 })
4978 4990 return false;
4979 4991 } else {
4980 4992 check_map[txt] = 1;
... ... @@ -4986,18 +4998,65 @@ Page({
4986 4998 var mo_num=getApp().get_limit_qty(g_item,act.length);
4987 4999 var steep=getApp().get_limit_qty(g_item,act.length,1);
4988 5000  
4989   - if ([0,3,5,7,10].indexOf(goods.prom_type)>-1){
  5001 + //赠品要排除之外,不进行判断
  5002 + if ([0,3,5,7,10].indexOf(goods.prom_type)>-1 && !goods.is_gift){
4990 5003 if(mo_num>goods.goods_num){
4991 5004 getApp().confirmBox(goods.goods_name + "的未达到起订数量");
4992 5005 th.data.is_summit_ing = 0;
  5006 + th.setData({ submit: 0 })
4993 5007 return false;
4994 5008 }
4995 5009 if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){
4996 5010 getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数");
4997 5011 th.data.is_summit_ing = 0;
  5012 + th.setData({ submit: 0 })
4998 5013 return false;
4999 5014 }
5000 5015  
  5016 + //-- 要判断一下优惠促销的商品的限购 --
  5017 + if(goods.prom_type==3){
  5018 + var pro_gd_limit_num=0;
  5019 + var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{
  5020 + data:{
  5021 + store_id:os.stoid,goods_id:goods.goods_id,prom_id:goods.prom_id,prom_type:3
  5022 + }
  5023 + })
  5024 + if(p_limit_rs && p_limit_rs.data.code==0){
  5025 + pro_gd_limit_num=p_limit_rs.data.data
  5026 + }
  5027 + //-- 如果有商品限购的时候 --
  5028 + if(pro_gd_limit_num>0){
  5029 + //-- 获取会员之前优惠促销商品买了多少件 --
  5030 + var pro_by_num=0;
  5031 + var lrs= {
  5032 + store_id: os.stoid,user_id: getApp().globalData.user_id,
  5033 + goods_id: goods.goods_id, prom_type: 3,
  5034 + prom_id: goods.prom_id, isnew:1
  5035 + };
  5036 + var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs});
  5037 + if(gd_limit_rs && gd_limit_rs.data.code==0){
  5038 + pro_by_num=gd_limit_rs.data.data.promgoodsbuynum
  5039 + }
  5040 +
  5041 + var m_ky=goods.goods_id+'|'+goods.prom_id;
  5042 +
  5043 + var more_num=yh_lm_map[m_ky]?yh_lm_map[m_ky]:0;
  5044 +
  5045 + if(pro_gd_limit_num<pro_by_num+goods.goods_num+more_num){
  5046 + getApp().confirmBox(goods.goods_name + "超优惠促销限购,无法购买");
  5047 + th.data.is_summit_ing = 0;
  5048 + th.setData({ submit: 0 })
  5049 + return false;
  5050 + }
  5051 +
  5052 + //方便下一轮商品判断限购
  5053 + if(!yh_lm_map[m_ky]) {
  5054 + yh_lm_map[m_ky]=0;
  5055 + }
  5056 + yh_lm_map[m_ky]+=goods.goods_num;
  5057 + }
  5058 + }
  5059 +
5001 5060 }
5002 5061  
5003 5062 //如果不立即购买或者秒杀,如果是线下库存购买的时候
... ... @@ -5009,6 +5068,7 @@ Page({
5009 5068 if (!isok) {
5010 5069 getApp().confirmBox(goods.goods_name + "的门店库存不足");
5011 5070 th.data.is_summit_ing = 0;
  5071 + th.setData({ submit: 0 })
5012 5072 return false;
5013 5073 }
5014 5074 }
... ... @@ -7207,7 +7267,7 @@ Page({
7207 7267 var gift_id = discount.gift_id;
7208 7268 for (var i in alllist) {
7209 7269 var list_item = alllist[i];
7210   - //-- 门店相同,活动相同的时候 --
  7270 + //-- 门店相同,活动相同的时候,就continue掉 --
7211 7271 if (pick_id == list_item.pickup_id && prom_id == list_item.prom_id) continue;
7212 7272 for (var j in list_item.goods) {
7213 7273 //如果赠品的ID一样,要进行统计数量
... ... @@ -7216,7 +7276,7 @@ Page({
7216 7276 all_num += list_item.goods[j].goods_num;
7217 7277 }
7218 7278 if (list_item.goods[j].is_gift == 1 && list_item.goods[j].gift_id == gift_id && list_item.goods[j].prom_id == prom_id) {
7219   - all_limit_num += list_item.goods[j].limit_num;
  7279 + all_limit_num += list_item.goods[j].goods_num;
7220 7280 }
7221 7281 }
7222 7282 }
... ... @@ -7230,7 +7290,8 @@ Page({
7230 7290 });
7231 7291 return false;
7232 7292 }
7233   - if (discount.limit_num < all_limit_num) {
  7293 + //-- 限购一定要大于0,否则就是不限的意思 --
  7294 + if (discount.limit_num>0 && discount.can_num < all_limit_num) {
7234 7295 wx.showToast({
7235 7296 title: "超出赠品限购",
7236 7297 icon: 'none',
... ... @@ -7253,6 +7314,16 @@ Page({
7253 7314 var all_num = 0;
7254 7315 for (let i in giftsinfo) {
7255 7316 let item = giftsinfo[i];
  7317 + if(item.must_num>0 ){
  7318 + if(!item.selected){
  7319 + ut.m_toast("必送的赠品没有选中");
  7320 + return false;
  7321 + }
  7322 + if(item.goods_num<item.must_num){
  7323 + ut.m_toast("活动赠品的超量数量不足");
  7324 + return false;
  7325 + }
  7326 + }
7256 7327 if (!item.selected) continue;
7257 7328 all_num += item.goods_num;
7258 7329 }
... ... @@ -7285,7 +7356,6 @@ Page({
7285 7356 var pos=this.find_pro_last(pk_list_goods,3,this.data.gf_prom_id);
7286 7357 var fd_gd=pk_list_goods[pos]
7287 7358  
7288   -
7289 7359 var url = "/api/weshop/cart/delGift?store_id=" + os.stoid + "&user_id="
7290 7360 + getApp().globalData.user_id + "&is_gift=1&pick_id=" + this.data.gift_pkid + "&prom_id=" + this.data.gf_prom_id;
7291 7361 await getApp().request.promiseDelete(url, {});
... ... @@ -7455,14 +7525,18 @@ Page({
7455 7525 var gf_pr_name = item_arr[ip].gf_pr_name;
7456 7526 var zp_num = item_arr[ip].zp_num;
7457 7527 var giftsinfo = item_arr[ip].giftsinfo;
  7528 +
7458 7529 var limit_all = 0;
7459 7530 var stock_all = 0;
  7531 + var no_limit=0;
  7532 +
7460 7533 for (let iu in giftsinfo) {
7461 7534 let gf_item = giftsinfo[iu];
7462   - limit_all += gf_item.limit_num;
  7535 + limit_all += gf_item.can_num>0?gf_item.can_num:0;
7463 7536 stock_all += gf_item.gift_storecount;
  7537 + if(gf_item.limit_num<=0) no_limit=1;
7464 7538 }
7465   - if (limit_all < zp_num) {
  7539 + if (!no_limit && limit_all < zp_num) {
7466 7540 error_arr.push(gf_pr_name + "限购不足");
7467 7541 }
7468 7542 if (stock_all < zp_num) {
... ...
packageE/pages/cart/cart2/cart2.wxml
... ... @@ -1054,17 +1054,21 @@
1054 1054 </view>
1055 1055  
1056 1056 <navigator class="goods-img rel" bindtap="go_gd" data-gd="{{items.goods_id}}">
1057   - <image class="wh100" src="{{imgUrl+items.goodsinfo.original_img}}" binderror="bind_bnerr2" data-errorimg="gift_goods[{{idx}}].goodsinfo.original_img"></image>
  1057 + <image class="wh100" src="{{imgUrl+items.goodsinfo.original_img}}" binderror="cart_set_err1" data-err="giftsinfo[{{idx}}].goodsinfo.original_img"></image>
1058 1058 </navigator>
1059 1059 <view class="goods-cont">
1060   - <view class="goods-name">
1061   - <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-gd="{{items.goods_id}}">{{items.goods_name}}</navigator>
  1060 + <view class="goods-name2">
  1061 + <navigator bindtap="go_gd" class="ellipsis-2 fs30" data-gd="{{items.goods_id}}">{{items.goods_name}}
  1062 + </navigator>
1062 1063  
1063 1064 <view class="specifications ellipsis-1">
1064 1065 <view wx:if="{{items.goodsinfo.goods_color || items.goodsinfo.goods_spec}}">
1065 1066 {{items.goodsinfo.goods_color}}{{items.goodsinfo.goods_color?"/":''}}{{items.goodsinfo.goods_spec}}</view>
1066 1067 <view wx:else>规格1</view>
1067 1068 </view>
  1069 + <text class="c-red" wx:if="{{items.must_num>0 && items.limit_num>0 && items.must_num>items.can_num}}">(超量不足)</text>
  1070 + <text class="c-red" wx:elif="{{items.must_num>0}}">必选{{items.must_num}}件</text>
  1071 +
1068 1072 </view>
1069 1073  
1070 1074 <view class="flex alend jc_sb">
... ...
packageE/pages/cart/cart2/cart2.wxss
... ... @@ -130,7 +130,13 @@ page {
130 130 margin-bottom: 16rpx;
131 131 font-size: 28rpx;
132 132 color: #333;
133   -
  133 +}
  134 +.goods-name2 {
  135 + height: 74rpx;
  136 + line-height: 40rpx;
  137 + margin-bottom: 16rpx;
  138 + font-size: 28rpx;
  139 + color: #333;
134 140 }
135 141  
136 142 .goods-color {
... ... @@ -1228,6 +1234,10 @@ margin-left: 20rpx;
1228 1234 margin-top: 6rpx;
1229 1235 }
1230 1236  
  1237 +.c-red {
  1238 + color: #f23030;vertical-align: top;position: relative;top: 3rpx;font-size: 21rpx;margin-left: 2rpx;
  1239 +}
  1240 +
1231 1241  
1232 1242  
1233 1243  
... ...
pages/cart/cart/cart.js
... ... @@ -4165,7 +4165,15 @@ Page({
4165 4165 var a_limit_num = 0;
4166 4166 for (let iy in discount.giftsinfo) {
4167 4167 let item = discount.giftsinfo[iy];
4168   - can_zp_num += parseInt(item.gift_storecount) > parseInt(item.limit_num) ? parseInt(item.limit_num) : parseInt(item.gift_storecount);
  4168 +
  4169 + var c_zp=0;
  4170 + if(parseInt(item.limit_num)>0){
  4171 + c_zp= parseInt(item.gift_storecount) > parseInt(item.can_num) ? parseInt(item.can_num) : parseInt(item.gift_storecount);
  4172 + }else{
  4173 + c_zp= parseInt(item.gift_storecount);
  4174 + }
  4175 + if(c_zp<0) c_zp=0;
  4176 + can_zp_num +=c_zp;
4169 4177 }
4170 4178  
4171 4179 var t_zp_num = parseInt(discount.zp_num) * parseInt(discount.bs);
... ... @@ -4487,7 +4495,14 @@ Page({
4487 4495 var a_limit_num = 0;
4488 4496 for (let iy in discount.giftsinfo) {
4489 4497 let item = discount.giftsinfo[iy];
4490   - can_zp_num += parseInt(item.gift_storecount) > parseInt(item.limit_num) ? parseInt(item.limit_num) : parseInt(item.gift_storecount);
  4498 + var c_zp=0;
  4499 + if(parseInt(item.limit_num)>0) {
  4500 + c_zp= parseInt(item.gift_storecount) > parseInt(item.can_num) ? parseInt(item.can_num) : parseInt(item.gift_storecount);
  4501 + }else{
  4502 + c_zp= parseInt(item.gift_storecount)
  4503 + }
  4504 + if(c_zp<0) c_zp=0;
  4505 + can_zp_num +=c_zp;
4491 4506 }
4492 4507  
4493 4508 var t_zp_num = parseInt(discount.zp_num) * parseInt(discount.bs);
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -7786,88 +7786,40 @@ Page({
7786 7786 if(th.data.user_pre_buynum >= fir_act.limit_num){
7787 7787 is_yh_out_limit=1;
7788 7788 }
7789   -
7790 7789 }
7791   - // var more_arr = [];
7792   - // //减价
7793   - // if (fir_act.money > 0){
7794   - //
7795   - // more_arr.push({
7796   - // text:'减价' + fir_act.money + '元',
7797   - // is_fir:1
7798   - // });
7799   - // }
7800   - // if (fir_act.sale > 0) {
7801   - // more_arr.push({
7802   - // text:'打' + fir_act.sale + '折',
7803   - // is_fir:1
7804   - // });
7805   - // }
7806   - // if (fir_act.past == 1) {
7807   - // more_arr.push({
7808   - // text:'包邮',
7809   - // is_fir:1
7810   - // });
7811   - // }
7812   - // if (fir_act.intValue > 0){
7813   - // more_arr.push({
7814   - // text:'送' + fir_act.intValue + '积分',
7815   - // is_fir:1
7816   - // });
7817   - // }
7818   - // if (fir_act.couponId > 0) {
7819   - // more_arr.push({
7820   - // text:'送' + fir_act.couponMoney + '元优惠券',
7821   - // is_quan:1
7822   - // });
7823   - // }
7824   - //
7825   - // if (fir_act.gift_id) {
7826   - // var is_more_gf = fir_act.gift_id.split(',')
7827   - // if (is_more_gf.length > 1) {
7828   - // more_arr.push({
7829   - // text:'送赠品',
7830   - // is_gift:1,
7831   - // prom_id:fir_act.prom_id
7832   - // });
7833   - // } else {
7834   - // more_arr.push({
7835   - // text:'送' + fir_act.goods_name + ' x' + fir_act.zp_num,
7836   - // is_gift:1,
7837   - // prom_id:fir_act.prom_id
7838   - // });
7839   - // }
7840   - // }
7841   - // if (fir_act.lb_id){
7842   - // more_arr.push({
7843   - // text:'送' + fir_act.lbtitle,
7844   - // lb_id:fir_act.lb_id
7845   - // });
7846   - // }
7847   - // if (fir_act.zxlb_id){
7848   - // more_arr.push({
7849   - // text:'送' + fir_act.zxlbtitle,
7850   - // zxlb_id:fir_act.zxlb_id
7851   - // });
7852   - // }
7853   - // if (fir_act.monthgiftbag_id){
7854   - // more_arr.push({
7855   - // text:'送' + fir_act.monthgiftbag_title,
7856   - // monthgiftbag_id:fir_act.monthgiftbag_id
7857   - // });
7858   - // }
7859   - var more_arr=ut.format_yh_act(fir_act);
7860   - //-- 开始组装数据 --
7861   - th.add_cx_prom_group({
7862   - id: fir_act.prom_id,
7863   - condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'),
7864   - limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
7865   - more: more_arr,
  7790 +
  7791 + //如果是有限购的时候
  7792 + if (fir_act.gd_limit_num>0 && !is_yh_out_limit){
  7793 + var lrs= {
  7794 + store_id: os.stoid,
  7795 + user_id: user_id,
  7796 + goods_id: gid,
7866 7797 prom_type: 3,
7867   - promGoodsListsDtos:r_data.promGoodsLists,
7868   - is_yh_out_limit:is_yh_out_limit
7869   - });
7870   - //}
  7798 + prom_id: fir_act.prom_id, isnew:1
  7799 + };
  7800 + var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs});
  7801 + var pro_by_num=0;
  7802 + if(gd_limit_rs && gd_limit_rs.data.code==0){
  7803 + pro_by_num=gd_limit_rs.data.data.promgoodsbuynum
  7804 + }
  7805 + if(pro_by_num >= fir_act.gd_limit_num){
  7806 + is_yh_out_limit=1;
  7807 + }
  7808 + }
  7809 + //-- 如果超出限购,就不显示了 --
  7810 + if(!is_yh_out_limit) {
  7811 + var more_arr = ut.format_yh_act(fir_act);
  7812 + //-- 开始组装数据 --
  7813 + th.add_cx_prom_group({
  7814 + id: fir_act.prom_id,
  7815 + condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'),
  7816 + limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
  7817 + more: more_arr,
  7818 + prom_type: 3,
  7819 + promGoodsListsDtos: r_data.promGoodsLists,
  7820 + is_yh_out_limit: is_yh_out_limit
  7821 + });
  7822 + }
7871 7823  
7872 7824 }
7873 7825  
... ...
pages/user/order_detail/order_detail.js
... ... @@ -465,7 +465,7 @@ Page({
465 465 }
466 466  
467 467 //-- 要进行判断指定门店的判断优化,先做普通商品 --
468   - if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids){
  468 + if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids && !good.is_gift){
469 469 var idx0=gg.pick_up_lists.findIndex(function (e){
470 470 return e.pickup_id==order.pickup_id;
471 471 })
... ... @@ -607,6 +607,13 @@ Page({
607 607 }
608 608 })
609 609  
  610 + if(!presellList || !presellList.length){
  611 + var content = good.goods_name + '未找到预售活动,请取消订单';
  612 + th.toast(content);
  613 + th.setData({ paying: 0 });
  614 + return false;
  615 + }
  616 +
610 617 if (presellList) {
611 618 if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) {
612 619 var content = good.goods_name + '购买数量超出商品库存,请取消订单';
... ... @@ -622,6 +629,28 @@ Page({
622 629 return false;
623 630 }
624 631  
  632 + var fres=await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellForm/get/"+os.stoid+"/"+presell_id, {});
  633 + //接口调用成功的时候
  634 + if(fres && fres.data.code==0 && fres.data.data){
  635 + //如果有指定门店的时候
  636 + if(fres.data.data.pick_up_lists){
  637 + var idx0=fres.data.data.pick_up_lists.findIndex(function (e){
  638 + return e.pickup_id==order.pickup_id;
  639 + })
  640 + if(idx0<0){
  641 + getApp().confirmBox(good.goods_name+"预售活动的门店不可售");
  642 + th.setData({ paying: 0 });
  643 + return false;
  644 + }
  645 + }
  646 +
  647 + }else{
  648 + var content = good.goods_name + '未找到预售活动,请取消订单';
  649 + th.toast(content);
  650 + th.setData({ paying: 0 });
  651 + return false;
  652 + }
  653 +
625 654 }
626 655 }
627 656  
... ... @@ -641,7 +670,19 @@ Page({
641 670 var content = good.goods_name + '未找到活动,请取消订单重新购买';
642 671 th.toast(content);
643 672 p_ok = 0;
  673 + }else if(r_data.promGoodsLists && good.prom_type == 3){
  674 + var fir_act = r_data.promGoodsLists[0];
  675 + //如果是有限购的时候
  676 + if (fir_act.gd_limit_num>0){
  677 + if(promgoodsbuynum+good.goods_num > fir_act.gd_limit_num){
  678 + var content = good.goods_name + '超出优惠促销活动商品限购,请取消订单重新购买';
  679 + th.toast(content)
  680 + p_ok = 0;
  681 + }
  682 + }
  683 +
644 684 }
  685 +
645 686 if (!r_data.ladderLists && good.prom_type == 10) {
646 687 var content = good.goods_name + '未找到活动,请取消订单重新购买';
647 688 th.toast(content);
... ...
pages/user/order_list/order_list.js
... ... @@ -780,7 +780,7 @@ Page({
780 780  
781 781  
782 782 //-- 要进行判断指定门店的判断优化,先做普通商品 --
783   - if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids){
  783 + if([0,3,5,7,10].indexOf(parseInt(good.prom_type))>-1 && gg.pick_group_ids && !good.is_gift){
784 784 var idx0=gg.pick_up_lists.findIndex(function (e){
785 785 return e.pickup_id==order.pickup_id;
786 786 })
... ... @@ -922,10 +922,15 @@ Page({
922 922 }
923 923 })
924 924  
925   -
926   - if (presellList) {
  925 + if(!presellList || !presellList.length){
  926 + var content = good.goods_name + '未找到预售活动,请取消订单';
  927 + th.toast(content);
  928 + th.setData({ paying: 0 });
  929 + return false;
  930 + }
927 931  
928 932  
  933 + if (presellList) {
929 934 if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) {
930 935 var content = good.goods_name + '购买数量超出商品库存,请取消订单';
931 936 th.toast(content);
... ... @@ -940,6 +945,28 @@ Page({
940 945 return false;
941 946 }
942 947  
  948 + var fres=await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellForm/get/"+os.stoid+"/"+presell_id, {});
  949 + //接口调用成功的时候
  950 + if(fres && fres.data.code==0 && fres.data.data){
  951 +
  952 + //如果有指定门店的时候
  953 + if(fres.data.data.pick_up_lists){
  954 + var idx0=fres.data.data.pick_up_lists.findIndex(function (e){
  955 + return e.pickup_id==order.pickup_id;
  956 + })
  957 + if(idx0<0){
  958 + getApp().confirmBox(good.goods_name+"预售活动的门店不可售");
  959 + th.setData({ paying: 0 });
  960 + return false;
  961 + }
  962 + }
  963 +
  964 + }else{
  965 + var content = good.goods_name + '未找到预售活动,请取消订单';
  966 + th.toast(content);
  967 + th.setData({ paying: 0 });
  968 + return false;
  969 + }
943 970 }
944 971 }
945 972  
... ... @@ -955,16 +982,32 @@ Page({
955 982 th.toast(content)
956 983 p_ok = 0;
957 984 }
  985 +
958 986 if (!r_data.promGoodsLists && good.prom_type == 3) {
959 987 var content = good.goods_name + '未找到活动,请取消订单重新购买';
960 988 th.toast(content);
961 989 p_ok = 0;
  990 + }else if(r_data.promGoodsLists && good.prom_type == 3){
  991 + var fir_act = r_data.promGoodsLists[0];
  992 + //如果是有限购的时候
  993 + if (fir_act.gd_limit_num>0){
  994 + if(promgoodsbuynum+good.goods_num > fir_act.gd_limit_num){
  995 + var content = good.goods_name + '超出优惠促销活动商品限购,请取消订单重新购买';
  996 + th.toast(content)
  997 + p_ok = 0;
  998 + }
  999 + }
  1000 +
962 1001 }
  1002 +
963 1003 if (!r_data.ladderLists && good.prom_type == 10) {
964 1004 var content = good.goods_name + '未找到活动,请取消订单重新购买';
965 1005 th.toast(content);
966 1006 p_ok = 0;
967 1007 }
  1008 +
  1009 +
  1010 +
968 1011 } else {
969 1012  
970 1013 var content = good.goods_name + '未找到活动,请取消订单重新购买'
... ...