作者 yangfu

订单列表/分红列表修改

... ... @@ -67,7 +67,7 @@ func QuartersBonusStatics(orders []*domain.Order, action int) (bonus []protocol.
bonus = make([]protocol.Bonus, 4)
for i := range orders {
o := orders[i]
quarter := o.CreateAt.Month() / 4
quarter := o.CreateAt.Month() / 3
bonus[quarter].Received += o.OrderBonusReceive()
bonus[quarter].Outstanding += o.OrderBonusWait()
bonus[quarter].Expend += o.OrderBonusOutstanding()
... ... @@ -106,6 +106,7 @@ func DividendOrders(header *protocol.RequestHeader, request *protocol.DividendOr
EndTime: request.EndTime,
Offset: request.PageIndex * request.PageSize,
Limit: request.PageSize,
SortByUpdateTime: domain.DESC,
})
if err != nil {
return
... ...
... ... @@ -53,6 +53,7 @@ func OrderDetail(header *protocol.RequestHeader, request *protocol.OrderDetailRe
OrderQuantity: order.OrderActualCount,
OrderAmount: order.OrderActualAmount,
OrderAmountCancel: order.OrderAmountCancel(),
OrderUpdateReason: order.Reason,
OrderDistrict: map[string]interface{}{"id": order.OrderRegionInfo.RegionId, "name": order.OrderRegionInfo.RegionName},
Customer: protocol.Customer{Uname: order.Buyer.BuyerName, Phone: order.Buyer.ContactInfo},
MyDividend: order.OrderTotalBonus(),
... ... @@ -149,8 +150,7 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
if request.PageIndex == 0 {
var (
partShipmentQuantity, allShipmentQuantity int
//cumulativeQuantity,
intentionQuantity int
cumulativeQuantity, intentionQuantity int
)
//部分发货的订单数量
partShipmentQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
... ... @@ -169,16 +169,16 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
OrderStatus: domain.OrderStatusDeliverAll,
})
//累计实发订单
//cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
// EndTime: request.EndTime,
// BeginTime: request.StartTime,
// OrderType: domain.OrderReal,
// PartnerId: header.UserId,
//})
cumulativeQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
EndTime: time.Now().Unix() * 1000,
//BeginTime: request.StartTime,
OrderType: domain.OrderReal,
PartnerId: header.UserId,
})
//累计意向订单
intentionQuantity, _, err = OrderDao.OrderStatics(&domain.OrderStaticQuery{
EndTime: request.EndTime,
BeginTime: request.StartTime,
EndTime: time.Now().Unix() * 1000,
//BeginTime: request.StartTime,
OrderType: domain.OrderIntention,
PartnerId: header.UserId,
})
... ... @@ -186,7 +186,7 @@ func OrderList(header *protocol.RequestHeader, request *protocol.OrderListReques
rsp.Statistics["partShipmentQuantity"] = partShipmentQuantity
rsp.Statistics["allShipmentQuantity"] = allShipmentQuantity
rsp.Statistics["orderQuantity"] = partShipmentQuantity + allShipmentQuantity //所有订单 = 部分发货 + 已经发货
rsp.Statistics["cumulativeQuantity"] = partShipmentQuantity + allShipmentQuantity //实发订单 = 部分发货 + 全部发货
rsp.Statistics["cumulativeQuantity"] = cumulativeQuantity //实发订单 = 部分发货 + 全部发货
rsp.Statistics["intentionQuantity"] = intentionQuantity
}
... ... @@ -207,7 +207,7 @@ func DomainOrderToOrderListItem(order *domain.Order) *protocol.OrderListItem {
OrderType: order.OrderType,
OrderNo: order.OrderCode,
OrderName: order.OrderName,
OrderAmount: order.OrderAmount,
OrderAmount: order.OrderActualAmount,
OrderActualCount: order.OrderActualCount,
OrderStatus: order.OrderStatus,
UpdateTime: order.UpdateAt.Unix() * 1000,
... ...
... ... @@ -63,6 +63,8 @@ type Order struct {
//上一次查看时间 已读情况
LastViewTime time.Time `json:"lastViewTime,omitempty"`
//订单更新理由
Reason string `json:"reason,omitempty"`
}
func (m *Order) Identify() interface{} {
... ... @@ -156,6 +158,7 @@ type DividendOrdersQueryOption struct {
EndTime int64 `json:"endTime"`
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
SortByUpdateTime string `json:"sortByUpdateTime,omitempty"`
}
//买家
... ...
... ... @@ -74,6 +74,9 @@ func (dao *OrderDao) DividendOrders(option *domain.DividendOrdersQueryOption) (c
if option.Offset > 0 {
q.Offset(option.Offset)
}
if len(option.SortByUpdateTime) > 0 {
q.Order(fmt.Sprintf("order.id %v", option.SortByUpdateTime))
}
count, err = q.Distinct().SelectAndCount()
return
}
... ...
... ... @@ -45,4 +45,6 @@ type Order struct {
//上一次查看时间 已读情况
LastViewTime time.Time
//订单更新理由
Reason string
}
... ...
... ... @@ -17,6 +17,7 @@ type OrderDetail struct {
OrderQuantity int `json:"orderQuantity"`
OrderAmount float64 `json:"orderAmount"`
OrderAmountCancel float64 `json:"orderAmountCancel"`
OrderUpdateReason string `json:"orderUpdateReason"`
OrderDistrict interface{} `json:"orderDistrict"`
Customer Customer `json:"customer"`
MyDividend float64 `json:"myDividend"`
... ...