物料订单补允许取消

This commit is contained in:
苏尹岚
2020-03-16 16:40:14 +08:00
parent cd371f6bad
commit 6ebc151a31

View File

@@ -910,7 +910,7 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
}
}
MarkArrears(db, order, orderPay)
CancelMatterOrder(db, order)
CancelMatterOrder(db, order, reason)
} else {
orderPay.Status = model.PayStatusCanceled
_, err2 := dao.UpdateEntity(db, orderPay)
@@ -927,7 +927,7 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
}
err = errList.GetErrListAsOne()
if len(payList) == 0 {
CancelMatterOrder(db, order)
CancelMatterOrder(db, order, "")
}
} else {
err = fmt.Errorf("当前订单状态:%s不允许取消", model.OrderStatusName[order.Status])
@@ -935,9 +935,13 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
return err
}
func CancelMatterOrder(db *dao.DaoDB, order *model.GoodsOrder) (err error) {
func CancelMatterOrder(db *dao.DaoDB, order *model.GoodsOrder, reason string) (err error) {
if order.FromStoreID != 0 {
if order.EclpOutID != "" {
//表示是京西的物料订单的子订单(拆分后的订单)
if len(order.VendorOrderID) == 16 && order.VendorID == model.VendorIDJX {
return fmt.Errorf("不允许取消该子订单请取消主订单进行退货退款主订单ID :[%v]", order.VendorOrderID[:len(order.VendorOrderID)-2])
}
_, err = api.JdEclpAPI.CancelOrder(order.EclpOutID)
} else {
var goodsList []*model.GoodsOrder
@@ -947,6 +951,7 @@ func CancelMatterOrder(db *dao.DaoDB, order *model.GoodsOrder) (err error) {
if err == nil && len(goodsList) > 0 {
for _, v := range goodsList {
_, err = api.JdEclpAPI.CancelOrder(v.EclpOutID)
changeOrderStatus(v.VendorOrderID, model.OrderStatusCanceled, reason)
}
}
}