order_statics.go
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package domain
import "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
//分洪统计
type OrderStatics struct {
//1:待支付分红 2:已支付分红
BonusStatus int8
//预计的订单内货品总数
PlanOrderCount int
//预计的订单的总金额
PlanOrderAmount float64
//按需使用的订单内货品总数 (初始值=-1)
UseOrderCount int
//按需使用的订单内货品总数 (初始值=-1)
UseOrderAmount float64
//合伙人应收分红
PlanPartnerBonus float64
//调整后的合伙人应收分红 (初始值=-1)
UsePartnerBonus float64
//合伙人已收分红
PartnerBonusHas float64
//合伙人未收分红
PartnerBonusNot float64
//合伙人分红支出
PartnerBonusExpense float64
}
//订单应收分红
func (m *OrderStatics) OrderTotalBonus() float64 {
if m.UseOrderCount >= 0 {
return utils.Decimal(m.UsePartnerBonus + m.PartnerBonusExpense)
}
return utils.Decimal(m.PlanPartnerBonus)
}
//订单已收分红
func (m *OrderStatics) OrderBonusReceive() float64 {
return utils.Decimal(m.PartnerBonusHas)
}
//订单未收分红
func (m *OrderStatics) OrderBonusWait() float64 {
bonusWait := m.OrderTotalBonus() - m.OrderBonusReceive()
if bonusWait < 0 {
return 0
}
return bonusWait
}
//分红支出
func (m *OrderStatics) OrderBonusOutstanding() float64 {
return utils.Decimal(m.PartnerBonusExpense)
}
//订单被取消金额
func (m *OrderStatics) OrderAmountCancel() float64 {
if m.UseOrderAmount < 0 {
return 0
}
if m.PlanOrderAmount > m.UseOrderAmount {
return 0
}
return utils.Decimal(m.UseOrderAmount - m.PlanOrderAmount)
}
//订单金额
func (m *OrderStatics) OrderAmount() float64 {
if m.UseOrderAmount < 0 {
return m.PlanOrderAmount
}
return m.UseOrderAmount
}