作者 yangfu

修改:分红列表,分红状态

... ... @@ -61,14 +61,31 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto
bonus = make([]protocol.Bonus, 4)
for i := range orders {
o := orders[i]
quarter := (o.CreateTime.Month() - 1) / 3
quarter := quarter(o.CreateTime)
bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + o.PlanPartnerBonus)
bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive())
bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait())
bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding())
//bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding())
}
return
}
// 季度
func quarter(t time.Time) int {
q := t.Month()
switch q {
case 4, 5, 6:
return 0
case 7, 8, 9:
return 1
case 10, 11, 12:
return 2
case 1, 2, 3:
return 3
}
return 0
}
// 分红订单
func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersRequest) (rsp *protocol.DividendOrdersResponse, err error) {
var (
... ...
... ... @@ -56,7 +56,7 @@ type GoodStatus int
const (
// 待支付
goodStatusWait GoodStatus = GoodStatus(iota)
goodStatusWait GoodStatus = GoodStatus(iota + 1)
// 已支付
goodStatusPay
// 已支付退货
... ...
... ... @@ -23,9 +23,10 @@ type DividendStatistics struct {
}
type Bonus struct {
Receivable float64 `json:"receivable"` //应收分红
Received float64 `json:"received"` //已收分红
Outstanding float64 `json:"outstanding"` //未收分红
Expend float64 `json:"expend"` //季度分红支出
Expend float64 `json:"-"` //季度分红支出
}
/*DividendOrders 分红订单*/
... ...