|
@@ -68,71 +68,73 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
|
@@ -68,71 +68,73 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo |
68
|
}
|
68
|
}
|
69
|
}
|
69
|
}
|
70
|
// 计算分红
|
70
|
// 计算分红
|
71
|
- for _, undertaker := range cooperationContract.Undertakers {
|
|
|
72
|
- // 添加承接人分红预算信息详情
|
|
|
73
|
- undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage
|
|
|
74
|
- dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
75
|
- DividendsUser: &domain.User{
|
|
|
76
|
- UserId: undertaker.UserId,
|
|
|
77
|
- UserBaseId: undertaker.UserBaseId,
|
|
|
78
|
- Org: undertaker.Org,
|
|
|
79
|
- Orgs: undertaker.Orgs,
|
|
|
80
|
- Department: undertaker.Department,
|
|
|
81
|
- Roles: undertaker.Roles,
|
|
|
82
|
- UserInfo: undertaker.UserInfo,
|
|
|
83
|
- UserType: undertaker.UserType,
|
|
|
84
|
- UserName: undertaker.UserName,
|
|
|
85
|
- UserPhone: undertaker.UserPhone,
|
|
|
86
|
- Status: undertaker.Status,
|
|
|
87
|
- Company: undertaker.Company,
|
|
|
88
|
- },
|
|
|
89
|
- DividendsParticipateType: domain.UNDERTAKER,
|
|
|
90
|
- DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
91
|
- DividendsAmount: undertakerDividendsAmount,
|
|
|
92
|
- })
|
|
|
93
|
- // 添加推荐人分红预算信息详情
|
|
|
94
|
- if undertaker.Referrer != nil {
|
|
|
95
|
- referrerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.ReferrerPercentage
|
|
|
96
|
- dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
97
|
- DividendsUser: &domain.User{
|
|
|
98
|
- UserId: undertaker.Referrer.UserId,
|
|
|
99
|
- UserBaseId: undertaker.Referrer.UserBaseId,
|
|
|
100
|
- Org: undertaker.Referrer.Org,
|
|
|
101
|
- Orgs: undertaker.Referrer.Orgs,
|
|
|
102
|
- Department: undertaker.Referrer.Department,
|
|
|
103
|
- Roles: undertaker.Referrer.Roles,
|
|
|
104
|
- UserInfo: undertaker.Referrer.UserInfo,
|
|
|
105
|
- UserType: undertaker.Referrer.UserType,
|
|
|
106
|
- UserName: undertaker.Referrer.UserName,
|
|
|
107
|
- UserPhone: undertaker.Referrer.UserPhone,
|
|
|
108
|
- Company: undertaker.Referrer.Company,
|
|
|
109
|
- },
|
|
|
110
|
- DividendsParticipateType: domain.REFERRER,
|
|
|
111
|
- DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
112
|
- DividendsAmount: referrerDividendsAmount,
|
|
|
113
|
- })
|
|
|
114
|
- }
|
|
|
115
|
- // 添加关联业务员分红预算信息详情
|
|
|
116
|
- if undertaker.Salesman != nil {
|
|
|
117
|
- salesmanDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.SalesmanPercentage
|
71
|
+ if dividendsIncentivesRuleMatched != nil {
|
|
|
72
|
+ for _, undertaker := range cooperationContract.Undertakers {
|
|
|
73
|
+ // 添加承接人分红预算信息详情
|
|
|
74
|
+ undertakerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.DividendsIncentivesPercentage
|
118
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
75
|
dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
119
|
DividendsUser: &domain.User{
|
76
|
DividendsUser: &domain.User{
|
120
|
- UserId: undertaker.Salesman.UserId,
|
|
|
121
|
- UserBaseId: undertaker.Salesman.UserBaseId,
|
|
|
122
|
- Org: undertaker.Salesman.Org,
|
|
|
123
|
- Orgs: undertaker.Salesman.Orgs,
|
|
|
124
|
- Department: undertaker.Salesman.Department,
|
|
|
125
|
- Roles: undertaker.Salesman.Roles,
|
|
|
126
|
- UserInfo: undertaker.Salesman.UserInfo,
|
|
|
127
|
- UserType: undertaker.Salesman.UserType,
|
|
|
128
|
- UserName: undertaker.Salesman.UserName,
|
|
|
129
|
- UserPhone: undertaker.Salesman.UserPhone,
|
|
|
130
|
- Company: undertaker.Salesman.Company,
|
77
|
+ UserId: undertaker.UserId,
|
|
|
78
|
+ UserBaseId: undertaker.UserBaseId,
|
|
|
79
|
+ Org: undertaker.Org,
|
|
|
80
|
+ Orgs: undertaker.Orgs,
|
|
|
81
|
+ Department: undertaker.Department,
|
|
|
82
|
+ Roles: undertaker.Roles,
|
|
|
83
|
+ UserInfo: undertaker.UserInfo,
|
|
|
84
|
+ UserType: undertaker.UserType,
|
|
|
85
|
+ UserName: undertaker.UserName,
|
|
|
86
|
+ UserPhone: undertaker.UserPhone,
|
|
|
87
|
+ Status: undertaker.Status,
|
|
|
88
|
+ Company: undertaker.Company,
|
131
|
},
|
89
|
},
|
132
|
- DividendsParticipateType: domain.SALESMAN,
|
90
|
+ DividendsParticipateType: domain.UNDERTAKER,
|
133
|
DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
91
|
DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
134
|
- DividendsAmount: salesmanDividendsAmount,
|
92
|
+ DividendsAmount: undertakerDividendsAmount,
|
135
|
})
|
93
|
})
|
|
|
94
|
+ // 添加推荐人分红预算信息详情
|
|
|
95
|
+ if undertaker.Referrer != nil {
|
|
|
96
|
+ referrerDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.ReferrerPercentage
|
|
|
97
|
+ dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
98
|
+ DividendsUser: &domain.User{
|
|
|
99
|
+ UserId: undertaker.Referrer.UserId,
|
|
|
100
|
+ UserBaseId: undertaker.Referrer.UserBaseId,
|
|
|
101
|
+ Org: undertaker.Referrer.Org,
|
|
|
102
|
+ Orgs: undertaker.Referrer.Orgs,
|
|
|
103
|
+ Department: undertaker.Referrer.Department,
|
|
|
104
|
+ Roles: undertaker.Referrer.Roles,
|
|
|
105
|
+ UserInfo: undertaker.Referrer.UserInfo,
|
|
|
106
|
+ UserType: undertaker.Referrer.UserType,
|
|
|
107
|
+ UserName: undertaker.Referrer.UserName,
|
|
|
108
|
+ UserPhone: undertaker.Referrer.UserPhone,
|
|
|
109
|
+ Company: undertaker.Referrer.Company,
|
|
|
110
|
+ },
|
|
|
111
|
+ DividendsParticipateType: domain.REFERRER,
|
|
|
112
|
+ DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
113
|
+ DividendsAmount: referrerDividendsAmount,
|
|
|
114
|
+ })
|
|
|
115
|
+ }
|
|
|
116
|
+ // 添加关联业务员分红预算信息详情
|
|
|
117
|
+ if undertaker.Salesman != nil {
|
|
|
118
|
+ salesmanDividendsAmount := (orderGood.OrderGoodAmount - orderGood.OrderGoodExpense) * dividendsIncentivesRuleMatched.SalesmanPercentage
|
|
|
119
|
+ dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
|
|
|
120
|
+ DividendsUser: &domain.User{
|
|
|
121
|
+ UserId: undertaker.Salesman.UserId,
|
|
|
122
|
+ UserBaseId: undertaker.Salesman.UserBaseId,
|
|
|
123
|
+ Org: undertaker.Salesman.Org,
|
|
|
124
|
+ Orgs: undertaker.Salesman.Orgs,
|
|
|
125
|
+ Department: undertaker.Salesman.Department,
|
|
|
126
|
+ Roles: undertaker.Salesman.Roles,
|
|
|
127
|
+ UserInfo: undertaker.Salesman.UserInfo,
|
|
|
128
|
+ UserType: undertaker.Salesman.UserType,
|
|
|
129
|
+ UserName: undertaker.Salesman.UserName,
|
|
|
130
|
+ UserPhone: undertaker.Salesman.UserPhone,
|
|
|
131
|
+ Company: undertaker.Salesman.Company,
|
|
|
132
|
+ },
|
|
|
133
|
+ DividendsParticipateType: domain.SALESMAN,
|
|
|
134
|
+ DividendsStage: int32(dividendsIncentivesRuleMatched.DividendsIncentivesStage),
|
|
|
135
|
+ DividendsAmount: salesmanDividendsAmount,
|
|
|
136
|
+ })
|
|
|
137
|
+ }
|
136
|
}
|
138
|
}
|
137
|
}
|
139
|
}
|
138
|
} else if orderGood.DividendsReturnedOrderNumber != "" { // 获取分红退货单
|
140
|
} else if orderGood.DividendsReturnedOrderNumber != "" { // 获取分红退货单
|