Commit a572bd1dc89cccdc88987c3a8bbe5c261db9c97d

Authored by season
2 parents ca1236c0 d920adcd

Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp

components/add_purchase/add_purchase.js
... ... @@ -2912,7 +2912,7 @@ Component({
2912 2912 },
2913 2913  
2914 2914 //---加入购物车的最后一步---
2915   - add_cart_next(e, t, a, o, newd, CanOutQty) {
  2915 + async add_cart_next(e, t, a, o, newd, CanOutQty) {
2916 2916  
2917 2917  
2918 2918 if (getApp().globalData.groupchat_id) {
... ... @@ -2953,6 +2953,31 @@ Component({
2953 2953 newd.prom_type = 0;
2954 2954 newd.prom_id = 0;
2955 2955 }
  2956 + if(newd.prom_type==0){
  2957 + //-- 要拿一下商品有没有组合购活动 ---
  2958 + var rq_url = '/api/weshop/activitylist/listGoodActInfo2New';
  2959 + var req_d = {
  2960 + "store_id": os.stoid,
  2961 + "goods_id": a,
  2962 + "user_id": getApp().globalData.user_id,
  2963 + }
  2964 +
  2965 + var ck_res= await getApp().request.promiseGet(rq_url, {
  2966 + data: req_d,
  2967 + });
  2968 +
  2969 + if (ck_res.data.code == 0 && ck_res.data.data && ck_res.data.data.length > 0) {
  2970 + var arr = ck_res.data.data;
  2971 + var arr3 = arr.filter(function (e) {
  2972 + return e.s_time < ut.gettimestamp() && e.prom_type == 7;
  2973 + })
  2974 +
  2975 + if (arr3 && arr3.length > 0) {
  2976 + newd.zh_prom_id=arr3[0].act_id;
  2977 + }
  2978 + }
  2979 + }
  2980 +
2956 2981  
2957 2982 wxlog.info(getApp().globalData.user_id + '-加入购物车:' + JSON.stringify(newd));
2958 2983 //
... ... @@ -2985,20 +3010,11 @@ Component({
2985 3010 var item = null;
2986 3011 //-------如果购物车中有相关的数据---------
2987 3012 if (re.data.data.total > 0) {
2988   - for (var j = 0; j < re.data.data.pageData.length; j++) {
2989   - if (!th.check_is_like(re.data.data.pageData[j], newd, 1)) continue;
2990   - item = re.data.data.pageData[j];
2991   - break;
2992   - }
2993   -
2994   - if (!item) {
2995 3013 for (var j = 0; j < re.data.data.pageData.length; j++) {
2996 3014 if (!th.check_is_like(re.data.data.pageData[j], newd)) continue;
2997 3015 item = re.data.data.pageData[j];
2998 3016 break;
2999 3017 }
3000   - }
3001   -
3002 3018 }
3003 3019  
3004 3020 if (item) {
... ... @@ -3040,47 +3056,27 @@ Component({
3040 3056 }
3041 3057 }
3042 3058  
3043   - var updata = {
3044   - id: item.id,
3045   - goods_num: e.data.goodsInputNum + item.goods_num,
3046   - goods_price: newd.goods_price,
3047   - member_goods_price: newd.goods_price,
3048   - store_id: th.data.stoid,
3049   - prom_id: newd.prom_id, //把活动id带上去(用于购物车失效变成有效商品)
3050   - prom_type: newd.prom_type
3051   - };
  3059 + if(newd.zh_prom_id>0 && item.zh_prom_id && newd.zh_prom_id!=item.zh_prom_id){
  3060 + wx.hideLoading();
  3061 + wx.showModal({
  3062 + title: '温馨提示',
  3063 + content: '当前商品已在购物车,是否替换参与该活动?',
  3064 + success(res) {
  3065 + if (res.confirm) {
  3066 + wx.showLoading();
  3067 + th.add_cart_next2(e,item,newd);
  3068 + }else{
  3069 + th.data.adding = 0;
  3070 + }
  3071 + }
  3072 + })
3052 3073  
3053   - if (newd.is_pd_normal) {
3054   - updata.is_pd_normal = 1
  3074 + }else{
  3075 + th. add_cart_next2(e,item,newd);
3055 3076 }
3056 3077  
3057   - //---是不是从收藏夹出来的---
3058   - if (th.data.c_guide_id) {
3059   - updata['guide_id'] = th.data.c_guide_id;
3060   - updata['guide_type'] = 3; //加入购物车之后就变成了3
3061   - } else {
3062   - if (getApp().globalData.guide_id) {
3063   - updata['guide_id'] = getApp().globalData.guide_id;
3064   - updata['guide_type'] = 0;
3065   - }
3066   - }
3067   - if (getApp().globalData.groupchat_id) {
3068   - updata['groupchat_id'] = getApp().globalData.groupchat_id;
3069   - }
3070 3078  
3071   - getApp().request.put("/api/weshop/cart/update", {
3072   - data: updata,
3073   - success: function (t) {
3074   - wx.hideLoading();
3075   - th.data.adding = 0;
3076   - getApp().my_warnning('加入购物车成功', 1, th, 450);
3077   - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
3078   - th.setData({
3079   - cartGoodsNum: c_num
3080   - });
3081   - th.closeSpecModal();
3082   - }
3083   - });
  3079 +
3084 3080 } else {
3085 3081 getApp().request.post("/api/weshop/cart/save", {
3086 3082 data: newd,
... ... @@ -3108,6 +3104,57 @@ Component({
3108 3104 }
3109 3105 },
3110 3106  
  3107 +
  3108 + add_cart_next2(e,item,newd){
  3109 + let th=this;
  3110 + var updata = {
  3111 + id: item.id,
  3112 + goods_num: e.data.goodsInputNum + item.goods_num,
  3113 + goods_price: newd.goods_price,
  3114 + member_goods_price: newd.goods_price,
  3115 + store_id: th.data.stoid,
  3116 + prom_id: newd.prom_id, //把活动id带上去(用于购物车失效变成有效商品)
  3117 + prom_type: newd.prom_type
  3118 + };
  3119 +
  3120 + if (newd.is_pd_normal) {
  3121 + updata.is_pd_normal = 1
  3122 + }
  3123 +
  3124 + if (newd.zh_prom_id) {
  3125 + updata.zh_prom_id = newd.zh_prom_id
  3126 + }
  3127 +
  3128 + //---是不是从收藏夹出来的---
  3129 + if (th.data.c_guide_id) {
  3130 + updata['guide_id'] = th.data.c_guide_id;
  3131 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  3132 + } else {
  3133 + if (getApp().globalData.guide_id) {
  3134 + updata['guide_id'] = getApp().globalData.guide_id;
  3135 + updata['guide_type'] = 0;
  3136 + }
  3137 + }
  3138 + if (getApp().globalData.groupchat_id) {
  3139 + updata['groupchat_id'] = getApp().globalData.groupchat_id;
  3140 + }
  3141 +
  3142 + getApp().request.put("/api/weshop/cart/update", {
  3143 + data: updata,
  3144 + success: function (t) {
  3145 + wx.hideLoading();
  3146 + th.data.adding = 0;
  3147 + getApp().my_warnning('加入购物车成功', 1, th, 450);
  3148 + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
  3149 + th.setData({
  3150 + cartGoodsNum: c_num
  3151 + });
  3152 + th.closeSpecModal();
  3153 + }
  3154 + });
  3155 +
  3156 + },
  3157 +
3111 3158 //-------------获取购买数量的总函数----------------
3112 3159 get_buy_num: function (gd, func) {
3113 3160 var map = this.data.g_buy_num,
... ...
components/diy_goodsGroup/diy_goodsGroup.js
... ... @@ -449,18 +449,26 @@ Component({
449 449  
450 450 item.prom_type = 0;
451 451 item.prom_id = 0;
452   - var url = "/api/weshop/activitylist/getGoodActInfo";
  452 + var url = "/api/weshop/activitylist/listGoodActInfo2New";
453 453 var req_data = {
454   - store_id: os.stoid, goodsidlist: val.goods_id, is_detail: 1, user_id: user_id
  454 + store_id: os.stoid, goods_id: val.goods_id, user_id: user_id
455 455 };
456 456  
457 457 item.prom_type = 0;
458 458 item.prom_id = 0;
459 459 //获取商品的实际活动
460   - await getApp().request.promiseGet(url, { data: req_data }).then(res => {
461   - if (res.data.code == 0 && res.data.data && res.data.data.length == 1) {
462   - item.prom_type = res.data.data[0].prom_type;
463   - item.prom_id = res.data.data[0].act_id;
  460 + await getApp().request.promiseGet(url, { data: req_data }).then(ck_res => {
  461 + if (ck_res.data.code == 0 && ck_res.data.data && ck_res.data.data.length > 0) {
  462 +
  463 + var arr = ck_res.data.data;
  464 + //-- 预热也要计算 --
  465 + var arr2 = arr.filter(function (e) {
  466 + return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
  467 + })
  468 + if (arr2.length == 1) {
  469 + item.prom_type = arr2[0].prom_type;
  470 + item.prom_id = arr2[0].act_id;
  471 + }
464 472 }
465 473 })
466 474  
... ...
packageB/pages/zuhegou/index/index.js
... ... @@ -41,6 +41,7 @@ Page({
41 41 sales_map: {}, //线下销售的map
42 42 fxShow:false,//分享是否显示
43 43 },
  44 +
44 45  
45 46 /**
46 47 * 生命周期函数--监听页面加载
... ... @@ -1739,6 +1740,7 @@ Page({
1739 1740  
1740 1741 newd.prom_type = 7;
1741 1742 newd.prom_id = th.data.act.id;
  1743 + newd.zh_prom_id = th.data.act.id;
1742 1744  
1743 1745 if (th.data.adding) return false;
1744 1746 th.data.adding = 1;
... ... @@ -1767,7 +1769,8 @@ Page({
1767 1769 goods_price: newd.goods_price,
1768 1770 member_goods_price: newd.goods_price,
1769 1771 store_id: os.stoid,
1770   - state: 0
  1772 + state: 0,
  1773 + zh_prom_id:th.data.act.id
1771 1774 };
1772 1775 if (th.data.s_cart_num) {
1773 1776 updata.goods_num = th.data.s_cart_num;
... ... @@ -2509,13 +2512,6 @@ Page({
2509 2512 }
2510 2513  
2511 2514 var th = this;
2512   - var index = th.data.sele_index;
2513   - var txt = "list[" + index + "].haveAdded";
2514   - var txt1 = "list[" + index + "].num";
2515   - var txt2 = "list[" + index + "].showNum";
2516   - var txt3 = "list[" + index + "].cart_id";
2517   - var txt4 = "list[" + index + "].current_price";
2518   - var txt5 = "list[" + index + "].cart_num";
2519 2515  
2520 2516 //----先看会员在购物车中是否加入了该商品-----
2521 2517 getApp().request.get("/api/weshop/cart/page", {
... ... @@ -2527,102 +2523,140 @@ Page({
2527 2523 },
2528 2524 success: function (re) {
2529 2525 if (re.data.data.total > 0) {
2530   - var item = re.data.data.pageData[0];
2531   - th.get_buy_num(th.data.sele_g, function () {
2532   - //当前的价格要更新进去
2533   - var cur_price = th.data.sele_g.shop_price;
2534   - if (th.data.card_field && th.data.sele_g[th.data.card_field]) {
2535   - cur_price = th.data.sele_g[th.data.card_field];
  2526 +
  2527 + //var item = re.data.data.pageData[0];
  2528 + var item=re.data.data.pageData.find(function (e){
  2529 + return [0,3,5,7,10].includes(parseInt(e.prom_type)) && e.is_gift==0;
  2530 + })
  2531 + //购物车中未找到相应的商品
  2532 + if(!item){ func(); return false;}
  2533 + //购物车中zh_prom_id为0或者和本次活动的id一致
  2534 + if(item.zh_prom_id<=0 || item.zh_prom_id==th.data.act.id){
  2535 + th.check_is_in_cart_next(item); return false;
2536 2536 }
2537 2537  
2538   - var prom_buybum = 0;
2539   - var gd_buynum = 0;
2540   - //加入也要控制一下限购
2541   - var check_obj = th.data.g_buy_num.get(th.data.sele_g.goods_id);
2542   - if (check_obj.gd_buynum && check_obj.gd_buynum > 0) gd_buynum = check_obj.gd_buynum;
2543   - if (check_obj.prom_buybum && check_obj.prom_buybum > 0) prom_buybum = check_obj.prom_buybum;
2544   -
2545   - if (check_obj) {
2546   - if (check_obj.prom_buybum && check_obj.prom_buybum >= th.data.sele_g.buyqty &&
2547   - th.data.sele_g.buyqty > 0
2548   - ) {
2549   - wx.showToast({
2550   - title: "您的已购数量超出活动的限购",
2551   - icon: 'none',
2552   - duration: 2000
2553   - });
2554   - return false;
2555   - }
2556   - if (check_obj.gd_buynum && check_obj.gd_buynum >= th.data.sele_g.viplimited &&
2557   - th.data.sele_g.viplimited > 0
2558   - ) {
2559   - wx.showToast({
2560   - title: "您的已购数量超出商品的限购",
2561   - icon: 'none',
2562   - duration: 2000
2563   - });
2564   - return false;
  2538 + wx.showModal({
  2539 + title: '温馨提示',
  2540 + content: '当前商品已在购物车,是否替换参与该活动?',
  2541 + success(res) {
  2542 + if (res.confirm) {
  2543 + th.check_is_in_cart_next(item);
2565 2544 }
2566 2545 }
  2546 + })
2567 2547  
2568   - item.cbuy = 'no';
2569   - var cbuy = th.data.sele_g.viplimited > 0 ? th.data.sele_g.viplimited - gd_buynum : 'no';
2570   - if (cbuy != 'no') item.cbuy = cbuy;
2571   - var cbuy2 = th.data.sele_g.buyqty > 0 ? th.data.sele_g.buyqty - prom_buybum : 'no';
2572   - if (cbuy2 != 'no') {
2573   - if (item.cbuy == 'no' || item.cbuy > cbuy2) item.cbuy = cbuy2;
2574   - }
2575 2548  
2576   - var num = item.goods_num;
  2549 + } else {
  2550 + func();
  2551 + }
  2552 + }
  2553 + })
  2554 + },
2577 2555  
2578   - var is_num_change = 0;
2579   - if (num < th.data.goodsInputNum) {
2580   - num = th.data.goodsInputNum;
2581   - is_num_change = 1;
2582   - }
  2556 + check_is_in_cart_next(item){
  2557 + let th=this;
2583 2558  
2584   - if (item.cbuy > -1 && item.cbuy < item.goods_num) {
2585   - num = item.cbuy;
2586   - }
2587   - th.setData({
2588   - [txt1]: num,
2589   - [txt2]: true,
2590   - [txt]: true,
2591   - [txt3]: item.id,
2592   - [txt4]: cur_price,
2593   - [txt5]: item.goods_num,
2594   - });
  2559 + var index = th.data.sele_index;
  2560 + var txt = "list[" + index + "].haveAdded";
  2561 + var txt1 = "list[" + index + "].num";
  2562 + var txt2 = "list[" + index + "].showNum";
  2563 + var txt3 = "list[" + index + "].cart_id";
  2564 + var txt4 = "list[" + index + "].current_price";
  2565 + var txt5 = "list[" + index + "].cart_num";
2595 2566  
2596   - var updata = {
2597   - id: item.id,
2598   - prom_type: 7,
2599   - goods_price: cur_price,
2600   - prom_id: th.data.act.id,
2601   - store_id: os.stoid,
2602   - state: 0
2603   - };
2604   - if (getApp().globalData.guide_id) {
2605   - updata['guide_id'] = getApp().globalData.guide_id;
2606   - updata['guide_type'] = 0;
2607   - }
2608   - if (is_num_change) {
2609   - updata['goods_num'] = num;
2610   - }
2611 2567  
2612   - getApp().request.put("/api/weshop/cart/update", {
2613   - data: updata,
2614   - success: function (t) { }
2615   - });
2616   - th.re_sum_price();
2617   - })
  2568 + th.get_buy_num(th.data.sele_g, function () {
  2569 + //当前的价格要更新进去
  2570 + var cur_price = th.data.sele_g.shop_price;
  2571 + if (th.data.card_field && th.data.sele_g[th.data.card_field]) {
  2572 + cur_price = th.data.sele_g[th.data.card_field];
  2573 + }
2618 2574  
2619   - } else {
2620   - func();
  2575 + var prom_buybum = 0;
  2576 + var gd_buynum = 0;
  2577 + //加入也要控制一下限购
  2578 + var check_obj = th.data.g_buy_num.get(th.data.sele_g.goods_id);
  2579 + if (check_obj.gd_buynum && check_obj.gd_buynum > 0) gd_buynum = check_obj.gd_buynum;
  2580 + if (check_obj.prom_buybum && check_obj.prom_buybum > 0) prom_buybum = check_obj.prom_buybum;
  2581 +
  2582 + if (check_obj) {
  2583 + if (check_obj.prom_buybum && check_obj.prom_buybum >= th.data.sele_g.buyqty &&
  2584 + th.data.sele_g.buyqty > 0
  2585 + ) {
  2586 + wx.showToast({
  2587 + title: "您的已购数量超出活动的限购",
  2588 + icon: 'none',
  2589 + duration: 2000
  2590 + });
  2591 + return false;
  2592 + }
  2593 + if (check_obj.gd_buynum && check_obj.gd_buynum >= th.data.sele_g.viplimited &&
  2594 + th.data.sele_g.viplimited > 0
  2595 + ) {
  2596 + wx.showToast({
  2597 + title: "您的已购数量超出商品的限购",
  2598 + icon: 'none',
  2599 + duration: 2000
  2600 + });
  2601 + return false;
2621 2602 }
2622 2603 }
  2604 +
  2605 + item.cbuy = 'no';
  2606 + var cbuy = th.data.sele_g.viplimited > 0 ? th.data.sele_g.viplimited - gd_buynum : 'no';
  2607 + if (cbuy != 'no') item.cbuy = cbuy;
  2608 + var cbuy2 = th.data.sele_g.buyqty > 0 ? th.data.sele_g.buyqty - prom_buybum : 'no';
  2609 + if (cbuy2 != 'no') {
  2610 + if (item.cbuy == 'no' || item.cbuy > cbuy2) item.cbuy = cbuy2;
  2611 + }
  2612 +
  2613 + var num = item.goods_num;
  2614 +
  2615 + var is_num_change = 0;
  2616 + if (num < th.data.goodsInputNum) {
  2617 + num = th.data.goodsInputNum;
  2618 + is_num_change = 1;
  2619 + }
  2620 +
  2621 + if (item.cbuy > -1 && item.cbuy < item.goods_num) {
  2622 + num = item.cbuy;
  2623 + }
  2624 + th.setData({
  2625 + [txt1]: num,
  2626 + [txt2]: true,
  2627 + [txt]: true,
  2628 + [txt3]: item.id,
  2629 + [txt4]: cur_price,
  2630 + [txt5]: item.goods_num,
  2631 + });
  2632 +
  2633 + var updata = {
  2634 + id: item.id,
  2635 + prom_type: 7,
  2636 + goods_price: cur_price,
  2637 + prom_id: th.data.act.id,
  2638 + store_id: os.stoid,
  2639 + state: 0,
  2640 + zh_prom_id: th.data.act.id,
  2641 + };
  2642 + if (getApp().globalData.guide_id) {
  2643 + updata['guide_id'] = getApp().globalData.guide_id;
  2644 + updata['guide_type'] = 0;
  2645 + }
  2646 + if (is_num_change) {
  2647 + updata['goods_num'] = num;
  2648 + }
  2649 +
  2650 + getApp().request.put("/api/weshop/cart/update", {
  2651 + data: updata,
  2652 + success: function (t) { }
  2653 + });
  2654 + th.re_sum_price();
2623 2655 })
  2656 +
2624 2657 },
2625 2658  
  2659 +
2626 2660 //-- 计算统计之后的金额 --
2627 2661 re_sum_price: function () {
2628 2662 var all_num = 0; //商品数量之和
... ... @@ -2834,19 +2868,30 @@ Page({
2834 2868 store_id: os.stoid,
2835 2869 pageSize: 600,
2836 2870 state: 0,
2837   - prom_type: 7,
2838   - prom_id: this.data.act.id
2839 2871 };
2840 2872 //获取购物车列表
2841 2873 getApp().request.get("/api/weshop/cart/list", {
2842 2874 data: req,
2843 2875 success: async function (e) {
2844 2876 if (ut.ajax_ok(e)) {
  2877 + var mlist=e.data.data.pageData.filter(function (e){
  2878 + return e.zh_prom_id==th.data.act.id || (e.prom_type==7 && e.prom_id==th.data.act.id)
  2879 + })
  2880 +
  2881 + if(!mlist || mlist.length==0){
  2882 + return false;
  2883 + }
2845 2884 var map = {};
2846   - var mlist = e.data.data.pageData;
  2885 + //var mlist = e.data.data.pageData;
2847 2886 th.data.cart_list = mlist;
2848 2887 for (let i in mlist) {
2849 2888 let item = mlist[i];
  2889 +
  2890 + if(item.zh_prom_id && item.prom_type==0 ){
  2891 + item.prom_type=7;
  2892 + item.prom_id=th.data.act.id
  2893 + }
  2894 +
2850 2895 if (item.prom_type != 7) continue;
2851 2896 if (item.prom_id != th.data.act.id) continue;
2852 2897 if (th.data.def_pick_store && th.data.def_pick_store.pickup_id) {
... ...
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
... ... @@ -946,13 +946,15 @@ Page({
946 946  
947 947 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
948 948  
949   - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
950   - if (goods_weight < 0) goods_weight = 0;
951   - goods_weight += item['weight'] * item['buynum'];
952   - cut_good_weight += item['weight'] * item['buynum'];
953   - }
954   - if (back_data.weight_free > 0) {
955   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  949 + if(back_data.weight_free* 1000<item['weight'] * item['buynum']) {
  950 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  951 + if (goods_weight < 0) goods_weight = 0;
  952 + goods_weight += item['weight'] * item['buynum'];
  953 + cut_good_weight += item['weight'] * item['buynum'];
  954 + }
  955 + if (back_data.weight_free > 0) {
  956 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  957 + }
956 958 }
957 959 continue;
958 960 }
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -2598,13 +2598,15 @@ Page({
2598 2598  
2599 2599 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
2600 2600  
2601   - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
2602   - if (goods_weight < 0) goods_weight = 0;
2603   - goods_weight += item['weight'] * item['buynum'];
2604   - cut_good_weight += item['weight'] * item['buynum'];
2605   - }
2606   - if (back_data.weight_free > 0) {
2607   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  2601 + if(back_data.weight_free* 1000<item['weight'] * item['buynum']) {
  2602 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  2603 + if (goods_weight < 0) goods_weight = 0;
  2604 + goods_weight += item['weight'] * item['buynum'];
  2605 + cut_good_weight += item['weight'] * item['buynum'];
  2606 + }
  2607 + if (back_data.weight_free > 0) {
  2608 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  2609 + }
2608 2610 }
2609 2611 continue;
2610 2612 }
... ...
packageC/pages/presell/cart/cart.wxml
... ... @@ -527,7 +527,7 @@
527 527 </view>
528 528 </view>
529 529 <!-- 打开是说明 -->
530   - <include src="remark_part.wxml"/>
  530 + <include src="remark_part_qj.wxml"/>
531 531 </view>
532 532 <!-- 包邮券的显示,立即购买 -->
533 533 <block wx:if="{{exp_type==0}}">
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -1019,14 +1019,16 @@ Page({
1019 1019  
1020 1020 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
1021 1021  
1022   - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
1023   - if (goods_weight < 0) goods_weight = 0;
1024   - cut_good_weight += item['weight'] * item['buynum'];
1025   - goods_weight += item['weight'] * item['buynum'];
  1022 + if(back_data.weight_free* 1000<item['weight'] * item['buynum']) {
  1023 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  1024 + if (goods_weight < 0) goods_weight = 0;
  1025 + cut_good_weight += item['weight'] * item['buynum'];
  1026 + goods_weight += item['weight'] * item['buynum'];
1026 1027  
1027   - }
1028   - if (back_data.weight_free > 0) {
1029   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  1028 + }
  1029 + if (back_data.weight_free > 0) {
  1030 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  1031 + }
1030 1032 }
1031 1033 continue;
1032 1034 }
... ...
packageC/pages/presell/cart/cart2.wxml
... ... @@ -356,7 +356,7 @@
356 356 </view>
357 357 </view>
358 358 <!-- 打开是说明 -->
359   - <include src="remark_part.wxml" />
  359 + <include src="remark_part_qj.wxml" />
360 360 </view>
361 361 <!-- 包邮券的显示,立即购买 -->
362 362 <block wx:if="{{bn_exp_type==0}}">
... ...
packageC/pages/presell/cart/remark_part_qj.wxml 0 → 100644
  1 +<view class="xc-buttom " wx:if="{{item.is_open==1}}" >
  2 + <view style="padding:10rpx">
  3 + <text class="five-level-word explain-coupon" wx:if="{{item.Remark}}">{{util.format(item.Remark)}}</text>
  4 + <text class="five-level-word explain-coupon" wx:else>
  5 + <block wx:if="{{item.UseObjectName}}">仅{{item.UseObjectName}}使用</block>
  6 + <block wx:else>全场通用</block>
  7 + </text>
  8 + <text class="five-level-word explain-coupon">取价规则:<block wx:if="{{item.FactPriceType>0}}">零售价</block><block wx:else="{{item.FactPriceType>0}}">实收价</block></text>
  9 + </view>
  10 +</view>
0 11 \ No newline at end of file
... ...
packageE/pages/cart/cart2/cart2.js
... ... @@ -1073,7 +1073,8 @@ Page({
1073 1073 goods_id: carr[iv].goods_id,
1074 1074 goods_num: 1,
1075 1075 is_limit_show: 0,
1076   - is_state: 0
  1076 + is_state: 0,
  1077 + zh_prom_id:item1.zh_prom_id
1077 1078 }
1078 1079 dug_cx_arr.push(gd_ite);
1079 1080 }
... ... @@ -3629,13 +3630,16 @@ Page({
3629 3630 if (back_data && back_data['is_by_all'] && item[j].is_post_temp
3630 3631 && (!back_data.no_free_goods || !th.ck_no_goods_arr(back_data.no_free_goods, item[j].goods_id))) {
3631 3632  
3632   - if (item[j]['exp_sum_type'] == 2 && back_data.weight_free > 0) {
3633   - if (goods_weight < 0) goods_weight = 0;
3634   - cut_good_weight += item[j]['weight'] * item[j]['goods_num'];
3635   - goods_weight += item[j]['weight'] * item[j]['goods_num'];
3636   - }
3637   - if (back_data.weight_free > 0) {
3638   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  3633 +
  3634 + if( back_data.weight_free* 1000<item[j]['weight'] * item[j]['goods_num']){
  3635 + if (item[j]['exp_sum_type'] == 2 && back_data.weight_free > 0 ) {
  3636 + if (goods_weight < 0) goods_weight = 0;
  3637 + cut_good_weight += item[j]['weight'] * item[j]['goods_num'];
  3638 + goods_weight += item[j]['weight'] * item[j]['goods_num'];
  3639 + }
  3640 + if (back_data.weight_free > 0) {
  3641 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  3642 + }
3639 3643 }
3640 3644 continue;
3641 3645  
... ... @@ -4393,14 +4397,16 @@ Page({
4393 4397  
4394 4398 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || !th.ck_no_goods_arr(back_data.no_free_goods, item.goods_id))) {
4395 4399  
4396   - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
4397   - if (goods_weight < 0) goods_weight = 0;
4398   - goods_weight += item['weight'] * item['buynum'];
4399   - cut_good_weight += item['weight'] * item['buynum'];
4400   - }
4401   - if (back_data.weight_free > 0) {
4402   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
4403   - }
  4400 + if(back_data.weight_free* 1000<item['weight'] * item['buynum']){
  4401 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  4402 + if (goods_weight < 0) goods_weight = 0;
  4403 + goods_weight += item['weight'] * item['buynum'];
  4404 + cut_good_weight += item['weight'] * item['buynum'];
  4405 + }
  4406 + if (back_data.weight_free > 0) {
  4407 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  4408 + }
  4409 + }
4404 4410 continue;
4405 4411  
4406 4412 }
... ... @@ -7215,6 +7221,8 @@ Page({
7215 7221 for (var ind in arr) {
7216 7222 var ep = arr[ind];
7217 7223  
  7224 + arr[ind].scj_arr=[]; //清空
  7225 +
7218 7226 //如果门店订单使用订单促销(此订单促销取价规则不是实收价的时候)
7219 7227 if (th.data.can_use_ord_prom[ep.pickup_id]) {
7220 7228 continue;
... ... @@ -9138,6 +9146,8 @@ Page({
9138 9146  
9139 9147 item.goods_num = 1;
9140 9148 item.goods_price = item.price;
  9149 + item.goods_market_price = gd.market_price;
  9150 +
9141 9151 item.prom_type = 5;
9142 9152 item.is_collocation = 1;
9143 9153 item.is_post_temp = 1;
... ...
packageE/pages/cart/cart2_inte/cart2_inte.js
... ... @@ -817,13 +817,15 @@ Page({
817 817  
818 818 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) {
819 819  
820   - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
821   - if (goods_weight < 0) goods_weight = 0;
822   - goods_weight += item['weight'] * item['buynum'];
823   - cut_good_weight += item['weight'] * item['buynum'];
824   - }
825   - if (back_data.weight_free > 0) {
826   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  820 + if(back_data.weight_free* 1000<item['weight'] * item['buynum']) {
  821 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  822 + if (goods_weight < 0) goods_weight = 0;
  823 + goods_weight += item['weight'] * item['buynum'];
  824 + cut_good_weight += item['weight'] * item['buynum'];
  825 + }
  826 + if (back_data.weight_free > 0) {
  827 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  828 + }
827 829 }
828 830 continue;
829 831 }
... ...
packageE/pages/cart/cart2_pt/cart2_pt.js
... ... @@ -992,14 +992,15 @@ Page({
992 992 let item = gd_arr_list[i];
993 993  
994 994 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
995   -
996   - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
997   - if (goods_weight < 0) goods_weight = 0;
998   - cut_good_weight += item['weight'] * item['buynum'];
999   - goods_weight += item['weight'] * item['buynum'];
1000   - }
1001   - if (back_data.weight_free > 0) {
1002   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  995 + if(back_data.weight_free* 1000<item['weight'] * item['buynum']) {
  996 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  997 + if (goods_weight < 0) goods_weight = 0;
  998 + cut_good_weight += item['weight'] * item['buynum'];
  999 + goods_weight += item['weight'] * item['buynum'];
  1000 + }
  1001 + if (back_data.weight_free > 0) {
  1002 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  1003 + }
1003 1004 }
1004 1005 continue;
1005 1006 }
... ...
packageE/pages/cart/cart_wk/cart_wk.js
... ... @@ -1003,14 +1003,15 @@ Page({
1003 1003 let item = gd_arr_list[i];
1004 1004  
1005 1005 if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
1006   -
1007   - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
1008   - if (goods_weight < 0) goods_weight = 0;
1009   - goods_weight += item['weight'] * item['buynum'];
1010   - cut_good_weight += item['weight'] * item['buynum'];
1011   - }
1012   - if (back_data.weight_free > 0) {
1013   - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  1006 + if(back_data.weight_free* 1000<item['weight'] * item['buynum']) {
  1007 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  1008 + if (goods_weight < 0) goods_weight = 0;
  1009 + goods_weight += item['weight'] * item['buynum'];
  1010 + cut_good_weight += item['weight'] * item['buynum'];
  1011 + }
  1012 + if (back_data.weight_free > 0) {
  1013 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  1014 + }
1014 1015 }
1015 1016 continue;
1016 1017 }
... ... @@ -1557,7 +1558,7 @@ Page({
1557 1558 pageSize: 100,
1558 1559 };
1559 1560  
1560   - if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){
  1561 + if(parseFloat(th.data.ckeck_quan_price)>=parseFloat(th.data.check_quan_price_scj)){
1561 1562 quan_rq.BuyPosSum=th.data.ckeck_quan_price;
1562 1563 quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list)
1563 1564 }
... ... @@ -2276,7 +2277,41 @@ Page({
2276 2277 }catch(error){
2277 2278  
2278 2279 }
2279   - }
  2280 + },
  2281 +
  2282 + //点击打开优惠券使用说明
  2283 + clik_coupons: function (e) {
  2284 + var ind = e.currentTarget.dataset.idx;
  2285 + var is_open = this.data.selected_quan_list[ind].is_open;
  2286 +
  2287 + if (is_open == 1) is_open = 0;
  2288 + else is_open = 1;
  2289 +
  2290 + var txt = "selected_quan_list[" + ind + "].is_open"
  2291 + var obj = {};
  2292 + obj[txt] = is_open;
  2293 +
  2294 + this.setData(obj);
  2295 + this.setData({ disabled: 1 })
  2296 + },
  2297 +
  2298 + clik_coupons3: function (e) {
  2299 + var ind = e.currentTarget.dataset.idx;
  2300 + var is_open = this.data.city_coupon_list[ind].is_open;
  2301 +
  2302 + if (is_open == 1) is_open = 0;
  2303 + else is_open = 1;
  2304 +
  2305 + var txt = "city_coupon_list[" + ind + "].is_open"
  2306 + var obj = {};
  2307 + obj[txt] = is_open;
  2308 +
  2309 + this.setData(obj);
  2310 + this.setData({ disabled: 1 })
  2311 + },
  2312 +
  2313 +
  2314 +
2280 2315  
2281 2316  
2282 2317  
... ...
packageE/pages/cart/cart_wk/cart_wk.wxml
1 1 <wxs module="filters" src="../../../../utils/filter.wxs"></wxs>
2 2 <wxs module="filter" src="../cart2/c_filter.wxs"></wxs>
  3 +<wxs src="../cart2/filter.wxs" module="util"></wxs>
3 4  
4 5 <!-- 先选择配送方式,2021.7修改 -->
5 6 <block wx:if="{{show_submit}}">
... ... @@ -292,7 +293,7 @@
292 293 </view>
293 294 </view>
294 295 <!-- 打开是说明 -->
295   - <include src="../cart2/remark_part.wxml" />
  296 + <include src="../cart2/remark_part_qj.wxml" />
296 297 </view>
297 298 <!-- 包邮券的显示,立即购买 -->
298 299 <block wx:if="{{get_by_quan_list && get_by_quan_list.length}}">
... ...
packageE/pages/user/cardinfo/cardinfo.js
... ... @@ -43,6 +43,9 @@ Page({
43 43 IsStopBuy:0, //卡是否停用
44 44 yu_e_show:0,//装入余额的弹窗
45 45 is_show_change_pop:0,
  46 +
  47 + is_xufei_setting:0,
  48 + xufei_setting_days:0,
46 49 },
47 50  
48 51 /**
... ... @@ -73,6 +76,10 @@ Page({
73 76 is_card_rule: is_cardrule,
74 77 plus_bg_color: swi_arr.plus_bg_color,
75 78 });
  79 +
  80 + th.data.is_xufei_setting=swi_arr.is_xufei_setting;
  81 + th.data.xufei_setting_days=swi_arr.xufei_setting_days;
  82 +
76 83 })
77 84  
78 85 //----------------------------获取最大的卡类-----------------------
... ... @@ -819,6 +826,27 @@ Page({
819 826 end_time=ut.format(end_time,'yyyy-MM-dd');
820 827 var errmsg="";
821 828  
  829 +
  830 + //如果有开始前多少天可续费
  831 + if(th.data.is_xufei_setting){
  832 +
  833 + var expiryDate=this.data.expiryDate;
  834 +
  835 + var str = expiryDate.replace(/-/g, '/');
  836 + var end = new Date(str);
  837 + end.setDate(end.getDate()- parseInt(th.data.xufei_setting_days) );
  838 + end = Date.parse(end) / 1000;
  839 +
  840 + var now=ut.gettimestamp();
  841 + if(now<end){
  842 + getApp().my_warnning("到期前"+th.data.xufei_setting_days+"天可续费!", 0, th);
  843 + return false;
  844 + }
  845 + }
  846 +
  847 +
  848 +
  849 +
822 850 //--商家是不是有等级卡功能,开通的人数是不是够用,开通是时间是不是到期--
823 851 await getApp().request.promiseGet("/api/weshop/plus/plus/card/register",
824 852 { data: { storeId: os.stoid,isRenewal:1,endData: end_time,userId:getApp().globalData.user_id} }).then(res => {
... ...
packageG/pages/user/order_detail/order_detail.js
... ... @@ -1792,6 +1792,15 @@ Page({
1792 1792 else if (arr2.length > 1) {
1793 1793 good.prom_type = g_item.prom_type; good.prom_id = g_item.prom_id;
1794 1794 }
  1795 +
  1796 + var arr3 = arr.filter(function (e) {
  1797 + return e.s_time < ut.gettimestamp() && e.prom_type == 7;
  1798 + })
  1799 +
  1800 + if (arr3 && arr3.length > 0) {
  1801 + b_item.zh_prom_id= arr3[0].act_id;
  1802 + }
  1803 +
1795 1804 }
1796 1805 })
1797 1806  
... ... @@ -2180,10 +2189,14 @@ Page({
2180 2189 }
2181 2190 },
2182 2191  
2183   - more_add_cart:async function(){
  2192 + more_add_cart:async function(){
  2193 + var th=this;
2184 2194 var back_goods_arr=this.data.back_goods_arr;
2185 2195 var err_text="";
2186 2196 var ok_num=0;
  2197 +
  2198 + var zh_prom_id_err=[];
  2199 + var zh_prom_id_err_goods=[];
2187 2200  
2188 2201 for(var i in back_goods_arr){
2189 2202 //商品ID
... ... @@ -2221,6 +2234,13 @@ Page({
2221 2234 newd['prom_type']=g_item.prom_type;
2222 2235 newd['prom_id']=g_item.prom_id;
2223 2236 }
  2237 +
  2238 +
  2239 + newd['zh_prom_id']=0;
  2240 +
  2241 + if(g_item.zh_prom_id){
  2242 + newd['zh_prom_id'] = g_item.zh_prom_id;
  2243 + }
2224 2244  
2225 2245  
2226 2246 var b_cart_goods=null;
... ... @@ -2271,7 +2291,20 @@ Page({
2271 2291 if(newd.guide_id){
2272 2292 updata.guide_id=newd.guide_id;
2273 2293 updata.guide_type=newd.guide_type;
2274   - }
  2294 + }
  2295 +
  2296 + if (newd.prom_type) {
  2297 + updata.prom_type = newd.prom_type;
  2298 + updata.prom_id = newd.prom_id;
  2299 + }
  2300 +
  2301 + //如果购物车中商品zh_prom_id不一致的话,要进行提示
  2302 + if(is_has.zh_prom_id>0 && is_has.zh_prom_id!= newd['zh_prom_id'] ){
  2303 + zh_prom_id_err.push(newd.goods_name+ '已在购物车\n');
  2304 + zh_prom_id_err_goods.push(updata);
  2305 + continue;
  2306 + }
  2307 +
2275 2308 await getApp().request.promisePut("/api/weshop/cart/update", {
2276 2309 data: updata
2277 2310 }).then(res=>{
... ... @@ -2297,34 +2330,90 @@ Page({
2297 2330  
2298 2331 wx.hideLoading();
2299 2332 this.data.moring=0;
2300   - if(ok_num==0){
2301   - //-- 如果没有获取用户信息 --
2302   - wx.showModal({
2303   - title:'提示',
2304   - content: err_text,
2305   - success(res) {}
2306   - });
2307   - }else{
2308   - if(err_text==""){
2309   - getApp().goto("/pages/cart/cart/cart");
2310   - }else{
2311   - // 如果没有获取用户信息
2312   - wx.showModal({
2313   - title:'提示',
2314   - content: err_text,
2315   - success(res) {
2316   - if (res.confirm) {
2317   - //跳转到登录页
2318   - getApp().goto("/pages/cart/cart/cart");
2319   - }
2320   - }
2321   - });
2322   -
2323   - }
2324   -
2325   - }
  2333 +
  2334 + if(zh_prom_id_err_goods && zh_prom_id_err_goods.length){
  2335 + if(err_text){
  2336 + err_text+="同时有以下商品:\n";
  2337 + }
  2338 + err_text+=zh_prom_id_err.join('');
  2339 + err_text+="是否替换参与该活动?"
  2340 +
  2341 + // 如果没有获取用户信息
  2342 + wx.showModal({
  2343 + title: '提示',
  2344 + content: err_text,
  2345 + success(res) {
  2346 + if (res.confirm) {
  2347 + //进行对有zh_prom_id 不一样的商品进行替换
  2348 + th.zhbuy_add_cart(zh_prom_id_err_goods)
  2349 + }
  2350 + }
  2351 + });
  2352 +
  2353 +
  2354 + }else {
  2355 +
  2356 + if (ok_num == 0) {
  2357 + //-- 如果没有获取用户信息 --
  2358 + wx.showModal({
  2359 + title: '提示',
  2360 + content: err_text,
  2361 + success(res) {
  2362 + }
  2363 + });
  2364 + } else {
  2365 + if (err_text == "") {
  2366 + getApp().goto("/pages/cart/cart/cart");
  2367 + } else {
  2368 + // 如果没有获取用户信息
  2369 + wx.showModal({
  2370 + title: '提示',
  2371 + content: err_text,
  2372 + success(res) {
  2373 + if (res.confirm) {
  2374 + //跳转到登录页
  2375 + getApp().goto("/pages/cart/cart/cart");
  2376 + }
  2377 + }
  2378 + });
  2379 +
  2380 + }
  2381 +
  2382 + }
  2383 + }
2326 2384 },
2327 2385  
  2386 + //-- 组合购的商品重新购买 --
  2387 + zhbuy_add_cart: async function (zh_prom_id_err_goods) {
  2388 + var err_text = "";
  2389 + for (var i in zh_prom_id_err_goods) {
  2390 + var updata=zh_prom_id_err_goods[i];
  2391 + await getApp().request.promisePut("/api/weshop/cart/update", {
  2392 + data: updata
  2393 + }).then(res => {
  2394 + if (res.data.code != 0) {
  2395 + err_text += newd.goods_name + "加入购物车失败\n";
  2396 + }
  2397 + })
  2398 + }
  2399 +
  2400 + if (err_text == "") {
  2401 + getApp().goto("/pages/cart/cart/cart");
  2402 + }else{
  2403 + // 如果没有获取用户信息
  2404 + wx.showModal({
  2405 + title: '提示',
  2406 + content: err_text,
  2407 + success(res) {
  2408 + if (res.confirm) {
  2409 + //跳转到登录页
  2410 + getApp().goto("/pages/cart/cart/cart");
  2411 + }
  2412 + }
  2413 + });
  2414 + }
  2415 + },
  2416 +
2328 2417 toast(msg){
2329 2418 wx.showToast({
2330 2419 title: msg,
... ...
pages/cart/cart/cart.js
... ... @@ -548,7 +548,8 @@ Page({
548 548 goods_id:carr[i].goods_id,
549 549 goods_num:1,
550 550 is_limit_show:0,
551   - is_state:0
  551 + is_state:0,
  552 + zh_prom_id:carr[i].zh_prom_id
552 553 }
553 554 g_arr.push(gd_ite);
554 555 }
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -2096,7 +2096,7 @@ Page({
2096 2096 },
2097 2097  
2098 2098 //---加入购物车的最后一步---
2099   - add_cart_next(e, t, a, o, newd, CanOutQty) {
  2099 + async add_cart_next(e, t, a, o, newd, CanOutQty) {
2100 2100  
2101 2101  
2102 2102 if (getApp().globalData.groupchat_id) {
... ... @@ -2138,6 +2138,32 @@ Page({
2138 2138 newd.prom_id=0;
2139 2139 }
2140 2140  
  2141 + if(newd.prom_type==0){
  2142 + //-- 要拿一下商品有没有组合购活动 ---
  2143 + var rq_url = '/api/weshop/activitylist/listGoodActInfo2New';
  2144 + var req_d = {
  2145 + "store_id": os.stoid,
  2146 + "goods_id": a,
  2147 + "user_id": getApp().globalData.user_id,
  2148 + }
  2149 +
  2150 + var ck_res= await getApp().request.promiseGet(rq_url, {
  2151 + data: req_d,
  2152 + });
  2153 +
  2154 + if (ck_res.data.code == 0 && ck_res.data.data && ck_res.data.data.length > 0) {
  2155 + var arr = ck_res.data.data;
  2156 + var arr3 = arr.filter(function (e) {
  2157 + return e.s_time < ut.gettimestamp() && e.prom_type == 7;
  2158 + })
  2159 +
  2160 + if (arr3 && arr3.length > 0) {
  2161 + newd.zh_prom_id=arr3[0].act_id;
  2162 + }
  2163 + }
  2164 + }
  2165 +
  2166 +
2141 2167 wxlog.info(getApp().globalData.user_id+'-加入购物车:'+JSON.stringify(newd));
2142 2168 //
2143 2169 // //如果有搭配购的时候的时候
... ... @@ -2159,8 +2185,6 @@ Page({
2159 2185 user_id: oo.user_id,
2160 2186 goods_id: a,
2161 2187 pick_id: e.data.sto_sele_id,
2162   - prom_type: newd.prom_type,
2163   - prom_id: newd.prom_id,
2164 2188 state: 0,
2165 2189 },
2166 2190 success: function (re) {
... ... @@ -2169,24 +2193,15 @@ Page({
2169 2193 var item = null;
2170 2194 //-------如果购物车中有相关的数据---------
2171 2195 if (re.data.data.total > 0) {
2172   - for (var j = 0; j < re.data.data.pageData.length; j++) {
2173   - if (!th.check_is_like(re.data.data.pageData[j], newd, 1)) continue;
2174   - item = re.data.data.pageData[j];
2175   - break;
2176   - }
2177   -
2178   - if (!item) {
2179 2196 for (var j = 0; j < re.data.data.pageData.length; j++) {
2180 2197 if (!th.check_is_like(re.data.data.pageData[j], newd)) continue;
2181 2198 item = re.data.data.pageData[j];
2182 2199 break;
2183 2200 }
2184   - }
2185   -
2186 2201 }
2187 2202  
2188 2203 if (item) {
2189   - item = re.data.data.pageData[0];
  2204 +
2190 2205 //判断数量,要看下购物车中有没有该商品
2191 2206 if (CanOutQty) {
2192 2207 if (item.goods_num + th.data.goodsInputNum > CanOutQty) {
... ... @@ -2224,47 +2239,25 @@ Page({
2224 2239 }
2225 2240 }
2226 2241  
2227   - var updata = {
2228   - id: item.id,
2229   - goods_num: e.data.goodsInputNum + item.goods_num,
2230   - goods_price: newd.goods_price,
2231   - member_goods_price: newd.goods_price,
2232   - store_id: th.data.stoid,
2233   - prom_id: newd.prom_id, //把活动id带上去(用于购物车失效变成有效商品)
2234   - prom_type: newd.prom_type
2235   - };
2236   -
2237   - if(newd.is_pd_normal){
2238   - updata.is_pd_normal=1
2239   - }
  2242 + if(newd.zh_prom_id>0 && item.zh_prom_id && newd.zh_prom_id!=item.zh_prom_id){
  2243 + wx.hideLoading();
  2244 + wx.showModal({
  2245 + title: '温馨提示',
  2246 + content: '当前商品已在购物车,是否替换参与该活动?',
  2247 + success(res) {
  2248 + if (res.confirm) {
  2249 + wx.showLoading();
  2250 + th.add_cart_next2(e,item,newd);
  2251 + }else{
  2252 + th.data.adding = 0;
  2253 + }
  2254 + }
  2255 + })
2240 2256  
2241   - //---是不是从收藏夹出来的---
2242   - if (th.data.c_guide_id) {
2243   - updata['guide_id'] = th.data.c_guide_id;
2244   - updata['guide_type'] = 3; //加入购物车之后就变成了3
2245   - } else {
2246   - if (getApp().globalData.guide_id) {
2247   - updata['guide_id'] = getApp().globalData.guide_id;
2248   - updata['guide_type'] = 0;
2249   - }
2250   - }
2251   - if (getApp().globalData.groupchat_id) {
2252   - updata['groupchat_id'] = getApp().globalData.groupchat_id;
  2257 + }else{
  2258 + th. add_cart_next2(e,item,newd);
2253 2259 }
2254 2260  
2255   - getApp().request.put("/api/weshop/cart/update", {
2256   - data: updata,
2257   - success: function (t) {
2258   - wx.hideLoading();
2259   - th.data.adding=0;
2260   - getApp().my_warnning('加入购物车成功', 1, th, 450);
2261   - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
2262   - th.setData({
2263   - cartGoodsNum: c_num
2264   - });
2265   - th.closeSpecModal();
2266   - }
2267   - });
2268 2261 } else {
2269 2262 getApp().request.post("/api/weshop/cart/save", {
2270 2263 data: newd,
... ... @@ -2284,7 +2277,6 @@ Page({
2284 2277 });
2285 2278  
2286 2279 } else {
2287   -
2288 2280 newd['pick_name'] = th.data.sto_sele_name;
2289 2281 newd['pick_dis'] = th.data.sto_sele_distr;
2290 2282 th.buyNow(newd);
... ... @@ -2292,8 +2284,61 @@ Page({
2292 2284 }
2293 2285 },
2294 2286  
  2287 +
  2288 + add_cart_next2(e,item,newd){
  2289 + let th=this;
  2290 + let updata = {
  2291 + id: item.id,
  2292 + goods_num: e.data.goodsInputNum + item.goods_num,
  2293 + goods_price: newd.goods_price,
  2294 + member_goods_price: newd.goods_price,
  2295 + store_id: th.data.stoid,
  2296 + prom_id: newd.prom_id, //把活动id带上去(用于购物车失效变成有效商品)
  2297 + prom_type: newd.prom_type
  2298 + };
  2299 +
  2300 + if(newd.is_pd_normal){
  2301 + updata.is_pd_normal=1
  2302 + }
  2303 +
  2304 + if (newd.zh_prom_id) {
  2305 + updata.zh_prom_id = newd.zh_prom_id
  2306 + }
  2307 +
  2308 + //---是不是从收藏夹出来的---
  2309 + if (th.data.c_guide_id) {
  2310 + updata['guide_id'] = th.data.c_guide_id;
  2311 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  2312 + } else {
  2313 + if (getApp().globalData.guide_id) {
  2314 + updata['guide_id'] = getApp().globalData.guide_id;
  2315 + updata['guide_type'] = 0;
  2316 + }
  2317 + }
  2318 + if (getApp().globalData.groupchat_id) {
  2319 + updata['groupchat_id'] = getApp().globalData.groupchat_id;
  2320 + }
  2321 +
  2322 + getApp().request.put("/api/weshop/cart/update", {
  2323 + data: updata,
  2324 + success: function (t) {
  2325 + wx.hideLoading();
  2326 + th.data.adding=0;
  2327 + getApp().my_warnning('加入购物车成功', 1, th, 450);
  2328 + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
  2329 + th.setData({
  2330 + cartGoodsNum: c_num
  2331 + });
  2332 + th.closeSpecModal();
  2333 + }
  2334 + });
  2335 + },
  2336 +
  2337 +
2295 2338 //因为在购物车 普通商品和 优惠促销,搭配购,组合购 阶梯购是一样的
2296 2339 check_is_like(e, newd, idx) {
  2340 +
  2341 + if(e.is_gift) return false; //如果是赠品就返回
2297 2342 if (e.prom_type == newd.prom_type) return true;
2298 2343 if (!idx) {
2299 2344 if (e.prom_type == 0) {
... ...
pages/user/order_list/order_list.js
... ... @@ -2120,6 +2120,16 @@ Page({
2120 2120 else if (arr2.length > 1) {
2121 2121 good.prom_type = g_item.prom_type; good.prom_id = g_item.prom_id;
2122 2122 }
  2123 +
  2124 +
  2125 + var arr3 = arr.filter(function (e) {
  2126 + return e.s_time < ut.gettimestamp() && e.prom_type == 7;
  2127 + })
  2128 +
  2129 + if (arr3 && arr3.length > 0) {
  2130 + b_item.zh_prom_id= arr3[0].act_id;
  2131 + }
  2132 +
2123 2133 }
2124 2134 })
2125 2135  
... ... @@ -2508,9 +2518,12 @@ Page({
2508 2518 },
2509 2519  
2510 2520 more_add_cart: async function () {
  2521 + var th=this;
2511 2522 var back_goods_arr = this.data.back_goods_arr;
2512 2523 var err_text = "";
2513 2524 var ok_num = 0;
  2525 + var zh_prom_id_err=[];
  2526 + var zh_prom_id_err_goods=[];
2514 2527  
2515 2528 for (var i in back_goods_arr) {
2516 2529 //商品ID
... ... @@ -2550,6 +2563,13 @@ Page({
2550 2563 newd['prom_id'] = g_item.prom_id;
2551 2564 }
2552 2565  
  2566 + newd['zh_prom_id']=0;
  2567 +
  2568 + if(g_item.zh_prom_id){
  2569 + newd['zh_prom_id'] = g_item.zh_prom_id;
  2570 + }
  2571 +
  2572 +
2553 2573 var b_cart_goods = null;
2554 2574 await getApp().request.promiseGet("/api/weshop/cart/page", {
2555 2575 data: {
... ... @@ -2570,13 +2590,11 @@ Page({
2570 2590 var is_has=null;
2571 2591 if(b_cart_goods) {
2572 2592  
2573   -
2574 2593 for (let jr = 0; jr < b_cart_goods.length; jr++) {
2575 2594 var b_cart_item = b_cart_goods[jr];
2576 2595  
2577   -
2578   - if (!g_item.prom_type || g_item.prom_type == 0) {
2579   - if ([0, 3, 5, 7, 10].indexOf(b_cart_item.prom_type) > -1) {
  2596 + if (!g_item.prom_type || g_item.prom_type == 0 || ([0, 3, 5, 7, 10].includes(parseInt(g_item.prom_type+''))) ) {
  2597 + if ([0, 3, 5, 7, 10].indexOf(b_cart_item.prom_type) > -1 && g_item.is_gift!=0) {
2580 2598 is_has = b_cart_item;
2581 2599 break
2582 2600 }
... ... @@ -2607,6 +2625,13 @@ Page({
2607 2625 updata.prom_id = newd.prom_id;
2608 2626 }
2609 2627  
  2628 + //如果购物车中商品zh_prom_id不一致的话,要进行提示
  2629 + if(is_has.zh_prom_id>0 && is_has.zh_prom_id!= newd['zh_prom_id'] ){
  2630 + zh_prom_id_err.push(newd.goods_name+ '已在购物车\n');
  2631 + zh_prom_id_err_goods.push(updata);
  2632 + continue;
  2633 + }
  2634 +
2610 2635 await getApp().request.promisePut("/api/weshop/cart/update", {
2611 2636 data: updata
2612 2637 }).then(res => {
... ... @@ -2631,32 +2656,90 @@ Page({
2631 2656 }
2632 2657 wx.hideLoading();
2633 2658 this.data.moring = 0;
2634   - if (ok_num == 0) {
2635   - //-- 如果没有获取用户信息 --
  2659 +
  2660 + if(zh_prom_id_err_goods && zh_prom_id_err_goods.length){
  2661 + if(err_text){
  2662 + err_text+="同时有以下商品:\n";
  2663 + }
  2664 + err_text+=zh_prom_id_err.join('');
  2665 + err_text+="是否替换参与该活动?"
  2666 +
  2667 + // 如果没有获取用户信息
2636 2668 wx.showModal({
2637 2669 title: '提示',
2638 2670 content: err_text,
2639   - success(res) { }
  2671 + success(res) {
  2672 + if (res.confirm) {
  2673 + //进行对有zh_prom_id 不一样的商品进行替换
  2674 + th.zhbuy_add_cart(zh_prom_id_err_goods)
  2675 + }
  2676 + }
2640 2677 });
2641   - } else {
2642   - if (err_text == "") {
2643   - getApp().goto("/pages/cart/cart/cart");
2644   - } else {
2645   - // 如果没有获取用户信息
  2678 +
  2679 +
  2680 + }else{
  2681 +
  2682 + if (ok_num == 0) {
  2683 + //-- 如果没有获取用户信息 --
2646 2684 wx.showModal({
2647 2685 title: '提示',
2648 2686 content: err_text,
2649   - success(res) {
2650   - if (res.confirm) {
2651   - //跳转到登录页
  2687 + success(res) { }
  2688 + });
  2689 + } else {
  2690 +
  2691 +
  2692 + if (err_text == "") {
2652 2693 getApp().goto("/pages/cart/cart/cart");
  2694 + } else {
  2695 + // 如果没有获取用户信息
  2696 + wx.showModal({
  2697 + title: '提示',
  2698 + content: err_text,
  2699 + success(res) {
  2700 + if (res.confirm) {
  2701 + //跳转到登录页
  2702 + getApp().goto("/pages/cart/cart/cart");
  2703 + }
  2704 + }
  2705 + });
2653 2706 }
2654   - }
2655   - });
  2707 + }
  2708 + }
  2709 + },
2656 2710  
  2711 + //-- 组合购的商品重新购买 --
  2712 + zhbuy_add_cart: async function (zh_prom_id_err_goods) {
  2713 + var err_text = "";
  2714 + for (var i in zh_prom_id_err_goods) {
  2715 + var updata=zh_prom_id_err_goods[i];
  2716 + await getApp().request.promisePut("/api/weshop/cart/update", {
  2717 + data: updata
  2718 + }).then(res => {
  2719 + if (res.data.code != 0) {
  2720 + err_text += newd.goods_name + "加入购物车失败\n";
  2721 + }
  2722 + })
2657 2723 }
2658   - }
  2724 +
  2725 + if (err_text == "") {
  2726 + getApp().goto("/pages/cart/cart/cart");
  2727 + }else{
  2728 + // 如果没有获取用户信息
  2729 + wx.showModal({
  2730 + title: '提示',
  2731 + content: err_text,
  2732 + success(res) {
  2733 + if (res.confirm) {
  2734 + //跳转到登录页
  2735 + getApp().goto("/pages/cart/cart/cart");
  2736 + }
  2737 + }
  2738 + });
  2739 + }
2659 2740 },
  2741 +
  2742 +
2660 2743 //获取用户参与组合购的次数
2661 2744 async getUserBuyPromNum(prom_id,is_buy){
2662 2745 var userInfo = getApp().globalData.userInfo;
... ...