fix:订单详情

This commit is contained in:
momo
2023-09-21 12:11:15 +08:00
parent 37fc648025
commit 30ae7eb814
11 changed files with 178 additions and 35 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"fusenapi/constants"
"fusenapi/model/gmodel"
"fusenapi/utils/basic"
@@ -79,16 +78,21 @@ func (d *defaultOrder) Detail(ctx context.Context, in *DetailReq) (res *DetailRe
return &DetailRes{}, nil
}
func (d *defaultOrder) OrderDetailHandler(ctx context.Context, order *gmodel.FsOrder) (res *DetailRes, err error) {
func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel.FsOrder) (res *DetailRes, err error) {
var orderDetail gmodel.OrderDetail
err = json.Unmarshal(*order.Metadata, &orderDetail)
err = json.Unmarshal(*orderInfo.Metadata, &orderDetail)
if err != nil {
logx.Errorf("create handler unmarshal metadata failed, err: %v", err)
return nil, err
}
fmt.Println(orderDetail)
for _, orderProduct := range orderDetail.OrderProduct {
orderProduct.TotalPrice = order.GetAmountInfoFormat(&orderProduct.TotalPrice)
orderProduct.ItemPrice = order.GetAmountInfoFormat(&orderProduct.ItemPrice)
orderProduct.ShoppingCartSnapshot = nil
}
orderDetail.OrderInfo.StatusLink = order.GetOrderStatusLinkUser(orderDetail.OrderInfo.DeliveryMethod, orderDetail.OrderInfo.StatusLink)
orderDetail.OrderAmount.Deposit.PayAmount = order.GetAmountInfoFormat(&orderDetail.OrderAmount.Deposit.PayAmount)
return nil, nil
}
@@ -294,7 +298,8 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
Cm: shoppingCartSnapshot.SizeInfo.Cm,
},
},
StepNum: stepNum,
StepNum: stepNum,
IsHighlyCustomized: *shoppingCart.IsHighlyCustomized,
})
}