From 614887830dc21e097d513219583e68d919dbbe25 Mon Sep 17 00:00:00 2001 From: abson Date: Tue, 28 Dec 2021 09:16:13 +0800 Subject: [PATCH] oa单优化 --- pages/cart/cart/cart.wxml | 37 +++++++++++++++++++++++-------------- pages/cart/cart/cart.wxss | 7 ++++++- pages/cart/cart2/cart2.js | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------- pages/cart/cart2/cart2.wxml | 14 +++++++------- 4 files changed, 90 insertions(+), 97 deletions(-) diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index f2760de..6d2dda8 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -39,11 +39,9 @@ - - - 总数量: - {{all_num}} - 再买{{freight_free - total_fee}}元可享包邮({{weight_free}}kg内); + + + 再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内) 编辑 完成 @@ -140,7 +138,8 @@ - + + 再买{{item.diff}} , @@ -153,26 +152,36 @@ 送礼包| - 去凑单> + 去凑单> - - + + - + {{item.title}} - 去凑单 - + 去凑单> + - {{item.title}} - 去凑单 + 去凑单> + + diff --git a/pages/cart/cart/cart.wxss b/pages/cart/cart/cart.wxss index 9519427..32bcca1 100644 --- a/pages/cart/cart/cart.wxss +++ b/pages/cart/cart/cart.wxss @@ -224,6 +224,9 @@ radio { .store { border-bottom: 7rpx solid rgb(245, 245, 245); } +.login-in { + position: relative; +} .login-in .Storenum { height: 80rpx; @@ -235,9 +238,11 @@ radio { } .login-in .weight_free { + /* position: absolute; + top: 20rpx; */ font-size: 26rpx; + /* margin-left: 20rpx; */ line-height: 48rpx; - margin-left: 30rpx; } .allradio { diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 8614b31..95bfc3e 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -24,7 +24,7 @@ Page({ firstEnter: !0, //页面获取的参数 param: null, - //提交订单的格式 + //提交订单的格式 formData: { order_amount: 0,//支付金额 total_amount: 0,//总价 @@ -125,7 +125,7 @@ Page({ in_zhact_gdmap:{}, //不同门店参与同一活动的限购 hid_inp:1, - user_note:{}, + user_note:"", zhhe_act_map:{}, //组合活动的map表 zuhe_map_good:{}, //组合购的map表 ladder_map:{}, //阶梯促销的map表 @@ -175,10 +175,7 @@ Page({ //----------子页返回父页触发---------- onShow: function () { var th = this; - th.setData({ - show_submit: 0, - - }); //让提交先掩藏 + th.setData({show_submit: 0}); //让提交先掩藏 th.data.g_cart_q_time = null; if (th.data.isclose == 0) { @@ -331,7 +328,6 @@ Page({ typeof func == "function" && func(); }) }, - //------获取会员信息-----先获取用户信息,在进行下一步--- get_info: function (func) { var user_id = t.globalData.user_id; @@ -529,7 +525,7 @@ Page({ } else { - item1.act = th.data.zhhe_act_map[item1.prom_id]; + item1.act = th.data.zhhe_act_map[item1.prom_id]; } } if(item1.prom_type==10){ @@ -565,7 +561,7 @@ Page({ } }) if (!isok){ - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item1.id; + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; getApp().request.delete(url, {}); th.data.ladder_map[item1.prom_id]=-1; continue; @@ -629,9 +625,7 @@ Page({ if (arr.length > 0) { for (var j = 0; j < arr.length; j++) { if (arr[j].pickup_id == pcid) { - - //赠品的配送方式要和优惠的主商品一样 - if(item.is_gift!=1){ + //if(item.is_gift!=1){ //确定配送方式 if (arr[j].distr_t == 0) { arr[j].distr_t = car_item.distr_type; @@ -652,8 +646,7 @@ Page({ arr[j].exp_type = e_t; if (e_t == 0) th.setData({is_all_zt: 0}); else if(e_t==1) th.setData({is_all_zt: 1}); - } - + //} //-- 把等级卡会优惠多少钱装进去 -- if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1; @@ -696,7 +689,6 @@ Page({ } //如果是物流的话,全部自提的控制要弄成0 if (e_t == 0) th.setData({is_all_zt: 0}); - else if (e_t == 1) th.setData({is_all_zt: 1}); var narr = new Array(); narr.push(car_item); @@ -835,8 +827,6 @@ Page({ get_buy_goods: function (e) { var th = this; var gg = to.get_b_now(); - - //--------如果goods_id一样,就是要立即购买----- if (e == gg.goods_id) { a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, { @@ -984,11 +974,6 @@ Page({ } else { //--看是不是搭配促销-- if (gg.prom_type == 5) { - - th.setData({ - 'is_coupon': gg.is_coupon - }); - t.data.data.prom_id = gg.prom_id; t.data.data.prom_type = 5; if (gg.room_id) { @@ -1389,8 +1374,7 @@ Page({ by_qc = res.data.data[0]; } }) - } - ; + }; var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist)); if (th.data.cartlist && th.data.cartlist.length > 0) { @@ -1478,7 +1462,7 @@ Page({ { is_no_zh=1; } - //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 + //阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加 if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id] && th.data.ladder_map[item[j].prom_id].is_useorderyh ) { @@ -1490,8 +1474,8 @@ Page({ } o_price += item[j].goods_price * item[j].goods_num; - //判断是否有设置限制重量包邮 - if(weight_free){ + //判断是否有设置限制重量包邮,先看商品有没有包邮 + if(item[j]['is_past']!==1 && weight_free){ if( item[j]['exp_sum_type']==2 ){ if (goods_weight < 0) goods_weight = 0; //累积商品重量 每种商品的重量 * 数量 @@ -1740,19 +1724,16 @@ Page({ }).then(res => { if (res.data.code == 0) { var ord_prom = res.data.data; - //如果订单没有勾选使用优惠券不参与此活动,或者没有用优惠券 - if(!ord_prom.is_xz_yh || quan_price<=0) { - order_prom_id = ord_prom['id']; - switch (ord_prom['type']) { - case 0: - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 - order_prom_amount = (o_condition - order_m).toFixed(2); - break; - case 1: - //order_m = o_condition - ord_prom['expression'];//满额优惠金额 - order_prom_amount = ord_prom['expression']; - break; - } + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (o_condition - order_m).toFixed(2); + break; + case 1: + //order_m = o_condition - ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; } } }) @@ -2098,20 +2079,16 @@ Page({ var order_prom_id = 0; if (th.data.order_prom[th.data.bn_pick]) { var ord_prom = th.data.order_prom[th.data.bn_pick]; - //如果订单没有勾选使用优惠券不参与此活动 - if(!ord_prom.is_xz_yh || quan_price<=0) { - - order_prom_id = ord_prom['id']; - switch (ord_prom['type']) { - case 0: - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 - order_prom_amount = (o_condition - order_m).toFixed(2); - break; - case 1: - order_m = o_condition - ord_prom['expression'];//满额优惠金额 - order_prom_amount = ord_prom['expression']; - break; - } + order_prom_id = ord_prom['id']; + switch (ord_prom['type']) { + case 0: + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折 + order_prom_amount = (o_condition - order_m).toFixed(2); + break; + case 1: + order_m = o_condition - ord_prom['expression'];//满额优惠金额 + order_prom_amount = ord_prom['expression']; + break; } } //--订单优惠的显示-- @@ -2263,7 +2240,6 @@ Page({ var ff = true; //------------立即购买------------- if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) { - if (th.data.bn_exp_type == 0 && th.data.user_addr == null) { ff = false; getApp().my_warnning("请选择收货地址", 0, th); @@ -2300,7 +2276,7 @@ Page({ 'user_money': th.data.formData.user_money, //使用余额 'total_amount': th.data.formData.total_amount, //订单总价 'order_amount': th.data.formData.order_amount, //应付 - 'user_note': th.data.user_note, //用户备注 + 'user_note': th.data.user_note['0']?th.data.user_note['0']:0, //用户备注 'store_id': oo.stoid, //商家 'pickup_id': th.data.bn_pick, //门店 'exp_type': th.data.bn_exp_type, //配送方式 @@ -2483,11 +2459,21 @@ Page({ 'gift_id': gift_gg.gift_id, 'prom_id': gift_gg.prom_id, }; + //-- 把导购的信息填入-- + if (gg.guide_id) { + g_goods.guide_id = gg.guide_id; + g_goods.guide_type = gg.guide_type; + //调用接口判断是不是会员 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => { + if (res.data.code == 0) { + g_goods.guide_name = is_vip.salesman; + g_goods.guide_sn = is_vip.salesman_no; + } + }) + } item.order_goods.push(g_goods); } pdata.push(item); - - console.log(pdata); } else { //---------购物车的结算--------- if (th.data.is_all_zt == 0 && th.data.user_addr == null) { @@ -2549,7 +2535,6 @@ Page({ if (t_item.coupon_price) { item.coupon_price = t_item.coupon_price; item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no; - t_item.quan_no=item.coupon_no; } else if (t_item.quan_no) { item.coupon_no = t_item.quan_no; item.coupon_price = 0; @@ -2618,16 +2603,15 @@ Page({ //房间号的ids var room_ids = ""; - //-- 把券的钱,写入从表 --- - if (t_item.quan_youhui_list && t_item.coupon_price) { + //-- 把券的钱,写入从表 --- + if (t_item.quan_youhui_list && t_item.coupon_price) { for (var kk in t_item.quan_youhui_list) { var you_item = t_item.quan_youhui_list[kk]; //-- 对券的价格进行平摊 -- await th.split_set_goods_quanprice(you_item,t_item); } } - //-------------让商品添加到商品列表-------------------- for (var k = 0; k < t_item.goods.length; k++) { var g_item = t_item.goods[k]; @@ -2650,7 +2634,6 @@ Page({ goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2); goods.pricing_type = g_item.pricing_type; } - if(g_item.quan_num){ goods.quan_num=g_item.quan_num; goods.quan_no=g_item.quan_no; @@ -2753,8 +2736,6 @@ Page({ 'content-type': 'application/json' },// 设置请求的 header success: function (res) { - - wx.hideLoading(); if (res.statusCode == 200) { var data = res.data; @@ -3603,7 +3584,6 @@ Page({ if (th.data.is_b_now == 1) { th.setData({index: m_wind, is_express: m_wind}); } else { - clearInterval(ui); var ui = setInterval(function () { if (th.data.cartlist) { var c_arr = th.data.cartlist; @@ -3720,17 +3700,15 @@ Page({ check_quan_ware_list = encodeURIComponent(gd['erpwareid']); }---*/ } - //优惠券优惠的金额要控制到优惠券的选择条件 var cut_price = 0; for (var i in th.data.prom_goods_map[pickup_id]) { var obj = th.data.prom_goods_map[pickup_id][i]; - if (obj.coupon_sele && obj.prom_price) { + if (obj.coupon_sele) { cut_price += obj.price - obj.prom_price; } } - //阶梯优惠使用券 var prom_pt_json= ep.prom_pt_json; if(prom_pt_json){ for(let oj in prom_pt_json){ @@ -3765,7 +3743,7 @@ Page({ data: { storeId: oo.stoid, userId: app.globalData.user_id, - BuySum: parseFloat(arr[ind].ckeck_quan_price?arr[ind].ckeck_quan_price:0).toFixed(2), + BuySum: arr[ind].ckeck_quan_price, WareIds: check_quan_ware_list, pageSize: 100 } @@ -3814,7 +3792,7 @@ Page({ data: { storeId: oo.stoid, userId: app.globalData.user_id, - BuySum: parseFloat(th.data.ckeck_quan_price?th.data.ckeck_quan_price:0).toFixed(2), + BuySum: th.data.ckeck_quan_price, WareIds: encodeURIComponent(th.data.check_quan_ware_list), pageSize: 100 }, @@ -3992,6 +3970,7 @@ Page({ var goods_weight = -1, goods_piece = -1; var gift_shipping_price = 0; var th = this; + var out_of_weight=null; switch (good['exp_sum_type']) { case 1: //统一运费 @@ -4003,8 +3982,9 @@ Page({ //累积商品重量 每种商品的重量 * 数量 goods_weight += good['weight'] * good['buynum']; if (goods_weight1 > 0) { + out_of_weight = gift_weight_free - goods_weight; + //不能调换位置 下面goods_weight会变大 goods_weight += goods_weight1; - out_of_weight = (gift_weight_free*1000) - goods_weight; } break; case 3: @@ -4172,9 +4152,8 @@ Page({ getApp().goto(url); }, - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 - split_set_goods_quanprice:async function (you_item,t_item) { - + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 + split_set_goods_quanprice:async function (you_item,t_item) { var coupon_price=you_item.WareCashSum; var goods=t_item.goods; var arr=[]; diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml index b3e0d46..7be9d90 100644 --- a/pages/cart/cart2/cart2.wxml +++ b/pages/cart/cart2/cart2.wxml @@ -375,13 +375,13 @@ - - - - - - - + + 留言 + + + + -- libgit2 0.21.4