|
|
|
package wholesale
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
OrderCancelStatusSuccess = 1 // 取消成功
|
|
|
|
OrderCancelStatusFail = 2 // 取消失败
|
|
|
|
)
|
|
|
|
|
|
|
|
type order struct {
|
|
|
|
}
|
|
|
|
type ArgsOrderSplit struct {
|
|
|
|
Source source // 商品来源
|
|
|
|
ParentSourceOrderSn string // 上级订单号
|
|
|
|
OrderSubs []OrderSub // 子订单
|
|
|
|
}
|
|
|
|
type OrderSub struct {
|
|
|
|
SourceOrderSn string // 供应商订单号
|
|
|
|
FreightFee decimal.Decimal // 运费
|
|
|
|
OrderFee decimal.Decimal // 订单金额
|
|
|
|
Skus []OrderSplitSkuItem // 拆分订单sku
|
|
|
|
}
|
|
|
|
type OrderSplitSkuItem struct {
|
|
|
|
SourceSkuId string
|
|
|
|
Quantity uint
|
|
|
|
SupplyPrice decimal.Decimal
|
|
|
|
}
|
|
|
|
|
|
|
|
// Split @Title 拆单
|
|
|
|
func (o *order) Split(ctx context.Context, args ArgsOrderSplit) (err error) {
|
|
|
|
xClient, err := client.GetClient(o)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
reply := 0
|
|
|
|
err = xClient.Call(ctx, "Split", args, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsOrderFreightFee struct {
|
|
|
|
Source source
|
|
|
|
OrderFreightFees []OrderFreightFee
|
|
|
|
}
|
|
|
|
type OrderFreightFee struct {
|
|
|
|
SourceOrderSn string // 供应商订单号
|
|
|
|
FreightFee decimal.Decimal // 运费
|
|
|
|
}
|
|
|
|
|
|
|
|
// FreightFee @Title 运费处理
|
|
|
|
func (o *order) FreightFee(ctx context.Context, args ArgsOrderFreightFee) {
|
|
|
|
xClient, err := client.GetClient(o)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
reply := 0
|
|
|
|
err = xClient.Call(ctx, "FreightFee", args, &reply)
|
|
|
|
return
|
|
|
|
}
|