作者 yangfu

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

@@ -61,14 +61,31 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto @@ -61,14 +61,31 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto
61 bonus = make([]protocol.Bonus, 4) 61 bonus = make([]protocol.Bonus, 4)
62 for i := range orders { 62 for i := range orders {
63 o := orders[i] 63 o := orders[i]
64 - quarter := (o.CreateTime.Month() - 1) / 3 64 + quarter := quarter(o.CreateTime)
  65 + bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + o.PlanPartnerBonus)
65 bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive()) 66 bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive())
66 bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait()) 67 bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait())
67 - bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding()) 68 + //bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding())
68 } 69 }
69 return 70 return
70 } 71 }
71 72
  73 +// 季度
  74 +func quarter(t time.Time) int {
  75 + q := t.Month()
  76 + switch q {
  77 + case 4, 5, 6:
  78 + return 0
  79 + case 7, 8, 9:
  80 + return 1
  81 + case 10, 11, 12:
  82 + return 2
  83 + case 1, 2, 3:
  84 + return 3
  85 + }
  86 + return 0
  87 +}
  88 +
72 // 分红订单 89 // 分红订单
73 func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersRequest) (rsp *protocol.DividendOrdersResponse, err error) { 90 func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersRequest) (rsp *protocol.DividendOrdersResponse, err error) {
74 var ( 91 var (
@@ -56,7 +56,7 @@ type GoodStatus int @@ -56,7 +56,7 @@ type GoodStatus int
56 56
57 const ( 57 const (
58 // 待支付 58 // 待支付
59 - goodStatusWait GoodStatus = GoodStatus(iota) 59 + goodStatusWait GoodStatus = GoodStatus(iota + 1)
60 // 已支付 60 // 已支付
61 goodStatusPay 61 goodStatusPay
62 // 已支付退货 62 // 已支付退货
@@ -23,9 +23,10 @@ type DividendStatistics struct { @@ -23,9 +23,10 @@ type DividendStatistics struct {
23 } 23 }
24 24
25 type Bonus struct { 25 type Bonus struct {
  26 + Receivable float64 `json:"receivable"` //应收分红
26 Received float64 `json:"received"` //已收分红 27 Received float64 `json:"received"` //已收分红
27 Outstanding float64 `json:"outstanding"` //未收分红 28 Outstanding float64 `json:"outstanding"` //未收分红
28 - Expend float64 `json:"expend"` //季度分红支出 29 + Expend float64 `json:"-"` //季度分红支出
29 } 30 }
30 31
31 /*DividendOrders 分红订单*/ 32 /*DividendOrders 分红订单*/