Commit 46edf7aa9eeab126535320edb521f158e48a4a7e

Authored by yvan.ni
1 parent bc1e6f94

1.团购限制使用优惠券。

2.自定义团购的商品销量要显示虚拟数量
components/diy_goodsGroup/diy_goodsGroup.js
... ... @@ -504,7 +504,7 @@ Component({
504 504 if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
505 505 var arr = res.data.data[0];
506 506 item.prom_price = arr.luck_goods_price;
507   - item.sales_sum=arr.buy_goodnum
  507 + item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0);
508 508 }
509 509 })
510 510 break;
... ... @@ -517,9 +517,12 @@ Component({
517 517 var prom =null;
518 518 if(res && res.data) prom=res.data.data;
519 519 if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time<now || (prom.show_time && prom.show_time<now)) ) {
520   - item.prom_price = res.data.data.price;
521   - if(res.data.data.user_price) item.prom_price=res.data.data.user_price;
522   - item.sales_sum=res.data.data.buy_num
  520 + item.prom_price = res.data.data.price;
  521 + if(res.data.data.user_price) item.prom_price=res.data.data.user_price;
  522 + var vNum=res.data.data.virtual_num?res.data.data.virtual_num:0;
  523 + var vNum1=res.data.data.virtualNum?res.data.data.virtualNum:0;
  524 + var vNum2=res.data.data.virtual?res.data.data.virtual:0;
  525 + item.sales_sum=res.data.data.buy_num+(vNum+vNum1+vNum2);
523 526 }else{
524 527 item.prom_type=0;
525 528 item.prom_id=0;
... ...
pages/cart/cart2/cart2.js
... ... @@ -1022,9 +1022,13 @@ Page({
1022 1022 t.data.data.prom_type = 0;
1023 1023 }
1024 1024  
1025   - th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
1026   - th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
1027   - th.data.check_quan_ware_list = t.data.data.erpwareid + "";
  1025 + if(tt.data.data.isQuan){
  1026 + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
  1027 + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
  1028 + th.data.check_quan_ware_list = t.data.data.erpwareid + "";
  1029 + }else{
  1030 + gd.is_xz_yh=1;
  1031 + }
1028 1032  
1029 1033 th.setData({
1030 1034 bn_goods: gd,
... ... @@ -1420,7 +1424,7 @@ Page({
1420 1424 }
1421 1425  
1422 1426 //--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额--
1423   - if (cart_item.exp_type == 0 && th.data.user_addr != null) {
  1427 + if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) {
1424 1428 //看是不是有调用过包邮券
1425 1429 if (!th.data.isget_by_quan[pickid]) {
1426 1430 //--判断要不要显示包邮券,调用接口,因为有for循环---
... ... @@ -1428,7 +1432,8 @@ Page({
1428 1432 data: {
1429 1433 store_id: os.stoid,
1430 1434 isuse: 0,
1431   - condition: q_conditin,
  1435 + //condition: q_conditin,
  1436 + condition:cart_item.ckeck_quan_price,
1432 1437 user_id: getApp().globalData.user_id,
1433 1438 pageSize: 2000
1434 1439 }
... ... @@ -1453,10 +1458,10 @@ Page({
1453 1458 }
1454 1459 if (arr) {
1455 1460 th.data.get_by_quan_list_cart[pickid] = arr;
1456   - //th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart});
1457   - if (th.data.is_b_now) {
1458   - th.setData({get_by_quan_list: arr});
1459   - }
  1461 + th.setData({get_by_quan_list_cart:th.data.get_by_quan_list_cart});
  1462 + //if (th.data.is_b_now) {
  1463 + // th.setData({get_by_quan_list: arr});
  1464 + //}
1460 1465 }
1461 1466 th.data.isget_by_quan[pickid] = 1;
1462 1467 }
... ... @@ -3428,6 +3433,19 @@ Page({
3428 3433 if (gd.prom_type == 1 || gd.is_gift || gd.prom_type == 7) {
3429 3434 continue;
3430 3435 }
  3436 +
  3437 + //--如果是团购,要判断有没有限制使用优惠券
  3438 + if(gd.prom_type == 2){
  3439 + var prom1=null;
  3440 + await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, {
  3441 + }).then(res => {
  3442 + if (res.data.code == 0) prom1 = res.data.data;
  3443 + })
  3444 + if(!prom1.isQuan){
  3445 + continue;
  3446 + }
  3447 + }
  3448 +
3431 3449 //如果有限制使用优惠券,就要返回
3432 3450 if (gd.prom_type == 3) {
3433 3451 if (th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue;
... ... @@ -3466,6 +3484,7 @@ Page({
3466 3484 arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price;
3467 3485 arr[ind].check_quan_ware_list = check_quan_ware_list;
3468 3486 arr[ind].check_quan_price_list = check_quan_price_list;
  3487 + arr[ind].is_xz_yh = is_xz_yh;
3469 3488  
3470 3489 //是否关闭使用优惠券
3471 3490 if (th.data.is_close_quan != 1 && !is_xz_yh) {
... ... @@ -3475,7 +3494,7 @@ Page({
3475 3494 data: {
3476 3495 storeId: oo.stoid,
3477 3496 userId: app.globalData.user_id,
3478   - BuySum: ckeck_quan_price,
  3497 + BuySum: arr[ind].ckeck_quan_price,
3479 3498 WareIds: check_quan_ware_list,
3480 3499 pageSize: 100
3481 3500 }
... ...