master
wangxinglong 2022-03-16 10:13:11 +08:00
parent 069ff17c60
commit f5f332e442
2 changed files with 89 additions and 55 deletions

View File

@ -572,7 +572,11 @@ class Coupon extends Base
$consumerMoney = round($consumerMoney,2); //四舍五入 精确到分
//开启了分销 覆盖 平台应得金额 和消费者应得金额 并且取消 渠道商打款
if($coupon->couponMain->is_distribution == CouponMain::COMMON_ON){
if(
$coupon->couponMain->is_distribution == CouponMain::COMMON_ON
&&
$business->is_assign == BusinessModel::COMMON_OFF
){
$disAdminMoney = (($deductionMoney/100) * $coupon->couponMain->commission_dis_admin);
//$disDistributionMoney = (($deductionMoney/100) * $coupon->couponMain->commission_dis_distribution);
$disDistributedMoney = (($deductionMoney/100) * $coupon->couponMain->commission_dis_distributed);
@ -920,7 +924,9 @@ class Coupon extends Base
$totalMoney = $couponMain['deduction_money'] * $couponMain['count'];
//如果开启了分销
if($couponMain["is_distribution"] == CouponMain::COMMON_ON){
//if($couponMain["is_distribution"] == CouponMain::COMMON_ON){
if($couponMain['commission_dis_distributed'] < $couponMain['commission_dis_distribution']){
//检测 【被分销者】部分是否最少0.3元
$distributedMoney = ($couponMain['commission_dis_distributed'] / 100) * $couponMain['deduction_money'];
if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) {
@ -929,6 +935,7 @@ class Coupon extends Base
. (CouponMain::min_redpack_money * (100 / ($couponMain['commission_dis_distributed'])))
. "");
}
}else{
//检测 【分销者】部分是否最少0.3元
$distributionMoney = ($couponMain['commission_dis_distribution'] / 100) * $couponMain['deduction_money'];
if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) {
@ -937,7 +944,12 @@ class Coupon extends Base
. (CouponMain::min_redpack_money * (100 / ($couponMain['commission_dis_distribution'])))
. "");
}
}else{
}
//}else{
if($couponMain['commission_consumer'] < $couponMain['commission_agency']){
//检测 【消费者】部分是否最少0.3元
$consumerMoney = ($couponMain['commission_consumer']/100) * $couponMain['deduction_money'];
if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) {
@ -946,6 +958,7 @@ class Coupon extends Base
. (CouponMain::min_redpack_money * (100 / ($couponMain['commission_consumer'])))
. "");
}
}else{
//检测 【渠道商】部分是否最少0.3元
$agencyMoney = ($couponMain['commission_agency']/100) * $couponMain['deduction_money'];
if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) {
@ -957,6 +970,9 @@ class Coupon extends Base
}
//}
//未领取的优惠券
$NotClaimedMoney = CouponRepository::getInstance()->getBusinessNotClaimedCoupon($account->business["code"]);
if($account->business["model"] == BusinessModel::model_ordinary) {

View File

@ -248,7 +248,13 @@ class Coupon extends Base
if($business->is_assign == BusinessModel::COMMON_ON){
return $this->json(5002, "商家已经指派了渠道商,不能开启分销");
}
}else{
if($business->is_assign == BusinessModel::COMMON_OFF){
return $this->json(5002, "商家没有指派渠道商,不能关闭分销");
}
}
if($data['commission_dis_distribution'] < $data['commission_dis_distributed']){
//检测【分销者】部分是否最少0.3元
$distributionMoney = ($data['commission_dis_distribution'] / 100) * $data['deduction_money'];
if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) {
@ -259,7 +265,7 @@ class Coupon extends Base
(CouponMain::min_redpack_money * (100 / ($data['commission_dis_distribution'])))
. "");
}
}else{
//检测【被分销者】部分是否最少0.3元
$distributedMoney = ($data['commission_dis_distributed'] / 100) * $data['deduction_money'];
if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) {
@ -270,11 +276,11 @@ class Coupon extends Base
(CouponMain::min_redpack_money * (100 / ($data['commission_dis_distributed'])))
. "");
}
}else{
if($business->is_assign == BusinessModel::COMMON_OFF){
return $this->json(5002, "商家没有指派渠道商,不能关闭分销");
}
if($data['commission_agency'] < $data['commission_consumer']){
//检测【渠道商】部分是否最少0.3元
$agencyMoney = ($data['commission_agency'] / 100) * $data['deduction_money'];
if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) {
@ -285,7 +291,7 @@ class Coupon extends Base
(CouponMain::min_redpack_money * (100 / ($data['commission_agency'])))
. "");
}
}else{
//检测【消费者】部分是否最少0.3元
$consumerMoney = ($data['commission_consumer'] / 100) * $data['deduction_money'];
if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) {
@ -299,6 +305,7 @@ class Coupon extends Base
}
$totalMoney = $data['deduction_money'] * $data['count'];
//未领取的优惠券
@ -410,6 +417,12 @@ class Coupon extends Base
if($business['is_assign'] == BusinessModel::COMMON_ON){
return $this->json(5002, "商家已经指派了渠道商,不能开启分销");
}
}else{
if($business['is_assign'] == BusinessModel::COMMON_OFF){
return $this->json(5002, "商家没有指派渠道商,不能关闭分销");
}
}
if($data['commission_dis_distribution'] < $data['commission_dis_distributed']){
//检测【分销者】部分是否最少0.3元
$distributionMoney = ($data['commission_dis_distribution']/100) * $data['deduction_money'];
if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) {
@ -421,7 +434,7 @@ class Coupon extends Base
. "%"
);
}
}else{
//检测【被分销者】部分是否最少0.3元
$distributedMoney = ($data['commission_dis_distributed']/100) * $data['deduction_money'];
if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) {
@ -432,11 +445,11 @@ class Coupon extends Base
(round((CouponMain::min_redpack_money / ($data['deduction_money'])) * 100, 2))
. "%");
}
}else{
if($business['is_assign'] == BusinessModel::COMMON_OFF){
return $this->json(5002, "商家没有指派渠道商,不能关闭分销");
}
if($couponMain['commission_consumer'] < $couponMain['commission_agency']){
//检测 【消费者】部分是否最少0.3元
$consumerMoney = ($couponMain['commission_consumer']/100) * $couponMain['deduction_money'];
if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) {
@ -447,6 +460,7 @@ class Coupon extends Base
(round((CouponMain::min_redpack_money / ($couponMain['deduction_money'])) * 100, 2))
. "%");
}
}else{
//检测 【渠道商】部分是否最少0.3元
$agencyMoney = ($couponMain['commission_agency']/100) * $couponMain['deduction_money'];
if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) {
@ -457,10 +471,10 @@ class Coupon extends Base
(round((CouponMain::min_redpack_money / ($couponMain['deduction_money'])) * 100, 2))
. "%");
}
}
$data['update_time'] = date("Y-m-d H:i:s");
Db::startTrans();
@ -553,6 +567,14 @@ class Coupon extends Base
return $this->json(4001,
"{$item["name"]}】所属商家【{$item->business->business_name}】已指派渠道商不能开启分销");
}
}else{
if($item->business->is_assign == BusinessModel::COMMON_OFF){
return $this->json(4001,
"{$item["name"]}】所属商家【{$item->business->business_name}】未指派渠道商不能关闭分销");
}
}
if($item['commission_dis_distribution'] < $item['commission_dis_distributed'] ){
//检测【分销者】部分是否最少0.3元
$distributionMoney = ($item['commission_dis_distribution'] / 100) * $item['deduction_money'];
if ($distributionMoney != 0 && $distributionMoney < CouponMain::min_redpack_money) {
@ -565,7 +587,7 @@ class Coupon extends Base
. "%"
);
}
}else{
//检测【被分销者】部分是否最少0.3元
$distributedMoney = ($item['commission_dis_distributed'] / 100) * $item['deduction_money'];
if ($distributedMoney != 0 && $distributedMoney < CouponMain::min_redpack_money) {
@ -576,12 +598,9 @@ class Coupon extends Base
(round((CouponMain::min_redpack_money / ($item['deduction_money'])) * 100, 2))
. "%");
}
}else{
if($item->business->is_assign == BusinessModel::COMMON_OFF){
return $this->json(4001,
"{$item["name"]}】所属商家【{$item->business->business_name}】未指派渠道商不能关闭分销");
}
if($item['commission_agency'] < $item['commission_consumer']){
//检测【渠道商】部分是否最少0.3元
$agencyMoney = ($item['commission_agency'] / 100) * $item['deduction_money'];
if ($agencyMoney != 0 && $agencyMoney < CouponMain::min_redpack_money) {
@ -594,7 +613,7 @@ class Coupon extends Base
. "%"
);
}
}else{
//检测【消费者】部分是否最少0.3元
$consumerMoney = ($item['commission_consumer'] / 100) * $item['deduction_money'];
if ($consumerMoney != 0 && $consumerMoney < CouponMain::min_redpack_money) {
@ -606,7 +625,6 @@ class Coupon extends Base
. "%");
}
}
}
Db::startTrans();