From 2d90d4d3828b8bdf27bf712996fb87f14c21a730 Mon Sep 17 00:00:00 2001 From: abson Date: Wed, 23 Mar 2022 22:12:48 +0800 Subject: [PATCH] 组合购使用优惠券问题 --- custom-tab-bar/index.js | 3 +-- pages/cart/cart2/cart2.js | 11 ++++++++--- pages/goods/search/g_filter.wxs | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------- pages/index/index/index.js | 1 - pages/user/address_list/address_list.js | 2 -- pages/user/address_list/address_list.wxml | 2 +- 6 files changed, 107 insertions(+), 109 deletions(-) diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 532967a..206902f 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -12,7 +12,6 @@ Component({ lifetimes: { attached: function() { - var th=this; getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ var dis=rs.data.data; @@ -99,7 +98,7 @@ Component({ //设置自定义页面的列表 set_list:function(data){ var itemList = data.data; - itemList = JSON.parse(itemList); + itemList = JSON.parse(itemList); this.setData({ list:itemList, backgroundColor: data.bkcolor, diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index ac11b9e..3300684 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -3855,15 +3855,20 @@ Page({ if (prom_pt_json) { for (let oj in prom_pt_json) { let item_j = prom_pt_json[oj]; - //要对一下阶梯优惠促销的功能 if (item_j.ladder_prom_id) { - //看一下要不要限制使用优惠券 if (th.data.ladder_map[item_j.ladder_prom_id] && th.data.ladder_map[item_j.ladder_prom_id].is_usecoupon) { continue; } - + cut_price += parseFloat(item_j.dis); + } + //要对一下组合购促销的功能 + if (item_j.zhprom_id) { + //看一下要不要限制使用优惠券 + if (th.data.zhhe_act_map[item_j.zhprom_id] && th.data.zhhe_act_map[item_j.zhprom_id].is_xz_yh) { + continue; + } cut_price += parseFloat(item_j.dis); } } diff --git a/pages/goods/search/g_filter.wxs b/pages/goods/search/g_filter.wxs index 7b575ba..605179a 100644 --- a/pages/goods/search/g_filter.wxs +++ b/pages/goods/search/g_filter.wxs @@ -1,108 +1,105 @@ var g_filters = { - //-- 判断是不是有等级价 -- - is_has_rank:function(rank_switch,item){ - if(!rank_switch) return false; - if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} - return false; - }, - - //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- - get_card_price:function(goods,all_card,type){ - var price1=parseFloat(goods['cardprice1']); - var price2=parseFloat(goods['cardprice2']); - var price3=parseFloat(goods['cardprice3']); - if(!all_card){ - if(type==0) return 0; - return ""; - } - - var arr=[]; - var min_price= 0; - var min_name=""; - - var min_price=null; - var min_name=null; - //---设置对应的价格名字---- - for(var i=0;i<3;i++) { - var vl=all_card[i]; - if(!vl) continue; - if(vl['CorrPrice']=="Price1" && price1>0) - { - if(min_price==null) { - min_price=price1;min_name=vl['CardName']; - } - else if(price10) - { - if(min_price==null) { - min_price=price2;min_name=vl['CardName']; - } - else if(price20) - { - if(min_price==null) { - min_price=price3;min_name=vl['CardName']; - } - else if(price37 ) min_name=min_name.substring(0, 8); - return min_name; - }, + //-- 判断是不是有等级价 -- + is_has_rank: function (rank_switch, item) { + if (!rank_switch) return false; + if (item.cardprice1 || item.cardprice2 || item.cardprice3) { return true } + return false; + }, + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- + get_card_price: function (goods, all_card, type) { + var price1 = parseFloat(goods['cardprice1']); + var price2 = parseFloat(goods['cardprice2']); + var price3 = parseFloat(goods['cardprice3']); + if (!all_card) { + if (type == 0) return 0; + return ""; + } - get_goods_url:function(item){ + var arr = []; + var min_price = 0; + var min_name = ""; - var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id - // 预售活动 - if(item.prom_type==8){ - url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id - } - // 如果是幸运购活动商品 - if(item.prom_type == 9){ - url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id - } - - if(item.prom_type==1 && item.prom_id>0){ - url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id+"&prom_type=1"; - } - return url1; - } + var min_price = null; + var min_name = null; + //---设置对应的价格名字---- + for (var i = 0; i < 3; i++) { + var vl = all_card[i]; + if (!vl) continue; + if (vl['CorrPrice'] == "Price1" && price1 > 0) { + if (min_price == null) { + min_price = price1; min_name = vl['CardName']; + } + else if (price1 < min_price) { + min_price = price1; min_name = vl['CardName']; + } + } + if (vl['CorrPrice'] == "Price2" && price2 > 0) { + if (min_price == null) { + min_price = price2; min_name = vl['CardName']; + } + else if (price2 < min_price) { + min_price = price2; min_name = vl['CardName']; + } + } + + if (vl['CorrPrice'] == "Price3" && price3 > 0) { + if (min_price == null) { + min_price = price3; min_name = vl['CardName']; + } + else if (price3 < min_price) { + min_price = price3; min_name = vl['CardName']; + } + } + + } + if (min_price == null) { + if (type == 0) return 0; + return ""; + } + + //if(type==0) return arr.length; + //--进行排序,升序--- + /*--- + arr.sort(function(a,b){ + if (a.price < b.price) { + return -1; + } else if (a.fee == b.fee) { + return 0; + } else { + return 1; + } + })--*/ + //-- 获取最下价钱,和相应的卡的名称 -- + //min_price=min.price; + //min_name=min.name; + if (type == 0) return min_price.toFixed(2); + if (min_name.length > 7) min_name = min_name.substring(0, 8); + return min_name; + }, + + + get_goods_url: function (item) { + + var url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + // 预售活动 + if (item.prom_type == 8) { + url1 = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + } + // 如果是幸运购活动商品 + if (item.prom_type == 9) { + url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id + } + + if (item.prom_type == 1 && item.prom_id > 0) { + url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + "&prom_type=1"; + } + return url1; + } } module.exports = { - is_has_rank:g_filters.is_has_rank, - get_card_price:g_filters.get_card_price, - get_goods_url:g_filters.get_goods_url + is_has_rank: g_filters.is_has_rank, + get_card_price: g_filters.get_card_price, + get_goods_url: g_filters.get_goods_url } \ No newline at end of file diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 72f8320..03fc98f 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -525,7 +525,6 @@ Page({ backgroundColor: temp_data.top_color, // 必写项 }) } - } }) diff --git a/pages/user/address_list/address_list.js b/pages/user/address_list/address_list.js index e9d8e0e..fd4f77f 100644 --- a/pages/user/address_list/address_list.js +++ b/pages/user/address_list/address_list.js @@ -56,10 +56,8 @@ Page({ var arr1 = e.data.addresses; var arr2 = t.data.data.pageData; var arr3 = [...arr1, ...arr2]; - var ismore = 0; if (arr3.length == t.data.data.total) ismore = 1 - e.setData({ addresses: arr3, total: t.data.data.total, ismore: ismore, is_address_read:1 diff --git a/pages/user/address_list/address_list.wxml b/pages/user/address_list/address_list.wxml index 363b580..5e667d8 100644 --- a/pages/user/address_list/address_list.wxml +++ b/pages/user/address_list/address_list.wxml @@ -32,7 +32,7 @@ - +