作者 tangxvhui

实际订单详情

... ... @@ -107,6 +107,10 @@ func (c *OrderInfoController) GetOrderPurpose() {
c.ResponseError(err)
return
}
if orderinfo.OrderType != domain.OrderIntention {
c.ResponseError(errors.New("参数错误"))
return
}
allGoods := []map[string]interface{}{}
for _, v := range orderinfo.Goods {
m := map[string]interface{}{
... ... @@ -368,3 +372,74 @@ func (c *OrderInfoController) PageListOrderReal() {
c.ResponsePageList(rsp, cnt, param.PageNumber)
return
}
//GetOrderReal 获取实发订单详情
func (c *OrderInfoController) GetOrderReal() {
type Parameter struct {
Id string `json:"id"`
}
var (
param Parameter
err error
)
if err = c.BindJsonData(&param); err != nil {
logs.Error(err)
c.ResponseError(errors.New("json数据解析失败"))
return
}
orderid, _ := strconv.ParseInt(param.Id, 10, 64)
orderSrv := orderService.NewOrderInfoService(nil)
orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{
OrderId: orderid,
})
if err != nil {
c.ResponseError(err)
return
}
if orderinfo.OrderType != domain.OrderReal {
c.ResponseError(errors.New("参数错误"))
return
}
allGoods := []map[string]interface{}{}
for _, v := range orderinfo.Goods {
m := map[string]interface{}{
"productName": v.GoodName,
"orderNum": v.PlanGoodNumber,
"univalence": v.Price,
"partnerRatio": v.PartnerBonusPercent,
"orderPrice": v.GoodCompute.PlanAmount,
"quantityControl": "",
"priceControl": "",
}
if v.GoodCompute.UseAmount >= 0 {
m["priceControl"] = fmt.Sprint(v.GoodCompute.UseAmount)
}
if v.UseGoodNumber >= 0 {
m["quantityControl"] = fmt.Sprint(v.UseGoodNumber)
}
allGoods = append(allGoods, m)
}
rsp := map[string]interface{}{
"buyer": orderinfo.Buyer.BuyerName,
"id": orderinfo.Id,
"partnerID": orderinfo.PartnerInfo.Id,
"partnerName": orderinfo.PartnerInfo.PartnerName,
"orderDist": orderinfo.RegionInfo.RegionName,
"orderId": orderinfo.OrderCode,
"shipmentsId": orderinfo.DeliveryCode,
"commissionProportion": orderinfo.SalesmanBonusPercent,
"orderNumCount": orderinfo.OrderCompute.PlanOrderCount,
"orderAmountAdjustmentCount": orderinfo.OrderCompute.PlanOrderAmount,
"orderNumCountControl": "",
"orderAmountAdjustmentCountControl": "",
"product": allGoods,
}
if orderinfo.OrderCompute.UseOrderAmount >= 0 {
rsp["orderNumCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount)
}
if orderinfo.OrderCompute.UseOrderCount >= 0 {
rsp["orderAmountAdjustmentCountControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount)
}
c.ResponseData(rsp)
return
}
... ...
... ... @@ -45,9 +45,9 @@ func init() {
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/detail", &controllers.OrderInfoController{}, "POST:GetOrderReal"),
beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"),
beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"),
),
beego.NSNamespace("/common",
... ...