Commit 614887830dc21e097d513219583e68d919dbbe25

Authored by abson
1 parent ba998f66

oa单优化

pages/cart/cart/cart.wxml
... ... @@ -39,11 +39,9 @@
39 39 <!-- 购物车商品框架 -->
40 40 <view class="login-in">
41 41 <!-- 编辑 -->
42   - <view class="padding flex-vertical-between fs30 Storenum store">
43   - <view class="flex">
44   - <view>总数量:</view>
45   - <view class="goods_num">{{all_num}}</view>
46   - <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="co-red weight_free">再买{{freight_free - total_fee}}元可享包邮({{weight_free}}kg内);</view>
  42 + <view class="padding flex-vertical-between fs30 Storenum store" style="{{total_fee > 0 && freight_free - total_fee > 0 ? 'justify-content:space-between':'justify-content: flex-end;'}}">
  43 + <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
  44 + <text>再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内)</text>
47 45 </view>
48 46 <view wx:if="{{is_edit==0}}" bindtap="edit_cart" data-type="1">编辑</view>
49 47 <view wx:else bindtap="edit_cart" data-type="0">完成</view>
... ... @@ -140,7 +138,8 @@
140 138 </view>
141 139 <!--- 去凑单 -->
142 140 <view style="margin-top: 20rpx; padding: 0 30rpx">
143   - <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" >
  141 + <block wx:if="{{item.make_up_arr}}">
  142 + <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" >
144 143 <view class="ellipsis-1" style="width: 80%">再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text>
145 144 <text wx:if="{{item.diff_type==1}}">件</text>
146 145 </text>,
... ... @@ -153,26 +152,36 @@
153 152 <text wx:if="{{item.content.is_libao==1}}">送礼包|</text>
154 153 <text></text>
155 154 </view>
156   - <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view>
  155 + <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view>
157 156 </view>
158   - </view>
159   -
  157 + </block>
  158 + </view>
160 159 <!-- 还差多少件立即享受组合购 -->
161 160 <block wx:if="{{item.need_list && item.need_list.length>0 && !is_edit}}">
162   - <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.need_list}}">
  161 + <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.need_list}}">
163 162 <text>{{item.title}}</text>
164   - <text data-url="/packageB/pages/zuhegou/index/index?id={{item.id}}" bindtap="go_url">去凑单</text>
165   - </view>
  163 + <text data-url="/packageB/pages/zuhegou/index/index?id={{item.id}}" bindtap="go_url">去凑单></text>
  164 + </view>
166 165 </block>
167 166  
168 167 <!-- 阶梯促销提示多少件的优惠 -->
169 168 <block wx:if="{{item.l_need_list && item.l_need_list.length>0 && !is_edit}}">
170   -
171 169 <view class="fs28 pdr20 pdl20 pdb20 c-red2 flex jc_sb" wx:for="{{item.l_need_list}}">
172 170 <text>{{item.title}}</text>
173   - <text data-url="/pages/goods/goodsList/goodsList?ladder_id={{item.id}}" bindtap="go_url">去凑单</text>
  171 + <text data-url="/pages/goods/goodsList/goodsList?ladder_id={{item.id}}" bindtap="go_url">去凑单></text>
174 172 </view>
175 173 </block>
  174 +
  175 + <!-- <block wx:if="{{item.make_up_arr}}">
  176 + <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
  177 + <text>再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内)</text>
  178 + </view>
  179 + </block>
  180 + <block wx:else="">
  181 + <view wx:if="{{total_fee > 0 && freight_free - total_fee > 0}}" class="fs28 pdr20 pdl20 c-red2 flex jc_sb weight_free">
  182 + <text>再买{{freight_free - total_fee}}元可享全场包邮({{weight_free}}kg内)</text>
  183 + </view>
  184 + </block> -->
