Commit f91875e72e8dd5982109edca6f7d284a8d12a5b5
1 parent
9f48c232
小程序购买阶梯促销的问题优化
Showing
7 changed files
with
175 additions
and
99 deletions
pages/cart/cart/cart.js
@@ -530,7 +530,7 @@ Page({ | @@ -530,7 +530,7 @@ Page({ | ||
530 | var isok = 1; | 530 | var isok = 1; |
531 | var is_flag=1; | 531 | var is_flag=1; |
532 | var act=null; | 532 | var act=null; |
533 | - var url="/api/weshop/prom/ladderForm/get/"+os.stoid+"/"+item.prom_id; | 533 | + var url="/api/weshop/prom/ladderForm/getNew/"+os.stoid+"/"+user_id+"/"+item.prom_id; |
534 | await getApp().request.promiseGet(url, {}).then(res => { | 534 | await getApp().request.promiseGet(url, {}).then(res => { |
535 | console.log(res,1000); | 535 | console.log(res,1000); |
536 | if(res.data.code==0 && res.data.data){ | 536 | if(res.data.code==0 && res.data.data){ |
pages/cart/cart2/cart2.js
@@ -1439,7 +1439,7 @@ Page({ | @@ -1439,7 +1439,7 @@ Page({ | ||
1439 | for (var j = 0; j < item.length; j++) { | 1439 | for (var j = 0; j < item.length; j++) { |
1440 | 1440 | ||
1441 | var is_no_zh=0; | 1441 | var is_no_zh=0; |
1442 | - if(item[j].prom_type!=7 || item[j].prom_type!=10 ) is_no_zh=1; | 1442 | + if(item[j].prom_type!=7 && item[j].prom_type!=10 ) is_no_zh=1; |
1443 | 1443 | ||
1444 | //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 | 1444 | //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 |
1445 | if(item[j].prom_type==7 && zh_prom_goods && zh_prom_goods[item[j].prom_id] | 1445 | if(item[j].prom_type==7 && zh_prom_goods && zh_prom_goods[item[j].prom_id] |
@@ -1449,7 +1449,7 @@ Page({ | @@ -1449,7 +1449,7 @@ Page({ | ||
1449 | } | 1449 | } |
1450 | //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 | 1450 | //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 |
1451 | if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id] | 1451 | if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id] |
1452 | - && th.data.ladder_map[item[j].prom_id].is_orderyh ) | 1452 | + && th.data.ladder_map[item[j].prom_id].is_useorderyh ) |
1453 | { | 1453 | { |
1454 | is_no_zh=1; | 1454 | is_no_zh=1; |
1455 | } | 1455 | } |
@@ -1473,7 +1473,6 @@ Page({ | @@ -1473,7 +1473,6 @@ Page({ | ||
1473 | //找到那些可以订单优惠叠加的 | 1473 | //找到那些可以订单优惠叠加的 |
1474 | for(let ij in zh_prom_goods){ | 1474 | for(let ij in zh_prom_goods){ |
1475 | let kitem=zh_prom_goods[ij]; | 1475 | let kitem=zh_prom_goods[ij]; |
1476 | - var is_has_zh=kitem.is_has_zh; | ||
1477 | if(kitem.act.is_orderyh) | 1476 | if(kitem.act.is_orderyh) |
1478 | o_price_no_zh-=kitem.cut_price; | 1477 | o_price_no_zh-=kitem.cut_price; |
1479 | } | 1478 | } |
@@ -1487,8 +1486,7 @@ Page({ | @@ -1487,8 +1486,7 @@ Page({ | ||
1487 | //找到那些可以订单优惠叠加的 | 1486 | //找到那些可以订单优惠叠加的 |
1488 | for(let ij in ladder_prom_goods){ | 1487 | for(let ij in ladder_prom_goods){ |
1489 | let kitem=ladder_prom_goods[ij]; | 1488 | let kitem=ladder_prom_goods[ij]; |
1490 | - var is_has_zh=kitem.is_has_ladder; | ||
1491 | - if(th.data.ladder_map[ij].is_orderyh ) | 1489 | + if(th.data.ladder_map[ij].is_useorderyh ) |
1492 | o_price_no_zh-=kitem.cut_price; | 1490 | o_price_no_zh-=kitem.cut_price; |
1493 | } | 1491 | } |
1494 | } | 1492 | } |
@@ -1683,6 +1681,13 @@ Page({ | @@ -1683,6 +1681,13 @@ Page({ | ||
1683 | o_condition=o_price_no_zh-quan_price; | 1681 | o_condition=o_price_no_zh-quan_price; |
1684 | } | 1682 | } |
1685 | 1683 | ||
1684 | + //看一下是不是不用组合购的订单优惠的叠加 | ||
1685 | + if(is_has_ladder){ | ||
1686 | + o_condition=o_price_no_zh-quan_price; | ||
1687 | + } | ||
1688 | + | ||
1689 | + | ||
1690 | + | ||
1686 | var order_m = 0; | 1691 | var order_m = 0; |
1687 | //---判断是不是有订单优惠--- | 1692 | //---判断是不是有订单优惠--- |
1688 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { | 1693 | await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", { |
@@ -2575,6 +2580,7 @@ Page({ | @@ -2575,6 +2580,7 @@ Page({ | ||
2575 | switch (g_item.prom_type) { | 2580 | switch (g_item.prom_type) { |
2576 | case 1: | 2581 | case 1: |
2577 | case 2: | 2582 | case 2: |
2583 | + case 10: | ||
2578 | goods.prom_type = g_item.prom_type; | 2584 | goods.prom_type = g_item.prom_type; |
2579 | goods.prom_id = g_item.prom_id; | 2585 | goods.prom_id = g_item.prom_id; |
2580 | break; | 2586 | break; |
@@ -3523,6 +3529,7 @@ Page({ | @@ -3523,6 +3529,7 @@ Page({ | ||
3523 | get_cart_quan: async function (order_prom_list_cart) { | 3529 | get_cart_quan: async function (order_prom_list_cart) { |
3524 | var th = this; | 3530 | var th = this; |
3525 | var is_xz_yh = 1; | 3531 | var is_xz_yh = 1; |
3532 | + var user_id=getApp().globalData.user_id; | ||
3526 | //等待值的出现 | 3533 | //等待值的出现 |
3527 | //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { | 3534 | //getApp().waitfor2(this,"g_cart_q_time","order_prom_list_cart",async function () { |
3528 | //var arr=th.data.order_prom_list_cart; | 3535 | //var arr=th.data.order_prom_list_cart; |
@@ -3556,7 +3563,19 @@ Page({ | @@ -3556,7 +3563,19 @@ Page({ | ||
3556 | }).then(res => { | 3563 | }).then(res => { |
3557 | if (res.data.code == 0) prom1 = res.data.data; | 3564 | if (res.data.code == 0) prom1 = res.data.data; |
3558 | }) | 3565 | }) |
3559 | - if(!prom1.isQuan){ | 3566 | + if(prom1 && !prom1.isQuan){ |
3567 | + continue; | ||
3568 | + } | ||
3569 | + } | ||
3570 | + | ||
3571 | + //--如果是团购,要判断有没有限制使用优惠券 | ||
3572 | + if(gd.prom_type == 10){ | ||
3573 | + var prom1=null; | ||
3574 | + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/"+ os.stoid +"/"+user_id+"/"+ gd.prom_id, { | ||
3575 | + }).then(res => { | ||
3576 | + if (res.data.code == 0) prom1 = res.data.data; | ||
3577 | + }) | ||
3578 | + if(prom1 && prom1.isuse && prom1. is_usecoupon){ | ||
3560 | continue; | 3579 | continue; |
3561 | } | 3580 | } |
3562 | } | 3581 | } |
pages/goods/goodsInfo/goodsInfo.js
@@ -1155,12 +1155,14 @@ Page({ | @@ -1155,12 +1155,14 @@ Page({ | ||
1155 | //if(o.prom_type==4){ | 1155 | //if(o.prom_type==4){ |
1156 | //newd.is_integral_normal=1; | 1156 | //newd.is_integral_normal=1; |
1157 | //} | 1157 | //} |
1158 | + | ||
1158 | //-----如果是秒杀,团购,积分购,拼团----- | 1159 | //-----如果是秒杀,团购,积分购,拼团----- |
1159 | newd.prom_type = th.data.prom_type; | 1160 | newd.prom_type = th.data.prom_type; |
1160 | newd.prom_id = th.data.prom_id; | 1161 | newd.prom_id = th.data.prom_id; |
1161 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | 1162 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); |
1162 | if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); | 1163 | if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); |
1163 | 1164 | ||
1165 | + | ||
1164 | th.add_cart_next(e, t, a, o, newd); //立即购买下一步 | 1166 | th.add_cart_next(e, t, a, o, newd); //立即购买下一步 |
1165 | 1167 | ||
1166 | }) | 1168 | }) |
@@ -1229,7 +1231,6 @@ Page({ | @@ -1229,7 +1231,6 @@ Page({ | ||
1229 | prom_type:th.data.sele_g.prom_type, | 1231 | prom_type:th.data.sele_g.prom_type, |
1230 | }; | 1232 | }; |
1231 | 1233 | ||
1232 | - | ||
1233 | //---是不是从收藏夹出来的--- | 1234 | //---是不是从收藏夹出来的--- |
1234 | if (th.data.c_guide_id) { | 1235 | if (th.data.c_guide_id) { |
1235 | newd['guide_id'] = th.data.c_guide_id; | 1236 | newd['guide_id'] = th.data.c_guide_id; |
@@ -1491,6 +1492,8 @@ Page({ | @@ -1491,6 +1492,8 @@ Page({ | ||
1491 | } | 1492 | } |
1492 | }); | 1493 | }); |
1493 | } else { | 1494 | } else { |
1495 | + | ||
1496 | + | ||
1494 | i.post("/api/weshop/cart/save", { | 1497 | i.post("/api/weshop/cart/save", { |
1495 | data: newd, | 1498 | data: newd, |
1496 | success: function (t) { | 1499 | success: function (t) { |
@@ -1509,7 +1512,6 @@ Page({ | @@ -1509,7 +1512,6 @@ Page({ | ||
1509 | } | 1512 | } |
1510 | else { | 1513 | else { |
1511 | 1514 | ||
1512 | - | ||
1513 | if(newd.prom_type==10){ | 1515 | if(newd.prom_type==10){ |
1514 | //----先看会员在购物车中是否加入了该商品,立即购买的----- | 1516 | //----先看会员在购物车中是否加入了该商品,立即购买的----- |
1515 | getApp().request.get("/api/weshop/cart/page", { | 1517 | getApp().request.get("/api/weshop/cart/page", { |
@@ -1521,9 +1523,11 @@ Page({ | @@ -1521,9 +1523,11 @@ Page({ | ||
1521 | success: function (res) { | 1523 | success: function (res) { |
1522 | //-------如果购物车中有相关的数据--------- | 1524 | //-------如果购物车中有相关的数据--------- |
1523 | if (res.data.code==0 && res.data.data.total > 0) { | 1525 | if (res.data.code==0 && res.data.data.total > 0) { |
1524 | - var item=res.data.data.pageData[0]; | ||
1525 | - var url = '/api/weshop/cart/del/' +e.data.stoid+ '/' + item.id; | ||
1526 | - getApp().request.delete(url, {}); | 1526 | + for(let j in res.data.data.pageData){ |
1527 | + let item_j=res.data.data.pageData[j]; | ||
1528 | + var url = '/api/weshop/cart/del/' +e.data.stoid+ '/' + item_j.id; | ||
1529 | + getApp().request.delete(url, {}); | ||
1530 | + } | ||
1527 | } | 1531 | } |
1528 | newd.state=1; | 1532 | newd.state=1; |
1529 | getApp().request.post("/api/weshop/cart/save", { | 1533 | getApp().request.post("/api/weshop/cart/save", { |
@@ -1537,6 +1541,7 @@ Page({ | @@ -1537,6 +1541,7 @@ Page({ | ||
1537 | 1541 | ||
1538 | } | 1542 | } |
1539 | }) | 1543 | }) |
1544 | + return false; | ||
1540 | } | 1545 | } |
1541 | 1546 | ||
1542 | 1547 | ||
@@ -5693,6 +5698,8 @@ Page({ | @@ -5693,6 +5698,8 @@ Page({ | ||
5693 | //---检查有没有优惠活动--- | 5698 | //---检查有没有优惠活动--- |
5694 | check_is_youhui: function (gid, is_nor) { | 5699 | check_is_youhui: function (gid, is_nor) { |
5695 | var th = this; | 5700 | var th = this; |
5701 | + var user_id=getApp().globalData.user_id; | ||
5702 | + if(!user_id) user_id=0; | ||
5696 | //如果是普通购买的时候,要进行调用 | 5703 | //如果是普通购买的时候,要进行调用 |
5697 | if (is_nor) { | 5704 | if (is_nor) { |
5698 | getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, { | 5705 | getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, { |
@@ -5726,6 +5733,32 @@ Page({ | @@ -5726,6 +5733,32 @@ Page({ | ||
5726 | r_data.collocationPromList.max = (max + th.data.data.shop_price).toFixed(2); | 5733 | r_data.collocationPromList.max = (max + th.data.data.shop_price).toFixed(2); |
5727 | r_data.collocationPromList.min = (min + th.data.data.shop_price).toFixed(2); | 5734 | r_data.collocationPromList.min = (min + th.data.data.shop_price).toFixed(2); |
5728 | } | 5735 | } |
5736 | + | ||
5737 | + if(r_data.ladderLists){ | ||
5738 | + var act_id=r_data.ladderLists[0].form_id; | ||
5739 | + //-- 判断会员能不能参与阶梯促销 -- | ||
5740 | + getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid+"/"+user_id + "/"+act_id, { | ||
5741 | + }).then(res=>{ | ||
5742 | + if(res.data.code==0 && res.data.data){ | ||
5743 | + var prom_content=""; | ||
5744 | + for(let jj in r_data.ladderLists){ | ||
5745 | + if(r_data.ladderLists[jj].discount==10){ | ||
5746 | + prom_content+="第"+(parseInt(jj)+1)+"件原价,"; | ||
5747 | + }else{ | ||
5748 | + prom_content+="第"+(parseInt(jj)+1)+"件"+r_data.ladderLists[jj].discount+"折,"; | ||
5749 | + } | ||
5750 | + } | ||
5751 | + prom_content=ut.sub_last(prom_content); | ||
5752 | + th.data.prom_type=10; | ||
5753 | + th.data.prom_id=act_id; | ||
5754 | + th.setData({ | ||
5755 | + jieti_prom:prom_content, | ||
5756 | + ladder_act_id:act_id | ||
5757 | + }) | ||
5758 | + } | ||
5759 | + }) | ||
5760 | + } | ||
5761 | + | ||
5729 | th.setData({ | 5762 | th.setData({ |
5730 | order_prom: r_data.promOrder, | 5763 | order_prom: r_data.promOrder, |
5731 | collocationGoods: r_data.collocationPromList, | 5764 | collocationGoods: r_data.collocationPromList, |
@@ -5734,11 +5767,8 @@ Page({ | @@ -5734,11 +5767,8 @@ Page({ | ||
5734 | th.is_show_more_buy(); | 5767 | th.is_show_more_buy(); |
5735 | } | 5768 | } |
5736 | } | 5769 | } |
5737 | - | ||
5738 | }) | 5770 | }) |
5739 | } | 5771 | } |
5740 | - | ||
5741 | - | ||
5742 | }, | 5772 | }, |
5743 | 5773 | ||
5744 | closePoster() { | 5774 | closePoster() { |
@@ -6064,33 +6094,21 @@ Page({ | @@ -6064,33 +6094,21 @@ Page({ | ||
6064 | getApp().request.promiseGet(url, {data:req_data}).then(async function (res) { | 6094 | getApp().request.promiseGet(url, {data:req_data}).then(async function (res) { |
6065 | if(res.data.code==0 && res.data.data && res.data.data.length){ | 6095 | if(res.data.code==0 && res.data.data && res.data.data.length){ |
6066 | var arr_data=res.data.data; | 6096 | var arr_data=res.data.data; |
6097 | + var new_arr=[]; | ||
6067 | for(let i in arr_data){ | 6098 | for(let i in arr_data){ |
6068 | let item=arr_data[i]; | 6099 | let item=arr_data[i]; |
6069 | - if(item.prom_type==10){ | ||
6070 | - var url1="/api/weshop/prom/ladderList/list?store_id="+os.stoid+"&form_id="+item.act_id; | ||
6071 | - await getApp().request.promiseGet(url1, {}).then(rs=>{ | ||
6072 | - if(rs.data.code==0 && rs.data.data && rs.data.data.length) { | ||
6073 | - var prom_content=""; | ||
6074 | - for(let jj in rs.data.data){ | ||
6075 | - if(rs.data.data[jj].discount==10){ | ||
6076 | - prom_content+="第"+(jj+1)+"件原价,"; | ||
6077 | - }else{ | ||
6078 | - prom_content+="第"+(jj+1)+"件"+rs.data.data[jj].discount+"折,"; | ||
6079 | - } | ||
6080 | - } | ||
6081 | - prom_content=ut.sub_last(prom_content); | ||
6082 | - item.prom_content=prom_content; | ||
6083 | - } | ||
6084 | - }) | ||
6085 | - } | 6100 | + //找不到活动要剔除 |
6101 | + if(!item.act_name) continue; | ||
6102 | + if(item.prom_type!=1) continue; | ||
6103 | + new_arr.push(item); | ||
6086 | } | 6104 | } |
6087 | 6105 | ||
6088 | - if(res.data.data.length=1){ | ||
6089 | - th.data.prom_id=res.data.data[0].act_id; | ||
6090 | - th.data.prom_type=res.data.data[0].prom_type; | 6106 | + if(new_arr.length==1){ |
6107 | + th.data.prom_id=new_arr[0].act_id; | ||
6108 | + th.data.prom_type=new_arr[0].prom_type; | ||
6091 | } | 6109 | } |
6092 | 6110 | ||
6093 | - th.setData({more_flash:arr_data}); | 6111 | + th.setData({more_flash:new_arr}); |
6094 | } | 6112 | } |
6095 | }) | 6113 | }) |
6096 | }, | 6114 | }, |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -614,6 +614,24 @@ | @@ -614,6 +614,24 @@ | ||
614 | </view> | 614 | </view> |
615 | </block> | 615 | </block> |
616 | 616 | ||
617 | + <block wx:if="{{jieti_prom}}"> | ||
618 | + <view class="cx-frame flex jc_sb" bindtap="go_more_ladder" data-id="{{ladder_act_id}}" | ||
619 | + style="position: relative; height: auto"> | ||
620 | + <view class="flex" style="width: 92%"> | ||
621 | + <view class="cx-sizs fs30" style="width: 90rpx;flex-shrink: 0">阶梯促</view> | ||
622 | + <!-- 中间显示层 --> | ||
623 | + <view class="ellipsis-1 fs24"> | ||
624 | + <text class="jie_show fs22">阶</text> | ||
625 | + {{jieti_prom}} | ||
626 | + </view> | ||
627 | + </view> | ||
628 | + <view data-coupon="1" bindtap="show_more_cx" class="cx-obtain-coupon wsize"> | ||
629 | + <text class="bg_jj" style="position: relative;right: 3rpx"></text> | ||
630 | + </view> | ||
631 | + </view> | ||
632 | + </block> | ||
633 | + | ||
634 | + | ||
617 | <!-- 要判断是不是有订单优惠 --> | 635 | <!-- 要判断是不是有订单优惠 --> |
618 | <block wx:if="{{order_prom}}"> | 636 | <block wx:if="{{order_prom}}"> |
619 | <view class="cx-frame flex" style="position: relative; height: auto"> | 637 | <view class="cx-frame flex" style="position: relative; height: auto"> |
@@ -654,36 +672,30 @@ | @@ -654,36 +672,30 @@ | ||
654 | <!-- 判断是不是有秒杀 --> | 672 | <!-- 判断是不是有秒杀 --> |
655 | <block wx:if="{{more_flash}}"> | 673 | <block wx:if="{{more_flash}}"> |
656 | 674 | ||
657 | - <block wx:for="{{more_flash}}"> | ||
658 | - <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}" > | ||
659 | - <view class="cx-sizs wsize" style="width: 144rpx">秒杀</view> | ||
660 | - <!-- 中间显示层 --> | ||
661 | - <view class="flex ai-center jc_sb" style="width: 570rpx" bindtap="go_more_flash" data-id="{{item.act_id}}"> | ||
662 | - <view class="flex"> | ||
663 | - <view class="miao_lab">秒</view> | ||
664 | - <view class="order_hui"> | ||
665 | - <view class="fs28 ellipsis-1">{{item.act_name}}</view> | ||
666 | - <view class="fs26"> | ||
667 | - (活动时间:{{tool.format_tt(item.s_time)}} - {{tool.format_tt(item.e_time)}}) | ||
668 | - </view> | 675 | + <block wx:for="{{more_flash}}"> |
676 | + <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}"> | ||
677 | + <view class="cx-sizs wsize" style="width: 144rpx">秒杀</view> | ||
678 | + <!-- 中间显示层 --> | ||
679 | + <view class="flex ai-center jc_sb" style="width: 570rpx" bindtap="go_more_flash" | ||
680 | + data-id="{{item.act_id}}"> | ||
681 | + <view class="flex"> | ||
682 | + <view class="miao_lab">秒</view> | ||
683 | + <view class="order_hui"> | ||
684 | + <view class="fs28 ellipsis-1">{{item.act_name}}</view> | ||
685 | + <view class="fs26"> | ||
686 | + (活动时间:{{tool.format_tt(item.s_time)}} - {{tool.format_tt(item.e_time)}}) | ||
669 | </view> | 687 | </view> |
670 | </view> | 688 | </view> |
671 | - <view><text class="bg_jj is_more_cx" style="position: relative;top:-10rpx"></text></view> | ||
672 | - </view> | ||
673 | - </view> | ||
674 | - | ||
675 | - <view class="cx-frame flex jc_sb" bindtap="go_more_ladder" data-id="{{item.act_id}}" style="position: relative; height: auto" wx:if="{{item.prom_type==10}}"> | ||
676 | - <view class="flex" style="width: 92%"> | ||
677 | - <view class="cx-sizs fs30" style="width: 90rpx;flex-shrink: 0">阶梯促</view> | ||
678 | - <!-- 中间显示层 --> | ||
679 | - <view class="ellipsis-1 fs24"><text class="jie_show fs22">阶</text>{{item.prom_content}}</view> | ||
680 | - </view> | ||
681 | - <view data-coupon="1" bindtap="show_more_cx" class="cx-obtain-coupon wsize"> | ||
682 | - <text class="bg_jj" style="position: relative;right: 3rpx"></text> | 689 | + </view> |
690 | + <view> | ||
691 | + <text class="bg_jj is_more_cx" style="position: relative;top:-10rpx"></text> | ||
692 | + </view> | ||
683 | </view> | 693 | </view> |
684 | </view> | 694 | </view> |
685 | </block> | 695 | </block> |
686 | </block> | 696 | </block> |
697 | + | ||
698 | + <!-- 保障服务 --> | ||
687 | <view class="bz_view flex bdt16" wx:if="{{bconfig}}" style=""> | 699 | <view class="bz_view flex bdt16" wx:if="{{bconfig}}" style=""> |
688 | <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image> | 700 | <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image> |
689 | <view class="flex f1 ai_c rel"> | 701 | <view class="flex f1 ai_c rel"> |
@@ -691,8 +703,6 @@ | @@ -691,8 +703,6 @@ | ||
691 | <view bindtap="clickCollapse" class="cx-obtain-coupon wsize arrow"> | 703 | <view bindtap="clickCollapse" class="cx-obtain-coupon wsize arrow"> |
692 | <text class="bg_jj {{flag?'down1':''}}"></text> | 704 | <text class="bg_jj {{flag?'down1':''}}"></text> |
693 | </view> | 705 | </view> |
694 | - <!-- <text class="bg_jj" bindtap="clickCollapse"></text> --> | ||
695 | - <!-- <text class="iconfont icon-shuangjiantouxia c-db"></text> --> | ||
696 | </view> | 706 | </view> |
697 | </view> | 707 | </view> |
698 | <!-- - 搭配促销 -- --> | 708 | <!-- - 搭配促销 -- --> |
pages/goods/goodsList/goodsList.js
@@ -67,8 +67,12 @@ Page({ | @@ -67,8 +67,12 @@ Page({ | ||
67 | 67 | ||
68 | if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; } | 68 | if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; } |
69 | if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; } | 69 | if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; } |
70 | - | ||
71 | - | 70 | + if (0 != t.ladder_id && t.ladder_id != undefined) { url += "&ladder_id=" + t.ladder_id; } |
71 | + | ||
72 | + var user_id=getApp().globalData.user_id; | ||
73 | + if(!user_id) user_id=0; | ||
74 | + url += "&user_id="+user_id; | ||
75 | + | ||
72 | // 优惠促销列表 | 76 | // 优惠促销列表 |
73 | if(t.prom_goods_id) { | 77 | if(t.prom_goods_id) { |
74 | url += '&prom_goods_id=' + t.prom_goods_id; | 78 | url += '&prom_goods_id=' + t.prom_goods_id; |
@@ -94,6 +98,34 @@ Page({ | @@ -94,6 +98,34 @@ Page({ | ||
94 | } | 98 | } |
95 | }) | 99 | }) |
96 | } | 100 | } |
101 | + | ||
102 | + //--- 阶梯优惠活动的凑单 --- | ||
103 | + if(t.ladder_id){ | ||
104 | + var user_id=getApp().globalData.user_id; | ||
105 | + if(!user_id) user_id=0; | ||
106 | + getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/"+oo.stoid+"/"+user_id+"/"+t.ladder_id,{ | ||
107 | + }).then(res=>{ | ||
108 | + if(res.data.code==0 && res.data.data){ | ||
109 | + var arr= res.data.data; | ||
110 | + var url1="/api/weshop/prom/ladderList/list?store_id="+oo.stoid+"&form_id="+arr.id; | ||
111 | + getApp().request.promiseGet(url1, {}).then(rs=>{ | ||
112 | + if(rs.data.code==0 && rs.data.data && rs.data.data.length) { | ||
113 | + var prom_content=""; | ||
114 | + for(let jj in rs.data.data){ | ||
115 | + if(rs.data.data[jj].discount==10){ | ||
116 | + prom_content+="第"+(parseInt(jj)+1)+"件原价,"; | ||
117 | + }else{ | ||
118 | + prom_content+="第"+(parseInt(jj)+1)+"件"+rs.data.data[jj].discount+"折,"; | ||
119 | + } | ||
120 | + } | ||
121 | + prom_content=ut.sub_last(prom_content); | ||
122 | + th.setData({jieti_prom:prom_content}) | ||
123 | + } | ||
124 | + }) | ||
125 | + } | ||
126 | + }) | ||
127 | + } | ||
128 | + | ||
97 | this.requestGoodsList(url); | 129 | this.requestGoodsList(url); |
98 | getApp().getConfig2(function(rs){ | 130 | getApp().getConfig2(function(rs){ |
99 | //计算等级价相关 | 131 | //计算等级价相关 |
pages/goods/goodsList/goodsList.wxml
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | </view> | 13 | </view> |
14 | </block> | 14 | </block> |
15 | <!-- 新增 --> | 15 | <!-- 新增 --> |
16 | - <view wx:if="{{jieti_prom}}" class="fs30 ellipsis-1" style="padding: 20rpx">阶梯促销:第一件原价,第二件9折,第三件8折</view> | 16 | + <view wx:if="{{jieti_prom}}" class="fs30 ellipsis-1" style="padding: 20rpx">阶梯促销:{{jieti_prom}}</view> |
17 | 17 | ||
18 | </view> | 18 | </view> |
19 | <view class="pd20 flex ai-center jc_sb"> | 19 | <view class="pd20 flex ai-center jc_sb"> |
utils/LoadMore.js
@@ -59,52 +59,49 @@ var e = function() { | @@ -59,52 +59,49 @@ var e = function() { | ||
59 | var n = !0; | 59 | var n = !0; |
60 | 60 | ||
61 | var i, r = s.data.listName, l = s.data.resultName, d = s.data.resultListName; | 61 | var i, r = s.data.listName, l = s.data.resultName, d = s.data.resultListName; |
62 | - i = "" != r ? t.data.data[r] : t.data.data.pageData; //data.pageData是接口固定会出现的,封装好了 | 62 | + i = "" != r ? t.data.data[r] : (t.data.data && t.data.data.pageData?t.data.data.pageData:null); //data.pageData是接口固定会出现的,封装好了 |
63 | var u = !1, g = null, c = s.data.page; | 63 | var u = !1, g = null, c = s.data.page; |
64 | 64 | ||
65 | - console.log('loadmore'); | ||
66 | - console.log(t.data.data.pageData); | ||
67 | - console.log(c ); | ||
68 | - | ||
69 | //如果已经的第二页的时候,就是把数据加入数组 | 65 | //如果已经的第二页的时候,就是把数据加入数组 |
70 | if (c !=undefined && c.data[l]) { | 66 | if (c !=undefined && c.data[l]) { |
71 | u = !0; | 67 | u = !0; |
72 | var f = null; | 68 | var f = null; |
73 | f = "" != d ? c.data[l][d] : c.data[l], [].push.apply(f, i), g = c.data[l]; | 69 | f = "" != d ? c.data[l][d] : c.data[l], [].push.apply(f, i), g = c.data[l]; |
74 | - } else g = t.data.data.pageData; | 70 | + } else g = (t.data.data && t.data.data.pageData?t.data.data.pageData:null); |
75 | 71 | ||
76 | 72 | ||
77 | //格式化 | 73 | //格式化 |
78 | var glist=""; | 74 | var glist=""; |
79 | - | ||
80 | - for (var ii = 0; ii < g.length; ii++) { | ||
81 | - //if(g[i].prom_type == 1 || g[i].prom_type == 2 || g[i].prom_type == 6) { | ||
82 | - if (g[ii].prom_type && g[ii].prom_type == 1) { | ||
83 | - glist += g[ii].goods_id+","; | ||
84 | - } | ||
85 | - if (g[ii].original_img!=undefined){ | ||
86 | - if (g[ii].original_img.indexOf(oo.imghost)==-1) | ||
87 | - g[ii].original_img = oo.imghost + g[ii].original_img; | ||
88 | - } | ||
89 | - | ||
90 | - if (g[ii].add_time != undefined && rurl.indexOf("goodscollect")<0){ | ||
91 | - var tx = g[ii].add_time + ""; | ||
92 | - if (tx.indexOf('-') == -1) { | ||
93 | - g[ii].add_time = ut.formatTime(g[ii].add_time, 'yyyy-MM-dd hh:mm:ss'); | 75 | + if(g) { |
76 | + for (var ii = 0; ii < g.length; ii++) { | ||
77 | + //if(g[i].prom_type == 1 || g[i].prom_type == 2 || g[i].prom_type == 6) { | ||
78 | + if (g[ii].prom_type && g[ii].prom_type == 1) { | ||
79 | + glist += g[ii].goods_id + ","; | ||
80 | + } | ||
81 | + if (g[ii].original_img != undefined) { | ||
82 | + if (g[ii].original_img.indexOf(oo.imghost) == -1) | ||
83 | + g[ii].original_img = oo.imghost + g[ii].original_img; | ||
84 | + } | ||
85 | + | ||
86 | + if (g[ii].add_time != undefined && rurl.indexOf("goodscollect") < 0) { | ||
87 | + var tx = g[ii].add_time + ""; | ||
88 | + if (tx.indexOf('-') == -1) { | ||
89 | + g[ii].add_time = ut.formatTime(g[ii].add_time, 'yyyy-MM-dd hh:mm:ss'); | ||
90 | + } | ||
91 | + } | ||
92 | + if (rurl.indexOf('comment/page') != -1) { | ||
93 | + console.log('comment/page'); | ||
94 | + console.log(g[ii].img); | ||
95 | + var tx1 = g[ii].img; | ||
96 | + | ||
97 | + if (tx1 != "" && tx1 != null && ut.isString(tx1)) { | ||
98 | + var arr = ut.unserialize(tx1); | ||
99 | + g[ii].img = arr; | ||
100 | + } else if (!ut.isArray(tx1)) { | ||
101 | + g[ii].img = ""; | ||
102 | + } | ||
103 | + } | ||
94 | } | 104 | } |
95 | - } | ||
96 | - if (rurl.indexOf('comment/page')!=-1){ | ||
97 | - console.log('comment/page'); | ||
98 | - console.log(g[ii].img); | ||
99 | - var tx1 = g[ii].img; | ||
100 | - | ||
101 | - if (tx1 != "" && tx1 != null && ut.isString(tx1)){ | ||
102 | - var arr = ut.unserialize(tx1); | ||
103 | - g[ii].img=arr; | ||
104 | - } else if (!ut.isArray(tx1)){ | ||
105 | - g[ii].img=""; | ||
106 | - } | ||
107 | - } | ||
108 | } | 105 | } |
109 | 106 | ||
110 | 107 |