diff --git a/packageA/pages/activity_share/activity_share.js b/packageA/pages/activity_share/activity_share.js index ccae667..687e429 100644 --- a/packageA/pages/activity_share/activity_share.js +++ b/packageA/pages/activity_share/activity_share.js @@ -161,7 +161,10 @@ Page({ //---秒杀,拼团,促销--- var item=this.data.share_good; if(item){ - var price = item.shop_price; + var price = item.price; + if(!price) price=item.shop_price; + + var title= item.goods_name; var img=this.data.url+item.original_img; var url="/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid; diff --git a/packageA/pages/goods_share/goods_share.wxml b/packageA/pages/goods_share/goods_share.wxml index d922e98..6705aed 100644 --- a/packageA/pages/goods_share/goods_share.wxml +++ b/packageA/pages/goods_share/goods_share.wxml @@ -10,8 +10,21 @@ 销量 - 价格 - 佣金 + + + 价格 + + + 价格 + + + + 佣金 + + + 佣金 + + 最新 diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 01f2e95..af4a9a9 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -112,6 +112,8 @@ Page({ show_card:null, //显示的等级卡 card_name:'', //显示的卡的名称 card_cut_price:null,//减价多少钱 + + show_submit:0, //提交按钮变正常显示 }, onLoad: function(t) { @@ -140,8 +142,9 @@ Page({ //----------子页返回父页触发---------- onShow: function() { var th=this; + th.setData({show_submit:0}); + if (th.data.isclose==0){ - wx.navigateTo({ url: "/pages/index/index/index" }) @@ -153,7 +156,7 @@ Page({ console.log(ie) //地址切换要把包邮券清空 - if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ + if( !th.data.user_addr || !ie || th.data.user_addr.address_id!=ie.address_id){ var using_quan=th.data.using_quan; for(var i in using_quan){ var item=using_quan[i]; @@ -164,19 +167,22 @@ Page({ } th.data.isget_by_quan={}; } - + + + th.data.prom_goods_map={}; + th.data.is_summit_ing=0; //更换地址回来要重新调用计算价钱的接口 if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ th.setData({user_addr: ie }); if (th.data.is_b_now == 1) { if(th.data.bn_goods) { th.setData({add_back:1}); - th.calculatePrice2(); + //th.calculatePrice2(); } }else{ if (th.data.cartlist){ th.setData({add_back:1}); - th.calculatePrice(); + //th.calculatePrice(); } } }else{ @@ -277,26 +283,31 @@ Page({ //------获取会员收货地址----- getuser_addr:function(func){ + var th=this; a.get("/api/weshop/useraddress/page", { - data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600 }, + data: { user_id: to.globalData.user_id, store_id: oo.stoid, pageSize: 600,t:Math.random()}, success: function (su) { /*--- var user_addr=[ { 'address_id': 882, 'user_id': 2661, 'consignee': '测试测试测', 'province': 3102, 'city': 3431, 'district': 3466, 'address': 'ed', 'more_address': '山西-长治市-襄垣县-虎(音si)亭镇', 'mobile': 13012345678,'is_default':1}, - ];---*/ - var user_addr = su.data.data.pageData; - var item = null; - var def_item=null; - for (var i = 0; i < user_addr.length; i++) { - if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i];} - if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } - } - - if (item == null) item = def_item; - if (item == null) item = user_addr[0]; + ];---*/ + var item = null; + if(su.data.code==0 && su.data.data && su.data.data.pageData){ + var user_addr = su.data.data.pageData; + var def_item=null; + for (var i = 0; i < user_addr.length; i++) { + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i];} + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } + } + + if (item == null) item = def_item; + if (item == null) item = user_addr[0]; + } if(item==undefined) item=null; + if(!item) th.setData({user_addr:null}); //地址为空的时候,要清空,因为返回的时候,有缓存 + func(item); } }); @@ -341,7 +352,8 @@ Page({ } }); }, - + + //-----真的获取购物车,入口-------- get_cart: function () { var th = this,app=getApp(); @@ -360,11 +372,7 @@ Page({ for (var i = 0; i < carr.length; i++) { var item = carr[i]; - //要把优惠活动加入,prom_goods_map中,赠品不要运算 - if(item.prom_type==3 && item.is_gift!=1){ - await th.add_prom_goods_map(item); - } - + //-- 如果是等级会员注册返回 -- if(is_card_back){ th.data.card_name=th.data.userinfo.card_field; @@ -383,12 +391,17 @@ 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])*item.goods_num; + item.cut_price1= item.goods_price-item[th.data.card_name]; + carr[i].cut_price1=(item.goods_price-item[th.data.card_name])*item.goods_num; } } + //要把优惠活动加入,prom_goods_map中,赠品不要运算 + if(item.prom_type==3 && item.is_gift!=1){ + await th.add_prom_goods_map(item); + } + item.original_img = oo.imghost + item.original_img; /*----接口要弄出来的,先顶着-----*/ @@ -399,7 +412,22 @@ Page({ if (arr.length > 0) { for (var j = 0; j < arr.length; j++) { if (arr[j].pickup_id == pcid) { - arr[j].goods.push(item); + arr[j].goods.push(item); + if(item.is_gift!=1){ + //确定配送方式 + if(arr[j].distr_t==0){ + arr[j].distr_t=item.distr_type; + } + var e_t=0 + switch (arr[j].distr_t) { + case 0: e_t = 1; break; + case 1: e_t = 1; break; + case 2: e_t = 0; break; + } + arr[j].exp_type=e_t; + if (e_t == 0) th.setData({ is_all_zt:0}); + } + //-- 把等级卡会优惠多少钱装进去 -- if(item.cut_price) arr[j].card_cut_price+=item.cut_price; find = 1;break; @@ -426,7 +454,6 @@ Page({ case 1: e_t = 1; break; case 2: e_t = 0; break; } - //如果是物流的话,全部自提的控制要弄成0 if (e_t == 0) th.setData({ is_all_zt:0}); @@ -441,14 +468,21 @@ Page({ } var ie = { - pickup_id: pcid, pname: pikname, goods: narr, wind: m_wind, distr_t: dis_t,card_cut_price:0, + pickup_id: pcid, pname: pikname, goods: narr, wind: m_wind, distr_t: dis_t,card_cut_price:0,exp_type:e_t, goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; - - if(!th.data.add_back){ - ie.exp_type= e_t - } + + //-- 如果是回退回来的情况 -- + if(th.data.cartlist && th.data.cartlist.length>0) { + for(var kj in th.data.cartlist){ + if(ie.pickup_id==th.data.cartlist[kj].pickup_id){ + ie.exp_type=th.data.cartlist[kj].exp_type; + break; + } + } + } + //-- 把等级卡会优惠多少钱装进去 -- - if(item.cut_price) ie.card_cut_price+=item.cut_price; + if(item.cut_price1) ie.card_cut_price+=item.cut_price1; arr.push(ie); } @@ -496,7 +530,9 @@ Page({ case 1: et = 1; break; case 2: et = 0; break; } - + + if(th.data.bn_goods) et=th.data.bn_exp_type + var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; if(et==0 && def_exp_code){ for(var k=0;k=0 && item_map.price-item_map.prom_price){ + //if(item_map.prom_price>=0 && item_map.price-item_map.prom_price){ + if(item_map.price-item_map.prom_price && item_map.prom_price!==null){ if(cart_item.prom_pt_json){ cart_item.prom_pt_json.push({"prom_id":item_map.prom_id,"dis":(item_map.price-item_map.prom_price).toFixed(2),"ispt":0}) }else{ @@ -892,6 +919,7 @@ Page({ cart_item.g_coupon_num.push({'c_id':item_map.s_coupon_id,"num": item_map.s_coupon_num}) } } + //-- 如果有送优包邮券的情况 -- if(item_map.s_libao){ if(!cart_item.s_libao) { @@ -1004,15 +1032,18 @@ Page({ if(no_ex_good){ is_good_no_by=th.check_by_goods(no_ex_good,item[j].goods_id); } + //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){ continue; } + //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by){ continue; } + //----------------如果是选择了物流--------------------- if(cart_item.exp_type == 0 && item[j].is_free_shipping==0){ //如果地址不为空 @@ -1197,7 +1228,7 @@ Page({ th.setData({ [atxt]: all_total_m, [atxt1]: all_order_m, [atxt2]: all_price, [atxt3]: all_user_m, [atxt4]: all_shipping_m, [atxt5]: all_coupon_price_m,[atxt6]: all_cutprice, - [atxt7]: all_order_prom, + [atxt7]: all_order_prom, show_submit:1 }) th.data.order_prom_list_cart=c_arr; th.set_can_num(); @@ -1247,7 +1278,7 @@ Page({ //-----------计算商品总价-------------- var allpice = good.shop_price * good.buynum; var cut_price=0; - if(good.prom_type==3 && good.prom_price){ + if(good.prom_type==3 && good.prom_price!==null){ cut_price=allpice-good.prom_price; } allpice=parseFloat(allpice).toFixed(2); @@ -1429,14 +1460,14 @@ Page({ if (th.data.bn_use_money == 1) { if (amoney> order_m) { order_m = order_m.toFixed(2); - th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price }) + th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price,show_submit:1 }) }else{ order_m =parseFloat(order_m - amoney); order_m = order_m.toFixed(2); - th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price }) + th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price,show_submit:1 }) } }else{ - th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price }) + th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price,show_submit:1}) } //优惠活动送积分 if(good.s_intValue){ @@ -1476,14 +1507,14 @@ Page({ if (th.data.bn_use_money == 1) { if (amoney> order_m) { order_m = order_m.toFixed(2); - th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price }) + th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price,show_submit:1 }) }else{ order_m =parseFloat(order_m - amoney); order_m = order_m.toFixed(2); - th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price }) + th.setData({ [txt]: amoney, [txt2]: order_m,[txt3]:coupon_price,show_submit:1 }) } }else{ - th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price }) + th.setData({ [txt]: 0, [txt2]: order_m,[txt3]:coupon_price, show_submit:1 }) } //优惠活动送积分 if(good.s_intValue){ @@ -1527,7 +1558,7 @@ Page({ if(th.data.bn_exp_type == 0 && th.data.user_addr==null ){ ff = false; getApp().my_warnning("请选择收货地址",0,th); - this.data.is_summit_ing = 0; + th.data.is_summit_ing = 0; } if (!ff) return false; var addr = th.data.user_addr; @@ -1536,6 +1567,7 @@ Page({ if(th.data.bn_exp_type==0) if(th.data.wu_arr==null || th.data.wu_arr.length<=0){ getApp().my_warnning("读取物流失败",0,th); + th.data.is_summit_ing = 0; return false; } @@ -1716,7 +1748,9 @@ Page({ console.log(pdata); }else{ //---------购物车的结算--------- - if (th.data.is_all_zt == 0 && th.data.user_addr == null) { ff = false; getApp().confirmBox("请新建收货地址");} + if (th.data.is_all_zt == 0 && th.data.user_addr == null) { + th.data.is_summit_ing = 0; + ff = false; getApp().confirmBox("请新建收货地址");} if (!ff) return false; var addr = th.data.user_addr; @@ -1726,6 +1760,7 @@ Page({ if(th.data.is_all_zt !=1) if(th.data.wu_arr==null || th.data.wu_arr.length<=0 ){ + th.data.is_summit_ing = 0; getApp().confirmBox("读取物流失败"); return false; } @@ -1939,7 +1974,7 @@ Page({ util_pay.pay(data.data, function() { //app.my_warnning("支付成功",1,th); //setTimeout(function () { - wx.navigateTo({ + wx.redirectTo({ url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data }) //},1000) @@ -1965,7 +2000,7 @@ Page({ //app.my_warnning("支付成功",1,th); //setTimeout(function () { th.setData({ isclose: 0 }); - wx.navigateTo({ + wx.redirectTo({ url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data, }) //}, 1000) @@ -2084,6 +2119,7 @@ Page({ //--------购物车购买时,选择自提和物流----------- setexptype_w:function(t){ + var def_exp_code= getApp().globalData.userInfo.def_exp_code,th=this; var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, wl_txt = t.currentTarget.dataset.wl_txt, diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml index 43f4e80..eaa234c 100644 --- a/pages/cart/cart2/cart2.wxml +++ b/pages/cart/cart2/cart2.wxml @@ -4,7 +4,7 @@
- + - + 应付金额:¥{{formData.order_amount}} - +