更新优惠券计算规则

This commit is contained in:
Jerry Yan 2020-10-23 11:46:20 +08:00
parent ae99da1907
commit 7477dda308

View File

@ -39,7 +39,8 @@ class Settlements extends Base
// 6获得预获产品券为被扣税费的100% buyerPreProductInProductTaxFeeScale
// 购户获得预获产品券最高占产品额比例?%
$buyerPreProductNum = round(($totalMoney + $order->deliverMoney),5);//1
// $buyerPreProductNum = round(($totalMoney + $order->deliverMoney),5);//1
$buyerPreProductNum = round(($discountMoney * (dataConf('couponPercentCanUsetGet')*0.01)),5);//1
$buyerMaxCouponsNum = round(($totalMoney + $order->deliverMoney)* (dataConf('buyerPreProductInProductScale')*0.01),5);//1
$buyerPreCoupousNum = round($discountMoney * (dataConf('buyerPreCoupousInSaleScale')*0.01),5);//2
// $buyerPreProductNum += round($order->productHandlingFee * (dataConf('buyerPreProductInHandlingFeeScale')*0.01),2);//3
@ -47,19 +48,11 @@ class Settlements extends Base
// $buyerPreProductNum += round($order->couponsHandlingFee * (dataConf('buyerPreProductInProductHandlingFeeScale')*0.01),2);//5
// $buyerPreProductNum += round($order->couponsTaxFee * (dataConf('buyerPreProductInProductTaxFeeScale')*0.01),2);//6
$buyerPreCoupousNum = $buyerPreCoupousNum > $buyerMaxCouponsNum ? $buyerMaxCouponsNum : $buyerPreCoupousNum;
if($buyerPreProductNum >= 0.01 || $buyerPreCoupousNum>=0.01){
if($buyerPreProductNum > 0 || $buyerPreCoupousNum > 0){
if(3 == $order->goodsType){
$get_from_coupon = $discountMoney*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf('couponPercentCanUsetGet')/100);
if ($get_from_coupon > $order['goodsMoney']) {
$get_from_coupon = $order['goodsMoney'];
}
Model('common/UserVouchers')->insertVouchersNotice($order->userId,$orderId,$buyerPreProductNum,$get_from_coupon,'交易订单【'.$order->orderNo.'】购户购物所得');
Model('common/UserVouchers')->insertVouchersNotice($order->userId,$orderId,$buyerPreProductNum,$buyerPreCoupousNum*((float)dataConf('helpSaleCouponsCalBase')/100),'交易订单【'.$order->orderNo.'】购户购物所得');
}else{
$get_from_coupon = $discountMoney*((float)dataConf('couponPercentCanUsetGet')/100);
if ($get_from_coupon > $order['goodsMoney']) {
$get_from_coupon = $order['goodsMoney'];
}
Model('common/UserVouchers')->insertVouchersNotice($order->userId,$orderId,$buyerPreProductNum,$get_from_coupon,'交易订单【'.$order->orderNo.'】购户购物所得');
Model('common/UserVouchers')->insertVouchersNotice($order->userId,$orderId,$buyerPreProductNum,$buyerPreCoupousNum,'交易订单【'.$order->orderNo.'】购户购物所得');
}
}
}