新增字段
This commit is contained in:
@@ -30,6 +30,7 @@ const (
|
|||||||
OrderTypeNormal = 0 //普通订单
|
OrderTypeNormal = 0 //普通订单
|
||||||
OrderTypeMatter = 0 //物料订单
|
OrderTypeMatter = 0 //物料订单
|
||||||
OrderTypeSupplyGoods = 2 //进货订单
|
OrderTypeSupplyGoods = 2 //进货订单
|
||||||
|
OrderTypeDefendPrice = 3 //守价订单
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -387,11 +388,13 @@ type PriceDefendOrder struct {
|
|||||||
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
|
||||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||||
SkuID int `orm:"column(sku_id)" json:"skuID"`
|
SkuID int `orm:"column(sku_id)" json:"skuID"`
|
||||||
AddressID int `orm:"column(address_id)" json:"addressID"`
|
AddressID int64 `orm:"column(address_id)" json:"addressID"`
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
DefendPrice int64 `json:"defendPrice"`
|
DefendPrice int64 `json:"defendPrice"` //守的价格
|
||||||
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
ActualPayPrice int64 `json:"actualPayPrice"` //单位为分 顾客实际支付
|
||||||
IsBuyNowPrice int `json:"isBuyNowPrice"`
|
IsBuyNowPrice int `json:"isBuyNowPrice"` //库存剩x(x=当前客户购买的数量)时以当时价抢购
|
||||||
|
Issue int `json:"issue"` //期数,每晚22:00以后的守价单是归在第二天的期数中
|
||||||
|
IsSuccess int `json:"isSuccess"` //是否抢购成功
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *PriceDefendOrder) TableIndex() [][]string {
|
func (v *PriceDefendOrder) TableIndex() [][]string {
|
||||||
|
|||||||
@@ -106,12 +106,13 @@ type JxOrderInfo struct {
|
|||||||
OrderPrice int64 `json:"orderPrice"` // 单位为分 订单商品价格
|
OrderPrice int64 `json:"orderPrice"` // 单位为分 订单商品价格
|
||||||
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
ActualPayPrice int64 `json:"actualPayPrice"` // 单位为分 顾客实际支付
|
||||||
|
|
||||||
OrderID int64 `json:"orderID"`
|
OrderID int64 `json:"orderID"`
|
||||||
StoreName string `json:"storeName"`
|
StoreName string `json:"storeName"`
|
||||||
Weight int `json:"weight"`
|
Weight int `json:"weight"`
|
||||||
FromStoreID int `json:"fromStoreID"`
|
FromStoreID int `json:"fromStoreID"`
|
||||||
EarningType int `json:"earningType"`
|
EarningType int `json:"earningType"`
|
||||||
OrderType int `json:"orderType"`
|
OrderType int `json:"orderType"`
|
||||||
|
IsBuyNowPrice int `json:"isBuyNowPrice"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeliveryTimeItem struct {
|
type DeliveryTimeItem struct {
|
||||||
@@ -230,7 +231,14 @@ func CreateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64,
|
|||||||
if fromStoreID != 0 {
|
if fromStoreID != 0 {
|
||||||
checkMatterDeliveryAddress(deliveryAddress)
|
checkMatterDeliveryAddress(deliveryAddress)
|
||||||
}
|
}
|
||||||
if createType != OrderCreateTypePre {
|
if createType == OrderCreateTypePre {
|
||||||
|
if jxOrder.OrderType == model.OrderTypeDefendPrice {
|
||||||
|
buildDefendPriceOrder(ctx, jxOrder, addressID)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if jxOrder.OrderType == model.OrderTypeDefendPrice {
|
||||||
|
return
|
||||||
|
}
|
||||||
if outJxOrder.TotalPrice != jxOrder.TotalPrice {
|
if outJxOrder.TotalPrice != jxOrder.TotalPrice {
|
||||||
return nil, fmt.Errorf("商品或配送信息发生改变,请重新下单")
|
return nil, fmt.Errorf("商品或配送信息发生改变,请重新下单")
|
||||||
}
|
}
|
||||||
@@ -245,6 +253,31 @@ func CreateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64,
|
|||||||
return outJxOrder, err
|
return outJxOrder, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func buildDefendPriceOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64) {
|
||||||
|
var (
|
||||||
|
issue = 0
|
||||||
|
db = dao.GetDB()
|
||||||
|
)
|
||||||
|
//属于下一期
|
||||||
|
if time.Now().Hour() >= 22 {
|
||||||
|
issue = utils.Str2Int(time.Now().AddDate(0, 0, 1).Format("20060102"))
|
||||||
|
} else {
|
||||||
|
issue = utils.Str2Int(time.Now().Format("20060102"))
|
||||||
|
}
|
||||||
|
priceDefendOrder := &model.PriceDefendOrder{
|
||||||
|
VendorOrderID: utils.Int64ToStr(GenOrderNo(ctx)),
|
||||||
|
StoreID: jxOrder.StoreID,
|
||||||
|
SkuID: jxOrder.Skus[0].SkuID,
|
||||||
|
AddressID: addressID,
|
||||||
|
Count: jxOrder.Skus[0].Count,
|
||||||
|
DefendPrice: jxOrder.Skus[0].Price,
|
||||||
|
IsBuyNowPrice: jxOrder.IsBuyNowPrice,
|
||||||
|
Issue: issue,
|
||||||
|
}
|
||||||
|
priceDefendOrder.ActualPayPrice = int64(priceDefendOrder.Count) * priceDefendOrder.DefendPrice
|
||||||
|
dao.CreateEntity(db, &priceDefendOrder)
|
||||||
|
}
|
||||||
|
|
||||||
// 买家取消(或申请取消)订单
|
// 买家取消(或申请取消)订单
|
||||||
func BuyerCancelOrder(ctx *jxcontext.Context, orderID int64, reason string) (canceled bool, err error) {
|
func BuyerCancelOrder(ctx *jxcontext.Context, orderID int64, reason string) (canceled bool, err error) {
|
||||||
order, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(orderID), model.VendorIDJX)
|
order, err := partner.CurOrderManager.LoadOrder(utils.Int64ToStr(orderID), model.VendorIDJX)
|
||||||
|
|||||||
Reference in New Issue
Block a user