会员
This commit is contained in:
@@ -916,34 +916,35 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
|||||||
if IsDeliverySelf {
|
if IsDeliverySelf {
|
||||||
outJxOrder.FreightPrice = 0
|
outJxOrder.FreightPrice = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断用户是否是会员
|
|
||||||
var (
|
|
||||||
tuserID string
|
|
||||||
dicountCards []*model.DiscountCard
|
|
||||||
)
|
|
||||||
if userID == "" {
|
|
||||||
tuserID = deliveryAddress.UserID
|
|
||||||
} else {
|
|
||||||
tuserID = userID
|
|
||||||
}
|
|
||||||
userMembers, _ := dao.GetUserMember(db, tuserID, "", model.MemberTypeDiscountCard)
|
|
||||||
if len(userMembers) > 0 {
|
|
||||||
if configList, err := dao.QueryConfigs(db, "会员折扣卡", model.ConfigTypeDiscountCard, ""); err == nil {
|
|
||||||
jxutils.Strings2Objs(configList[0].Value, &dicountCards)
|
|
||||||
discountCard := findDiscountCard(dicountCards, userMembers[0].MemberTypeID)
|
|
||||||
outJxOrder.OrderPrice = outJxOrder.OrderPrice * int64(discountCard.PicePercentage) / 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if jxOrder.OrderType == model.OrderTypeNormal {
|
if jxOrder.OrderType == model.OrderTypeNormal {
|
||||||
|
outJxOrder.TotalPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice
|
||||||
}
|
// 判断用户是否是会员
|
||||||
outJxOrder.TotalPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice
|
var (
|
||||||
outJxOrder.ActualPayPrice = outJxOrder.TotalPrice
|
tuserID string
|
||||||
if jxOrder.OrderType == model.OrderTypeDefendPrice {
|
dicountCards []*model.DiscountCard
|
||||||
|
)
|
||||||
|
if userID == "" {
|
||||||
|
tuserID = deliveryAddress.UserID
|
||||||
|
} else {
|
||||||
|
tuserID = userID
|
||||||
|
}
|
||||||
|
userMembers, _ := dao.GetUserMember(db, tuserID, "", model.MemberTypeDiscountCard)
|
||||||
|
if len(userMembers) > 0 {
|
||||||
|
if configList, err := dao.QueryConfigs(db, "会员折扣卡", model.ConfigTypeDiscountCard, ""); err == nil {
|
||||||
|
jxutils.Strings2Objs(configList[0].Value, &dicountCards)
|
||||||
|
discountCard := findDiscountCard(dicountCards, userMembers[0].MemberTypeID)
|
||||||
|
outJxOrder.OrderPrice = outJxOrder.OrderPrice * int64(discountCard.PicePercentage) / 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outJxOrder.ActualPayPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice
|
||||||
|
} else if jxOrder.OrderType == model.OrderTypeDefendPrice {
|
||||||
outJxOrder.Skus[0].DefendPrice = jxOrder.Skus[0].DefendPrice
|
outJxOrder.Skus[0].DefendPrice = jxOrder.Skus[0].DefendPrice
|
||||||
|
|
||||||
|
} else {
|
||||||
|
outJxOrder.TotalPrice = outJxOrder.OrderPrice + outJxOrder.FreightPrice
|
||||||
|
outJxOrder.ActualPayPrice = outJxOrder.TotalPrice
|
||||||
}
|
}
|
||||||
if jxOrder.UserID != "" {
|
if jxOrder.UserID != "" {
|
||||||
outJxOrder.UserID = jxOrder.UserID
|
outJxOrder.UserID = jxOrder.UserID
|
||||||
|
|||||||
Reference in New Issue
Block a user