diff --git a/components/diy_seckill/diy_seckill.js b/components/diy_seckill/diy_seckill.js index 4c67c3f..0e858a4 100644 --- a/components/diy_seckill/diy_seckill.js +++ b/components/diy_seckill/diy_seckill.js @@ -57,6 +57,7 @@ Component({ var item = {}; goodsidlist+=val.goodsid+","; }) + goodsidlist=ut.sub_last(goodsidlist); //--调用接口,读取秒杀-- app.request.promiseGet("/api/ms/flash_sale/getGoodsList?store_id=" diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js index 3fe92f1..60e5404 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -146,16 +146,17 @@ Component({ var card_name_map = new Map(); var user = getApp().globalData.userInfo; - - for (var i = 0; i < plusCard.length; i++) { - if ((user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) { - continue; + if(plusCard) { + for (var i = 0; i < plusCard.length; i++) { + if (user && (user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { + continue; + } + var name = "card" + plusCard[i].CorrPrice.toLowerCase(); + card_name_map.set(name, plusCard[i].CardName); + new_arr.push(plusCard[i]); + + } - var name = "card" + plusCard[i].CorrPrice.toLowerCase(); - card_name_map.set(name, plusCard[i].CardName); - new_arr.push(plusCard[i]); - - } var ob = { "card_list": new_arr, diff --git a/components/goods_list/goods_list.wxss b/components/goods_list/goods_list.wxss index 2814822..0c7f8dc 100644 --- a/components/goods_list/goods_list.wxss +++ b/components/goods_list/goods_list.wxss @@ -1,5 +1,6 @@ .collects { margin-top: 40rpx; + margin-bottom: 40rpx; } .ib { diff --git a/components/my_confirm/my_confirm.js b/components/my_confirm/my_confirm.js index de6129e..dd401fb 100644 --- a/components/my_confirm/my_confirm.js +++ b/components/my_confirm/my_confirm.js @@ -29,10 +29,13 @@ Component({ }) }, go_sure: function() { - this.data.success(); + this.setData({ yu_e_show: 0}) + if(this.data.success) this.data.success(); + }, go_cancle: function() { - this.data.cancle(); + this.setData({ yu_e_show: 0}) + if(this.data.cancle) this.data.cancle(); }, close_yu_e: function() { this.setData({ diff --git a/components/my_confirm/my_confirm.wxml b/components/my_confirm/my_confirm.wxml index 00f519b..d82fc15 100644 --- a/components/my_confirm/my_confirm.wxml +++ b/components/my_confirm/my_confirm.wxml @@ -4,7 +4,7 @@ - {{title}} + {{title}} {{s_text}} {{c_text}} diff --git a/components/my_confirm/my_confirm.wxss b/components/my_confirm/my_confirm.wxss index aa124ba..f05f462 100644 --- a/components/my_confirm/my_confirm.wxss +++ b/components/my_confirm/my_confirm.wxss @@ -40,7 +40,7 @@ } .xc-qr-frame{ width:560rpx; - height: 280rpx; + min-zoom: 280rpx; background: #fff; z-index: 55; position: fixed; diff --git a/components/share_box/share_box.js b/components/share_box/share_box.js new file mode 100644 index 0000000..789813d --- /dev/null +++ b/components/share_box/share_box.js @@ -0,0 +1,18 @@ +var t = getApp(),os =t.globalData.setting; +Component({ + properties: { + }, + data: { + iurl:os.imghost, + }, + ready: function() { + }, + methods: { + //--- 分享 --- + go_share:function () { + this.triggerEvent('go_share') + } + + } + +}) \ No newline at end of file diff --git a/components/share_box/share_box.json b/components/share_box/share_box.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/share_box/share_box.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/share_box/share_box.wxml b/components/share_box/share_box.wxml new file mode 100644 index 0000000..449574a --- /dev/null +++ b/components/share_box/share_box.wxml @@ -0,0 +1,3 @@ + + diff --git a/components/share_box/share_box.wxss b/components/share_box/share_box.wxss new file mode 100644 index 0000000..3c25d2a --- /dev/null +++ b/components/share_box/share_box.wxss @@ -0,0 +1,7 @@ +.box_main{ + width: 80rpx;height: 80rpx; background-color: #fff; border-radius: 50%; border: 1rpx solid #adadad; position: fixed;right: 0; top:50%; + background-repeat: no-repeat;background-position: center center; background-size: cover; +} +button.control[plain] { + border: 0; +} \ No newline at end of file diff --git a/packageA/pages/prom_list/prom_list.js b/packageA/pages/prom_list/prom_list.js index 2ff76e1..450ce8e 100644 --- a/packageA/pages/prom_list/prom_list.js +++ b/packageA/pages/prom_list/prom_list.js @@ -43,8 +43,20 @@ Page({ //------初始化加载---------- onLoad: function(t) { var goods_id=t.goods_id; - this.setData({gid:goods_id}); + this.setData({gid:goods_id}); var ee=this,th=ee,that=ee; + var first_leader=t.first_leader; + if(first_leader){ + getApp().globalData.first_leader=first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ + if(res.data.code==0){ + getApp().globalData.guide_id=res.data.data.id; + } + }) + } + + //----获取系统参数,并判断等级价格----- getApp().getConfig2(function(e) { var json_d = JSON.parse(e.switch_list); @@ -216,7 +228,7 @@ Page({ //--- 判断是等级会员,且在有效期范围内 --- if(user.card_field && now5) card_name=card_name.substring(0,5); + if(card_name && card_name.length>5) card_name=card_name.substring(0,5); th.setData({card_field:user.card_field,card_name:card_name}); if(t.data.data[user.card_field]>0) t.data.data.shop_price=t.data.data[user.card_field]; } @@ -323,7 +335,6 @@ Page({ a = 0, o = this.data.data; a = o.goods_id; - //----------添加到购物车时,要判断限购数量,-------- e.get_buy_num(o, function(ee) { //---判断商品是否超出限购--- @@ -370,6 +381,28 @@ Page({ prom_id:o.prom_id }; + //---是不是从收藏夹出来的--- + if(th.data.c_guide_id){ + newd['guide_id'] = th.data.c_guide_id; + newd['guide_type']=2; + if ("add" == t.currentTarget.dataset.action) newd['guide_type']=3; + }else{ + if(getApp().globalData.guide_id){ + newd['guide_id'] = getApp().globalData.guide_id; + newd['guide_type']=0; + if ("add" == t.currentTarget.dataset.action) newd['guide_type']=1; + } + } + + //如果有导购ID的话 + if(newd['guide_id'] && th.data.sele_collocation){ + for(var jj in th.data.sele_collocation ){ + th.data.sele_collocation[jj]['guide_id']=newd['guide_id']; + th.data.sele_collocation[jj]['guide_type']=newd['guide_type']; + } + } + + //-----如果是秒杀,团购,积分购,拼团----- if (th.data.data.prom_type != 5) { return s.my_warnning("商品不是搭配活动!", 0, th); @@ -612,22 +645,25 @@ Page({ //--点击分享事件--- onShareAppMessage: function(t) { - var th = this; - var price = th.data.data.shop_price; - if (th.data.prom_act) { - price = th.data.prom_act.price; - } - var title= th.data.data.goods_name; - var img=th.data.data.original_img; - if(th.data.prom_type==6){ - title=th.data.prom_act.share_title; - img=th.data.iurl+th.data.prom_act.share_imgurl; - } + var curPage=this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + if(getApp().globalData.user_id){ + if(pagePath.indexOf("?")>0){ + pagePath+="&goods_id="+this.data.gid+" &first_leader="+getApp().globalData.user_id; + }else{ + pagePath+="?goods_id="+this.data.gid+"&first_leader="+getApp().globalData.user_id; + } + } + + console.log("111"); + console.log(pagePath); return { - title: price + "元 " +title, - path: "/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid, - imageUrl: img, + title: "搭配购", + path: pagePath, } }, diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index a3e37d2..ea1bb48 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -17,6 +17,24 @@ Page({ iurl: os.imghost, }, + //------初始化加载---------- + onLoad: function(t) { + var first_leader = t.first_leader; + + console.log("------------"); + console.log(first_leader); + + if (first_leader) { + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + } + }) + } + }, + onShow: function(t) { wx.setNavigationBarTitle({ title: "天天拼单",}) @@ -126,12 +144,34 @@ Page({ this.reloadGoodList(); }, - //---------分享配置-------- - onShareAppMessage: function (e) { - return { - title: "限时团购", - } - }, + + + //---------分享配置-------- + onShareAppMessage: function (e) { + var curPage=this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + if(getApp().globalData.user_id){ + + if(pagePath.indexOf("?")>0){ + pagePath+="&first_leader="+getApp().globalData.user_id; + }else{ + pagePath+="?first_leader="+getApp().globalData.user_id; + } + } + + console.log("11"+pagePath); + + return { + title: "限时团购", + path:pagePath, + } + }, + + + //图片失败,默认图片 bind_bnerr2: function (e) { diff --git a/pages/activity/pind_list/pind_list.json b/pages/activity/pind_list/pind_list.json index 47305b4..fe12943 100644 --- a/pages/activity/pind_list/pind_list.json +++ b/pages/activity/pind_list/pind_list.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "天天拼单" + "navigationBarTitleText": "天天拼单", + "usingComponents": { + "share_box": "/components/share_box/share_box" + } } \ No newline at end of file diff --git a/pages/activity/pind_list/pind_list.wxml b/pages/activity/pind_list/pind_list.wxml index e19716e..12741c4 100644 --- a/pages/activity/pind_list/pind_list.wxml +++ b/pages/activity/pind_list/pind_list.wxml @@ -84,4 +84,6 @@ 没有相关内容 - \ No newline at end of file + + + \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.js b/pages/activity/seckill_list/seckill_list.js index a669049..aa6e5e0 100644 --- a/pages/activity/seckill_list/seckill_list.js +++ b/pages/activity/seckill_list/seckill_list.js @@ -12,6 +12,26 @@ Page({ ismore:1, //是否可以加载更多 isshow:0, }, + + //------初始化加载---------- + onLoad: function(t) { + var first_leader = t.first_leader; + + console.log("------------"); + console.log(first_leader); + + if (first_leader) { + getApp().globalData.first_leader = first_leader; + //调用接口判断是不是会员 + getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => { + if (res.data.code == 0) { + getApp().globalData.guide_id = res.data.data.id; + } + }) + } + }, + + onShow: function(t) { wx.setNavigationBarTitle({ title: "商品秒杀",}) @@ -123,12 +143,31 @@ Page({ this.setData({type:a,goodlist:null}); this.reloadGoodList(); }, - //---------分享配置-------- - onShareAppMessage: function (e) { - return { - title: "疯狂秒杀", - } - }, + + + //---------分享配置-------- + onShareAppMessage: function (e) { + var curPage=this; + var pagePath = curPage.route; //当前页面url + if (pagePath.indexOf('/') != 0) { + pagePath = '/' + pagePath; + } + if(getApp().globalData.user_id){ + + if(pagePath.indexOf("?")>0){ + pagePath+="&first_leader="+getApp().globalData.user_id; + }else{ + pagePath+="?first_leader="+getApp().globalData.user_id; + } + } + + console.log("11"+pagePath); + return { + title: "限时秒杀", + path:pagePath, + } + }, + //图片失败,默认图片 bind_bnerr2: function (e) { var _errImg = e.target.dataset.errorimg; diff --git a/pages/activity/seckill_list/seckill_list.json b/pages/activity/seckill_list/seckill_list.json index b6cce60..e533db3 100644 --- a/pages/activity/seckill_list/seckill_list.json +++ b/pages/activity/seckill_list/seckill_list.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "商品秒杀" + "navigationBarTitleText": "商品秒杀", + "usingComponents": { + "share_box": "/components/share_box/share_box" + } } \ No newline at end of file diff --git a/pages/activity/seckill_list/seckill_list.wxml b/pages/activity/seckill_list/seckill_list.wxml index c10ebd1..8de10eb 100644 --- a/pages/activity/seckill_list/seckill_list.wxml +++ b/pages/activity/seckill_list/seckill_list.wxml @@ -73,3 +73,5 @@ + + diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 05f1aae..6569fa0 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -57,9 +57,12 @@ Page({ var th = this; //调用底部导航 t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url); - this.getCardList(); - if(getApp().globalData.user_id) getApp().requestCardNum(); + //--强行等待,让购物车的数量能够正确的线上 + setTimeout(function () { + if(getApp().globalData.user_id) getApp().requestCardNum(th); + },500) + //--获取是否又秒杀活动-- getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { data: { @@ -142,102 +145,105 @@ Page({ carr = su.data.data.pageData; var all_num = 0; - for (var i = 0; i < carr.length; i++) { - var item = carr[i]; - var good=null; - await getApp().request.promiseGet("/api/weshop/goods/get/"+os.stoid+"/"+item.goods_id,{}).then(res=>{ - good=res.data.data; - }) - var tt=ut.gettimestamp(); - //如果商品下架了,或者商品是赠品,一开始都要清除 - if((good.down_time>0 && good.down_time0) { + for (var i = 0; i < carr.length; i++) { + var item = carr[i]; + var good = null; + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + item.goods_id, {}).then(res => { + good = res.data.data; + }) + var tt = ut.gettimestamp(); + //如果商品下架了,或者商品是赠品,一开始都要清除 + if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0 || item.is_gift) { var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; getApp().request.delete(url, { - success: function(t) { } + success: function (t) { + } }); //商品已经下架 continue; - } - //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着 - if(item.prom_type==1){ - var prom=null; - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+item.prom_id,{ - }).then(res=>{ - if(res.data.code==0) prom=res.data.data; - }) - //---如果有活动,不算在一起--- - if(!prom && prom.is_end==0 && prom.end_time>now && prom.start_time { - if(res.data.code==0){ - var r_data=res.data.data; - if(!r_data.promGoodsLists){ - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - a.delete(url, {}); - //商品已经下架 - isok=0; - } + } + //如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着 + if (item.prom_type == 1) { + var prom = null; + await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + item.prom_id, {}).then(res => { + if (res.data.code == 0) prom = res.data.data; + }) + //---如果有活动,不算在一起--- + if (!prom && prom.is_end == 0 && prom.end_time > now && prom.start_time < now) { + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + a.delete(url, { + success: function (t) { } - else{ + }); + //商品已经下架 + continue; + } + } + //--判断优惠活动有没有过期-- + else if (item.prom_type == 3) { + var isok = 1; + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => { + if (res.data.code == 0) { + var r_data = res.data.data; + if (!r_data.promGoodsLists) { var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; - a.delete(url, { }); + a.delete(url, {}); //商品已经下架 - isok=0; + isok = 0; } + } else { + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + a.delete(url, {}); + //商品已经下架 + isok = 0; + } }) - if(!isok) continue; - } + if (!isok) continue; + } - all_num += item.goods_num; - item.original_img = oo.imghost + item.original_img; - item.selected = 0; + all_num += item.goods_num; + item.original_img = oo.imghost + item.original_img; + item.selected = 0; - var pcid = item.pick_id; - var find = 0; - //---------循环查找门店--- - if (arr.length > 0) { - for (var j = 0; j < arr.length; j++) { - if (arr[j].pid == pcid) { - arr[j].goods.push(item); - find = 1; - break; + var pcid = item.pick_id; + var find = 0; + //---------循环查找门店--- + if (arr.length > 0) { + for (var j = 0; j < arr.length; j++) { + if (arr[j].pid == pcid) { + arr[j].goods.push(item); + find = 1; + break; + } } } - } - //------如果没有找到----- - if (find == 0) { - var pikname = ''; - //找到门店名称 - for (var k = 0; k < th.data.allsto.length; k++) { - if (pcid == th.data.allsto[k].pickup_id) { - pikname = th.data.allsto[k].pickup_name; - break; + //------如果没有找到----- + if (find == 0) { + var pikname = ''; + //找到门店名称 + for (var k = 0; k < th.data.allsto.length; k++) { + if (pcid == th.data.allsto[k].pickup_id) { + pikname = th.data.allsto[k].pickup_name; + break; + } } + var narr = new Array(); + narr.push(item); + var ie = { + pid: pcid, + pname: pikname, + goods: narr, + selected: 0 + }; + arr.push(ie); } - var narr = new Array(); - narr.push(item); - var ie = { - pid: pcid, - pname: pikname, - goods: narr, - selected: 0 - }; - arr.push(ie); } } + if(arr.length==0) { setTimeout(function () { var goods_list = th.selectComponent("#goods_list"); //组件的id @@ -657,10 +663,11 @@ Page({ e.doCheckAll(); t.goods_num=false_data.false_data.buy_limit; - e.update_cart(t, pitem, item); - + e.update_cart(t, pitem, item); return false; } + e.update_cart(t, pitem, item); + }else{ //--- 看一下是不是线下库存 --- if(th.data.sales_rules==2){ @@ -789,6 +796,7 @@ Page({ e.check_prom_activity(i) } e.doCheckAll(); + getApp().requestCardNum(e); } }); }, @@ -1294,4 +1302,5 @@ Page({ getApp().goto(url); } + }); \ No newline at end of file diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 8744b68..76f395c 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -1,3 +1,6 @@ + +