...
|
...
|
@@ -68,71 +68,73 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
|
}
|
|
|
}
|
|
|
// 计算分红
|
|
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
// 添加承接人分红预算信息详情
|
|
|
undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.UserId,
|
|
|
UserBaseId: undertaker.UserBaseId,
|
|
|
Org: undertaker.Org,
|
|
|
Orgs: undertaker.Orgs,
|
|
|
Department: undertaker.Department,
|
|
|
Roles: undertaker.Roles,
|
|
|
UserInfo: undertaker.UserInfo,
|
|
|
UserType: undertaker.UserType,
|
|
|
UserName: undertaker.UserName,
|
|
|
UserPhone: undertaker.UserPhone,
|
|
|
Status: undertaker.Status,
|
|
|
Company: undertaker.Company,
|
|
|
},
|
|
|
DividendsParticipateType: domain.UNDERTAKER,
|
|
|
DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
DividendsAmount: undertakerDividendsAmount,
|
|
|
})
|
|
|
// 添加推荐人分红预算信息详情
|
|
|
if undertaker.Referrer != nil {
|
|
|
referrerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.ReferrerPercentage
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.Referrer.UserId,
|
|
|
UserBaseId: undertaker.Referrer.UserBaseId,
|
|
|
Org: undertaker.Referrer.Org,
|
|
|
Orgs: undertaker.Referrer.Orgs,
|
|
|
Department: undertaker.Referrer.Department,
|
|
|
Roles: undertaker.Referrer.Roles,
|
|
|
UserInfo: undertaker.Referrer.UserInfo,
|
|
|
UserType: undertaker.Referrer.UserType,
|
|
|
UserName: undertaker.Referrer.UserName,
|
|
|
UserPhone: undertaker.Referrer.UserPhone,
|
|
|
Company: undertaker.Referrer.Company,
|
|
|
},
|
|
|
DividendsParticipateType: domain.REFERRER,
|
|
|
DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
DividendsAmount: referrerDividendsAmount,
|
|
|
})
|
|
|
}
|
|
|
// 添加关联业务员分红预算信息详情
|
|
|
if undertaker.Salesman != nil {
|
|
|
salesmanDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.SalesmanPercentage
|
|
|
if dividendsIncentivesRuleMatched != nil {
|
|
|
for _, undertaker := range cooperationContract.Undertakers {
|
|
|
// 添加承接人分红预算信息详情
|
|
|
undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.Salesman.UserId,
|
|
|
UserBaseId: undertaker.Salesman.UserBaseId,
|
|
|
Org: undertaker.Salesman.Org,
|
|
|
Orgs: undertaker.Salesman.Orgs,
|
|
|
Department: undertaker.Salesman.Department,
|
|
|
Roles: undertaker.Salesman.Roles,
|
|
|
UserInfo: undertaker.Salesman.UserInfo,
|
|
|
UserType: undertaker.Salesman.UserType,
|
|
|
UserName: undertaker.Salesman.UserName,
|
|
|
UserPhone: undertaker.Salesman.UserPhone,
|
|
|
Company: undertaker.Salesman.Company,
|
|
|
UserId: undertaker.UserId,
|
|
|
UserBaseId: undertaker.UserBaseId,
|
|
|
Org: undertaker.Org,
|
|
|
Orgs: undertaker.Orgs,
|
|
|
Department: undertaker.Department,
|
|
|
Roles: undertaker.Roles,
|
|
|
UserInfo: undertaker.UserInfo,
|
|
|
UserType: undertaker.UserType,
|
|
|
UserName: undertaker.UserName,
|
|
|
UserPhone: undertaker.UserPhone,
|
|
|
Status: undertaker.Status,
|
|
|
Company: undertaker.Company,
|
|
|
},
|
|
|
DividendsParticipateType: domain.SALESMAN,
|
|
|
DividendsParticipateType: domain.UNDERTAKER,
|
|
|
DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
DividendsAmount: salesmanDividendsAmount,
|
|
|
DividendsAmount: undertakerDividendsAmount,
|
|
|
})
|
|
|
// 添加推荐人分红预算信息详情
|
|
|
if undertaker.Referrer != nil {
|
|
|
referrerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.ReferrerPercentage
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.Referrer.UserId,
|
|
|
UserBaseId: undertaker.Referrer.UserBaseId,
|
|
|
Org: undertaker.Referrer.Org,
|
|
|
Orgs: undertaker.Referrer.Orgs,
|
|
|
Department: undertaker.Referrer.Department,
|
|
|
Roles: undertaker.Referrer.Roles,
|
|
|
UserInfo: undertaker.Referrer.UserInfo,
|
|
|
UserType: undertaker.Referrer.UserType,
|
|
|
UserName: undertaker.Referrer.UserName,
|
|
|
UserPhone: undertaker.Referrer.UserPhone,
|
|
|
Company: undertaker.Referrer.Company,
|
|
|
},
|
|
|
DividendsParticipateType: domain.REFERRER,
|
|
|
DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
DividendsAmount: referrerDividendsAmount,
|
|
|
})
|
|
|
}
|
|
|
// 添加关联业务员分红预算信息详情
|
|
|
if undertaker.Salesman != nil {
|
|
|
salesmanDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.SalesmanPercentage
|
|
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
DividendsUser: &domain.User{
|
|
|
UserId: undertaker.Salesman.UserId,
|
|
|
UserBaseId: undertaker.Salesman.UserBaseId,
|
|
|
Org: undertaker.Salesman.Org,
|
|
|
Orgs: undertaker.Salesman.Orgs,
|
|
|
Department: undertaker.Salesman.Department,
|
|
|
Roles: undertaker.Salesman.Roles,
|
|
|
UserInfo: undertaker.Salesman.UserInfo,
|
|
|
UserType: undertaker.Salesman.UserType,
|
|
|
UserName: undertaker.Salesman.UserName,
|
|
|
UserPhone: undertaker.Salesman.UserPhone,
|
|
|
Company: undertaker.Salesman.Company,
|
|
|
},
|
|
|
DividendsParticipateType: domain.SALESMAN,
|
|
|
DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
DividendsAmount: salesmanDividendsAmount,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else if orderGood.DividendsReturnedOrderNumber != "" { // 获取分红退货单
|
...
|
...
|
|