|
@@ -76,7 +76,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
@@ -76,7 +76,8 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
76
|
if dividendsIncentivesRuleMatched != nil {
|
76
|
if dividendsIncentivesRuleMatched != nil {
|
77
|
for _, undertaker := range cooperationContract.Undertakers {
|
77
|
for _, undertaker := range cooperationContract.Undertakers {
|
78
|
// 添加承接人分红预算信息详情
|
78
|
// 添加承接人分红预算信息详情
|
79
|
- undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage
|
79
|
+ // TODO 使用decimal提高精度
|
|
|
80
|
+ undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage / 100
|
80
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
81
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
81
|
DividendsUser: &domain.User{
|
82
|
DividendsUser: &domain.User{
|
82
|
UserId: undertaker.UserId,
|
83
|
UserId: undertaker.UserId,
|
|
@@ -98,7 +99,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
@@ -98,7 +99,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
98
|
})
|
99
|
})
|
99
|
// 添加推荐人分红预算信息详情
|
100
|
// 添加推荐人分红预算信息详情
|
100
|
if undertaker.Referrer != nil {
|
101
|
if undertaker.Referrer != nil {
|
101
|
- referrerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.ReferrerPercentage
|
102
|
+ referrerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.ReferrerPercentage / 100
|
102
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
103
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
103
|
DividendsUser: &domain.User{
|
104
|
DividendsUser: &domain.User{
|
104
|
UserId: undertaker.Referrer.UserId,
|
105
|
UserId: undertaker.Referrer.UserId,
|
|
@@ -120,7 +121,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
@@ -120,7 +121,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
120
|
}
|
121
|
}
|
121
|
// 添加关联业务员分红预算信息详情
|
122
|
// 添加关联业务员分红预算信息详情
|
122
|
if undertaker.Salesman != nil {
|
123
|
if undertaker.Salesman != nil {
|
123
|
- salesmanDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.SalesmanPercentage
|
124
|
+ salesmanDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.SalesmanPercentage / 100
|
124
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
125
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
125
|
DividendsUser: &domain.User{
|
126
|
DividendsUser: &domain.User{
|
126
|
UserId: undertaker.Salesman.UserId,
|
127
|
UserId: undertaker.Salesman.UserId,
|
|
@@ -163,7 +164,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
@@ -163,7 +164,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
163
|
// 计算分红
|
164
|
// 计算分红
|
164
|
for _, undertaker := range cooperationContract.Undertakers {
|
165
|
for _, undertaker := range cooperationContract.Undertakers {
|
165
|
// 添加承接人分红退货预算信息详情
|
166
|
// 添加承接人分红退货预算信息详情
|
166
|
- undertakerDividendsAmount := -orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage
|
167
|
+ undertakerDividendsAmount := -orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage / 100
|
167
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
168
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
168
|
DividendsUser: &domain.User{
|
169
|
DividendsUser: &domain.User{
|
169
|
UserId: undertaker.UserId,
|
170
|
UserId: undertaker.UserId,
|
|
@@ -185,7 +186,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
@@ -185,7 +186,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
185
|
})
|
186
|
})
|
186
|
// 添加推荐人分红退货预算信息详情
|
187
|
// 添加推荐人分红退货预算信息详情
|
187
|
if undertaker.Referrer != nil {
|
188
|
if undertaker.Referrer != nil {
|
188
|
- referrerDividendsAmount := -orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.ReferrerPercentage
|
189
|
+ referrerDividendsAmount := -orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.ReferrerPercentage / 100
|
189
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
190
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
190
|
DividendsUser: &domain.User{
|
191
|
DividendsUser: &domain.User{
|
191
|
UserId: undertaker.Referrer.UserId,
|
192
|
UserId: undertaker.Referrer.UserId,
|
|
@@ -207,7 +208,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
@@ -207,7 +208,7 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
207
|
}
|
208
|
}
|
208
|
// 添加关联业务员分红退货预算信息详情
|
209
|
// 添加关联业务员分红退货预算信息详情
|
209
|
if undertaker.Salesman != nil {
|
210
|
if undertaker.Salesman != nil {
|
210
|
- salesmanDividendsAmount := -orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.SalesmanPercentage
|
211
|
+ salesmanDividendsAmount := -orderGood.OrderGoodAmount * dividendsIncentivesRuleMatched.SalesmanPercentage / 100
|
211
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
212
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
212
|
DividendsUser: &domain.User{
|
213
|
DividendsUser: &domain.User{
|
213
|
UserId: undertaker.Salesman.UserId,
|
214
|
UserId: undertaker.Salesman.UserId,
|