diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index d2f890c..45a5b8e 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -364,8 +364,7 @@ Page({ } //-- 如果是等级会员注册返回 -- - if(is_card_back){ - + if(is_card_back){ // 拼团,搭配购不计算,赠品也不计算 if( item['prom_type']!=5 && item['prom_type']!=6 && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){ item.goods_price=item[th.data.card_name]; @@ -376,7 +375,7 @@ Page({ if(item[th.data.card_name]>0 && item['prom_type']!=5 && item['prom_type']!=6 && !th.data.userinfo.card_field && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){ item.cut_price= item.goods_price-item[th.data.card_name]; - carr[i].cut_price=item.goods_price-item[th.data.card_name]; + carr[i].cut_price=(item.goods_price-item[th.data.card_name])*item.goods_num; } } @@ -503,7 +502,7 @@ Page({ //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格 //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 -- if(!gg.collocation_goods && gd['prom_type']!=6 && th.data.card_name && gd[th.data.card_name]>0 && gg.goods_price>gd[th.data.card_name] && !th.data.userinfo.card_field){ - var cut_p= gg.goods_price-gd[th.data.card_name]; + var cut_p= (gg.goods_price-gd[th.data.card_name])*gg.goods_num; th.setData({card_cut_price:cut_p}); } } @@ -526,7 +525,7 @@ Page({ t.data.data.prom_id = 0; t.data.data.prom_type = 0; - + //如果立即购买那边过来,就要读取接口,查看活动的优惠内容 if(gg.prom_type==3){ t.data.data.prom_id = gg.prom_id ; @@ -538,7 +537,7 @@ Page({ var num=1; if(data.is_bz==1){ num=data.bs; - if (num > data.gift_limitnum) num = 0; + if (num > data.gift_limit_num) num = 0; } //如果赠品数量超出礼品库存,就取消 if(num>data['gift_storecount']) num=0; @@ -1617,7 +1616,10 @@ Page({ if(gg.room_id && gg.room_id>0){ goods.room_id=gg.room_id; } - + + //积分购,先要带is_integral_normal=1 + if(gg.is_integral_normal) goods.is_integral_normal=1; + //如果不立即购买或者秒杀,如果是线下库存购买的时候 if(goods.prom_type!=1 && goods.prom_type!=6 && th.data.sales_rules==2){ var isok=1; diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index 5222fd6..48024f6 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -369,7 +369,7 @@ Page({ console.log(rs); var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && th.data.kt_type!=3 ){ + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ switch (good['exp_sum_type']) { case 1: //统一运费 @@ -436,7 +436,8 @@ Page({ //------------立即购买------------- console.log("buy_new"); - if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){ + //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候 + if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){ ff = false; getApp().my_warnning("请选择收货地址",0,this); this.data.is_summit_ing = 0; @@ -449,7 +450,7 @@ Page({ console.log(th.data.wu_arr); console.log(th.data.bn_exp_type); - if(th.data.bn_exp_type==0) { + if(th.data.bn_exp_type==0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)) { if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) { getApp().my_warnning("读取物流失败",0,this); this.data.is_summit_ing = 0; @@ -468,8 +469,6 @@ Page({ 'more_address': addr == null ? "" : addr.more_address, 'mobile': th.data.userinfo.mobile, 'email':'', - 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code, - 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name, 'invoice_title':'', 'goods_price': th.data.formData.all_price, //商品总价 'shipping_price': th.data.formData.shipping_price, //物流金额 @@ -485,6 +484,12 @@ Page({ 'is_pt_tz':th.data.is_pt_tz, //开团类型 'order_goods':new Array(), }; + + //如果不是阶梯团,或者是普通购买, + if((th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)){ + item['shipping_code']= th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code; + item['shipping_name']= th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name; + } if(!th.data.bn_goods.is_normal){ item.is_zsorder=th.data.kt_type+1; //开团类型 diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index cfb698b..7cc5f7a 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1004,8 +1004,8 @@ Page({ goods_name: o.goods_name, goods_sn: o.goods_sn, sku: o.sku, - }; - + }; + //---是不是从收藏夹出来的--- if(th.data.c_guide_id){ newd['guide_id'] = th.data.c_guide_id; @@ -2242,6 +2242,9 @@ Page({ }); return false; } + if(prom_type==4){ + th.setData({is_integral_normal:1}); + } //if (prom_type != 3 && prom_type!=0){ //---判断秒杀---- if (prom_type == 1) { @@ -3276,7 +3279,7 @@ Page({ } }) }, - + //--定义的保存图片方法,分享团--- saveImageToPhotosAlbum: function() { //--先判断会员状态-- @@ -3330,12 +3333,12 @@ Page({ //-- 如果有自定义海报的时候,判断背景的图片 -- if(th.data.share_b_img){ - //pg_path=th.data.share_b_img; + pg_path=th.data.share_b_img; } context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); //-- 是自定义海报的情况下 -- - if(th.data.poster){ + if(th.data.poster && parseInt(th.data.poster.style)==2){ //在线上分享人的情况下 if(parseInt(th.data.poster.show_headpic)){ //获取坐标 @@ -3355,7 +3358,7 @@ Page({ context.setLineJoin('round'); //交点设置成圆角 context.setFillStyle("white") context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); - } + } }else{ //--昵称--- context.setFontSize(24 * unit) @@ -3405,8 +3408,7 @@ Page({ switch (type) { case 0: //普通商品的展示 //中间的几个字 - if(th.data.poster ){ - + if(th.data.poster && parseInt(th.data.poster.style)==2 ){ if(parseInt(th.data.poster.show_quality)){ var g_path = "../../../images/share/s_gou.png"; context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); @@ -3589,7 +3591,7 @@ Page({ //--- 如果是自定义海报的时候 --- - if(th.data.poster){ + if(th.data.poster && parseInt(th.data.poster.style)==2){ //如果显示会员信息的话 if(parseInt(th.data.poster.show_headpic)){ diff --git a/pages/team/team_success/team_success.js b/pages/team/team_success/team_success.js index 36f7ab5..0c72ea1 100644 --- a/pages/team/team_success/team_success.js +++ b/pages/team/team_success/team_success.js @@ -56,7 +56,34 @@ Page({ }) var pay_f = t.payf, order_sn = t.ordersn; this.setData({ pay_f: pay_f, order_sn: order_sn}), - this.init(order_sn) + this.init(order_sn); + + //-- 自定义海报 -- + getApp().request.promiseGet("/api/weshop/goods/poster/page",{ + data:{store_id:os.stoid, type:1, is_user:1 } + }).then(res=>{ + if(res.data.code==0){ + + var poster_data=res.data.data.pageData[0]; + var json_str=poster_data.jsonStr; + if(json_str){ + var json_data=JSON.parse(json_str); + if(json_data.bg_img){ + + //-- 把图片那到本地 -- + wx.getImageInfo({ + src:json_data.bg_img, + success: function(res) { + var path= res.path; + th.setData({share_b_img:path}) + }, + fail: function(res) {} + }); + } + th.setData({poster:json_data}) + } + } + }) }, //关闭展开列表 click:function(e){ @@ -377,19 +404,53 @@ Page({ console.log(vpath); //先画背景 - var pg_path = "../../../images/share/share_bg.png"; + var pg_path = "../../../images/share/share_bg.png"; + //-- 如果有自定义海报的时候,判断背景的图片 -- + if(th.data.share_b_img){ + pg_path=th.data.share_b_img; + } + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; - //强烈推荐 - var tj_path = "../../../images/share/q_tj.png"; - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit); - context.setFontSize(18 * unit) - context.setFillStyle("white") - context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit); + + //-- 是自定义海报的情况下 -- + if(th.data.poster && parseInt(th.data.poster.style)==2){ + //在线上分享人的情况下 + if(parseInt(th.data.poster.show_headpic)){ + //获取坐标 + var x=parseFloat(th.data.poster.head_x)*2; + var y=parseFloat(th.data.poster.head_y)*2; + var x1=(x+90) *unit; + var y1=(y+50) *unit; + //--昵称--- + context.setFontSize(24 * unit) + context.setFillStyle("black") + context.fillText(app.globalData.userInfo.nickname, x1, y1); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; + //强烈推荐 改许程 + var tj_path = "../../../images/share/q_tj.png"; + context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit) + context.setLineJoin('round'); //交点设置成圆角 + context.setFillStyle("white") + context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); + } + + }else{ + //--昵称--- + context.setFontSize(24 * unit) + context.setFillStyle("black") + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; + //强烈推荐 + var tj_path = "../../../images/share/q_tj.png"; + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit); + context.setFontSize(18 * unit) + context.setFillStyle("white") + context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit); + } + + + //---产品名称--- context.setFontSize(21.3 * unit); @@ -468,7 +529,15 @@ Page({ context.setFontSize(22 * unit) context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit); //---二维吗图--- - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); + //-- 自定义海报 -- + if(th.data.poster){ + var erm_x= parseFloat(th.data.poster.ewm_x)*2; + var erm_y= parseFloat(th.data.poster.ewm_y)*2; + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); + }else{ + //---二维吗图--- + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); + } break case 2://阶梯团的展示 //---画线--- @@ -503,24 +572,58 @@ Page({ context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); //---二维吗图--- - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); + //-- 自定义海报 -- + if(th.data.poster){ + var erm_x= parseFloat(th.data.poster.ewm_x)*2; + var erm_y= parseFloat(th.data.poster.ewm_y)*2; + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); + }else{ + //---二维吗图--- + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); + } break } - //---绘制圆形要放在最后---- - context.save(); - context.beginPath(); - var h_x = 60 * unit; - var h_y = 24 * unit; - var h_r = 40 * unit; - var cx = h_x + h_r; - var cy = h_y + h_r; - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); - context.closePath(); - context.fill(); - context.clip(); - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); - context.restore(); + //--- 如果是自定义海报的时候 --- + if(th.data.poster && parseInt(th.data.poster.style)==2){ + + //如果显示会员信息的话 + if(parseInt(th.data.poster.show_headpic)){ + //获取坐标 + var x= parseFloat(th.data.poster.head_x)*2; + var y=parseFloat(th.data.poster.head_y)*2; + //---绘制圆形要放在最后---- + context.save(); + context.beginPath(); + var h_x = x* unit; + var h_y = y * unit; + var h_r = 40 * unit; + var cx = h_x + h_r; + var cy = h_y + h_r; + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + context.closePath(); + context.fill(); + context.clip(); + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + context.restore(); + } + + }else{ + //---绘制圆形要放在最后---- + context.save(); + context.beginPath(); + var h_x = 60 * unit; + var h_y = 24 * unit; + var h_r = 40 * unit; + var cx = h_x + h_r; + var cy = h_y + h_r; + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + context.closePath(); + context.fill(); + context.clip(); + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + context.restore(); + } //把画板内容绘制成图片,并回调 画板图片路径 context.draw(false, function () { diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index b687528..fdb3f02 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -752,6 +752,12 @@ Page({ b_item.goods_sn=good.goods_sn; b_item.sku=good.sku; b_item.is_integral_normal=g_item.is_integral_normal; + + //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 -- + var card_field=th.data.card_field; + if(card_field && good[card_field]>0){ + b_item.price=good[card_field]; + } //--判断商品当前的活动情况-- switch(good.prom_type){ @@ -902,6 +908,8 @@ Page({ if(prom){ req_data.prom_type= good.prom_type; req_data.prom_id= good.prom_id; + b_item.prom_type=good.prom_type; + b_item.prom_id=good.prom_id; //------判断活动是否抢光----- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + @@ -1024,6 +1032,11 @@ Page({ if(g_item.is_pd_normal){ newd['is_pd_normal']=g_item.is_pd_normal; } + if(g_item.prom_type){ + newd['prom_type']=g_item.prom_type; + newd['prom_id']=g_item.prom_id; + } + var b_cart_goods=null; diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index cb011b7..d4f8a41 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -837,6 +837,12 @@ Page({ b_item.goods_sn=good.goods_sn; b_item.sku=good.sku; b_item.is_integral_normal=g_item.is_integral_normal; + + //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 -- + var card_field=th.data.card_field; + if(card_field && good[card_field]>0){ + b_item.price=good[card_field]; + } //--判断商品当前的活动情况-- switch(good.prom_type){ @@ -987,7 +993,8 @@ Page({ if(prom){ req_data.prom_type= good.prom_type; req_data.prom_id= good.prom_id; - + b_item.prom_type=good.prom_type; + b_item.prom_id=good.prom_id; //------判断活动是否抢光----- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + good.prom_type + "/" + good.prom_id, { @@ -1110,6 +1117,11 @@ Page({ newd['is_pd_normal']=g_item.is_pd_normal; } + if(g_item.prom_type){ + newd['prom_type']=g_item.prom_type; + newd['prom_id']=g_item.prom_id; + } + var b_cart_goods=null; await getApp().request.promiseGet("/api/weshop/cart/page", { diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml index dc2afc7..dbfcbb7 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -133,7 +133,7 @@ - + 取消订单 拼团失败 diff --git a/pages/user/order_list/order_list.wxss b/pages/user/order_list/order_list.wxss index a63509b..c2ba572 100644 --- a/pages/user/order_list/order_list.wxss +++ b/pages/user/order_list/order_list.wxss @@ -221,7 +221,8 @@ page { } .commodity_evaluate .links { - height: 92rpx; + /* height: 92rpx; */ + height: auto; } .commodity_evaluate .commodity_To_evaluate { @@ -229,6 +230,7 @@ page { height: 48rpx; border-radius: 10rpx; line-height: 48rpx; + margin-bottom: 10rpx; } .commodity_evaluate .commodity_To_evaluate view { diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index 808626f..69f9790 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -273,165 +273,171 @@ Page({ }, onclickstore: function() { var th = this; - if (th.data.store == 0) { - this.setData({ - store: 1 - }) - } else { - this.setData({ - store: 0 - }) - } - var dd = { - store_id: r.stoid, - isstop: 0, - pageSize: 300 - } - th.setData({ - sort_store: 0 - }); - var i = getApp().request; - //如果有距离的话 - if (th.data.lat != null) { - dd.lat = th.data.lat; - dd.lon = th.data.lon; - } - //----------获取门店---------------- - getApp().request.promiseGet("/api/weshop/pickup/list", { - data: dd, - }).then(res => { - var e = res; - if (e.data.code == 0) { - //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- - if (th.data.def_pick_store) { - for (var k = 0; k < e.data.data.pageData.length; k++) { - if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { - e.data.data.pageData.splice(k, 1); //删除 - break; - } - } - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 - } - - //单总量超出5个的时候 - if (e.data.data.total > 5) { - i.get("/api/weshop/storagecategory/page", { - data: { - store_id: r.stoid, - is_show: 1, - pageSize: 300 - }, - success: function(ee) { - if (ee.data.code == 0) { - if (ee.data.data.pageData.length > 0) { - var def_arr = new Array(); - var ishas = 0; - //-- 开始就看5个门店 -- - for (var k = 0; k < 5; k++) { - if (k == e.data.data.pageData.length) break; - def_arr.push(e.data.data.pageData[k]); - } - - th.setData({ - def_pickpu_list: def_arr, - pickpu_list: ee.data.data.pageData - }); - var sto_cate = ee.data.data.pageData; - var sto_arr = e.data.data.pageData; - var newarr = new Array(); - var qita = new Array(); - - //----要进行门店分组-------- - for (var i = 0; i < sto_arr.length; i++) { - //找一下这个门店有没有在分类数组内 - var find2 = 0, - find2name = ""; - for (var m = 0; m < sto_cate.length; m++) { - if (sto_arr[i].category_id == sto_cate[m].cat_id) { - find2 = sto_cate[m].cat_id; - find2name = sto_cate[m].cat_name; - break; - } - } - - if (newarr.length > 0) { - var find = 0; - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 - if (find2 != 0) { - for (var ii = 0; ii < newarr.length; ii++) { - if (sto_arr[i].category_id == newarr[ii].cat_id) { - newarr[ii].s_arr.push(sto_arr[i]); - find = 1; - break; - } - } - if (find == 0) { - var arr0 = new Array(); - arr0.push(sto_arr[i]); - var item = { - cat_id: find2, - name: find2name, - s_arr: arr0 - }; - newarr.push(item); - } - } else { - qita.push(sto_arr[i]); - } - } else { - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 - if (find2 != 0) { - var arr0 = new Array(); - arr0.push(sto_arr[i]); - var item = { - cat_id: find2, - name: find2name, - s_arr: arr0 - }; - newarr.push(item); - } else { - qita.push(sto_arr[i]); - } - } - } - - //----安排其他的分类----- - if (qita.length > 0) { - var item = { - cat_id: -1, - name: "其他", - s_arr: qita - }; - newarr.push(item); - } - th.setData({ - is_show_sto_cat: 1, - all_sto: newarr - }); - - } else { - th.setData({ - is_show_sto_cat: -1, - only_pk: e.data.data.pageData - }); - } - } else { - th.setData({ - is_show_sto_cat: -1, - only_pk: e.data.data.pageData - }); - } - } - }); - } else { - th.setData({ - is_show_sto_cat: 0, - only_pk: e.data.data.pageData - }); - } - } - }, 200) + //检验门店的点击,看下次数是不是到了 + this.check_click_ok(function(){ + if (th.data.store == 0) { + th.setData({ + store: 1 + }) + } else { + th.setData({ + store: 0 + }) + } + var dd = { + store_id: r.stoid, + isstop: 0, + pageSize: 300 + } + th.setData({ + sort_store: 0 + }); + var i = getApp().request; + //如果有距离的话 + if (th.data.lat != null) { + dd.lat = th.data.lat; + dd.lon = th.data.lon; + } + //----------获取门店---------------- + getApp().request.promiseGet("/api/weshop/pickup/list", { + data: dd, + }).then(res => { + var e = res; + if (e.data.code == 0) { + //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- + if (th.data.def_pick_store) { + for (var k = 0; k < e.data.data.pageData.length; k++) { + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { + e.data.data.pageData.splice(k, 1); //删除 + break; + } + } + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 + } + + //单总量超出5个的时候 + if (e.data.data.total > 5) { + i.get("/api/weshop/storagecategory/page", { + data: { + store_id: r.stoid, + is_show: 1, + pageSize: 300 + }, + success: function(ee) { + if (ee.data.code == 0) { + if (ee.data.data.pageData.length > 0) { + var def_arr = new Array(); + var ishas = 0; + //-- 开始就看5个门店 -- + for (var k = 0; k < 5; k++) { + if (k == e.data.data.pageData.length) break; + def_arr.push(e.data.data.pageData[k]); + } + + th.setData({ + def_pickpu_list: def_arr, + pickpu_list: ee.data.data.pageData + }); + var sto_cate = ee.data.data.pageData; + var sto_arr = e.data.data.pageData; + var newarr = new Array(); + var qita = new Array(); + + //----要进行门店分组-------- + for (var i = 0; i < sto_arr.length; i++) { + //找一下这个门店有没有在分类数组内 + var find2 = 0, + find2name = ""; + for (var m = 0; m < sto_cate.length; m++) { + if (sto_arr[i].category_id == sto_cate[m].cat_id) { + find2 = sto_cate[m].cat_id; + find2name = sto_cate[m].cat_name; + break; + } + } + + if (newarr.length > 0) { + var find = 0; + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 + if (find2 != 0) { + for (var ii = 0; ii < newarr.length; ii++) { + if (sto_arr[i].category_id == newarr[ii].cat_id) { + newarr[ii].s_arr.push(sto_arr[i]); + find = 1; + break; + } + } + if (find == 0) { + var arr0 = new Array(); + arr0.push(sto_arr[i]); + var item = { + cat_id: find2, + name: find2name, + s_arr: arr0 + }; + newarr.push(item); + } + } else { + qita.push(sto_arr[i]); + } + } else { + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 + if (find2 != 0) { + var arr0 = new Array(); + arr0.push(sto_arr[i]); + var item = { + cat_id: find2, + name: find2name, + s_arr: arr0 + }; + newarr.push(item); + } else { + qita.push(sto_arr[i]); + } + } + } + + //----安排其他的分类----- + if (qita.length > 0) { + var item = { + cat_id: -1, + name: "其他", + s_arr: qita + }; + newarr.push(item); + } + th.setData({ + is_show_sto_cat: 1, + all_sto: newarr + }); + + } else { + th.setData({ + is_show_sto_cat: -1, + only_pk: e.data.data.pageData + }); + } + } else { + th.setData({ + is_show_sto_cat: -1, + only_pk: e.data.data.pageData + }); + } + } + }); + } else { + th.setData({ + is_show_sto_cat: 0, + only_pk: e.data.data.pageData + }); + } + } + }, 200) + + },2) + }, + //选择更多门店 more_store: function() { this.setData({ @@ -887,7 +893,24 @@ Page({ //-- 跳转到获取导购的列表 -- go_get_guide:function () { - getApp().goto("/pages/user/choice_guide/choice_guide"); + this.check_click_ok(function(){ + getApp().goto("/pages/user/choice_guide/choice_guide"); + },1) + }, + + //点击门店,导购的次数判断, type 1=导购 2=门店 + check_click_ok:function(func,idx){ + var th=this; + var userId=getApp().globalData.user_id; + getApp().request.get("/api/weshop/users/getGuideNum/"+r.stoid+"/"+userId+"/"+idx, { + success: function(res) { + if(res.data.code==0){ + func(); + }else{ + getApp().my_warnning(res.data.msg, 0, th); + } + } + }); }