Merged
Merge Request #518 · created by 后端研发-苏明海


Dev


From dev into test

Merged by 后端研发-苏明海

1 participants



pages/cart/cart2/cart2.js
... ... @@ -364,8 +364,7 @@ Page({
364 364 }
365 365  
366 366 //-- 如果是等级会员注册返回 --
367   - if(is_card_back){
368   -
  367 + if(is_card_back){
369 368 // 拼团,搭配购不计算,赠品也不计算
370 369 if( item['prom_type']!=5 && item['prom_type']!=6 && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){
371 370 item.goods_price=item[th.data.card_name];
... ... @@ -376,7 +375,7 @@ Page({
376 375 if(item[th.data.card_name]>0 && item['prom_type']!=5 && item['prom_type']!=6 && !th.data.userinfo.card_field
377 376 && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){
378 377 item.cut_price= item.goods_price-item[th.data.card_name];
379   - carr[i].cut_price=item.goods_price-item[th.data.card_name];
  378 + carr[i].cut_price=(item.goods_price-item[th.data.card_name])*item.goods_num;
380 379 }
381 380  
382 381 }
... ... @@ -503,7 +502,7 @@ Page({
503 502 //--- 商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
504 503 //-- 搭配购的商品也可以单独购买,所以此时搭配购的商品要进行计算优惠 --
505 504 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){
506   - var cut_p= gg.goods_price-gd[th.data.card_name];
  505 + var cut_p= (gg.goods_price-gd[th.data.card_name])*gg.goods_num;
507 506 th.setData({card_cut_price:cut_p});
508 507 }
509 508 }
... ... @@ -526,7 +525,7 @@ Page({
526 525  
527 526 t.data.data.prom_id = 0;
528 527 t.data.data.prom_type = 0;
529   -
  528 +
530 529 //如果立即购买那边过来,就要读取接口,查看活动的优惠内容
531 530 if(gg.prom_type==3){
532 531 t.data.data.prom_id = gg.prom_id ;
... ... @@ -538,7 +537,7 @@ Page({
538 537 var num=1;
539 538 if(data.is_bz==1){
540 539 num=data.bs;
541   - if (num > data.gift_limitnum) num = 0;
  540 + if (num > data.gift_limit_num) num = 0;
542 541 }
543 542 //如果赠品数量超出礼品库存,就取消
544 543 if(num>data['gift_storecount']) num=0;
... ... @@ -1617,7 +1616,10 @@ Page({
1617 1616 if(gg.room_id && gg.room_id>0){
1618 1617 goods.room_id=gg.room_id;
1619 1618 }
1620   -
  1619 +
  1620 + //积分购,先要带is_integral_normal=1
  1621 + if(gg.is_integral_normal) goods.is_integral_normal=1;
  1622 +
1621 1623 //如果不立即购买或者秒杀,如果是线下库存购买的时候
1622 1624 if(goods.prom_type!=1 && goods.prom_type!=6 && th.data.sales_rules==2){
1623 1625 var isok=1;
... ...
pages/cart/cart2_pt/cart2_pt.js
... ... @@ -369,7 +369,7 @@ Page({
369 369 console.log(rs);
370 370 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
371 371 //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
372   - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && th.data.kt_type!=3 ){
  372 + 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) ){
373 373 switch (good['exp_sum_type']) {
374 374 case 1:
375 375 //统一运费
... ... @@ -436,7 +436,8 @@ Page({
436 436 //------------立即购买-------------
437 437 console.log("buy_new");
438 438  
439   - if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){
  439 + //如果不是阶梯团,或者是普通购买,商家选择了物流,以及地址为空的时候
  440 + if(th.data.bn_exp_type == 0 && th.data.user_addr==null && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1) ){
440 441 ff = false;
441 442 getApp().my_warnning("请选择收货地址",0,this);
442 443 this.data.is_summit_ing = 0;
... ... @@ -449,7 +450,7 @@ Page({
449 450 console.log(th.data.wu_arr);
450 451 console.log(th.data.bn_exp_type);
451 452  
452   - if(th.data.bn_exp_type==0) {
  453 + if(th.data.bn_exp_type==0 && (th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)) {
453 454 if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
454 455 getApp().my_warnning("读取物流失败",0,this);
455 456 this.data.is_summit_ing = 0;
... ... @@ -468,8 +469,6 @@ Page({
468 469 'more_address': addr == null ? "" : addr.more_address,
469 470 'mobile': th.data.userinfo.mobile,
470 471 'email':'',
471   - 'shipping_code': th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code,
472   - 'shipping_name': th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name,
473 472 'invoice_title':'',
474 473 'goods_price': th.data.formData.all_price, //商品总价
475 474 'shipping_price': th.data.formData.shipping_price, //物流金额
... ... @@ -485,6 +484,12 @@ Page({
485 484 'is_pt_tz':th.data.is_pt_tz, //开团类型
486 485 'order_goods':new Array(),
487 486 };
  487 +
  488 + //如果不是阶梯团,或者是普通购买,
  489 + if((th.data.kt_type!=3 || th.data.bn_goods.is_normal==1)){
  490 + item['shipping_code']= th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;
  491 + item['shipping_name']= th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;
  492 + }
488 493  
489 494 if(!th.data.bn_goods.is_normal){
490 495 item.is_zsorder=th.data.kt_type+1; //开团类型
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -1004,8 +1004,8 @@ Page({
1004 1004 goods_name: o.goods_name,
1005 1005 goods_sn: o.goods_sn,
1006 1006 sku: o.sku,
1007   - };
1008   -
  1007 + };
  1008 +
1009 1009 //---是不是从收藏夹出来的---
1010 1010 if(th.data.c_guide_id){
1011 1011 newd['guide_id'] = th.data.c_guide_id;
... ... @@ -2242,6 +2242,9 @@ Page({
2242 2242 });
2243 2243 return false;
2244 2244 }
  2245 + if(prom_type==4){
  2246 + th.setData({is_integral_normal:1});
  2247 + }
2245 2248 //if (prom_type != 3 && prom_type!=0){
2246 2249 //---判断秒杀----
2247 2250 if (prom_type == 1) {
... ... @@ -3276,7 +3279,7 @@ Page({
3276 3279 }
3277 3280 })
3278 3281 },
3279   -
  3282 +
3280 3283 //--定义的保存图片方法,分享团---
3281 3284 saveImageToPhotosAlbum: function() {
3282 3285 //--先判断会员状态--
... ... @@ -3330,12 +3333,12 @@ Page({
3330 3333  
3331 3334 //-- 如果有自定义海报的时候,判断背景的图片 --
3332 3335 if(th.data.share_b_img){
3333   - //pg_path=th.data.share_b_img;
  3336 + pg_path=th.data.share_b_img;
3334 3337 }
3335 3338 context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
3336 3339  
3337 3340 //-- 是自定义海报的情况下 --
3338   - if(th.data.poster){
  3341 + if(th.data.poster && parseInt(th.data.poster.style)==2){
3339 3342 //在线上分享人的情况下
3340 3343 if(parseInt(th.data.poster.show_headpic)){
3341 3344 //获取坐标
... ... @@ -3355,7 +3358,7 @@ Page({
3355 3358 context.setLineJoin('round'); //交点设置成圆角
3356 3359 context.setFillStyle("white")
3357 3360 context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit);
3358   - }
  3361 + }
3359 3362 }else{
3360 3363 //--昵称---
3361 3364 context.setFontSize(24 * unit)
... ... @@ -3405,8 +3408,7 @@ Page({
3405 3408 switch (type) {
3406 3409 case 0: //普通商品的展示
3407 3410 //中间的几个字
3408   - if(th.data.poster ){
3409   -
  3411 + if(th.data.poster && parseInt(th.data.poster.style)==2 ){
3410 3412 if(parseInt(th.data.poster.show_quality)){
3411 3413 var g_path = "../../../images/share/s_gou.png";
3412 3414 context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
... ... @@ -3589,7 +3591,7 @@ Page({
3589 3591  
3590 3592  
3591 3593 //--- 如果是自定义海报的时候 ---
3592   - if(th.data.poster){
  3594 + if(th.data.poster && parseInt(th.data.poster.style)==2){
3593 3595  
3594 3596 //如果显示会员信息的话
3595 3597 if(parseInt(th.data.poster.show_headpic)){
... ...
pages/team/team_success/team_success.js
... ... @@ -56,7 +56,34 @@ Page({
56 56 })
57 57 var pay_f = t.payf, order_sn = t.ordersn;
58 58 this.setData({ pay_f: pay_f, order_sn: order_sn}),
59   - this.init(order_sn)
  59 + this.init(order_sn);
  60 +
  61 + //-- 自定义海报 --
  62 + getApp().request.promiseGet("/api/weshop/goods/poster/page",{
  63 + data:{store_id:os.stoid, type:1, is_user:1 }
  64 + }).then(res=>{
  65 + if(res.data.code==0){
  66 +
  67 + var poster_data=res.data.data.pageData[0];
  68 + var json_str=poster_data.jsonStr;
  69 + if(json_str){
  70 + var json_data=JSON.parse(json_str);
  71 + if(json_data.bg_img){
  72 +
  73 + //-- 把图片那到本地 --
  74 + wx.getImageInfo({
  75 + src:json_data.bg_img,
  76 + success: function(res) {
  77 + var path= res.path;
  78 + th.setData({share_b_img:path})
  79 + },
  80 + fail: function(res) {}
  81 + });
  82 + }
  83 + th.setData({poster:json_data})
  84 + }
  85 + }
  86 + })
60 87 },
61 88 //关闭展开列表
62 89 click:function(e){
... ... @@ -377,19 +404,53 @@ Page({
377 404 console.log(vpath);
378 405  
379 406 //先画背景
380   - var pg_path = "../../../images/share/share_bg.png";
  407 + var pg_path = "../../../images/share/share_bg.png";
  408 + //-- 如果有自定义海报的时候,判断背景的图片 --
  409 + if(th.data.share_b_img){
  410 + pg_path=th.data.share_b_img;
  411 + }
  412 +
381 413 context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
382   - //--昵称---
383   - context.setFontSize(24 * unit)
384   - context.setFillStyle("black")
385   - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
386   - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
387   - //强烈推荐
388   - var tj_path = "../../../images/share/q_tj.png";
389   - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit);
390   - context.setFontSize(18 * unit)
391   - context.setFillStyle("white")
392   - context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit);
  414 +
  415 + //-- 是自定义海报的情况下 --
  416 + if(th.data.poster && parseInt(th.data.poster.style)==2){
  417 + //在线上分享人的情况下
  418 + if(parseInt(th.data.poster.show_headpic)){
  419 + //获取坐标
  420 + var x=parseFloat(th.data.poster.head_x)*2;
  421 + var y=parseFloat(th.data.poster.head_y)*2;
  422 + var x1=(x+90) *unit;
  423 + var y1=(y+50) *unit;
  424 + //--昵称---
  425 + context.setFontSize(24 * unit)
  426 + context.setFillStyle("black")
  427 + context.fillText(app.globalData.userInfo.nickname, x1, y1);
  428 + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
  429 + //强烈推荐 改许程
  430 + var tj_path = "../../../images/share/q_tj.png";
  431 + context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit);
  432 + context.setFontSize(16 * unit)
  433 + context.setLineJoin('round'); //交点设置成圆角
  434 + context.setFillStyle("white")
  435 + context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit);
  436 + }
  437 +
  438 + }else{
  439 + //--昵称---
  440 + context.setFontSize(24 * unit)
  441 + context.setFillStyle("black")
  442 + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
  443 + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
  444 + //强烈推荐
  445 + var tj_path = "../../../images/share/q_tj.png";
  446 + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit);
  447 + context.setFontSize(18 * unit)
  448 + context.setFillStyle("white")
  449 + context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit);
  450 + }
  451 +
  452 +
  453 +
393 454  
394 455 //---产品名称---
395 456 context.setFontSize(21.3 * unit);
... ... @@ -468,7 +529,15 @@ Page({
468 529 context.setFontSize(22 * unit)
469 530 context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit);
470 531 //---二维吗图---
471   - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  532 + //-- 自定义海报 --
  533 + if(th.data.poster){
  534 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  535 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  536 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  537 + }else{
  538 + //---二维吗图---
  539 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  540 + }
472 541 break
473 542 case 2://阶梯团的展示
474 543 //---画线---
... ... @@ -503,24 +572,58 @@ Page({
503 572  
504 573 context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
505 574 //---二维吗图---
506   - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  575 + //-- 自定义海报 --
  576 + if(th.data.poster){
  577 + var erm_x= parseFloat(th.data.poster.ewm_x)*2;
  578 + var erm_y= parseFloat(th.data.poster.ewm_y)*2;
  579 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
  580 + }else{
  581 + //---二维吗图---
  582 + context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
  583 + }
507 584 break
508 585 }
509 586  
510   - //---绘制圆形要放在最后----
511   - context.save();
512   - context.beginPath();
513   - var h_x = 60 * unit;
514   - var h_y = 24 * unit;
515   - var h_r = 40 * unit;
516   - var cx = h_x + h_r;
517   - var cy = h_y + h_r;
518   - context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
519   - context.closePath();
520   - context.fill();
521   - context.clip();
522   - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
523   - context.restore();
  587 + //--- 如果是自定义海报的时候 ---
  588 + if(th.data.poster && parseInt(th.data.poster.style)==2){
  589 +
  590 + //如果显示会员信息的话
  591 + if(parseInt(th.data.poster.show_headpic)){
  592 + //获取坐标
  593 + var x= parseFloat(th.data.poster.head_x)*2;
  594 + var y=parseFloat(th.data.poster.head_y)*2;
  595 + //---绘制圆形要放在最后----
  596 + context.save();
  597 + context.beginPath();
  598 + var h_x = x* unit;
  599 + var h_y = y * unit;
  600 + var h_r = 40 * unit;
  601 + var cx = h_x + h_r;
  602 + var cy = h_y + h_r;
  603 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  604 + context.closePath();
  605 + context.fill();
  606 + context.clip();
  607 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  608 + context.restore();
  609 + }
  610 +
  611 + }else{
  612 + //---绘制圆形要放在最后----
  613 + context.save();
  614 + context.beginPath();
  615 + var h_x = 60 * unit;
  616 + var h_y = 24 * unit;
  617 + var h_r = 40 * unit;
  618 + var cx = h_x + h_r;
  619 + var cy = h_y + h_r;
  620 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  621 + context.closePath();
  622 + context.fill();
  623 + context.clip();
  624 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  625 + context.restore();
  626 + }
524 627  
525 628 //把画板内容绘制成图片,并回调 画板图片路径
526 629 context.draw(false, function () {
... ...
pages/user/order_detail/order_detail.js
... ... @@ -752,6 +752,12 @@ Page({
752 752 b_item.goods_sn=good.goods_sn;
753 753 b_item.sku=good.sku;
754 754 b_item.is_integral_normal=g_item.is_integral_normal;
  755 +
  756 + //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 --
  757 + var card_field=th.data.card_field;
  758 + if(card_field && good[card_field]>0){
  759 + b_item.price=good[card_field];
  760 + }
755 761  
756 762 //--判断商品当前的活动情况--
757 763 switch(good.prom_type){
... ... @@ -902,6 +908,8 @@ Page({
902 908 if(prom){
903 909 req_data.prom_type= good.prom_type;
904 910 req_data.prom_id= good.prom_id;
  911 + b_item.prom_type=good.prom_type;
  912 + b_item.prom_id=good.prom_id;
905 913  
906 914 //------判断活动是否抢光-----
907 915 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
... ... @@ -1024,6 +1032,11 @@ Page({
1024 1032 if(g_item.is_pd_normal){
1025 1033 newd['is_pd_normal']=g_item.is_pd_normal;
1026 1034 }
  1035 + if(g_item.prom_type){
  1036 + newd['prom_type']=g_item.prom_type;
  1037 + newd['prom_id']=g_item.prom_id;
  1038 + }
  1039 +
1027 1040  
1028 1041  
1029 1042 var b_cart_goods=null;
... ...
pages/user/order_list/order_list.js
... ... @@ -837,6 +837,12 @@ Page({
837 837 b_item.goods_sn=good.goods_sn;
838 838 b_item.sku=good.sku;
839 839 b_item.is_integral_normal=g_item.is_integral_normal;
  840 +
  841 + //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 --
  842 + var card_field=th.data.card_field;
  843 + if(card_field && good[card_field]>0){
  844 + b_item.price=good[card_field];
  845 + }
840 846  
841 847 //--判断商品当前的活动情况--
842 848 switch(good.prom_type){
... ... @@ -987,7 +993,8 @@ Page({
987 993 if(prom){
988 994 req_data.prom_type= good.prom_type;
989 995 req_data.prom_id= good.prom_id;
990   -
  996 + b_item.prom_type=good.prom_type;
  997 + b_item.prom_id=good.prom_id;
991 998 //------判断活动是否抢光-----
992 999 await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
993 1000 os.stoid + "/" + good.prom_type + "/" + good.prom_id, {
... ... @@ -1110,6 +1117,11 @@ Page({
1110 1117 newd['is_pd_normal']=g_item.is_pd_normal;
1111 1118 }
1112 1119  
  1120 + if(g_item.prom_type){
  1121 + newd['prom_type']=g_item.prom_type;
  1122 + newd['prom_id']=g_item.prom_id;
  1123 + }
  1124 +
1113 1125  
1114 1126 var b_cart_goods=null;
1115 1127 await getApp().request.promiseGet("/api/weshop/cart/page", {
... ...
pages/user/order_list/order_list.wxml
... ... @@ -133,7 +133,7 @@
133 133 </view>
134 134 </view>
135 135 </view>
136   - <view class="links flex-right-vertical fs30">
  136 + <view class="links flex-right-vertical fs30" style="flex-wrap: wrap;margin-top: 10rpx;">
137 137 <image wx:if="{{(item.order_status==1&&item.pay_status==1 && item.shipping_status==0 && item.exp_type==1)}}" class="code" src="{{iurl}}miniapp/images/order/code.png" bindtap="code_show" data-order_sn="{{item.order_sn}}"></image>
138 138 <view bindtap="cancelOrder" class="commodity_To_evaluate flex-level View_evaluation" data-id="{{item.order_id}}" data-zsorder="{{item.is_zsorder}}" data-orderindex="{{index}}" wx:if="{{(item.order_status==0 &&item.pay_status==0)}}">取消订单</view>
139 139 <view class="commodity_To_evaluate flex-level View_evaluation" wx:if="{{item.pt_status==3}}">拼团失败</view>
... ...
pages/user/order_list/order_list.wxss
... ... @@ -221,7 +221,8 @@ page {
221 221 }
222 222  
223 223 .commodity_evaluate .links {
224   - height: 92rpx;
  224 + /* height: 92rpx; */
  225 + height: auto;
225 226 }
226 227  
227 228 .commodity_evaluate .commodity_To_evaluate {
... ... @@ -229,6 +230,7 @@ page {
229 230 height: 48rpx;
230 231 border-radius: 10rpx;
231 232 line-height: 48rpx;
  233 + margin-bottom: 10rpx;
232 234 }
233 235  
234 236 .commodity_evaluate .commodity_To_evaluate view {
... ...
pages/user/userinfo/userinfo.js
... ... @@ -273,165 +273,171 @@ Page({
273 273 },
274 274 onclickstore: function() {
275 275 var th = this;
276   - if (th.data.store == 0) {
277   - this.setData({
278   - store: 1
279   - })
280   - } else {
281   - this.setData({
282   - store: 0
283   - })
284   - }
285   - var dd = {
286   - store_id: r.stoid,
287   - isstop: 0,
288   - pageSize: 300
289   - }
290   - th.setData({
291   - sort_store: 0
292   - });
293   - var i = getApp().request;
294   - //如果有距离的话
295   - if (th.data.lat != null) {
296   - dd.lat = th.data.lat;
297   - dd.lon = th.data.lon;
298   - }
299   - //----------获取门店----------------
300   - getApp().request.promiseGet("/api/weshop/pickup/list", {
301   - data: dd,
302   - }).then(res => {
303   - var e = res;
304   - if (e.data.code == 0) {
305   - //-- 如果有默认选择门店的时候,要把默认门店放在第一位 --
306   - if (th.data.def_pick_store) {
307   - for (var k = 0; k < e.data.data.pageData.length; k++) {
308   - if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
309   - e.data.data.pageData.splice(k, 1); //删除
310   - break;
311   - }
312   - }
313   - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
314   - }
315   -
316   - //单总量超出5个的时候
317   - if (e.data.data.total > 5) {
318   - i.get("/api/weshop/storagecategory/page", {
319   - data: {
320   - store_id: r.stoid,
321   - is_show: 1,
322   - pageSize: 300
323   - },
324   - success: function(ee) {
325   - if (ee.data.code == 0) {
326   - if (ee.data.data.pageData.length > 0) {
327   - var def_arr = new Array();
328   - var ishas = 0;
329   - //-- 开始就看5个门店 --
330   - for (var k = 0; k < 5; k++) {
331   - if (k == e.data.data.pageData.length) break;
332   - def_arr.push(e.data.data.pageData[k]);
333   - }
334   -
335   - th.setData({
336   - def_pickpu_list: def_arr,
337   - pickpu_list: ee.data.data.pageData
338   - });
339   - var sto_cate = ee.data.data.pageData;
340   - var sto_arr = e.data.data.pageData;
341   - var newarr = new Array();
342   - var qita = new Array();
343   -
344   - //----要进行门店分组--------
345   - for (var i = 0; i < sto_arr.length; i++) {
346   - //找一下这个门店有没有在分类数组内
347   - var find2 = 0,
348   - find2name = "";
349   - for (var m = 0; m < sto_cate.length; m++) {
350   - if (sto_arr[i].category_id == sto_cate[m].cat_id) {
351   - find2 = sto_cate[m].cat_id;
352   - find2name = sto_cate[m].cat_name;
353   - break;
354   - }
355   - }
356   -
357   - if (newarr.length > 0) {
358   - var find = 0;
359   - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
360   - if (find2 != 0) {
361   - for (var ii = 0; ii < newarr.length; ii++) {
362   - if (sto_arr[i].category_id == newarr[ii].cat_id) {
363   - newarr[ii].s_arr.push(sto_arr[i]);
364   - find = 1;
365   - break;
366   - }
367   - }
368   - if (find == 0) {
369   - var arr0 = new Array();
370   - arr0.push(sto_arr[i]);
371   - var item = {
372   - cat_id: find2,
373   - name: find2name,
374   - s_arr: arr0
375   - };
376   - newarr.push(item);
377   - }
378   - } else {
379   - qita.push(sto_arr[i]);
380   - }
381   - } else {
382   - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
383   - if (find2 != 0) {
384   - var arr0 = new Array();
385   - arr0.push(sto_arr[i]);
386   - var item = {
387   - cat_id: find2,
388   - name: find2name,
389   - s_arr: arr0
390   - };
391   - newarr.push(item);
392   - } else {
393   - qita.push(sto_arr[i]);
394   - }
395   - }
396   - }
397   -
398   - //----安排其他的分类-----
399   - if (qita.length > 0) {
400   - var item = {
401   - cat_id: -1,
402   - name: "其他",
403   - s_arr: qita
404   - };
405   - newarr.push(item);
406   - }
407   - th.setData({
408   - is_show_sto_cat: 1,
409   - all_sto: newarr
410   - });
411   -
412   - } else {
413   - th.setData({
414   - is_show_sto_cat: -1,
415   - only_pk: e.data.data.pageData
416   - });
417   - }
418   - } else {
419   - th.setData({
420   - is_show_sto_cat: -1,
421   - only_pk: e.data.data.pageData
422   - });
423   - }
424   - }
425   - });
426   - } else {
427   - th.setData({
428   - is_show_sto_cat: 0,
429   - only_pk: e.data.data.pageData
430   - });
431   - }
432   - }
433   - }, 200)
  276 + //检验门店的点击,看下次数是不是到了
  277 + this.check_click_ok(function(){
  278 + if (th.data.store == 0) {
  279 + th.setData({
  280 + store: 1
  281 + })
  282 + } else {
  283 + th.setData({
  284 + store: 0
  285 + })
  286 + }
  287 + var dd = {
  288 + store_id: r.stoid,
  289 + isstop: 0,
  290 + pageSize: 300
  291 + }
  292 + th.setData({
  293 + sort_store: 0
  294 + });
  295 + var i = getApp().request;
  296 + //如果有距离的话
  297 + if (th.data.lat != null) {
  298 + dd.lat = th.data.lat;
  299 + dd.lon = th.data.lon;
  300 + }
  301 + //----------获取门店----------------
  302 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  303 + data: dd,
  304 + }).then(res => {
  305 + var e = res;
  306 + if (e.data.code == 0) {
  307 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位 --
  308 + if (th.data.def_pick_store) {
  309 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  310 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  311 + e.data.data.pageData.splice(k, 1); //删除
  312 + break;
  313 + }
  314 + }
  315 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  316 + }
  317 +
  318 + //单总量超出5个的时候
  319 + if (e.data.data.total > 5) {
  320 + i.get("/api/weshop/storagecategory/page", {
  321 + data: {
  322 + store_id: r.stoid,
  323 + is_show: 1,
  324 + pageSize: 300
  325 + },
  326 + success: function(ee) {
  327 + if (ee.data.code == 0) {
  328 + if (ee.data.data.pageData.length > 0) {
  329 + var def_arr = new Array();
  330 + var ishas = 0;
  331 + //-- 开始就看5个门店 --
  332 + for (var k = 0; k < 5; k++) {
  333 + if (k == e.data.data.pageData.length) break;
  334 + def_arr.push(e.data.data.pageData[k]);
  335 + }
  336 +
  337 + th.setData({
  338 + def_pickpu_list: def_arr,
  339 + pickpu_list: ee.data.data.pageData
  340 + });
  341 + var sto_cate = ee.data.data.pageData;
  342 + var sto_arr = e.data.data.pageData;
  343 + var newarr = new Array();
  344 + var qita = new Array();
  345 +
  346 + //----要进行门店分组--------
  347 + for (var i = 0; i < sto_arr.length; i++) {
  348 + //找一下这个门店有没有在分类数组内
  349 + var find2 = 0,
  350 + find2name = "";
  351 + for (var m = 0; m < sto_cate.length; m++) {
  352 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  353 + find2 = sto_cate[m].cat_id;
  354 + find2name = sto_cate[m].cat_name;
  355 + break;
  356 + }
  357 + }
  358 +
  359 + if (newarr.length > 0) {
  360 + var find = 0;
  361 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  362 + if (find2 != 0) {
  363 + for (var ii = 0; ii < newarr.length; ii++) {
  364 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  365 + newarr[ii].s_arr.push(sto_arr[i]);
  366 + find = 1;
  367 + break;
  368 + }
  369 + }
  370 + if (find == 0) {
  371 + var arr0 = new Array();
  372 + arr0.push(sto_arr[i]);
  373 + var item = {
  374 + cat_id: find2,
  375 + name: find2name,
  376 + s_arr: arr0
  377 + };
  378 + newarr.push(item);
  379 + }
  380 + } else {
  381 + qita.push(sto_arr[i]);
  382 + }
  383 + } else {
  384 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  385 + if (find2 != 0) {
  386 + var arr0 = new Array();
  387 + arr0.push(sto_arr[i]);
  388 + var item = {
  389 + cat_id: find2,
  390 + name: find2name,
  391 + s_arr: arr0
  392 + };
  393 + newarr.push(item);
  394 + } else {
  395 + qita.push(sto_arr[i]);
  396 + }
  397 + }
  398 + }
  399 +
  400 + //----安排其他的分类-----
  401 + if (qita.length > 0) {
  402 + var item = {
  403 + cat_id: -1,
  404 + name: "其他",
  405 + s_arr: qita
  406 + };
  407 + newarr.push(item);
  408 + }
  409 + th.setData({
  410 + is_show_sto_cat: 1,
  411 + all_sto: newarr
  412 + });
  413 +
  414 + } else {
  415 + th.setData({
  416 + is_show_sto_cat: -1,
  417 + only_pk: e.data.data.pageData
  418 + });
  419 + }
  420 + } else {
  421 + th.setData({
  422 + is_show_sto_cat: -1,
  423 + only_pk: e.data.data.pageData
  424 + });
  425 + }
  426 + }
  427 + });
  428 + } else {
  429 + th.setData({
  430 + is_show_sto_cat: 0,
  431 + only_pk: e.data.data.pageData
  432 + });
  433 + }
  434 + }
  435 + }, 200)
  436 +
  437 + },2)
  438 +
434 439 },
  440 +
435 441 //选择更多门店
436 442 more_store: function() {
437 443 this.setData({
... ... @@ -887,7 +893,24 @@ Page({
887 893  
888 894 //-- 跳转到获取导购的列表 --
889 895 go_get_guide:function () {
890   - getApp().goto("/pages/user/choice_guide/choice_guide");
  896 + this.check_click_ok(function(){
  897 + getApp().goto("/pages/user/choice_guide/choice_guide");
  898 + },1)
  899 + },
  900 +
  901 + //点击门店,导购的次数判断, type 1=导购 2=门店
  902 + check_click_ok:function(func,idx){
  903 + var th=this;
  904 + var userId=getApp().globalData.user_id;
  905 + getApp().request.get("/api/weshop/users/getGuideNum/"+r.stoid+"/"+userId+"/"+idx, {
  906 + success: function(res) {
  907 + if(res.data.code==0){
  908 + func();
  909 + }else{
  910 + getApp().my_warnning(res.data.msg, 0, th);
  911 + }
  912 + }
  913 + });
891 914 }
892 915  
893 916  
... ...