作者 tangxvhui

实际订单列表

@@ -12,4 +12,6 @@ type ListOrderBaseQuery struct { @@ -12,4 +12,6 @@ type ListOrderBaseQuery struct {
12 Limit int `json:"limit"` 12 Limit int `json:"limit"`
13 //订单类型 13 //订单类型
14 OrderType int `json:"orderType"` 14 OrderType int `json:"orderType"`
  15 + //发货单号
  16 + DeliveryCode string `json:"deliveryCode"`
15 } 17 }
@@ -44,6 +44,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder @@ -44,6 +44,7 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder
44 Offset: listOrderQuery.Offset, 44 Offset: listOrderQuery.Offset,
45 Limit: listOrderQuery.Limit, 45 Limit: listOrderQuery.Limit,
46 OrderType: listOrderQuery.OrderType, 46 OrderType: listOrderQuery.OrderType,
  47 + DeliveryCode: listOrderQuery.DeliveryCode,
47 } 48 }
48 orders, cnt, err = orderRepository.Find(query) 49 orders, cnt, err = orderRepository.Find(query)
49 if err != nil { 50 if err != nil {
@@ -2,6 +2,7 @@ package controllers @@ -2,6 +2,7 @@ package controllers
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
  5 + "fmt"
5 "strconv" 6 "strconv"
6 "time" 7 "time"
7 8
@@ -302,3 +303,68 @@ func (c *OrderInfoController) OrderPurposeDelivery() { @@ -302,3 +303,68 @@ func (c *OrderInfoController) OrderPurposeDelivery() {
302 c.ResponseData(nil) 303 c.ResponseData(nil)
303 return 304 return
304 } 305 }
  306 +
  307 +//PageListOrderReal 获取实发订单列表
  308 +func (c *OrderInfoController) PageListOrderReal() {
  309 + type Parameter struct {
  310 + SearchText string `json:"searchText"`
  311 + Partner int64 `json:"partner"`
  312 + PageSize int `json:"pageSize"`
  313 + PageNumber int `json:"pageNumber"`
  314 + }
  315 + var (
  316 + param Parameter
  317 + err error
  318 + )
  319 + if err = c.BindJsonData(&param); err != nil {
  320 + logs.Error(err)
  321 + c.ResponseError(errors.New("json数据解析失败"))
  322 + return
  323 + }
  324 + if param.PageNumber == 0 {
  325 + param.PageNumber = 1
  326 + }
  327 + if param.PageSize == 0 {
  328 + param.PageSize = 20
  329 + }
  330 +
  331 + orderSrv := orderService.NewOrderInfoService(nil)
  332 + orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{
  333 + PartnerId: param.Partner,
  334 + DeliveryCode: param.SearchText,
  335 + OrderType: domain.OrderReal,
  336 + Limit: param.PageSize,
  337 + Offset: (param.PageNumber - 1) * param.PageSize,
  338 + })
  339 + if err != nil {
  340 + c.ResponseError(err)
  341 + return
  342 + }
  343 + rsp := []map[string]interface{}{}
  344 + for i := range orderinfos {
  345 + orderinfo := orderinfos[i]
  346 + m := map[string]interface{}{
  347 + "createTime": orderinfo.CreateTime.Local().Format("2006-01-02 15:04:05"),
  348 + "updateTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:05"),
  349 + "buyer": orderinfo.Buyer.BuyerName,
  350 + "id": orderinfo.Id,
  351 + "orderId": orderinfo.OrderCode,
  352 + "shipmentsId": orderinfo.DeliveryCode,
  353 + "partner": orderinfo.PartnerInfo.PartnerName,
  354 + "orderNum": orderinfo.OrderCompute.PlanOrderCount,
  355 + "orderPrice": orderinfo.OrderCompute.PlanOrderAmount,
  356 + "orderDist": orderinfo.RegionInfo.RegionName,
  357 + "quantityControl": "",
  358 + "priceControl": "",
  359 + }
  360 + if orderinfo.OrderCompute.UseOrderCount >= 0 {
  361 + m["quantityControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
  362 + }
  363 + if orderinfo.OrderCompute.UseOrderAmount >= 0 {
  364 + m["priceControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
  365 + }
  366 + rsp = append(rsp, m)
  367 + }
  368 + c.ResponsePageList(rsp, cnt, param.PageNumber)
  369 + return
  370 +}
@@ -38,13 +38,14 @@ func init() { @@ -38,13 +38,14 @@ func init() {
38 // beego.NSRouter("/purpose/detail", &controllers.OrderController{}, "POST:GetOrderPurpose"), 38 // beego.NSRouter("/purpose/detail", &controllers.OrderController{}, "POST:GetOrderPurpose"),
39 // beego.NSRouter("/purpose/del", &controllers.OrderController{}, "POST:RemoveOrderPurpose"), 39 // beego.NSRouter("/purpose/del", &controllers.OrderController{}, "POST:RemoveOrderPurpose"),
40 //beego.NSRouter("/purpose/convert", &controllers.OrderController{}, "POST:OrderPurposeToReal"), 40 //beego.NSRouter("/purpose/convert", &controllers.OrderController{}, "POST:OrderPurposeToReal"),
  41 + // beego.NSRouter("/actual/list", &controllers.OrderController{}, "POST:PageListOrderReal"),
41 beego.NSRouter("/purpose/list", &controllers.OrderInfoController{}, "POST:PageListOrderPurpose"), 42 beego.NSRouter("/purpose/list", &controllers.OrderInfoController{}, "POST:PageListOrderPurpose"),
42 beego.NSRouter("/purpose/update", &controllers.OrderInfoController{}, "POST:UpdateOrderPurpose"), 43 beego.NSRouter("/purpose/update", &controllers.OrderInfoController{}, "POST:UpdateOrderPurpose"),
43 beego.NSRouter("/purpose/detail", &controllers.OrderInfoController{}, "POST:GetOrderPurpose"), 44 beego.NSRouter("/purpose/detail", &controllers.OrderInfoController{}, "POST:GetOrderPurpose"),
44 beego.NSRouter("/purpose/del", &controllers.OrderInfoController{}, "POST:RemoveOrderPurpose"), 45 beego.NSRouter("/purpose/del", &controllers.OrderInfoController{}, "POST:RemoveOrderPurpose"),
45 beego.NSRouter("/purpose/sendout", &controllers.OrderInfoController{}, "POST:OrderPurposeDelivery"), 46 beego.NSRouter("/purpose/sendout", &controllers.OrderInfoController{}, "POST:OrderPurposeDelivery"),
  47 + beego.NSRouter("/actual/list", &controllers.OrderInfoController{}, "POST:PageListOrderReal"),
46 48
47 - beego.NSRouter("/actual/list", &controllers.OrderController{}, "POST:PageListOrderReal"),  
48 beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"), 49 beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"),
49 beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"), 50 beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"),
50 ), 51 ),