Commit 160decd26f56e1d7c2982772263691c3621134ce
Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp
Showing
20 changed files
with
603 additions
and
154 deletions
components/diy_public/diy_public.js
| ... | ... | @@ -50,9 +50,12 @@ Component({ |
| 50 | 50 | '2':"/miniapp/images/component/pingd/pingd.png", |
| 51 | 51 | '6':"/miniapp/images/component/pingd/pingd.png", |
| 52 | 52 | '8':"/miniapp/images/component/presale.png", |
| 53 | + '9':"/miniapp/images/component/luckyactivity_new1.png", | |
| 54 | + // '9':"/images/luckyactivity_new.png", | |
| 53 | 55 | }, |
| 54 | 56 | nav1:'/packageA/pages/goodsInfo/goodsInfo?', |
| 55 | 57 | nav2:'/pages/goods/goodsInfo/goodsInfo?', |
| 58 | + | |
| 56 | 59 | }, |
| 57 | 60 | |
| 58 | 61 | pageLifetimes: { |
| ... | ... | @@ -98,7 +101,7 @@ Component({ |
| 98 | 101 | prom_text:'已团', |
| 99 | 102 | nav1:'/pages/goods/goodsInfo/goodsInfo?', |
| 100 | 103 | nav2:'/pages/goods/goodsInfo/goodsInfo?' |
| 101 | - }) | |
| 104 | + }) | |
| 102 | 105 | } |
| 103 | 106 | if (this.data.prom_type==8) { //预售 |
| 104 | 107 | this.setData({ |
| ... | ... | @@ -107,6 +110,14 @@ Component({ |
| 107 | 110 | nav2:'/packageC/pages/presell/goodsInfo/goodsInfo?' |
| 108 | 111 | }) |
| 109 | 112 | } |
| 113 | + if (this.data.prom_type==9) { //幸运购 | |
| 114 | + this.setData({ | |
| 115 | + prom_text:'已售', | |
| 116 | + nav1:'/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?', | |
| 117 | + nav2:'/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?' | |
| 118 | + }) | |
| 119 | + } | |
| 120 | + | |
| 110 | 121 | var g_id = this.data.object; |
| 111 | 122 | |
| 112 | 123 | this.init(g_id); |
| ... | ... | @@ -165,6 +176,10 @@ Component({ |
| 165 | 176 | gUrl="/api/weshop/marketing/marketingPresellList/page?store_id=" |
| 166 | 177 | +os.stoid+"&goodsidlist="+goodsidlist + "&user_id="+user_id+'&is_end=0&timetype=3&isuse=1'; |
| 167 | 178 | } |
| 179 | + if (th.data.prom_type==9) { //幸运购 | |
| 180 | + gUrl="/api/weshop/prom/luckyActivity/getGoodsList?store_id=" | |
| 181 | + +os.stoid+"&goodsidlist="+goodsidlist + "&user_id="+user_id+'&is_end=0&timetype=1&type=1'; | |
| 182 | + } | |
| 168 | 183 | |
| 169 | 184 | |
| 170 | 185 | |
| ... | ... | @@ -226,6 +241,18 @@ Component({ |
| 226 | 241 | pageSize:9 |
| 227 | 242 | } |
| 228 | 243 | } |
| 244 | + if (this.data.prom_type==9) { //幸运购 | |
| 245 | + gUrl="/api/weshop/prom/luckyActivity/page" | |
| 246 | + req={ | |
| 247 | + store_id:os.stoid, | |
| 248 | + is_end:0, | |
| 249 | + timetype:1, | |
| 250 | + // isuse:1, | |
| 251 | + // page:1, | |
| 252 | + // user_id:user_id, | |
| 253 | + // pageSize:9 | |
| 254 | + } | |
| 255 | + } | |
| 229 | 256 | |
| 230 | 257 | getApp().request.promiseGet(gUrl, |
| 231 | 258 | { isShowLoading: 1, data:req } |
| ... | ... | @@ -244,6 +271,7 @@ Component({ |
| 244 | 271 | let prom_type=this.data.prom_type |
| 245 | 272 | goodslist.forEach(function (vy, indy) { |
| 246 | 273 | if(!vy.id) vy.id=vy.prom_id; |
| 274 | + if(vy.title && !vy.goods_name) vy.goods_name=vy.title; | |
| 247 | 275 | }) |
| 248 | 276 | |
| 249 | 277 | // 判断火热,预热 |
| ... | ... | @@ -279,7 +307,7 @@ Component({ |
| 279 | 307 | |
| 280 | 308 | |
| 281 | 309 | var promisies = []; |
| 282 | - if (th.data.prom_type !=8) { | |
| 310 | + if (th.data.prom_type !=8 && th.data.prom_type !=9) { | |
| 283 | 311 | for (const key in all_array) { |
| 284 | 312 | if (Object.hasOwnProperty.call(all_array, key)) { |
| 285 | 313 | const val = all_array[key]; |
| ... | ... | @@ -306,6 +334,7 @@ Component({ |
| 306 | 334 | }; |
| 307 | 335 | // let price=all_array[i].price.toFixed(2) |
| 308 | 336 | let price=all_array[i].price + '' |
| 337 | + | |
| 309 | 338 | if (th.data.prom_type==8) { //预售 |
| 310 | 339 | price = all_array[i].presell_price + '' |
| 311 | 340 | if (all_array[i].status ===0) { |
| ... | ... | @@ -315,8 +344,12 @@ Component({ |
| 315 | 344 | all_array[i].goods_num=all_array[i].presell_sumqty*1 + all_array[i].virtual_qty*1 |
| 316 | 345 | all_array[i].buy_num=all_array[i].buy_goodnum + all_array[i].virtual_qty*1 |
| 317 | 346 | } |
| 318 | - | |
| 319 | - | |
| 347 | + } | |
| 348 | + if (th.data.prom_type==9) { //幸运购 | |
| 349 | + price = (all_array[i].group_price / 100) + '' | |
| 350 | + // all_array[i].buy_num = all_array[i].group_joined | |
| 351 | + all_array[i].buy_num = all_array[i].goods_num*1 - all_array[i].actLen*1 | |
| 352 | + // all_array[i].goods_name = all_array[i].title | |
| 320 | 353 | } |
| 321 | 354 | |
| 322 | 355 | |
| ... | ... | @@ -329,6 +362,12 @@ Component({ |
| 329 | 362 | } |
| 330 | 363 | |
| 331 | 364 | all_array[i].residue=all_array[i].goods_num*1 - all_array[i].buy_num*1 |
| 365 | + all_array[i].residue = (all_array[i].residue >= 0) ? all_array[i].residue : 0 | |
| 366 | + if (th.data.prom_type==9) { //幸运购 | |
| 367 | + all_array[i].residue= all_array[i].actLen | |
| 368 | + } | |
| 369 | + | |
| 370 | + // console.error(all_array[i].residue); | |
| 332 | 371 | if (all_array[i].residue && all_array[i].residue > 0 && all_array[i].status !=2) { |
| 333 | 372 | empty.push(all_array[i]) |
| 334 | 373 | } |
| ... | ... | @@ -438,7 +477,14 @@ Component({ |
| 438 | 477 | sec: '00' |
| 439 | 478 | } |
| 440 | 479 | } |
| 441 | - var txt = "goods_array[" + j + "][" + i + "].djs"; | |
| 480 | + let txt = "goods_array[" + j + "][" + i + "].djs"; | |
| 481 | + | |
| 482 | + if (!o.status && obj.day=='00' && obj.hou=='00' && obj.min=='00' && obj.sec=='01') { | |
| 483 | + let t1="goods_array[" + j + "][" + i + "].status"; | |
| 484 | + ee.setData({ | |
| 485 | + [t1]:1 | |
| 486 | + }) | |
| 487 | + } | |
| 442 | 488 | ee.setData({ |
| 443 | 489 | [txt]: obj |
| 444 | 490 | }); |
| ... | ... | @@ -464,6 +510,9 @@ Component({ |
| 464 | 510 | if (this.data.prom_type==8) { //预售 |
| 465 | 511 | url="/packageC/pages/presell/list/list"; |
| 466 | 512 | } |
| 513 | + if (this.data.prom_type==9) { //幸运购 | |
| 514 | + url="/packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList"; | |
| 515 | + } | |
| 467 | 516 | |
| 468 | 517 | wx.navigateTo({ |
| 469 | 518 | url | ... | ... |
components/diy_public/diy_public.wxml
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | 已售罄 |
| 34 | 34 | </view> |
| 35 | 35 | <view wx:else style="{{'height: 70rpx;padding: 10rpx 30rpx;box-sizing:border-box;background:'+ (aitem.status ==0 ? object.scountdown_background_color : (aitem.status ==0 ? object.scountdown_background_color : object.countdown_background_color))}}" class="{{'new_item1_time '+ (object.count_down_float ? 'item_float' : '')}}"> |
| 36 | - <image src="{{imghost+imgobj[prom_type]}}"></image> | |
| 36 | + <image src="{{imghost+imgobj[prom_type]}}" style="{{prom_type ==9 ? 'height:60rpx;' : ''}}"></image> | |
| 37 | 37 | <view style="text-align: center;line-height: 30rpx;"> |
| 38 | 38 | <view wx:if="{{aitem.status == 1}}">距结束时间</view> |
| 39 | 39 | <view wx:if="{{aitem.status == 0}}">距开始时间</view> |
| ... | ... | @@ -245,7 +245,7 @@ |
| 245 | 245 | 已售罄 |
| 246 | 246 | </view> |
| 247 | 247 | <view wx:else class="{{'new_item1_time ' + (object.count_down_float ? 'item_float' : '')}}" style="{{'box-sizing: border-box;height: 70rpx;padding: 10rpx 30rpx;background:'+ (aitem.status ==0 ? object.scountdown_background_color : object.countdown_background_color)}}"> |
| 248 | - <image src="{{imghost+imgobj[prom_type]}}"></image> | |
| 248 | + <image src="{{imghost+imgobj[prom_type]}}" style="{{prom_type ==9 ? 'height:60rpx;' : ''}}"></image> | |
| 249 | 249 | <view style="text-align: center;line-height: 30rpx;"> |
| 250 | 250 | <view wx:if="{{aitem.status == 1}}">距结束时间</view> |
| 251 | 251 | <view wx:if="{{aitem.status == 0}}">距开始时间</view> | ... | ... |
components/diy_public/diy_public.wxss
| ... | ... | @@ -555,4 +555,14 @@ swiper { |
| 555 | 555 | border-radius: 10rpx; |
| 556 | 556 | margin-right: 10rpx; |
| 557 | 557 | opacity: .8; |
| 558 | + } | |
| 559 | + .lucky{ | |
| 560 | + display: inline-block; | |
| 561 | + font-size: 24rpx; | |
| 562 | + padding: 0 10rpx; | |
| 563 | + background-color: #f23023; | |
| 564 | + opacity: .8; | |
| 565 | + color: #fff; | |
| 566 | + margin-right: 10rpx; | |
| 567 | + border-radius: 10rpx; | |
| 558 | 568 | } |
| 559 | 569 | \ No newline at end of file | ... | ... |
components/promate_pop/promate_pop.wxml
| ... | ... | @@ -20,7 +20,8 @@ |
| 20 | 20 | <view class="item_pro_right"> |
| 21 | 21 | <view wx:if="{{item.prom_type!=3}}" class="fs26" style="max-width:81%" >{{item.title}}</view> |
| 22 | 22 | <view wx:else class="fs26" style="max-width:81%" >{{item.title}} |
| 23 | - 消费满<text class="c-red">{{item.condition}}</text>享优惠({{item.limit}}) | |
| 23 | + 消费满<text class="c-red">{{item.condition}}</text> | |
| 24 | + 享优惠({{item.limit}}<text wx:if="{{item.goodslimit}}">,限购{{item.goodslimit}}件</text>) | |
| 24 | 25 | </view> |
| 25 | 26 | |
| 26 | 27 | <view wx:if="{{item.prom_type==5}}" class="fs26">搭配价:<text class="c-red">{{item.show_price}}</text></view> | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxss
packageC/pages/luckyGo/luckyGo_activityList/luckyGo_activityList.wxml
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | |
| 12 | 12 | <view class="list"> |
| 13 | 13 | <block wx:for="{{list.pageData}}"> |
| 14 | - <view class="list-item" wx:if="{{item.status == 1}}" bindtap="{{item.actLen == 0 ? '':'go'}}" data-url="/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id={{item.goods_id}}&prom_type=9&group_id={{item.id}}"> | |
| 14 | + <view class="list-item" wx:if="{{item.status == 1}}" bindtap="{{item.actLen == 0 ? 'go':'go'}}" data-url="/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id={{item.goods_id}}&prom_type=9&group_id={{item.id}}"> | |
| 15 | 15 | <view class="flex ai-center"> |
| 16 | 16 | <view class="img-container"> |
| 17 | 17 | <image class="img-block" src="{{imghost + item.original_img}}" data-val="{{item.original_img}}" | ... | ... |
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
| ... | ... | @@ -712,6 +712,9 @@ Page({ |
| 712 | 712 | this.data.show_prew_img = 0; return false; |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | + th.data.fir_def_store =null; | |
| 716 | + that.setData({ def_pick_store: null,}); | |
| 717 | + | |
| 715 | 718 | /*-- |
| 716 | 719 | //优惠券要实时更新 |
| 717 | 720 | getApp().getConfig2(function (e) { |
| ... | ... | @@ -878,6 +881,7 @@ Page({ |
| 878 | 881 | sele_g: t.data.data, |
| 879 | 882 | userInfo: getApp().globalData.userInfo, |
| 880 | 883 | }); |
| 884 | + | |
| 881 | 885 | ee.init(gid); |
| 882 | 886 | //获取门店 |
| 883 | 887 | ee.get_sto(); |
| ... | ... | @@ -1912,6 +1916,7 @@ Page({ |
| 1912 | 1916 | //---------拿出门店分类和门店------------ |
| 1913 | 1917 | get_sto(e) { |
| 1914 | 1918 | var th = this, is_normal = e; |
| 1919 | + var that=th; | |
| 1915 | 1920 | |
| 1916 | 1921 | if (e == 1) { |
| 1917 | 1922 | th.setData({ is_normal: 1 }) |
| ... | ... | @@ -1921,6 +1926,8 @@ Page({ |
| 1921 | 1926 | |
| 1922 | 1927 | var timer_get = setInterval(function () { |
| 1923 | 1928 | if (th.data.is_get_local_ok == 0) return false; |
| 1929 | + if (!th.data.fir_def_store) return false; | |
| 1930 | + | |
| 1924 | 1931 | var dd = null, i = getApp().request; |
| 1925 | 1932 | if (!th.data.sele_g) return false; |
| 1926 | 1933 | |
| ... | ... | @@ -1968,44 +1975,107 @@ Page({ |
| 1968 | 1975 | }).then(res => { |
| 1969 | 1976 | var e = res; |
| 1970 | 1977 | |
| 1978 | + //确保门店的数量要>0时,才进行计算 | |
| 1971 | 1979 | if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { |
| 1972 | 1980 | |
| 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 | 1981 | |
| 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; | |
| 1982 | + | |
| 1983 | + //指定门店判断, 不是普通购买的时候,秒杀的时候,秒杀有指定门店 | |
| 1984 | + var pickup_ids=th.data.presellForm.pick_up_lists | |
| 1985 | + //-- 如果有指定门店的时候 -- | |
| 1986 | + if(pickup_ids){ | |
| 1987 | + | |
| 1988 | + var ok_arr=[]; | |
| 1989 | + for (let i in e.data.data.pageData) { | |
| 1990 | + let ite = e.data.data.pageData[i]; | |
| 1991 | + //-- 查找一下门店有没有在 -- | |
| 1992 | + var idx=pickup_ids.findIndex(function (e){ | |
| 1993 | + return e.pickup_id==ite.pickup_id; | |
| 1994 | + }) | |
| 1995 | + if(idx>-1){ | |
| 1996 | + ok_arr.push(ite) | |
| 1997 | + } | |
| 1998 | + } | |
| 1999 | + | |
| 2000 | + //判断会员的默认的门店是不是匹配指定的门店 | |
| 2001 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
| 2002 | + //-- 查找一下门店有没有在 -- | |
| 2003 | + var idx1=pickup_ids.findIndex(function (e){ | |
| 2004 | + return e.pickup_id==th.data.def_pick_store.pickup_id; | |
| 2005 | + }) | |
| 2006 | + | |
| 2007 | + if(idx1<0){ | |
| 2008 | + //如果是秒杀的指定门店,就要设置秒杀的 | |
| 2009 | + th.data.def_pick_store.is_no_dis_act=1; | |
| 2010 | + }else{ | |
| 2011 | + th.data.def_pick_store.is_no_dis_act=0; | |
| 1990 | 2012 | } |
| 2013 | + | |
| 2014 | + that.setData({ | |
| 2015 | + def_pick_store: th.data.def_pick_store | |
| 2016 | + }) | |
| 2017 | + | |
| 2018 | + } | |
| 2019 | + e.data.data.pageData=ok_arr; //数组重新赋值 | |
| 2020 | + e.data.data.total=ok_arr.length; //数组的长度 | |
| 2021 | + } | |
| 2022 | + else{ | |
| 2023 | + //-- 多规格指定门店优化 -- | |
| 2024 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}'){ | |
| 2025 | + th.data.def_pick_store.is_no_dis_act=0; | |
| 2026 | + that.setData({ | |
| 2027 | + def_pick_store: th.data.def_pick_store | |
| 2028 | + }) | |
| 1991 | 2029 | } |
| 1992 | - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
| 1993 | 2030 | } |
| 1994 | 2031 | |
| 2032 | + //确保门店的数量要>0时,才进行计算 | |
| 2033 | + if(e.data.data.pageData.length > 0) { | |
| 1995 | 2034 | |
| 1996 | - th.setData({ all_pick_list: e.data.data.pageData }); | |
| 1997 | 2035 | |
| 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) | |
| 2036 | + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店 | |
| 2037 | + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) { | |
| 2038 | + th.setData({ | |
| 2039 | + def_pick_store: e.data.data.pageData[0], | |
| 2040 | + sto_sele_name: e.data.data.pageData[0].pickup_name, | |
| 2041 | + sto_sele_id: e.data.data.pageData[0].pickup_id, | |
| 2042 | + sto_sele_distr: e.data.data.pageData[0].distr_type | |
| 2043 | + }); | |
| 2044 | + th.data.fir_def_store = e.data.data.pageData[0]; | |
| 2045 | + } | |
| 2046 | + | |
| 2047 | + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 -- | |
| 2048 | + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') { | |
| 2049 | + for (var k = 0; k < e.data.data.pageData.length; k++) { | |
| 2050 | + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | |
| 2051 | + e.data.data.pageData.splice(k, 1); //删除 | |
| 2052 | + break; | |
| 2053 | + } | |
| 2054 | + } | |
| 2055 | + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | |
| 2056 | + } | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + th.setData({all_pick_list: e.data.data.pageData}); | |
| 2060 | + | |
| 2061 | + //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售-- | |
| 2062 | + if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id | |
| 2063 | + && 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)) { | |
| 2064 | + setTimeout(function () { | |
| 2065 | + th.deal_pickup_dline(e); | |
| 2066 | + }, 800) | |
| 2067 | + } else { | |
| 2068 | + setTimeout(function () { | |
| 2069 | + th.deal_pickup(e); //--普通门店排版-- | |
| 2070 | + }, 800) | |
| 2071 | + } | |
| 2008 | 2072 | } |
| 2073 | + else{ | |
| 2074 | + wx.hideLoading(); | |
| 2075 | + } | |
| 2076 | + } | |
| 2077 | + else{ | |
| 2078 | + wx.hideLoading(); | |
| 2009 | 2079 | } |
| 2010 | 2080 | }) |
| 2011 | 2081 | }, 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
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); |
| ... | ... | @@ -2385,7 +2396,8 @@ Page({ |
| 2385 | 2396 | giftsinfo: get_data.giftsinfo, |
| 2386 | 2397 | zp_num: get_data.zp_num * get_data.bs, |
| 2387 | 2398 | gf_pr_name: item_map.name, |
| 2388 | - prom_id: item_map.prom_id | |
| 2399 | + prom_id: item_map.prom_id, | |
| 2400 | + bs: parseInt(get_data.bs), | |
| 2389 | 2401 | }); |
| 2390 | 2402 | |
| 2391 | 2403 | duo_zp_num_arr[item_map.prom_id] = t_zp_num; |
| ... | ... | @@ -4711,6 +4723,8 @@ Page({ |
| 4711 | 4723 | |
| 4712 | 4724 | var order_prom_list_cart = th.data.order_prom_list_cart; |
| 4713 | 4725 | |
| 4726 | + //优惠商品限购的优化 | |
| 4727 | + var yh_lm_map={}; | |
| 4714 | 4728 | //--组装推送数据-- |
| 4715 | 4729 | for (var i = 0; i < order_prom_list_cart.length; i++) { |
| 4716 | 4730 | var t_item = order_prom_list_cart[i]; |
| ... | ... | @@ -4877,8 +4891,6 @@ Page({ |
| 4877 | 4891 | var check_map = {}; |
| 4878 | 4892 | let groupchat_ids=[] |
| 4879 | 4893 | |
| 4880 | - | |
| 4881 | - | |
| 4882 | 4894 | //-------------让商品添加到商品列表-------------------- |
| 4883 | 4895 | for (var k = 0; k < t_item.goods.length; k++) { |
| 4884 | 4896 | |
| ... | ... | @@ -4975,6 +4987,7 @@ Page({ |
| 4975 | 4987 | //--赠品的时候,阶梯促销会右重复的情况,还有组合购的时候拆分出去的 -- |
| 4976 | 4988 | if (check_map[txt] && goods.prom_type != 10) { |
| 4977 | 4989 | getApp().confirmBox(goods.goods_name + "计算金额错误,请重新刷新"); |
| 4990 | + th.setData({ submit: 0 }) | |
| 4978 | 4991 | return false; |
| 4979 | 4992 | } else { |
| 4980 | 4993 | check_map[txt] = 1; |
| ... | ... | @@ -4986,18 +4999,65 @@ Page({ |
| 4986 | 4999 | var mo_num=getApp().get_limit_qty(g_item,act.length); |
| 4987 | 5000 | var steep=getApp().get_limit_qty(g_item,act.length,1); |
| 4988 | 5001 | |
| 4989 | - if ([0,3,5,7,10].indexOf(goods.prom_type)>-1){ | |
| 5002 | + //赠品要排除之外,不进行判断 | |
| 5003 | + if ([0,3,5,7,10].indexOf(goods.prom_type)>-1 && !goods.is_gift){ | |
| 4990 | 5004 | if(mo_num>goods.goods_num){ |
| 4991 | 5005 | getApp().confirmBox(goods.goods_name + "的未达到起订数量"); |
| 4992 | 5006 | th.data.is_summit_ing = 0; |
| 5007 | + th.setData({ submit: 0 }) | |
| 4993 | 5008 | return false; |
| 4994 | 5009 | } |
| 4995 | 5010 | if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){ |
| 4996 | 5011 | getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数"); |
| 4997 | 5012 | th.data.is_summit_ing = 0; |
| 5013 | + th.setData({ submit: 0 }) | |
| 4998 | 5014 | return false; |
| 4999 | 5015 | } |
| 5000 | 5016 | |
| 5017 | + //-- 要判断一下优惠促销的商品的限购 -- | |
| 5018 | + if(goods.prom_type==3){ | |
| 5019 | + var pro_gd_limit_num=0; | |
| 5020 | + var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{ | |
| 5021 | + data:{ | |
| 5022 | + store_id:os.stoid,goods_id:goods.goods_id,prom_id:goods.prom_id,prom_type:3 | |
| 5023 | + } | |
| 5024 | + }) | |
| 5025 | + if(p_limit_rs && p_limit_rs.data.code==0){ | |
| 5026 | + pro_gd_limit_num=p_limit_rs.data.data | |
| 5027 | + } | |
| 5028 | + //-- 如果有商品限购的时候 -- | |
| 5029 | + if(pro_gd_limit_num>0){ | |
| 5030 | + //-- 获取会员之前优惠促销商品买了多少件 -- | |
| 5031 | + var pro_by_num=0; | |
| 5032 | + var lrs= { | |
| 5033 | + store_id: os.stoid,user_id: getApp().globalData.user_id, | |
| 5034 | + goods_id: goods.goods_id, prom_type: 3, | |
| 5035 | + prom_id: goods.prom_id, isnew:1 | |
| 5036 | + }; | |
| 5037 | + var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs}); | |
| 5038 | + if(gd_limit_rs && gd_limit_rs.data.code==0){ | |
| 5039 | + pro_by_num=gd_limit_rs.data.data.promgoodsbuynum | |
| 5040 | + } | |
| 5041 | + | |
| 5042 | + var m_ky=goods.goods_id+'|'+goods.prom_id; | |
| 5043 | + | |
| 5044 | + var more_num=yh_lm_map[m_ky]?yh_lm_map[m_ky]:0; | |
| 5045 | + | |
| 5046 | + if(pro_gd_limit_num<pro_by_num+goods.goods_num+more_num){ | |
| 5047 | + getApp().confirmBox(goods.goods_name + "超优惠促销限购"+pro_gd_limit_num+"件,无法购买"); | |
| 5048 | + th.data.is_summit_ing = 0; | |
| 5049 | + th.setData({ submit: 0 }) | |
| 5050 | + return false; | |
| 5051 | + } | |
| 5052 | + | |
| 5053 | + //方便下一轮商品判断限购 | |
| 5054 | + if(!yh_lm_map[m_ky]) { | |
| 5055 | + yh_lm_map[m_ky]=0; | |
| 5056 | + } | |
| 5057 | + yh_lm_map[m_ky]+=goods.goods_num; | |
| 5058 | + } | |
| 5059 | + } | |
| 5060 | + | |
| 5001 | 5061 | } |
| 5002 | 5062 | |
| 5003 | 5063 | //如果不立即购买或者秒杀,如果是线下库存购买的时候 |
| ... | ... | @@ -5009,6 +5069,7 @@ Page({ |
| 5009 | 5069 | if (!isok) { |
| 5010 | 5070 | getApp().confirmBox(goods.goods_name + "的门店库存不足"); |
| 5011 | 5071 | th.data.is_summit_ing = 0; |
| 5072 | + th.setData({ submit: 0 }) | |
| 5012 | 5073 | return false; |
| 5013 | 5074 | } |
| 5014 | 5075 | } |
| ... | ... | @@ -6559,7 +6620,7 @@ Page({ |
| 6559 | 6620 | if (a_limit_num >= t_zp_num && a_stock_num >= t_zp_num) { |
| 6560 | 6621 | send_gf[pickid].push({ |
| 6561 | 6622 | pickup_id: pickid, giftsinfo: get_data.giftsinfo, zp_num: get_data.zp_num * get_data.bs, |
| 6562 | - gf_pr_name: prom.name, prom_id: prom.prom_id | |
| 6623 | + gf_pr_name: prom.name, prom_id: prom.prom_id,bs:get_data.bs | |
| 6563 | 6624 | }); |
| 6564 | 6625 | } |
| 6565 | 6626 | th.setData({ send_gf: send_gf }); |
| ... | ... | @@ -7190,7 +7251,8 @@ Page({ |
| 7190 | 7251 | zp_num: this.data.send_gf[pk][index].zp_num, |
| 7191 | 7252 | gift_pkid: pk, |
| 7192 | 7253 | gf_prom_id: this.data.send_gf[pk][index].prom_id, |
| 7193 | - send_gf_index: index | |
| 7254 | + send_gf_index: index, | |
| 7255 | + gf_bs:this.data.send_gf[pk][index].bs | |
| 7194 | 7256 | }) |
| 7195 | 7257 | }, |
| 7196 | 7258 | |
| ... | ... | @@ -7207,7 +7269,7 @@ Page({ |
| 7207 | 7269 | var gift_id = discount.gift_id; |
| 7208 | 7270 | for (var i in alllist) { |
| 7209 | 7271 | var list_item = alllist[i]; |
| 7210 | - //-- 门店相同,活动相同的时候 -- | |
| 7272 | + //-- 门店相同,活动相同的时候,就continue掉 -- | |
| 7211 | 7273 | if (pick_id == list_item.pickup_id && prom_id == list_item.prom_id) continue; |
| 7212 | 7274 | for (var j in list_item.goods) { |
| 7213 | 7275 | //如果赠品的ID一样,要进行统计数量 |
| ... | ... | @@ -7216,7 +7278,7 @@ Page({ |
| 7216 | 7278 | all_num += list_item.goods[j].goods_num; |
| 7217 | 7279 | } |
| 7218 | 7280 | 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; | |
| 7281 | + all_limit_num += list_item.goods[j].goods_num; | |
| 7220 | 7282 | } |
| 7221 | 7283 | } |
| 7222 | 7284 | } |
| ... | ... | @@ -7230,7 +7292,8 @@ Page({ |
| 7230 | 7292 | }); |
| 7231 | 7293 | return false; |
| 7232 | 7294 | } |
| 7233 | - if (discount.limit_num < all_limit_num) { | |
| 7295 | + //-- 限购一定要大于0,否则就是不限的意思 -- | |
| 7296 | + if (discount.limit_num>0 && discount.can_num < all_limit_num) { | |
| 7234 | 7297 | wx.showToast({ |
| 7235 | 7298 | title: "超出赠品限购", |
| 7236 | 7299 | icon: 'none', |
| ... | ... | @@ -7249,10 +7312,22 @@ Page({ |
| 7249 | 7312 | th.data.isget_by_quan[gf_pickup_id]=null; |
| 7250 | 7313 | |
| 7251 | 7314 | var zp_num = this.data.zp_num; |
| 7315 | + var gf_bs = this.data.gf_bs?this.data.gf_bs:1; | |
| 7316 | + | |
| 7252 | 7317 | var giftsinfo = this.data.giftsinfo; |
| 7253 | 7318 | var all_num = 0; |
| 7254 | 7319 | for (let i in giftsinfo) { |
| 7255 | 7320 | let item = giftsinfo[i]; |
| 7321 | + if(item.must_num>0 ){ | |
| 7322 | + if(!item.selected){ | |
| 7323 | + ut.m_toast("必送的赠品没有选中"); | |
| 7324 | + return false; | |
| 7325 | + } | |
| 7326 | + if(item.goods_num<item.must_num*gf_bs){ | |
| 7327 | + ut.m_toast(item.goods_name+"赠品的数量需选"+item.must_num*gf_bs+"件"); | |
| 7328 | + return false; | |
| 7329 | + } | |
| 7330 | + } | |
| 7256 | 7331 | if (!item.selected) continue; |
| 7257 | 7332 | all_num += item.goods_num; |
| 7258 | 7333 | } |
| ... | ... | @@ -7285,7 +7360,6 @@ Page({ |
| 7285 | 7360 | var pos=this.find_pro_last(pk_list_goods,3,this.data.gf_prom_id); |
| 7286 | 7361 | var fd_gd=pk_list_goods[pos] |
| 7287 | 7362 | |
| 7288 | - | |
| 7289 | 7363 | var url = "/api/weshop/cart/delGift?store_id=" + os.stoid + "&user_id=" |
| 7290 | 7364 | + getApp().globalData.user_id + "&is_gift=1&pick_id=" + this.data.gift_pkid + "&prom_id=" + this.data.gf_prom_id; |
| 7291 | 7365 | await getApp().request.promiseDelete(url, {}); |
| ... | ... | @@ -7455,14 +7529,18 @@ Page({ |
| 7455 | 7529 | var gf_pr_name = item_arr[ip].gf_pr_name; |
| 7456 | 7530 | var zp_num = item_arr[ip].zp_num; |
| 7457 | 7531 | var giftsinfo = item_arr[ip].giftsinfo; |
| 7532 | + | |
| 7458 | 7533 | var limit_all = 0; |
| 7459 | 7534 | var stock_all = 0; |
| 7535 | + var no_limit=0; | |
| 7536 | + | |
| 7460 | 7537 | for (let iu in giftsinfo) { |
| 7461 | 7538 | let gf_item = giftsinfo[iu]; |
| 7462 | - limit_all += gf_item.limit_num; | |
| 7539 | + limit_all += gf_item.can_num>0?gf_item.can_num:0; | |
| 7463 | 7540 | stock_all += gf_item.gift_storecount; |
| 7541 | + if(gf_item.limit_num<=0) no_limit=1; | |
| 7464 | 7542 | } |
| 7465 | - if (limit_all < zp_num) { | |
| 7543 | + if (!no_limit && limit_all < zp_num) { | |
| 7466 | 7544 | error_arr.push(gf_pr_name + "限购不足"); |
| 7467 | 7545 | } |
| 7468 | 7546 | if (stock_all < zp_num) { | ... | ... |
packageE/pages/cart/cart2/cart2.wxml
| ... | ... | @@ -1042,7 +1042,7 @@ |
| 1042 | 1042 | </view> |
| 1043 | 1043 | <!-- top act_name --> |
| 1044 | 1044 | <view class="flex gift_top_v ai_c fs30" style="padding-left: 70rpx"> |
| 1045 | - {{gf_pr_name}},可任选{{zp_num}}件商品为赠品 | |
| 1045 | + {{gf_pr_name}},可选{{zp_num}}件商品为赠品 | |
| 1046 | 1046 | </view> |
| 1047 | 1047 | <!-- 赠品选择 --> |
| 1048 | 1048 | <scroll-view scroll-y="{{true}}" style="height:calc(100% - 300rpx);"> |
| ... | ... | @@ -1054,17 +1054,20 @@ |
| 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.must_num*gf_bs}}件</text> | |
| 1070 | + | |
| 1068 | 1071 | </view> |
| 1069 | 1072 | |
| 1070 | 1073 | <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 | + min-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
| ... | ... | @@ -3220,6 +3220,8 @@ Page({ |
| 3220 | 3220 | var zh_limit_m={} |
| 3221 | 3221 | var zh_all_ck={}; |
| 3222 | 3222 | |
| 3223 | + //多门店的时候,控制不能超出限购 | |
| 3224 | + var yh_by_map={}; | |
| 3223 | 3225 | // let checkOff=false |
| 3224 | 3226 | for (var i = 0; i < this.data.requestData.length; i++) { |
| 3225 | 3227 | |
| ... | ... | @@ -3232,6 +3234,10 @@ Page({ |
| 3232 | 3234 | } |
| 3233 | 3235 | |
| 3234 | 3236 | var i_arr = this.data.requestData[i].goods; |
| 3237 | + | |
| 3238 | + //判断一下商品能不能满足优惠促销的条件 | |
| 3239 | + await th.check_can_yh_pro(i_arr); | |
| 3240 | + | |
| 3235 | 3241 | for (var j = 0; j < i_arr.length; j++) { |
| 3236 | 3242 | if (i_arr[j].selected && i_arr[j].is_gift != 1) { |
| 3237 | 3243 | |
| ... | ... | @@ -3251,7 +3257,6 @@ Page({ |
| 3251 | 3257 | if (this.data.requestData[i].show_can_cx && (i_arr[j].prom_type == 3 || i_arr[j].prom_type == 7)) { |
| 3252 | 3258 | |
| 3253 | 3259 | var show_can_cx=this.data.requestData[i].show_can_cx; |
| 3254 | - | |
| 3255 | 3260 | //-- 查找选中了什么 -- |
| 3256 | 3261 | for (var ik in show_can_cx) { |
| 3257 | 3262 | var ch_map = show_can_cx[ik].ch_map; |
| ... | ... | @@ -3269,6 +3274,26 @@ Page({ |
| 3269 | 3274 | } else { |
| 3270 | 3275 | i_arr[j].prom_id = fd1.prom_id; |
| 3271 | 3276 | i_arr[j].prom_type = fd1.prom_type; |
| 3277 | + | |
| 3278 | + var ky=i_arr[j]['prom_type']+'-'+i_arr[j]['prom_id']+'-'+i_arr[j]['goods_id']; | |
| 3279 | + var ky_n=0; | |
| 3280 | + if(yh_by_map[ky]){ | |
| 3281 | + ky_n+=yh_by_map[ky]; | |
| 3282 | + } | |
| 3283 | + | |
| 3284 | + //-- 判断优惠促销活动的商品的限购,can_yh 表示商品满足优惠促销的条件 -- | |
| 3285 | + if(i_arr[j].prom_type==3 && fd1.act.goodslimit>0 && i_arr[j].can_yh ){ | |
| 3286 | + var p_can_by=fd1.act.goodslimit-fd1.act.goodslimited; | |
| 3287 | + if(i_arr[j].goods_num+ky_n>p_can_by){ | |
| 3288 | + getApp().confirmBox(i_arr[j].goods_name + "超出活动限购数量"+fd1.act.goodslimit+"件"); | |
| 3289 | + wx.hideLoading(); | |
| 3290 | + return false; | |
| 3291 | + } | |
| 3292 | + } | |
| 3293 | + //-- 把购物数量记录到map表中 -- | |
| 3294 | + if(!yh_by_map[ky]) yh_by_map[ky]=0; | |
| 3295 | + yh_by_map[ky]+=i_arr[j].goods_num; | |
| 3296 | + | |
| 3272 | 3297 | } |
| 3273 | 3298 | } |
| 3274 | 3299 | |
| ... | ... | @@ -3966,6 +3991,7 @@ Page({ |
| 3966 | 3991 | |
| 3967 | 3992 | |
| 3968 | 3993 | }, |
| 3994 | + | |
| 3969 | 3995 | //跳到首页 |
| 3970 | 3996 | goto: function (e) { |
| 3971 | 3997 | var url = '/pages/index/index/index'; |
| ... | ... | @@ -4165,7 +4191,15 @@ Page({ |
| 4165 | 4191 | var a_limit_num = 0; |
| 4166 | 4192 | for (let iy in discount.giftsinfo) { |
| 4167 | 4193 | 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); | |
| 4194 | + | |
| 4195 | + var c_zp=0; | |
| 4196 | + if(parseInt(item.limit_num)>0){ | |
| 4197 | + c_zp= parseInt(item.gift_storecount) > parseInt(item.can_num) ? parseInt(item.can_num) : parseInt(item.gift_storecount); | |
| 4198 | + }else{ | |
| 4199 | + c_zp= parseInt(item.gift_storecount); | |
| 4200 | + } | |
| 4201 | + if(c_zp<0) c_zp=0; | |
| 4202 | + can_zp_num +=c_zp; | |
| 4169 | 4203 | } |
| 4170 | 4204 | |
| 4171 | 4205 | var t_zp_num = parseInt(discount.zp_num) * parseInt(discount.bs); |
| ... | ... | @@ -4290,6 +4324,7 @@ Page({ |
| 4290 | 4324 | } |
| 4291 | 4325 | |
| 4292 | 4326 | }, |
| 4327 | + | |
| 4293 | 4328 | //优惠促销用户参与次数 |
| 4294 | 4329 | async getUserBuyPromNum_pre(prom_id) { |
| 4295 | 4330 | var userInfo = getApp().globalData.userInfo; |
| ... | ... | @@ -4487,7 +4522,14 @@ Page({ |
| 4487 | 4522 | var a_limit_num = 0; |
| 4488 | 4523 | for (let iy in discount.giftsinfo) { |
| 4489 | 4524 | 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); | |
| 4525 | + var c_zp=0; | |
| 4526 | + if(parseInt(item.limit_num)>0) { | |
| 4527 | + c_zp= parseInt(item.gift_storecount) > parseInt(item.can_num) ? parseInt(item.can_num) : parseInt(item.gift_storecount); | |
| 4528 | + }else{ | |
| 4529 | + c_zp= parseInt(item.gift_storecount) | |
| 4530 | + } | |
| 4531 | + if(c_zp<0) c_zp=0; | |
| 4532 | + can_zp_num +=c_zp; | |
| 4491 | 4533 | } |
| 4492 | 4534 | |
| 4493 | 4535 | var t_zp_num = parseInt(discount.zp_num) * parseInt(discount.bs); |
| ... | ... | @@ -4727,8 +4769,6 @@ Page({ |
| 4727 | 4769 | }); |
| 4728 | 4770 | }, |
| 4729 | 4771 | |
| 4730 | - | |
| 4731 | - | |
| 4732 | 4772 | //-- 开始显示活动的弹出 -- |
| 4733 | 4773 | switch_cx_group: function (e) { |
| 4734 | 4774 | var idx = e.currentTarget.dataset.index; |
| ... | ... | @@ -4964,6 +5004,81 @@ Page({ |
| 4964 | 5004 | 'code': 0, |
| 4965 | 5005 | 'msg': '成功' |
| 4966 | 5006 | }) |
| 5007 | + }, | |
| 5008 | + | |
| 5009 | + //-- 判断一下有没有满足优惠促销的条件 -- | |
| 5010 | + check_can_yh_pro:async function (i_arr){ | |
| 5011 | + var map={}; | |
| 5012 | + for (let i = 0; i < i_arr.length; i++) { | |
| 5013 | + var item=i_arr[i]; | |
| 5014 | + if(item.is_gift) continue; | |
| 5015 | + if(item.prom_type!=3) continue; | |
| 5016 | + | |
| 5017 | + if (map[item.prom_id]) { | |
| 5018 | + var ob = map[item.prom_id]; | |
| 5019 | + //-- 避免同一件商品重复添加 -- | |
| 5020 | + if (ob.goods && ob.goods.length) { | |
| 5021 | + var fid = ob.goods.findIndex(function (e) { | |
| 5022 | + e.goods_id == item.goods_id | |
| 5023 | + }) | |
| 5024 | + if (fid > -1) continue; | |
| 5025 | + } | |
| 5026 | + ob.price += item.goods_price * item.goods_num; | |
| 5027 | + ob.goods_num += item.goods_num; | |
| 5028 | + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); | |
| 5029 | + } else { | |
| 5030 | + var prom = null; | |
| 5031 | + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + item.prom_id, {}).then(res => { | |
| 5032 | + if (res.data.code == 0) { | |
| 5033 | + prom = res.data.data; | |
| 5034 | + } | |
| 5035 | + }) | |
| 5036 | + | |
| 5037 | + var ob = {}; | |
| 5038 | + ob.is_bz = prom.is_bz; | |
| 5039 | + ob.prom_id=item.prom_id; | |
| 5040 | + ob.price = item.goods_price * item.goods_num; | |
| 5041 | + ob.goods_num = item.goods_num; | |
| 5042 | + ob.goods = new Array(); | |
| 5043 | + ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); | |
| 5044 | + map[item.prom_id] = ob; | |
| 5045 | + } | |
| 5046 | + } | |
| 5047 | + | |
| 5048 | + var res=null; | |
| 5049 | + for (const mapKey in map) { | |
| 5050 | + var item_map=map[mapKey]; | |
| 5051 | + //开始判断能不能参与优惠 | |
| 5052 | + res=await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { | |
| 5053 | + data: { | |
| 5054 | + price: parseFloat(item_map.price).toFixed(2), prom_id: item_map.prom_id, | |
| 5055 | + goods_num: item_map.goods_num, user_id: getApp().globalData.user_id, | |
| 5056 | + is_bz: item_map.is_bz | |
| 5057 | + } | |
| 5058 | + }) | |
| 5059 | + if (res.data.code == 0 && res.data.data.condition) { | |
| 5060 | + | |
| 5061 | + for (let i = 0; i < i_arr.length; i++) { | |
| 5062 | + var item_g = i_arr[i]; | |
| 5063 | + if (item_g.is_gift) continue; | |
| 5064 | + | |
| 5065 | + //-- 避免同一件商品重复添加 -- | |
| 5066 | + if (item_map.goods && item_map.goods.length) { | |
| 5067 | + var fid = item_map.goods.findIndex(function (e) { | |
| 5068 | + e.goods_id == item_g.goods_id | |
| 5069 | + }) | |
| 5070 | + if (fid > -1) continue; | |
| 5071 | + } | |
| 5072 | + //判断商品是可以参与优惠促销的 | |
| 5073 | + i_arr[i].can_yh=1; | |
| 5074 | + } | |
| 5075 | + | |
| 5076 | + } | |
| 5077 | + | |
| 5078 | + } | |
| 5079 | + | |
| 5080 | + | |
| 5081 | + | |
| 4967 | 5082 | } |
| 4968 | 5083 | |
| 4969 | 5084 | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -7786,88 +7786,47 @@ 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 | + var limit='每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'); | |
| 7814 | + if(fir_act.gd_limit_num>0){ | |
| 7815 | + limit+=",限购"+fir_act.gd_limit_num+"件"; | |
| 7816 | + } | |
| 7817 | + | |
| 7818 | + //-- 开始组装数据 -- | |
| 7819 | + th.add_cx_prom_group({ | |
| 7820 | + id: fir_act.prom_id, | |
| 7821 | + condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'), | |
| 7822 | + limit: limit, | |
| 7823 | + gd_limit_num:fir_act.gd_limit_num>0?fir_act.gd_limit_num:0, | |
| 7824 | + more: more_arr, | |
| 7825 | + prom_type: 3, | |
| 7826 | + promGoodsListsDtos: r_data.promGoodsLists, | |
| 7827 | + is_yh_out_limit: is_yh_out_limit | |
| 7828 | + }); | |
| 7829 | + } | |
| 7871 | 7830 | |
| 7872 | 7831 | } |
| 7873 | 7832 | ... | ... |
pages/index/index/index.wxml
| ... | ... | @@ -484,9 +484,12 @@ |
| 484 | 484 | <diy_public object="{{item.content}}" prom_type="6"></diy_public> |
| 485 | 485 | </block> |
| 486 | 486 | <!--秒杀--> |
| 487 | - <block wx:if="{{item.ename=='seckill' || item.ename=='seckillNew'}}"> | |
| 487 | + <block wx:if="{{item.ename=='seckill'}}"> | |
| 488 | 488 | <seckill object="{{item.content}}"></seckill> |
| 489 | 489 | </block> |
| 490 | + <block wx:if="{{item.ename=='seckillNew'}}"> | |
| 491 | + <diy_public object="{{item.content}}" prom_type="1"></diy_public> | |
| 492 | + </block> | |
| 490 | 493 | <!--标题--> |
| 491 | 494 | <block wx:if="{{item.ename=='title'}}"> |
| 492 | 495 | <title object="{{item.content}}"></title> |
| ... | ... | @@ -530,6 +533,10 @@ |
| 530 | 533 | <block wx:if="{{item.ename=='luckyactivity'}}"> |
| 531 | 534 | <luckyGo object="{{item.content}}"></luckyGo> |
| 532 | 535 | </block> |
| 536 | + <block wx:if="{{item.ename=='luckyactivityNew'}}"> | |
| 537 | + <!-- <luckyGo object="{{item.content}}"></luckyGo> --> | |
| 538 | + <diy_public object="{{item.content}}" prom_type="9"></diy_public> | |
| 539 | + </block> | |
| 533 | 540 | |
| 534 | 541 | <!-- 服务卡项 --> |
| 535 | 542 | <block wx:if="{{item.ename=='servicecategory'}}"> | ... | ... |
pages/template/index.json
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | "searchbox":"/components/diy_searchbox/diy_searchbox", |
| 12 | 12 | "shopname": "/components/diy_shopname/diy_shopname", |
| 13 | 13 | "pingd_buy": "/components/diy_pingd_buy/diy_pingd_buy", |
| 14 | + "luckyGo": "/components/diy_luckyGo/diy_luckyGo", | |
| 14 | 15 | "diy_public": "/components/diy_public/diy_public", |
| 15 | 16 | "title": "/components/diy_title/diy_title", |
| 16 | 17 | "notice": "/components/diy_notice/diy_notice", | ... | ... |
pages/template/index.wxml
| ... | ... | @@ -41,9 +41,12 @@ |
| 41 | 41 | <diy_public object="{{item.content}}" prom_type="6"></diy_public> |
| 42 | 42 | </block> |
| 43 | 43 | <!--秒杀--> |
| 44 | - <block wx:if="{{item.ename=='seckill' || item.ename=='seckillNew'}}"> | |
| 44 | + <block wx:if="{{item.ename=='seckill'}}"> | |
| 45 | 45 | <seckill object="{{item.content}}"></seckill> |
| 46 | 46 | </block> |
| 47 | + <block wx:if="{{item.ename=='seckillNew'}}"> | |
| 48 | + <diy_public object="{{item.content}}" prom_type="1"></diy_public> | |
| 49 | + </block> | |
| 47 | 50 | <!--标题--> |
| 48 | 51 | <block wx:if="{{item.ename=='title'}}"> |
| 49 | 52 | <title object="{{item.content}}"></title> |
| ... | ... | @@ -79,6 +82,15 @@ |
| 79 | 82 | <block wx:if="{{item.ename=='groupbuyNew'}}"> |
| 80 | 83 | <diy_public object="{{item.content}}" prom_type="2"></diy_public> |
| 81 | 84 | </block> |
| 85 | + | |
| 86 | + <!-- 幸运购 --> | |
| 87 | + <block wx:if="{{item.ename=='luckyactivity'}}"> | |
| 88 | + <luckyGo object="{{item.content}}"></luckyGo> | |
| 89 | + </block> | |
| 90 | + <block wx:if="{{item.ename=='luckyactivityNew'}}"> | |
| 91 | + <!-- <luckyGo object="{{item.content}}"></luckyGo> --> | |
| 92 | + <diy_public object="{{item.content}}" prom_type="9"></diy_public> | |
| 93 | + </block> | |
| 82 | 94 | </view> |
| 83 | 95 | </block> |
| 84 | 96 | </view> | ... | ... |
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 + '未找到活动,请取消订单重新购买' | ... | ... |