用户订单列表完善
This commit is contained in:
parent
421b63846a
commit
2f5ce8dd77
|
@ -88,6 +88,7 @@ func (o *FsOrderModel) FindPageListByPage(ctx context.Context, rowBuilder *gorm.
|
|||
type FsOrderRel struct {
|
||||
FsOrder
|
||||
FsOrderDetails []FsOrderDetails `gorm:"foreignKey:order_id;references:id"`
|
||||
FsOrderAffiliateInfo FsOrderAffiliate `gorm:"foreignKey:order_id;references:id"`
|
||||
}
|
||||
|
||||
type FsOrderDetails struct {
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/format"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"context"
|
||||
|
||||
|
@ -47,7 +48,11 @@ func (l *UserOrderListLogic) UserOrderList(req *types.UserOrderListReq, userinfo
|
|||
var page = req.Page
|
||||
var pageSize = req.PageSize
|
||||
var listRes []*gmodel.FsOrderRel
|
||||
rowBuilder = rowBuilder.Where("user_id =?", userinfo.UserId).Where("status =?", req.Status)
|
||||
rowBuilder = rowBuilder.Where("user_id =?", userinfo.UserId)
|
||||
|
||||
if req.Status != -1 {
|
||||
rowBuilder = rowBuilder.Where("status = ?", req.Status)
|
||||
}
|
||||
|
||||
// 查询总数
|
||||
total, err := orderModel.FindCount(l.ctx, rowBuilder, nil)
|
||||
|
@ -61,7 +66,7 @@ func (l *UserOrderListLogic) UserOrderList(req *types.UserOrderListReq, userinfo
|
|||
|
||||
// 查询数据
|
||||
if total > 0 {
|
||||
rowBuilder = rowBuilder.Preload("FsOrderDetails", func(dbPreload *gorm.DB) *gorm.DB {
|
||||
rowBuilder = rowBuilder.Preload("FsOrderAffiliateInfo").Preload("FsOrderDetails", func(dbPreload *gorm.DB) *gorm.DB {
|
||||
return dbPreload.Table(orderDetailModel.TableName()).Preload("FsOrderDetailTemplateInfo").Preload("FsProductInfo")
|
||||
})
|
||||
listRes, err = orderModel.FindPageListByPage(l.ctx, rowBuilder, &page, &pageSize, nil, "")
|
||||
|
@ -125,9 +130,34 @@ func (l *UserOrderListLogic) UserOrderList(req *types.UserOrderListReq, userinfo
|
|||
pbData.ProductList = productList
|
||||
}
|
||||
|
||||
var surplusAt int64
|
||||
surplusAt = (*item.Ctime + constants.CANCLE_ORDER_EXPIRE) - time.Now().Unix()
|
||||
if surplusAt < 0 {
|
||||
surplusAt = 0
|
||||
}
|
||||
//fsOrderAffiliateInfo := item.FsOrderAffiliateInfo
|
||||
|
||||
// 流程控制
|
||||
// statusTime := make([]*types.StatusTime,8)
|
||||
// statusTime[0] = &types.StatusTime{
|
||||
// Key: 1,Time:*fsOrderAffiliateInfo.SureTime,
|
||||
// }
|
||||
// statusTime[1] = &types.StatusTime{
|
||||
// Key: 1,Time:*ifsOrderAffiliateInfo.ProductTime,
|
||||
// }
|
||||
|
||||
// `sure_time` int(10) unsigned DEFAULT '0' COMMENT '确认时间',
|
||||
// `product_time` int(10) unsigned DEFAULT '0' COMMENT '生产时间',
|
||||
// `product_endtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '生成完成时间',
|
||||
// `deliver_time` int(10) unsigned DEFAULT '0' COMMENT '发货时间',
|
||||
// `ups_deliver_time` int(10) unsigned DEFAULT '0' COMMENT 'ups发货时间',
|
||||
// `ups_time` int(10) unsigned DEFAULT '0' COMMENT 'UPS提货时间',
|
||||
// `arrival_time` int(10) unsigned DEFAULT '0' COMMENT '到达云仓的时间',
|
||||
// `recevie_time` int(10) unsigned DEFAULT '0' COMMENT '云仓收货时间',
|
||||
|
||||
pbData.PcsBox = pcsBox
|
||||
pbData.Pcs = pcs
|
||||
pbData.SurplusAt = *item.Ctime + constants.CANCLE_ORDER_EXPIRE
|
||||
pbData.SurplusAt = surplusAt
|
||||
pbData.LogisticsStatus = 1
|
||||
pbData.Deposit = *item.TotalAmount / 2
|
||||
pbData.Remaining = pbData.Deposit
|
||||
|
|
Loading…
Reference in New Issue
Block a user