176 185  
177 186  
178 187 <!-- 线下取价 -->
... ...
pages/cart/cart/cart.wxss
... ... @@ -224,6 +224,9 @@ radio {
224 224 .store {
225 225 border-bottom: 7rpx solid rgb(245, 245, 245);
226 226 }
  227 +.login-in {
  228 + position: relative;
  229 +}
227 230  
228 231 .login-in .Storenum {
229 232 height: 80rpx;
... ... @@ -235,9 +238,11 @@ radio {
235 238 }
236 239  
237 240 .login-in .weight_free {
  241 + /* position: absolute;
  242 + top: 20rpx; */
238 243 font-size: 26rpx;
  244 + /* margin-left: 20rpx; */
239 245 line-height: 48rpx;
240   - margin-left: 30rpx;
241 246 }
242 247  
243 248 .allradio {
... ...
pages/cart/cart2/cart2.js
... ... @@ -24,7 +24,7 @@ Page({
24 24 firstEnter: !0,
25 25 //页面获取的参数
26 26 param: null,
27   - //提交订单的格式
  27 + //提交订单的格式
28 28 formData: {
29 29 order_amount: 0,//支付金额
30 30 total_amount: 0,//总价
... ... @@ -125,7 +125,7 @@ Page({
125 125  
126 126 in_zhact_gdmap:{}, //不同门店参与同一活动的限购
127 127 hid_inp:1,
128   - user_note:{},
  128 + user_note:"",
129 129 zhhe_act_map:{}, //组合活动的map表
130 130 zuhe_map_good:{}, //组合购的map表
131 131 ladder_map:{}, //阶梯促销的map表
... ... @@ -175,10 +175,7 @@ Page({
175 175 //----------子页返回父页触发----------
176 176 onShow: function () {
177 177 var th = this;
178   - th.setData({
179   - show_submit: 0,
180   -
181   - }); //让提交先掩藏
  178 + th.setData({show_submit: 0}); //让提交先掩藏
182 179 th.data.g_cart_q_time = null;
183 180  
184 181 if (th.data.isclose == 0) {
... ... @@ -331,7 +328,6 @@ Page({
331 328 typeof func == "function" && func();
332 329 })
333 330 },
334   -
335 331 //------获取会员信息-----先获取用户信息,在进行下一步---
336 332 get_info: function (func) {
337 333 var user_id = t.globalData.user_id;
... ... @@ -529,7 +525,7 @@ Page({
529 525 }
530 526 else
531 527 {
532   - item1.act = th.data.zhhe_act_map[item1.prom_id];
  528 + item1.act = th.data.zhhe_act_map[item1.prom_id];
533 529 }
534 530 }
535 531 if(item1.prom_type==10){
... ... @@ -565,7 +561,7 @@ Page({
565 561 }
566 562 })
567 563 if (!isok){
568   - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item1.id;
  564 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
569 565 getApp().request.delete(url, {});
570 566 th.data.ladder_map[item1.prom_id]=-1;
571 567 continue;
... ... @@ -629,9 +625,7 @@ Page({
629 625 if (arr.length > 0) {
630 626 for (var j = 0; j < arr.length; j++) {
631 627 if (arr[j].pickup_id == pcid) {
632   -
633   - //赠品的配送方式要和优惠的主商品一样
634   - if(item.is_gift!=1){
  628 + //if(item.is_gift!=1){
635 629 //确定配送方式
636 630 if (arr[j].distr_t == 0) {
637 631 arr[j].distr_t = car_item.distr_type;
... ... @@ -652,8 +646,7 @@ Page({
652 646 arr[j].exp_type = e_t;
653 647 if (e_t == 0) th.setData({is_all_zt: 0});
654 648 else if(e_t==1) th.setData({is_all_zt: 1});
655   - }
656   -
  649 + //}
657 650  
658 651 //-- 把等级卡会优惠多少钱装进去 --
659 652 if (car_item.cut_price1) arr[j].card_cut_price += car_item.cut_price1;
... ... @@ -696,7 +689,6 @@ Page({
696 689 }
697 690 //如果是物流的话,全部自提的控制要弄成0
698 691 if (e_t == 0) th.setData({is_all_zt: 0});
699   - else if (e_t == 1) th.setData({is_all_zt: 1});
700 692  
701 693 var narr = new Array();
702 694 narr.push(car_item);
... ... @@ -835,8 +827,6 @@ Page({
835 827 get_buy_goods: function (e) {
836 828 var th = this;
837 829 var gg = to.get_b_now();
838   -
839   -
840 830 //--------如果goods_id一样,就是要立即购买-----
841 831 if (e == gg.goods_id) {
842 832 a.get("/api/weshop/goods/get/" + oo.stoid + "/" + e, {
... ... @@ -984,11 +974,6 @@ Page({
984 974 } else {
985 975 //--看是不是搭配促销--
986 976 if (gg.prom_type == 5) {
987   -
988   - th.setData({
989   - 'is_coupon': gg.is_coupon
990   - });
991   -
992 977 t.data.data.prom_id = gg.prom_id;
993 978 t.data.data.prom_type = 5;
994 979 if (gg.room_id) {
... ... @@ -1389,8 +1374,7 @@ Page({
1389 1374 by_qc = res.data.data[0];
1390 1375 }
1391 1376 })
1392   - }
1393   - ;
  1377 + };
1394 1378 var c_arr = JSON.parse(JSON.stringify(th.data.old_cartlist));
1395 1379  
1396 1380 if (th.data.cartlist && th.data.cartlist.length > 0) {
... ... @@ -1478,7 +1462,7 @@ Page({
1478 1462 {
1479 1463 is_no_zh=1;
1480 1464 }
1481   - //组合购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
  1465 + //阶梯购的商品,且有订单优惠的叠加,is_orderyh就是优惠叠加
1482 1466 if(item[j].prom_type==10 && ladder_prom_goods && ladder_prom_goods[item[j].prom_id]
1483 1467 && th.data.ladder_map[item[j].prom_id].is_useorderyh )
1484 1468 {
... ... @@ -1490,8 +1474,8 @@ Page({
1490 1474 }
1491 1475 o_price += item[j].goods_price * item[j].goods_num;
1492 1476  
1493   - //判断是否有设置限制重量包邮
1494   - if(weight_free){
  1477 + //判断是否有设置限制重量包邮,先看商品有没有包邮
  1478 + if(item[j]['is_past']!==1 && weight_free){
1495 1479 if( item[j]['exp_sum_type']==2 ){
1496 1480 if (goods_weight < 0) goods_weight = 0;
1497 1481 //累积商品重量 每种商品的重量 * 数量
... ... @@ -1740,19 +1724,16 @@ Page({
1740 1724 }).then(res => {
1741 1725 if (res.data.code == 0) {
1742 1726 var ord_prom = res.data.data;
1743   - //如果订单没有勾选使用优惠券不参与此活动,或者没有用优惠券
1744   - if(!ord_prom.is_xz_yh || quan_price<=0) {
1745   - order_prom_id = ord_prom['id'];
1746   - switch (ord_prom['type']) {
1747   - case 0:
1748   - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
1749   - order_prom_amount = (o_condition - order_m).toFixed(2);
1750   - break;
1751   - case 1:
1752   - //order_m = o_condition - ord_prom['expression'];//满额优惠金额
1753   - order_prom_amount = ord_prom['expression'];
1754   - break;
1755   - }
  1727 + order_prom_id = ord_prom['id'];
  1728 + switch (ord_prom['type']) {
  1729 + case 0:
  1730 + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  1731 + order_prom_amount = (o_condition - order_m).toFixed(2);
  1732 + break;
  1733 + case 1:
  1734 + //order_m = o_condition - ord_prom['expression'];//满额优惠金额
  1735 + order_prom_amount = ord_prom['expression'];
  1736 + break;
1756 1737 }
1757 1738 }
1758 1739 })
... ... @@ -2098,20 +2079,16 @@ Page({
2098 2079 var order_prom_id = 0;
2099 2080 if (th.data.order_prom[th.data.bn_pick]) {
2100 2081 var ord_prom = th.data.order_prom[th.data.bn_pick];
2101   - //如果订单没有勾选使用优惠券不参与此活动
2102   - if(!ord_prom.is_xz_yh || quan_price<=0) {
2103   -
2104   - order_prom_id = ord_prom['id'];
2105   - switch (ord_prom['type']) {
2106   - case 0:
2107   - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
2108   - order_prom_amount = (o_condition - order_m).toFixed(2);
2109   - break;
2110   - case 1:
2111   - order_m = o_condition - ord_prom['expression'];//满额优惠金额
2112   - order_prom_amount = ord_prom['expression'];
2113   - break;
2114   - }
  2082 + order_prom_id = ord_prom['id'];
  2083 + switch (ord_prom['type']) {
  2084 + case 0:
  2085 + order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  2086 + order_prom_amount = (o_condition - order_m).toFixed(2);
  2087 + break;
  2088 + case 1:
  2089 + order_m = o_condition - ord_prom['expression'];//满额优惠金额
  2090 + order_prom_amount = ord_prom['expression'];
  2091 + break;
2115 2092 }
2116 2093 }
2117 2094 //--订单优惠的显示--
... ... @@ -2263,7 +2240,6 @@ Page({
2263 2240 var ff = true;
2264 2241 //------------立即购买-------------
2265 2242 if (th.data.is_b_now == 1 && th.data.bn_goods.prom_type != 5) {
2266   -
2267 2243 if (th.data.bn_exp_type == 0 && th.data.user_addr == null) {
2268 2244 ff = false;
2269 2245 getApp().my_warnning("请选择收货地址", 0, th);
... ... @@ -2300,7 +2276,7 @@ Page({
2300 2276 'user_money': th.data.formData.user_money, //使用余额
2301 2277 'total_amount': th.data.formData.total_amount, //订单总价
2302 2278 'order_amount': th.data.formData.order_amount, //应付
2303   - 'user_note': th.data.user_note, //用户备注
  2279 + 'user_note': th.data.user_note['0']?th.data.user_note['0']:0, //用户备注
2304 2280 'store_id': oo.stoid, //商家
2305 2281 'pickup_id': th.data.bn_pick, //门店
2306 2282 'exp_type': th.data.bn_exp_type, //配送方式
... ... @@ -2483,11 +2459,21 @@ Page({
2483 2459 'gift_id': gift_gg.gift_id,
2484 2460 'prom_id': gift_gg.prom_id,
2485 2461 };
  2462 + //-- 把导购的信息填入--
  2463 + if (gg.guide_id) {
  2464 + g_goods.guide_id = gg.guide_id;
  2465 + g_goods.guide_type = gg.guide_type;
  2466 + //调用接口判断是不是会员
  2467 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + gg.guide_id, {}).then(res => {
  2468 + if (res.data.code == 0) {
  2469 + g_goods.guide_name = is_vip.salesman;
  2470 + g_goods.guide_sn = is_vip.salesman_no;
  2471 + }
  2472 + })
  2473 + }
2486 2474 item.order_goods.push(g_goods);
2487 2475 }
2488 2476 pdata.push(item);
2489   -
2490   - console.log(pdata);
2491 2477 } else {
2492 2478 //---------购物车的结算---------
2493 2479 if (th.data.is_all_zt == 0 && th.data.user_addr == null) {
... ... @@ -2549,7 +2535,6 @@ Page({
2549 2535 if (t_item.coupon_price) {
2550 2536 item.coupon_price = t_item.coupon_price;
2551 2537 item.coupon_no = th.data.using_quan[t_item.pickup_id].coupon_no;
2552   - t_item.quan_no=item.coupon_no;
2553 2538 } else if (t_item.quan_no) {
2554 2539 item.coupon_no = t_item.quan_no;
2555 2540 item.coupon_price = 0;
... ... @@ -2618,16 +2603,15 @@ Page({
2618 2603  
2619 2604 //房间号的ids
2620 2605 var room_ids = "";
2621   - //-- 把券的钱,写入从表 ---
2622   - if (t_item.quan_youhui_list && t_item.coupon_price) {
2623 2606  
  2607 + //-- 把券的钱,写入从表 ---
  2608 + if (t_item.quan_youhui_list && t_item.coupon_price) {
2624 2609 for (var kk in t_item.quan_youhui_list) {
2625 2610 var you_item = t_item.quan_youhui_list[kk];
2626 2611 //-- 对券的价格进行平摊 --
2627 2612 await th.split_set_goods_quanprice(you_item,t_item);
2628 2613 }
2629 2614 }
2630   -
2631 2615 //-------------让商品添加到商品列表--------------------
2632 2616 for (var k = 0; k < t_item.goods.length; k++) {
2633 2617 var g_item = t_item.goods[k];
... ... @@ -2650,7 +2634,6 @@ Page({
2650 2634 goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
2651 2635 goods.pricing_type = g_item.pricing_type;
2652 2636 }
2653   -
2654 2637 if(g_item.quan_num){
2655 2638 goods.quan_num=g_item.quan_num;
2656 2639 goods.quan_no=g_item.quan_no;
... ... @@ -2753,8 +2736,6 @@ Page({
2753 2736 'content-type': 'application/json'
2754 2737 },// 设置请求的 header
2755 2738 success: function (res) {
2756   -
2757   -
2758 2739 wx.hideLoading();
2759 2740 if (res.statusCode == 200) {
2760 2741 var data = res.data;
... ... @@ -3603,7 +3584,6 @@ Page({
3603 3584 if (th.data.is_b_now == 1) {
3604 3585 th.setData({index: m_wind, is_express: m_wind});
3605 3586 } else {
3606   - clearInterval(ui);
3607 3587 var ui = setInterval(function () {
3608 3588 if (th.data.cartlist) {
3609 3589 var c_arr = th.data.cartlist;
... ... @@ -3720,17 +3700,15 @@ Page({
3720 3700 check_quan_ware_list = encodeURIComponent(gd['erpwareid']);
3721 3701 }---*/
3722 3702 }
3723   -
3724 3703 //优惠券优惠的金额要控制到优惠券的选择条件
3725 3704 var cut_price = 0;
3726 3705 for (var i in th.data.prom_goods_map[pickup_id]) {
3727 3706 var obj = th.data.prom_goods_map[pickup_id][i];
3728   - if (obj.coupon_sele && obj.prom_price) {
  3707 + if (obj.coupon_sele) {
3729 3708 cut_price += obj.price - obj.prom_price;
3730 3709 }
3731 3710 }
3732 3711  
3733   - //阶梯优惠使用券
3734 3712 var prom_pt_json= ep.prom_pt_json;
3735 3713 if(prom_pt_json){
3736 3714 for(let oj in prom_pt_json){
... ... @@ -3765,7 +3743,7 @@ Page({
3765 3743 data: {
3766 3744 storeId: oo.stoid,
3767 3745 userId: app.globalData.user_id,
3768   - BuySum: parseFloat(arr[ind].ckeck_quan_price?arr[ind].ckeck_quan_price:0).toFixed(2),
  3746 + BuySum: arr[ind].ckeck_quan_price,
3769 3747 WareIds: check_quan_ware_list,
3770 3748 pageSize: 100
3771 3749 }
... ... @@ -3814,7 +3792,7 @@ Page({
3814 3792 data: {
3815 3793 storeId: oo.stoid,
3816 3794 userId: app.globalData.user_id,
3817   - BuySum: parseFloat(th.data.ckeck_quan_price?th.data.ckeck_quan_price:0).toFixed(2),
  3795 + BuySum: th.data.ckeck_quan_price,
3818 3796 WareIds: encodeURIComponent(th.data.check_quan_ware_list),
3819 3797 pageSize: 100
3820 3798 },
... ... @@ -3992,6 +3970,7 @@ Page({
3992 3970 var goods_weight = -1, goods_piece = -1;
3993 3971 var gift_shipping_price = 0;
3994 3972 var th = this;
  3973 + var out_of_weight=null;
3995 3974 switch (good['exp_sum_type']) {
3996 3975 case 1:
3997 3976 //统一运费
... ... @@ -4003,8 +3982,9 @@ Page({
4003 3982 //累积商品重量 每种商品的重量 * 数量
4004 3983 goods_weight += good['weight'] * good['buynum'];
4005 3984 if (goods_weight1 > 0) {
  3985 + out_of_weight = gift_weight_free - goods_weight;
  3986 + //不能调换位置 下面goods_weight会变大
4006 3987 goods_weight += goods_weight1;
4007   - out_of_weight = (gift_weight_free*1000) - goods_weight;
4008 3988 }
4009 3989 break;
4010 3990 case 3:
... ... @@ -4172,9 +4152,8 @@ Page({
4172 4152 getApp().goto(url);
4173 4153 },
4174 4154  
4175   - //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表
4176   - split_set_goods_quanprice:async function (you_item,t_item) {
4177   -
  4155 + //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表
  4156 + split_set_goods_quanprice:async function (you_item,t_item) {
4178 4157 var coupon_price=you_item.WareCashSum;
4179 4158 var goods=t_item.goods;
4180 4159 var arr=[];
... ...
pages/cart/cart2/cart2.wxml
... ... @@ -375,13 +375,13 @@
375 375 </view>
376 376 </view>
377 377 <!-- 留言 -->
378   -<!-- <view class="coupon-mes flex-vertical">-->
379   -<!-- <view>留言</view>-->
380   -<!-- <view class="leave-word">-->
381   -<!-- <input placeholder-class="fs28" placeholder='给商家留言,最多100字' bindinput="keyUpChangeNum" disabled="{{disabled}}"-->
382   -<!-- class="word-box" maxlength="100" name="user_note"></input>-->
383   -<!-- </view>-->
384   -<!-- </view>-->
  378 + <view class="coupon-mes flex-vertical">
  379 + <view>留言</view>
  380 + <view class="leave-word">
  381 + <input placeholder-class="fs28" placeholder='给商家留言,最多100字' data-index="{{index}}" bindinput="keyUpChangeNum"
  382 + class="word-box" maxlength="100" name="user_note"></input>
  383 + </view>
  384 + </view>
385 385  
386 386 <!-- 是否参与店铺优惠 -->
387 387 <view class="coupon-mes flex-vertical" bindtap="bn_pop_offline" wx:if="{{bn_goods.offline_price}}">
... ...