作者 tangxvhui

实际订单列表

... ... @@ -12,4 +12,6 @@ type ListOrderBaseQuery struct {
Limit int `json:"limit"`
//订单类型
OrderType int `json:"orderType"`
//发货单号
DeliveryCode string `json:"deliveryCode"`
}
... ...
... ... @@ -39,11 +39,12 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder
orderRepository = value
}
query := domain.OrderBaseFindQuery{
PartnerId: listOrderQuery.PartnerId,
OrderCode: listOrderQuery.OrderCode,
Offset: listOrderQuery.Offset,
Limit: listOrderQuery.Limit,
OrderType: listOrderQuery.OrderType,
PartnerId: listOrderQuery.PartnerId,
OrderCode: listOrderQuery.OrderCode,
Offset: listOrderQuery.Offset,
Limit: listOrderQuery.Limit,
OrderType: listOrderQuery.OrderType,
DeliveryCode: listOrderQuery.DeliveryCode,
}
orders, cnt, err = orderRepository.Find(query)
if err != nil {
... ...
... ... @@ -2,6 +2,7 @@ package controllers
import (
"errors"
"fmt"
"strconv"
"time"
... ... @@ -302,3 +303,68 @@ func (c *OrderInfoController) OrderPurposeDelivery() {
c.ResponseData(nil)
return
}
//PageListOrderReal 获取实发订单列表
func (c *OrderInfoController) PageListOrderReal() {
type Parameter struct {
SearchText string `json:"searchText"`
Partner int64 `json:"partner"`
PageSize int `json:"pageSize"`
PageNumber int `json:"pageNumber"`
}
var (
param Parameter
err error
)
if err = c.BindJsonData(&param); err != nil {
logs.Error(err)
c.ResponseError(errors.New("json数据解析失败"))
return
}
if param.PageNumber == 0 {
param.PageNumber = 1
}
if param.PageSize == 0 {
param.PageSize = 20
}
orderSrv := orderService.NewOrderInfoService(nil)
orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{
PartnerId: param.Partner,
DeliveryCode: param.SearchText,
OrderType: domain.OrderReal,
Limit: param.PageSize,
Offset: (param.PageNumber - 1) * param.PageSize,
})
if err != nil {
c.ResponseError(err)
return
}
rsp := []map[string]interface{}{}
for i := range orderinfos {
orderinfo := orderinfos[i]
m := map[string]interface{}{
"createTime": orderinfo.CreateTime.Local().Format("2006-01-02 15:04:05"),
"updateTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:05"),
"buyer": orderinfo.Buyer.BuyerName,
"id": orderinfo.Id,
"orderId": orderinfo.OrderCode,
"shipmentsId": orderinfo.DeliveryCode,
"partner": orderinfo.PartnerInfo.PartnerName,
"orderNum": orderinfo.OrderCompute.PlanOrderCount,
"orderPrice": orderinfo.OrderCompute.PlanOrderAmount,
"orderDist": orderinfo.RegionInfo.RegionName,
"quantityControl": "",
"priceControl": "",
}
if orderinfo.OrderCompute.UseOrderCount >= 0 {
m["quantityControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
}
if orderinfo.OrderCompute.UseOrderAmount >= 0 {
m["priceControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
}
rsp = append(rsp, m)
}
c.ResponsePageList(rsp, cnt, param.PageNumber)
return
}
... ...
... ... @@ -38,13 +38,14 @@ func init() {
// beego.NSRouter("/purpose/detail", &controllers.OrderController{}, "POST:GetOrderPurpose"),
// beego.NSRouter("/purpose/del", &controllers.OrderController{}, "POST:RemoveOrderPurpose"),
//beego.NSRouter("/purpose/convert", &controllers.OrderController{}, "POST:OrderPurposeToReal"),
// beego.NSRouter("/actual/list", &controllers.OrderController{}, "POST:PageListOrderReal"),
beego.NSRouter("/purpose/list", &controllers.OrderInfoController{}, "POST:PageListOrderPurpose"),
beego.NSRouter("/purpose/update", &controllers.OrderInfoController{}, "POST:UpdateOrderPurpose"),
beego.NSRouter("/purpose/detail", &controllers.OrderInfoController{}, "POST:GetOrderPurpose"),
beego.NSRouter("/purpose/del", &controllers.OrderInfoController{}, "POST:RemoveOrderPurpose"),
beego.NSRouter("/purpose/sendout", &controllers.OrderInfoController{}, "POST:OrderPurposeDelivery"),
beego.NSRouter("/actual/list", &controllers.OrderInfoController{}, "POST:PageListOrderReal"),
beego.NSRouter("/actual/list", &controllers.OrderController{}, "POST:PageListOrderReal"),
beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"),
beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"),
),
... ...