diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js
index 936168b..3848073 100644
--- a/packageA/pages/goodsInfo/goodsInfo.js
+++ b/packageA/pages/goodsInfo/goodsInfo.js
@@ -4161,6 +4161,7 @@ Page({
user_id: oo.user_id,
goods_id: a,
pick_id: e.data.sto_sele_id,
+ prom_type:(newd.prom_type?newd.prom_type:0),
state: 0
},
success: function (re) {
diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js
index 694e364..58abd65 100644
--- a/packageE/pages/cart/cart2/cart2.js
+++ b/packageE/pages/cart/cart2/cart2.js
@@ -399,6 +399,7 @@ Page({
wx.hideLoading()
return arr
},
+
//计算商品预存款请求方法------------------------------------
async getGoodsAdvancesum(storageid, listform, cartList) {
let res = await getApp().request.promisePost(`/api/weshop/delphiapi/saveErpApi`, {
@@ -712,15 +713,15 @@ Page({
//如果有购买活动
item1.promgoodsbuynum = promgoodsbuynum;
- //如果是秒杀的时候
- if (item1.prom_type == 1) {
- var url = "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid
- + "/" + item1.goods_id + "/1/" + item1.prom_id + "/" + app.globalData.user_id;
- await app.request.promiseGet(url, {}).then(res => {
- if (res.data.code == 0) {
- console.log(res.data.data, "111");
- item1.is_order_yh = res.data.data.is_order_yh;
- item1.is_post_temp = res.data.data.is_post_temp;
+ //如果是秒杀,团购的时候
+ if([1,2].indexOf(item1.prom_type)>-1){
+ var url= "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid
+ + "/" + item1.goods_id + "/"+item1.prom_type+"/" + item1.prom_id + "/" + app.globalData.user_id;
+ await app.request.promiseGet(url,{}).then(res=>{
+ if(res.data.code==0){
+ console.log(res.data.data,"111");
+ item1.is_order_yh=res.data.data.is_order_yh;
+ item1.is_post_temp=res.data.data.is_post_temp;
}
})
}
@@ -1467,7 +1468,7 @@ Page({
success: async function (tt) {
if (tt.data.code == 0) {
//t.data.data.shop_price = tt.data.data.prom_price;
- t.data.data.shop_price = tt.data.data.prom_user_price;
+ gd.shop_price=t.data.data.shop_price = tt.data.data.prom_user_price;
th.data.ckeck_quan_price = 0;
gd.is_xz_yh = 1;
@@ -1532,53 +1533,110 @@ Page({
getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, {
success: async function (tt) {
if (tt.data.code == 0) {
- //t.data.data.shop_price = tt.data.data.prom_price;
- t.data.data.shop_price = tt.data.data.price;
+ //获取一下主表的信息
+ ut.get_active_info(2,gd.prom_id,os.stoid,function(e){
+
+ //t.data.data.shop_price = tt.data.data.prom_price;
+ gd.shop_price=t.data.data.shop_price = tt.data.data.price;
+
+ t.data.data.fir_rate = tt.data.data.fir_rate;
+ t.data.data.sec_rate = tt.data.data.sec_rate;
+ t.data.data.thi_rate = tt.data.data.thi_rate;
+ t.data.data.commission = tt.data.data.commission;
+
+ if(e.is_order_yh){
+ th.data.bn_is_order_yh=1;
+ }else{
+ th.data.bn_is_order_yh=0;
+ }
+ if(e.is_post_temp){
+ th.data.bn_is_post_temp=1;
+ }else{
+ th.data.bn_is_post_temp=0;
+ }
+
+
+ //-- 计算获得佣金的金额 --
+ if (getApp().globalData.userInfo.is_distribut
+ && th.data.dis_config && th.data.dis_config.is_yongjin_dk) {
+
+ var c_num = getApp().get_commission(th.data.dis_config, t.data.data, gg.goods_num);
+
+ gd.use_commission = c_num;
+ t.data.data.use_commission = c_num;
+
+ }
+
+
+ if (tt.data.data.isQuan) {
+ th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
+ th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
+ th.data.check_quan_ware_list = t.data.data.erpwareid + "";
+ } else {
+ gd.is_xz_yh = 1;
+ }
+
+ th.setData({
+ bn_goods: gd,
+ bn_pickname: gg.pick_name,
+ bn_exp_type: et,
+ index: m_wind,
+ bn_pick: gg.pick_id,
+ bn_t_exp_t: distr_t,
+ bn_exp_type: et
+ });
+
+ //-- 计算价格 --
+ th.calculatePrice2();
+ //获取优惠券,如果有券的钱,就调用
+ if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
+
+ })
- t.data.data.fir_rate = tt.data.data.fir_rate;
- t.data.data.sec_rate = tt.data.data.sec_rate;
- t.data.data.thi_rate = tt.data.data.thi_rate;
- t.data.data.commission = tt.data.data.commission;
} else {
t.data.data.prom_id = 0;
t.data.data.prom_type = 0;
- }
- //-- 计算获得佣金的金额 --
- if (getApp().globalData.userInfo.is_distribut
- && th.data.dis_config && th.data.dis_config.is_yongjin_dk) {
- var c_num = getApp().get_commission2(th.data.dis_config, t.data.data, gg.goods_num);
- gd.use_commission = c_num;
- t.data.data.use_commission = c_num;
+ //-- 计算获得佣金的金额 --
+ if (getApp().globalData.userInfo.is_distribut
+ && th.data.dis_config && th.data.dis_config.is_yongjin_dk) {
+ var c_num = getApp().get_commission2(th.data.dis_config, t.data.data, gg.goods_num);
- }
+ gd.use_commission = c_num;
+ t.data.data.use_commission = c_num;
+ }
+
+
+ if (tt.data.data.isQuan) {
+ th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
+ th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
+ th.data.check_quan_ware_list = t.data.data.erpwareid + "";
+ } else {
+ gd.is_xz_yh = 1;
+ }
+
+ th.setData({
+ bn_goods: gd,
+ bn_pickname: gg.pick_name,
+ bn_exp_type: et,
+ index: m_wind,
+ bn_pick: gg.pick_id,
+ bn_t_exp_t: distr_t,
+ bn_exp_type: et
+ });
+
+ //-- 计算价格 --
+ th.calculatePrice2();
+ //获取优惠券,如果有券的钱,就调用
+ if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
- if (tt.data.data.isQuan) {
- th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
- th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
- th.data.check_quan_ware_list = t.data.data.erpwareid + "";
- } else {
- gd.is_xz_yh = 1;
}
- th.setData({
- bn_goods: gd,
- bn_pickname: gg.pick_name,
- bn_exp_type: et,
- index: m_wind,
- bn_pick: gg.pick_id,
- bn_t_exp_t: distr_t,
- bn_exp_type: et
- });
- //-- 计算价格 --
- th.calculatePrice2();
- //获取优惠券,如果有券的钱,就调用
- if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
}
});
@@ -1855,7 +1913,6 @@ Page({
},
-
calclate_lbNum(r_data) {
let send_lb = this.data.send_lb;
//g_lb_num我的礼包 g_zxlb_num专享礼包
@@ -2060,15 +2117,14 @@ Page({
}
o_price += item[j].goods_price * item[j].goods_num;
- //-- 秒杀的时候,判断有没有订单优惠和包邮模板的叠加 --
- if (item[j].prom_type == 1) {
- if (!item[j].is_order_yh)
- no_order_yh += item[j].goods_price * item[j].goods_num;
- if (!item[j].is_post_temp)
- no_post_temp += item[j].goods_price * item[j].goods_num;
- }
-
+ //-- 秒杀, 团购的时候,判断有没有订单优惠和包邮模板的叠加 --
+ if( [1,2].indexOf(item[j].prom_type)>-1){
+ if(!item[j].is_order_yh)
+ no_order_yh+=item[j].goods_price * item[j].goods_num;
+ if(!item[j].is_post_temp)
+ no_post_temp+=item[j].goods_price * item[j].goods_num;
+ }
}
//判断是不是有组合购的金额
var f_o_price = o_price;
@@ -2370,6 +2426,7 @@ Page({
var order_m = 0;
+
//么有使用券,或者活动没有限制使用优惠券
if (ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)) {
order_prom_id = ord_prom['id'];
@@ -2389,8 +2446,6 @@ Page({
}
}
-
-
cart_item.order_prom_amount = 0;
//--订单优惠的显示--
if (order_prom_id > 0) {
@@ -2743,7 +2798,6 @@ Page({
if (cut_price) {
var c_txt = "formData.cut_price";
th.setData({ [c_txt]: cut_price, });
-
}
//如果有线下取价的时候
@@ -6454,6 +6508,4 @@ Page({
}
-
-
});
diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js
index 5c71d4f..b77b224 100644
--- a/pages/cart/cart2_pt/cart2_pt.js
+++ b/pages/cart/cart2_pt/cart2_pt.js
@@ -1,10 +1,11 @@
var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"),
- s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp();
+ s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp();
var oo = t.globalData.setting, os = oo;
var regeneratorRuntime = require('../../../utils/runtime.js');
var util_pay = require("../../../utils/pay.js");
Page({
+
data: {
url: t.globalData.setting.url,
resourceUrl: t.globalData.setting.resourceUrl,
@@ -439,6 +440,17 @@ Page({
t.data.data.thi_rate = tt.data.data.thi_rate;
t.data.data.commission = tt.data.data.commission;
+ if(e.is_order_yh){
+ th.data.bn_is_order_yh=1;
+ }else{
+ th.data.bn_is_order_yh=0;
+ }
+
+ if(e.is_post_temp){
+ th.data.bn_is_post_temp=1;
+ }else{
+ th.data.bn_is_post_temp=0;
+ }
if (pt_data.kttype == 3) {
t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买
@@ -632,8 +644,22 @@ Page({
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
var out_of_weight = null; //超出多少重量
- //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
+ //-- 判断订单优惠的叠加 --
+ var ord_prom=null;
+ var o_condition=allpice;
+ if(th.data.bn_is_order_yh && th.data.kt_type != 3 ){
+
+ await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
+ data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
+ }).then(res => {
+ if (res.data.code == 0) {
+ ord_prom = res.data.data;
+ }
+ })
+ }
+
+ //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
+ if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
var user_addr = th.data.user_addr;
var req_d = {
@@ -641,11 +667,16 @@ Page({
wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid
}
var back_data = null;
- await getApp().request.promisePost("/api/weshop/order/areaFreight", {
- is_json: 1, data: req_d
- }).then(rs => {
- if (rs.data.code == 0) back_data = rs.data.data;
- });
+
+ if(!ord_prom || ord_prom.bn_is_post_temp) {
+ if (th.data.bn_is_post_temp || th.data.bn_goods.is_normal == 1) {
+ await getApp().request.promisePost("/api/weshop/order/areaFreight", {
+ is_json: 1, data: req_d
+ }).then(rs => {
+ if (rs.data.code == 0) back_data = rs.data.data;
+ });
+ }
+ }
var gd_arr_list = [];
gd_arr_list.push(good);
@@ -771,6 +802,7 @@ Page({
goods_weight: gd_w
}
+
var is_next = 1;
//获取同城配送参数
await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", {
@@ -780,6 +812,7 @@ Page({
if (res.data.code == 0) {
var wl_txt = "formData.shipping_price";
th.setData({ [wl_txt]: res.data.data, })
+
} else {
is_next = 0;
wx.showToast({
@@ -902,6 +935,41 @@ Page({
+ //-- 如果是订单优惠的时候,allpice要拿来减掉一些 --
+ var order_prom_id=0;
+ var order_prom_amount=0;
+ if(ord_prom){
+ order_prom_id = ord_prom['id'];
+ switch (ord_prom['type']) {
+ case 0:
+ allpice = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
+ order_prom_amount = (o_condition - order_m).toFixed(2);
+ break;
+ case 1:
+ //-- 如果有优惠促销倍减的时候 --
+ var bs = 1;
+ if (ord_prom.is_bz) {
+ bs = Math.floor(o_condition / ord_prom.money);
+ }
+ allpice = o_condition - bs * ord_prom['expression'];//满额优惠金额
+ order_prom_amount = ord_prom['expression'];
+ break;
+ }
+ }
+
+ //--订单优惠的显示--
+ var order_prom_txt1 = "formData.order_prom_id";
+ var order_prom_txt2 = "formData.order_prom_amount";
+ if (order_prom_id > 0) {
+ th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
+ } else {
+ th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
+ }
+
+ //-----------------总价-----------------
+ var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price);
+ total_m = parseFloat(total_m).toFixed(2);
+
var txt = "formData.user_money";
var txt2 = "formData.order_amount";
var txt4 = "formData.use_commission";
@@ -1008,11 +1076,22 @@ Page({
'order_goods': new Array(),
};
- //如果不是阶梯团,或者是普通购买,
- if ((th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
- item['shipping_code'] = th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;
- item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;
- }
+
+ //--判断有没有优惠活动--
+ if (th.data.formData.order_prom_amount > 0) {
+ var order_prom_list = {};
+ order_prom_list.order_prom_id = th.data.formData.order_prom_id;
+ order_prom_list.order_prom_amount = th.data.formData.order_prom_amount;
+ item.order_prom_list = order_prom_list;
+ }
+
+
+
+ //如果不是阶梯团,或者是普通购买,
+ if ((th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
+ item['shipping_code'] = th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;
+ item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;
+ }
if (!th.data.bn_goods.is_normal) {
item.is_zsorder = th.data.kt_type + 1; //开团类型
@@ -1140,6 +1219,7 @@ Page({
getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});
}
}
+
var order_amount = 0;
pdata.forEach(function (em, ind) {
order_amount += em.order_amount;
diff --git a/pages/cart/cart2_pt/cart2_pt.wxml b/pages/cart/cart2_pt/cart2_pt.wxml
index 1e2dafa..81d96d5 100644
--- a/pages/cart/cart2_pt/cart2_pt.wxml
+++ b/pages/cart/cart2_pt/cart2_pt.wxml
@@ -160,7 +160,6 @@