作者 tangxvhui

实际订单详情

@@ -107,6 +107,10 @@ func (c *OrderInfoController) GetOrderPurpose() { @@ -107,6 +107,10 @@ func (c *OrderInfoController) GetOrderPurpose() {
107 c.ResponseError(err) 107 c.ResponseError(err)
108 return 108 return
109 } 109 }
  110 + if orderinfo.OrderType != domain.OrderIntention {
  111 + c.ResponseError(errors.New("参数错误"))
  112 + return
  113 + }
110 allGoods := []map[string]interface{}{} 114 allGoods := []map[string]interface{}{}
111 for _, v := range orderinfo.Goods { 115 for _, v := range orderinfo.Goods {
112 m := map[string]interface{}{ 116 m := map[string]interface{}{
@@ -368,3 +372,74 @@ func (c *OrderInfoController) PageListOrderReal() { @@ -368,3 +372,74 @@ func (c *OrderInfoController) PageListOrderReal() {
368 c.ResponsePageList(rsp, cnt, param.PageNumber) 372 c.ResponsePageList(rsp, cnt, param.PageNumber)
369 return 373 return
370 } 374 }
  375 +
  376 +//GetOrderReal 获取实发订单详情
  377 +func (c *OrderInfoController) GetOrderReal() {
  378 + type Parameter struct {
  379 + Id string `json:"id"`
  380 + }
  381 + var (
  382 + param Parameter
  383 + err error
  384 + )
  385 + if err = c.BindJsonData(&param); err != nil {
  386 + logs.Error(err)
  387 + c.ResponseError(errors.New("json数据解析失败"))
  388 + return
  389 + }
  390 + orderid, _ := strconv.ParseInt(param.Id, 10, 64)
  391 + orderSrv := orderService.NewOrderInfoService(nil)
  392 + orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{
  393 + OrderId: orderid,
  394 + })
  395 + if err != nil {
  396 + c.ResponseError(err)
  397 + return
  398 + }
  399 + if orderinfo.OrderType != domain.OrderReal {
  400 + c.ResponseError(errors.New("参数错误"))
  401 + return
  402 + }
  403 + allGoods := []map[string]interface{}{}
  404 + for _, v := range orderinfo.Goods {
  405 + m := map[string]interface{}{
  406 + "productName": v.GoodName,
  407 + "orderNum": v.PlanGoodNumber,
  408 + "univalence": v.Price,
  409 + "partnerRatio": v.PartnerBonusPercent,
  410 + "orderPrice": v.GoodCompute.PlanAmount,
  411 + "quantityControl": "",
  412 + "priceControl": "",
  413 + }
  414 + if v.GoodCompute.UseAmount >= 0 {
  415 + m["priceControl"] = fmt.Sprint(v.GoodCompute.UseAmount)
  416 + }
  417 + if v.UseGoodNumber >= 0 {
  418 + m["quantityControl"] = fmt.Sprint(v.UseGoodNumber)
  419 + }
  420 + allGoods = append(allGoods, m)
  421 + }
  422 + rsp := map[string]interface{}{
  423 + "buyer": orderinfo.Buyer.BuyerName,
  424 + "id": orderinfo.Id,
  425 + "partnerID": orderinfo.PartnerInfo.Id,
  426 + "partnerName": orderinfo.PartnerInfo.PartnerName,
  427 + "orderDist": orderinfo.RegionInfo.RegionName,
  428 + "orderId": orderinfo.OrderCode,
  429 + "shipmentsId": orderinfo.DeliveryCode,
  430 + "commissionProportion": orderinfo.SalesmanBonusPercent,
  431 + "orderNumCount": orderinfo.OrderCompute.PlanOrderCount,
  432 + "orderAmountAdjustmentCount": orderinfo.OrderCompute.PlanOrderAmount,
  433 + "orderNumCountControl": "",
  434 + "orderAmountAdjustmentCountControl": "",
  435 + "product": allGoods,
  436 + }
  437 + if orderinfo.OrderCompute.UseOrderAmount >= 0 {
  438 + rsp["orderNumCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
  439 + }
  440 + if orderinfo.OrderCompute.UseOrderCount >= 0 {
  441 + rsp["orderAmountAdjustmentCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
  442 + }
  443 + c.ResponseData(rsp)
  444 + return
  445 +}
@@ -45,9 +45,9 @@ func init() { @@ -45,9 +45,9 @@ func init() {
45 beego.NSRouter("/purpose/del", &controllers.OrderInfoController{}, "POST:RemoveOrderPurpose"), 45 beego.NSRouter("/purpose/del", &controllers.OrderInfoController{}, "POST:RemoveOrderPurpose"),
46 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"), 47 beego.NSRouter("/actual/list", &controllers.OrderInfoController{}, "POST:PageListOrderReal"),
  48 + beego.NSRouter("/actual/detail", &controllers.OrderInfoController{}, "POST:GetOrderReal"),
48 49
49 beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"), 50 beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"),
50 - beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"),  
51 ), 51 ),
52 52
53 beego.NSNamespace("/common", 53 beego.NSNamespace("/common",