diff --git a/components/lb_sear/lb_sear.js b/components/lb_sear/lb_sear.js new file mode 100644 index 0000000..7d3ac03 --- /dev/null +++ b/components/lb_sear/lb_sear.js @@ -0,0 +1,31 @@ +var t = getApp(), os = t.globalData.setting; +Component({ + properties: {}, + data: { + f_sear:0, + sear_key:'' + }, + + ready: function() {}, + methods: { + show_sear_inp(){ + this.setData({f_sear:1}); + }, + blur_sear(){ + if(!this.data.sear_key) + this.setData({f_sear:0}); + }, + + search_lb(){ + this.triggerEvent('search_lb'); + }, + + input_sear(e){ + let value = e.detail.value; + this.data.sear_key=value; + this.triggerEvent('input_sear',value); + } + + } + +}) \ No newline at end of file diff --git a/components/lb_sear/lb_sear.json b/components/lb_sear/lb_sear.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/lb_sear/lb_sear.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/lb_sear/lb_sear.wxml b/components/lb_sear/lb_sear.wxml new file mode 100644 index 0000000..5fdb94c --- /dev/null +++ b/components/lb_sear/lb_sear.wxml @@ -0,0 +1,4 @@ + + 搜索礼包 + + diff --git a/components/lb_sear/lb_sear.wxss b/components/lb_sear/lb_sear.wxss new file mode 100644 index 0000000..56fd335 --- /dev/null +++ b/components/lb_sear/lb_sear.wxss @@ -0,0 +1,4 @@ +@import '../../app.wxss'; +.t_search_box{ + border-radius:20rpx;bottom: 10rpx; width: 700rpx; left: 25rpx; height: 80rpx; background-color:rgba(255, 255, 255, 0.7); +} diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js index 9ccc3f3..1ddfe8e 100644 --- a/packageA/pages/myGift/myGift.js +++ b/packageA/pages/myGift/myGift.js @@ -20,7 +20,8 @@ Page({ noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 pageNum: 1, // 当前页数 iurl: os.imghost, //图片前缀网址 - is_summit_ing:0 //是不是提交申请 + is_summit_ing:0, //是不是提交申请 + sear_key:'' //顶部搜索关键子 }, clickTab(e) { @@ -44,6 +45,10 @@ Page({ } else if(index == 1) { url = '/api/weshop/libao/libaoFormvip/page'; }; + + if(this.data.sear_key){ + data.key_str=this.data.sear_key; + } this.getData(true, url, data); @@ -161,7 +166,7 @@ Page({ if(index == 0) { url = '/api/weshop/libao/libaoForm/page'; - data.timetype=2; + data.timetype=1; } else if(index == 1) { url = '/api/weshop/libao/libaoFormvip/page'; }; @@ -205,6 +210,10 @@ Page({ user_id: app.globalData.user_id, } + if(this.data.sear_key){ + req_data.key_str=this.data.sear_key; + } + if(index == 0) { url = '/api/weshop/libao/libaoForm/page'; req_data.timetype=1; @@ -431,6 +440,38 @@ Page({ close_remark:function(){ this.setData({show_rem_pop:0,}) + }, + + search_lb(){ + + let index=this.data.currentIndex; + let url = ''; + let data = { + store_id: app.globalData.setting.stoid, + user_id: app.globalData.user_id, + }; + this.setData({ + list: null, + pageNum: 1, + noMore: false, + }); + + if(index == 0) { + url = '/api/weshop/libao/libaoForm/page'; + data.timetype=2; + } else if(index == 1) { + url = '/api/weshop/libao/libaoFormvip/page'; + }; + + if(this.data.sear_key){ + data.key_str=this.data.sear_key; + } + this.getData(true, url, data); + }, + + input_sear(e){ + let value = e.detail; + this.data.sear_key=value; } }) \ No newline at end of file diff --git a/packageA/pages/myGift/myGift.json b/packageA/pages/myGift/myGift.json index c52f0b2..79999dd 100644 --- a/packageA/pages/myGift/myGift.json +++ b/packageA/pages/myGift/myGift.json @@ -5,6 +5,7 @@ "warn": "/components/long_warn/long_warn", "nav_b": "/components/nav_b/nav_b", "my_confirm": "/components/my_confirm/my_confirm", - "nodata": "/components/nodata/nodata" + "nodata": "/components/nodata/nodata", + "lb_sear": "/components/lb_sear/lb_sear" } } \ No newline at end of file diff --git a/packageA/pages/myGift/myGift.wxml b/packageA/pages/myGift/myGift.wxml index 6d78e37..cf0656f 100644 --- a/packageA/pages/myGift/myGift.wxml +++ b/packageA/pages/myGift/myGift.wxml @@ -2,15 +2,16 @@ - + + - - + + diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index 8d9504e..f762957 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -8254,13 +8254,13 @@ Page({ buyed=zbuy.data.data.userbuynum; } if (zh['zh_num'] > 0 && zh['zh_buy_num'] + num0 > zh['zh_num']) { - func({'code': -1, 'msg': '超出组合购活动总数量'}); - return false; + //func({'code': -1, 'msg': '超出组合购活动总数量'}); + //return false; } if (zh && zh['buy_limit'] > 0 && num0+buyed > zh['buy_limit']) { - func({'code': -1, 'msg': '超出超出组合购活动的限购'}); - return false; + //func({'code': -1, 'msg': '超出超出组合购活动的限购'}); + //return false; } } @@ -8292,8 +8292,8 @@ Page({ return e.goods_id == gid; }) if (gdlist['buyqty'] > 0 && num1 + promgoodsbuynum > gdlist['buyqty']) { - func({'code': -1, 'msg': '超出组合购商品的限购'}); - return false; + //func({'code': -1, 'msg': '超出组合购商品的限购'}); + //return false; } } } diff --git a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js index 519ee16..e8442ad 100644 --- a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js +++ b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js @@ -439,10 +439,17 @@ Page({ }, getList: function (e) { + + if(this.data.ismore) return false; + if(this.data.searching) return false; + this.data.searching=1; + + wx.showLoading({ + title: '加载中.', + }) + var th = this; - getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagForm/page', { - isShowLoading: true, - data: { + var r_q={ store_id: th.data.getStorageID, //商家ID user_id: th.data.getUserID, //用户ID page: th.data.curpage, @@ -450,8 +457,19 @@ Page({ is_end:0, timetype:1, is_act:0 - }, + } + + if(this.data.sear_key){ + r_q.key_str=this.data.sear_key; + } + + getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagForm/page', { + isShowLoading: true, + data:r_q, success: function (res) { + + this.data.searching=0; + if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -488,6 +506,9 @@ Page({ is_get:1 }) } + + wx.hideLoading(); + } }) @@ -852,5 +873,17 @@ Page({ buy_libao:function () { com.buy_libao(this) + }, + + search_lb(){ + this.data.curpage=0; + this.searching=0; + this.setData({ismore:0,is_get:0,wareCard:[]}); + this.getList(); + }, + + input_sear(e){ + let value = e.detail; + this.data.sear_key=value; } }) \ No newline at end of file diff --git a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.json b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.json index 6acc1c4..2ea7afc 100644 --- a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.json +++ b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.json @@ -2,6 +2,7 @@ "navigationBarTitleText": "礼包列表", "usingComponents": { "warn": "/components/long_warn/long_warn", - "my_confirm": "/components/my_confirm/my_confirm" + "my_confirm": "/components/my_confirm/my_confirm", + "lb_sear": "/components/lb_sear/lb_sear" } } \ No newline at end of file diff --git a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.wxml b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.wxml index f3e7128..e4c76b6 100644 --- a/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.wxml +++ b/packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.wxml @@ -1,13 +1,15 @@ - + + - + + diff --git a/packageE/pages/user/monthgiftbag/monthgiftbag.js b/packageE/pages/user/monthgiftbag/monthgiftbag.js index ce91e05..489a42c 100644 --- a/packageE/pages/user/monthgiftbag/monthgiftbag.js +++ b/packageE/pages/user/monthgiftbag/monthgiftbag.js @@ -27,6 +27,8 @@ Page({ total: 0, //总数量 ad_data: null, first_leader: e.globalData.first_leader || 0, // 推荐人ID + + sear_key:'' }, onLoad: function (options) { this.setData({ @@ -98,19 +100,38 @@ Page({ }, + getList: function () { + + if(this.data.ismore) return false; + if(this.data.searching) return false; + this.data.searching=1; + + wx.showLoading({ + title: '加载中.', + }) + var th = this; + let r_q={ + store_id: th.data.getStorageID, //商家ID + user_id: th.data.getUserID, //用户ID + page: th.data.curpage, + pageSize: th.data.pageSize, + pay_state:1 + }; + + if(this.data.sear_key){ + r_q.key_str=this.data.sear_key; + } + getApp().request.get('/api/weshop/marketing/marketingMonthgiftbagRecord/page', { isShowLoading: true, - data: { - store_id: th.data.getStorageID, //商家ID - user_id: th.data.getUserID, //用户ID - page: th.data.curpage, - pageSize: th.data.pageSize, - pay_state:1 - }, + data:r_q , success: function (res) { + + th.data.searching=0; + if (res.data.code == 0) { var arr1 = th.data.wareCard; @@ -156,6 +177,8 @@ Page({ }) } + wx.hideLoading(); + } }); @@ -226,5 +249,17 @@ Page({ } }, + search_lb(){ + this.data.curpage=0; + this.searching=0; + this.setData({ismore:0,is_get:0,wareCard:[]}); + this.getList(); + }, + + input_sear(e){ + let value = e.detail; + this.data.sear_key=value; + } + }); \ No newline at end of file diff --git a/packageE/pages/user/monthgiftbag/monthgiftbag.json b/packageE/pages/user/monthgiftbag/monthgiftbag.json index c5d51ee..80007bc 100644 --- a/packageE/pages/user/monthgiftbag/monthgiftbag.json +++ b/packageE/pages/user/monthgiftbag/monthgiftbag.json @@ -3,6 +3,7 @@ "enablePullDownRefresh": false, "usingComponents": { "warn": "/components/long_warn/long_warn", - "my_confirm": "/components/my_confirm/my_confirm" + "my_confirm": "/components/my_confirm/my_confirm", + "lb_sear": "/components/lb_sear/lb_sear" } } \ No newline at end of file diff --git a/packageE/pages/user/monthgiftbag/monthgiftbag.wxml b/packageE/pages/user/monthgiftbag/monthgiftbag.wxml index ae95d7b..720fe7c 100644 --- a/packageE/pages/user/monthgiftbag/monthgiftbag.wxml +++ b/packageE/pages/user/monthgiftbag/monthgiftbag.wxml @@ -1,13 +1,14 @@ - + + - - - + + + diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index 015606d..55ee6dd 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -187,6 +187,8 @@ Page({ wx.hideLoading(); if(th.data.b_plist){ + //让秒杀跳转后能下拉加载 + th.data.ismore = 1; //组件的id var auto_go = th.selectComponent("#auto_go"); auto_go.show(); diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index aae4ded..f22b50f 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -203,6 +203,8 @@ Page({ wx.hideLoading(); if(th.data.b_plist){ + //让秒杀跳转后能下拉加载 + th.data.ismore = 1; //组件的id var auto_go = th.selectComponent("#auto_go"); auto_go.show(); diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 75c72b6..a1021af 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -3488,7 +3488,7 @@ Page({ console.log('活动次数:' + userbuynum); - if(userbuynum >= i_arr[j].act.zh_num && i_arr[j].act.zh_num>0){ + if(0 >= i_arr[j].act.zh_num-i_arr[j].act.zh_buy_num && i_arr[j].act.zh_num>0){ i_arr[j].out_all_num=1; checkArr7.push(i_arr[j]) }else if (userbuynum >= i_arr[j].act.buy_limit && i_arr[j].act.buy_limit>0) { @@ -4034,11 +4034,13 @@ Page({ prom_type: g_arr[i].prom_type, prom_id: g_arr[i].prom_id, }; - let gitem = checkArr7.find(item => item.goods_id == g_arr[i].goods_id) - if (gitem) { - data.prom_type = 0 - data.prom_id = 0 - } + + // let gitem = checkArr7.find(item => item.goods_id == g_arr[i].goods_id) + // if (gitem) { + // data.prom_type = 0 + // data.prom_id = 0 + // } + //-- 如果有线下取价的时候 -- if (g_arr[i].is_offline) { data.pricing_type = g_arr[i].pricing_type; @@ -5065,6 +5067,7 @@ Page({ else cx_prom_group[dx].sele = 1; } + let the_rs={code:0}; // -- 判断 -- this.cx_check_ok2(async function (the_rs) { if (the_rs.code == 0) { @@ -5204,11 +5207,11 @@ Page({ buyed = zbuy.data.data.userbuynum; } if (zh['zh_num'] > 0 && zh['zh_buy_num'] + num0 > zh['zh_num']) { - func({ - 'code': -1, - 'msg': '超出组合购活动总数量' - }); - return false; + // func({ + // 'code': -1, + // 'msg': '超出组合购活动总数量' + // }); + // return false; } } } @@ -5244,11 +5247,11 @@ Page({ return e.goods_id == gid; }) if (gdlist['buyqty'] > 0 && num1 + promgoodsbuynum > gdlist['buyqty']) { - func({ - 'code': -1, - 'msg': '超出组合购商品的限购' - }); - return false; + // func({ + // 'code': -1, + // 'msg': '超出组合购商品的限购' + // }); + // return false; } } } diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index c9cfaf6..0318e4a 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -71,6 +71,8 @@ Page({ keyword:'', //门店搜索 sec_i:-1,//选中分类门店 下标 + sear_key:'' + }, onLoad: function (options) { var th=this; @@ -431,17 +433,35 @@ Page({ }, getList: function (e) { + + if(this.data.ismore) return false; + if(this.data.searching) return false; + this.data.searching=1; + + wx.showLoading({ + title: '加载中.', + }) + var th = this; + let r_q={ + storeId: th.data.getStorageID, //商家ID + userId: th.data.getUserID, //用户ID + page: th.data.curpage, + pageSize: th.data.pageSize, + is_share:0 + }; + + if(this.data.sear_key){ + r_q.key_str=this.data.sear_key; + } + getApp().request.get('/api/weshop/marketing/giftbag/page', { isShowLoading: true, - data: { - storeId: th.data.getStorageID, //商家ID - userId: th.data.getUserID, //用户ID - page: th.data.curpage, - pageSize: th.data.pageSize, - is_share:0 - }, + data: r_q, success: function (res) { + + th.data.searching=0; + if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -460,6 +480,7 @@ Page({ is_read: 1, is_get:1 }), wx.stopPullDownRefresh(); //停止下拉刷新 + } else { th.setData({ is_read: 1, @@ -467,6 +488,9 @@ Page({ is_get:1 }) } + + wx.hideLoading(); + } }) @@ -825,5 +849,18 @@ Page({ buy_libao:function () { com.buy_libao(this) + }, + + search_lb(){ + this.data.curpage=0; + this.searching=0; + this.setData({ismore:0,is_get:0,wareCard:[]}); + this.getList(); + }, + + input_sear(e){ + let value = e.detail; + this.data.sear_key=value; } + }) \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.json b/pages/giftpack/buygiftpack/giftpackbuy.json index 6acc1c4..2ea7afc 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.json +++ b/pages/giftpack/buygiftpack/giftpackbuy.json @@ -2,6 +2,7 @@ "navigationBarTitleText": "礼包列表", "usingComponents": { "warn": "/components/long_warn/long_warn", - "my_confirm": "/components/my_confirm/my_confirm" + "my_confirm": "/components/my_confirm/my_confirm", + "lb_sear": "/components/lb_sear/lb_sear" } } \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml index 0e45a25..db3772f 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxml +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml @@ -1,13 +1,15 @@ - + + - - + + + diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxss b/pages/giftpack/buygiftpack/giftpackbuy.wxss index 1102c60..7393c1c 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.wxss +++ b/pages/giftpack/buygiftpack/giftpackbuy.wxss @@ -254,4 +254,4 @@ page { border-radius: 30rpx; border: 2rpx solid rgb(238, 238, 238); padding-left: 30rpx; -} \ No newline at end of file +} diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 01b0e44..4597bca 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -28,6 +28,8 @@ Page({ total: 0, //总数量 ad_data: null, first_leader: e.globalData.first_leader || 0, // 推荐人ID + + sear_key:'' //顶部搜索关键子 }, onLoad: function (options) { this.setData({ @@ -94,17 +96,34 @@ Page({ }, getList: function () { + + if(this.data.ismore) return false; + if(this.data.searching) return false; + this.data.searching=1; + + wx.showLoading({ + title: '加载中.', + }) + var th = this; + let r_q={ + storeId: th.data.getStorageID, //商家ID + userId: th.data.getUserID, //用户ID + page: th.data.curpage, + pageSize: th.data.pageSize + } + + if(this.data.sear_key){ + r_q.key_str=this.data.sear_key; + } getApp().request.get('/api/weshop/marketing/my/giftbag/page', { isShowLoading: true, - data: { - storeId: th.data.getStorageID, //商家ID - userId: th.data.getUserID, //用户ID - page: th.data.curpage, - pageSize: th.data.pageSize - }, + data: r_q, success: function (res) { + + th.data.searching=0; + if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -155,6 +174,8 @@ Page({ }) } + wx.hideLoading(); + } }); @@ -203,7 +224,7 @@ Page({ //--- 分享设置 -- onShareAppMessage: function (e) { - getApp().globalData.no_clear=1; + getApp().globalData.no_clear=1; var curPage = this; var pagePath = curPage.route; //当前页面url if (pagePath.indexOf('/') != 0) { @@ -216,14 +237,25 @@ Page({ } }, - onShareTimeline() { + onShareTimeline() { getApp().globalData.no_clear=1; return { title: '专享礼包', imageUrl: this.data.ad_data.ad_code, query: "first_leader=" + this.data.getUserID } - }, + }, + + search_lb(){ + this.data.curpage=0; + this.searching=0; + this.setData({ismore:0,is_get:0,wareCard:[]}); + this.getList(); + }, + input_sear(e){ + let value = e.detail; + this.data.sear_key=value; + } }); \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.json b/pages/giftpack/mygiftpack/mygiftpack.json index 1f07b7f..bd6784b 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.json +++ b/pages/giftpack/mygiftpack/mygiftpack.json @@ -3,6 +3,7 @@ "enablePullDownRefresh": false, "usingComponents": { "warn": "/components/long_warn/long_warn", - "my_confirm": "/components/my_confirm/my_confirm" + "my_confirm": "/components/my_confirm/my_confirm", + "lb_sear": "/components/lb_sear/lb_sear" } } \ No newline at end of file diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxml b/pages/giftpack/mygiftpack/mygiftpack.wxml index 55914d9..c4095d3 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxml +++ b/pages/giftpack/mygiftpack/mygiftpack.wxml @@ -1,13 +1,14 @@ - - + + + - - - + + + diff --git a/pages/giftpack/mygiftpack/mygiftpack.wxss b/pages/giftpack/mygiftpack/mygiftpack.wxss index 518748d..74560e2 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.wxss +++ b/pages/giftpack/mygiftpack/mygiftpack.wxss @@ -261,7 +261,6 @@ button{ background-color: rgb(153,153,153) !important; } - button::after{ border: none; } diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 235259d..3731ffd 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1598,7 +1598,7 @@ Page({ }) }, - async getUserBuyPromNum(prom_id) { + async getUserBuyPromNum(prom_id,is_zh) { var userInfo = getApp().globalData.userInfo; var url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=7&prom_id=${prom_id}`; let res = await getApp().request.promiseGet(url, { @@ -1611,6 +1611,7 @@ Page({ this.setData({ userbuynum }) + if(is_zh) this.data.user_zh_buy_num=userbuynum; // return userbuynum }, @@ -2183,6 +2184,7 @@ Page({ newd['pick_name'] = th.data.sto_sele_name; newd['pick_dis'] = th.data.sto_sele_distr; th.buyNow(newd); + } }, @@ -2249,46 +2251,82 @@ Page({ s.set_b_now(e); getApp().goto("/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id) } else { - - //----其他就按照公众号的购物车立即购买形式来修改,先看会员在购物车中是否加入了该商品,立即购买的----- - getApp().request.get("/api/weshop/cart/page", { - data: { - store_id: os.stoid, - user_id: oo.user_id, - state: 1 - }, - success: function (res) { - //-------如果购物车中有相关的数据--------- - if (res.data.code == 0 && res.data.data.total > 0) { - for (let j in res.data.data.pageData) { - let item_j = res.data.data.pageData[j]; - var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id; - getApp().request.delete(url, {}); - } + //-- 如果是第一顺序是组合购的时候 -- + if(th.data.cx_prom_group && th.data.cx_prom_group.length && th.data.cx_prom_group[0].prom_type==7){ + if(!th.data.is_has_zh_num){ + th.data.adding=0; + wx.hideLoading(); + wx.showModal({ + title: '提示', + content: '超出组合购总数,将以普通商品购买', + success (res) { + if (res.confirm) { + th.cart_next_next(e); + } + } + }) + }else if(th.data.user_zh_buy_num>=th.data.zh_act.buy_limit && th.data.zh_act.buy_limit>0){ + th.data.adding=0; + wx.hideLoading(); + wx.showModal({ + title: '提示', + content: '超出组合购限购次数,将以普通商品购买', + success (res) { + if (res.confirm) { + th.cart_next_next(e); + } + } + }) + }else{ + th.cart_next_next(e); } + } + else{ + th.cart_next_next(e); + } + } - //-- 推迟一下,因为删除没有那么快 -- - setTimeout(() => { - e.state = 1; - e.prom_type = 0; - e.prom_id = 0 - getApp().request.post("/api/weshop/cart/save", { - data: e, - success: function (t) { - th.closeSpecModal(); - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1"); - } - }); - }, 500) - } - }) - } + } + }, + + cart_next_next(e){ + var th=this; + //----其他就按照公众号的购物车立即购买形式来修改,先看会员在购物车中是否加入了该商品,立即购买的----- + getApp().request.get("/api/weshop/cart/page", { + data: { + store_id: os.stoid, + user_id: oo.user_id, + state: 1 + }, + success: function (res) { + //-------如果购物车中有相关的数据--------- + if (res.data.code == 0 && res.data.data.total > 0) { + for (let j in res.data.data.pageData) { + let item_j = res.data.data.pageData[j]; + var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id; + getApp().request.delete(url, {}); + } + } + //-- 推迟一下,因为删除没有那么快 -- + setTimeout(() => { + e.state = 1; + e.prom_type = 0; + e.prom_id = 0 + getApp().request.post("/api/weshop/cart/save", { + data: e, + success: function (t) { + th.closeSpecModal(); + getApp().goto("/packageE/pages/cart/cart2/cart2?state=1"); + } + }); + }, 500) - } + } + }) }, //----------增加购买数量----------- @@ -3401,7 +3439,7 @@ Page({ } else that.get_sto(null,()=>{ that.sele_spec_next(that,item,gid,nor); - }); + },item); }, @@ -3436,7 +3474,11 @@ Page({ var req_d = { "store_id": os.stoid, "goods_id": that.data.gid, +<<<<<<< HEAD "user_id": getApp().globalData.user_id, +======= + "user_id": getApp().globalData.user_id +>>>>>>> dev_oa_fu27 } getApp().request.get(url, { data: req_d, @@ -3633,7 +3675,7 @@ Page({ //---------拿出门店分类和门店------------ - get_sto(e,func) { + get_sto(e,func,item) { console.log('get_sto') var th = this, that = this; @@ -3706,9 +3748,15 @@ Page({ if(!is_normal && py>0 && [3,5,7,10].indexOf(py)<0 ){ pickup_ids=null; } + //-- 把秒杀的指定对象带入 -- + if(item){ + if(item.is_pickup && item.pick_up_lists){ + pickup_ids=item.pick_up_lists + }else{ + pickup_ids=null; + } - //指定门店判断, 不是普通购买的时候,秒杀的时候,秒杀有指定门店 - if(!is_normal && [1,2,6].indexOf(py)>-1 && th.data.prom_act.pick_up_lists){ + }else if(!is_normal && [1,2,6].indexOf(py)>-1 && th.data.prom_act.pick_up_lists){ //指定门店判断, 不是普通购买的时候,秒杀的时候,秒杀有指定门店 pickup_ids=th.data.prom_act.pick_up_lists } @@ -3829,18 +3877,26 @@ Page({ } if(func) func(); }else{ + + if(func) func(); + th.setData({sp_seleing:0}) wx.hideLoading(); } } else { + if(func) func(); + th.setData({sp_seleing:0}) wx.hideLoading(); } },err=>{ ut.m_toast('网络繁忙,请稍后重试'); + if(func) func(); + th.setData({sp_seleing:0}) wx.hideLoading(); }) }, 200) }, + //获取搜索门店输入的值 input_store: function (e) { this.setData({ @@ -3951,7 +4007,32 @@ Page({ } var g_distr_type = th.data.sele_g.distr_type; - wx.hideLoading(); + wx.hideLoading() + + + /*--- 判断初始的用户的默认门店要不要弄进去 ---*/ + var fid=-1; + if(th.data.fir_def_store){ + var fid=e.data.data.pageData.findIndex((e)=>{ + return e.pickup_id==th.data.fir_def_store.pickup_id; + }) + } + //--如果找到默认门店,同时也应该判断配送方式对不对-- + if (th.data.fir_def_store && th.data.fir_def_store.pickup_id && fid<0 && + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { + th.data.fir_def_store.CanOutQty = 0; + //--当选择的门店是客户默认的门店的时候-- + if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) { + th.setData({ + def_pick_store: th.data.fir_def_store + }); + e.data.data.pageData.unshift(th.data.def_pick_store); + } else { + e.data.data.pageData.splice(1, 0, th.data.fir_def_store); + } + } + + //单总量超出10个的时候,同时门店有分类 if (e.data.data.total > 10 && e.his_cate_num) { @@ -4302,6 +4383,8 @@ Page({ } + + //数据组装下 var em = {}; em.data = {}; @@ -4311,8 +4394,14 @@ Page({ em.his_cate_num=e.his_cate_num; + var fid=-1; + if(th.data.fir_def_store){ + var fid=em.data.data.pageData.findIndex((e)=>{ + return e.pickup_id==th.data.fir_def_store.pickup_id; + }) + } //--如果找到默认门店,同时也应该判断配送方式对不对-- - if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && + if (th.data.fir_def_store && th.data.fir_def_store.pickup_id && fid<0 && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { th.data.fir_def_store.CanOutQty = 0; //--当选择的门店是客户默认的门店的时候-- @@ -4336,6 +4425,7 @@ Page({ th.deal_pickup(em); } else { + th.setData({ all_sto: null, only_pk: null, @@ -4344,6 +4434,7 @@ Page({ } } else { + th.setData({ all_sto: null, only_pk: null, @@ -7267,6 +7358,7 @@ Page({ }) } }, + //关闭选择门店 close_popup: function (e) { var th = this; @@ -7472,12 +7564,22 @@ Page({ if (!item) return false; + if (item.is_no_dis_nor || (item.is_no_dis_act && !th.data.is_normal)){ + wx.showToast({ + title: "该门店不可售,请选择其他门店", + icon: 'none', + duration: 2000 + }); + return false; + } + + if (!th.data.sele_g) return false; //判断门店的配送方式是不是匹配 var g_distr_type = th.data.sele_g.distr_type; if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { wx.showToast({ - title: "门店配送方式不匹配", + title: "门店配送方式不匹配,请选择其他门店", icon: 'none', duration: 2000 }); @@ -8485,14 +8587,13 @@ Page({ let item = f_more[i]; f_more[i].prom_id = item.act_id; f_more[i].prom_type = 1; - if (item.goods_id == this.data.data.goods_id) { - continue; - } + var url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + item.act_id; await getApp().request.promiseGet(url, {}).then(rs => { if (rs.data.code == 0 && rs.data.data) { f_more[i].price = rs.data.data.user_price; - + f_more[i].is_pickup = rs.data.data.is_pickup; + f_more[i].pick_up_lists = rs.data.data.pick_up_lists; } }) } @@ -8724,12 +8825,13 @@ Page({ //判断组合购总数够不够 var is_has_zh_num = (!e.data.data.zh_num || e.data.data.zh_buy_num < e.data.data.zh_num); - if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time && is_has_zh_num) { + if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time ) { //-- 获取商品列表 -- th.setData({ zh_act: e.data.data }); - th.getUserBuyPromNum(e.data.data.id) + th.data.is_has_zh_num= is_has_zh_num; + th.getUserBuyPromNum(e.data.data.id,1) } }