|
|
package req
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/shopspring/decimal"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
// Item 商品明细.
|
|
|
type Item struct {
|
|
|
SkuID string `json:"sku_id"` // ERP内商品编码 长度<=40
|
|
|
ShopSkuId string `json:"shop_sku_id"` // 店铺商品编码 长度<=128
|
|
|
Amount decimal.Decimal `json:"amount"` // 应付金额,保留两位小数,单位(元)
|
|
|
BasePrice decimal.Decimal `json:"base_price"` // 基本价
|
|
|
Qty uint `json:"qty"` // 数量
|
|
|
Name string `json:"name"` // 商品名字
|
|
|
OuterOiID string `json:"outer_oi_id"` // 商家系统订单商品明细主键,为了拆单合单时溯源,最长不超过 50,保持唯一
|
|
|
Pic string `json:"pic"` // 图片
|
|
|
PropertiesValue string `json:"properties_value"` // 属性
|
|
|
}
|
|
|
|
|
|
// PayDetail WAIT_BUYER_PAY 状态可以不给.
|
|
|
type PayDetail struct {
|
|
|
OuterPayID string `json:"outer_pay_id"` // 外部支付单号,最大50
|
|
|
PayDate string `json:"pay_date"` // 支付日期
|
|
|
Payment string `json:"payment"` // 支付方式,最大20
|
|
|
SellerAccount string `json:"seller_account"` // 卖家支付账号,最大 50
|
|
|
BuyerAccount string `json:"buyer_account"` // 买家支付账号,最大 200
|
|
|
Amount decimal.Decimal `json:"amount"` // 支付金额
|
|
|
}
|
|
|
|
|
|
// Order 聚水潭订单.
|
|
|
type Order struct {
|
|
|
ShopID uint `json:"shop_id"` // 店铺编号
|
|
|
SoID string `json:"so_id"` // 线上订单号 长度 <= 50
|
|
|
OrderDate string `json:"order_date"` // 订单日期 2018-09-01 23:59:11
|
|
|
ShopStatus string `json:"shop_status"` // ["订单: 等待买家付款=WAIT_BUYER_PAY, 等待卖家发货=WAIT_SELLER_SEND_GOODS,等待买家确认收货=WAIT_BUYER_CONFIRM_GOODS, 交易成功=TRADE_FINISHED, 付款后交易关闭=TRADE_CLOSED,付款前交易关闭=TRADE_CLOSED_BY_TAOBAO;发货前可更新"]
|
|
|
ShopBuyerID string `json:"shop_buyer_id"` // 买家帐号 长度 <= 50
|
|
|
ReceiverState string `json:"receiver_state"` // 收货省份 长度 <= 50
|
|
|
ReceiverCity string `json:"receiver_city"` // 收货市 长度 <= 50
|
|
|
ReceiverDistrict string `json:"receiver_district"` // 收货街区
|
|
|
ReceiverAddress string `json:"receiver_address"` // 收货地址
|
|
|
ReceiverName string `json:"receiver_name"` // 收货人
|
|
|
ReceiverPhone string `json:"receiver_phone"` // 联系电话
|
|
|
PayAmount decimal.Decimal `json:"pay_amount"` // 应付金额 保留两位小数
|
|
|
Freight decimal.Decimal `json:"freight"` // 运费
|
|
|
ShopModified string `json:"shop_modified"` // 订单日期 2018-09-01 23:59:11
|
|
|
Items []*Item `json:"items"` // 商品明细
|
|
|
Pay *PayDetail `json:"pay,omitempty"`
|
|
|
}
|
|
|
|
|
|
// OrderSyncReq 上传order请求.
|
|
|
type OrderSyncReq struct {
|
|
|
Data []*Order
|
|
|
}
|
|
|
|
|
|
// OrderCancel 取消order.
|
|
|
type OrderCancel struct {
|
|
|
ShopID int `json:"shop_id"` // 店铺编号
|
|
|
SoID string `json:"so_id"` // 线上订单号 长度 <= 50
|
|
|
}
|
|
|
|
|
|
// OrderCancelReq 取消order请求.
|
|
|
type OrderCancelReq struct {
|
|
|
Data []*OrderCancel // 最多20个
|
|
|
}
|
|
|
|
|
|
//OrderQuery 查询order.
|
|
|
type OrderQuery struct {
|
|
|
SoIDS []string `json:"so_ids"`
|
|
|
}
|
|
|
|
|
|
//OrderQueryReq 查询order请求.
|
|
|
type OrderQueryReq struct {
|
|
|
Data *OrderQuery
|
|
|
}
|
|
|
|
|
|
// DateTime 序列化时间.
|
|
|
type DateTime time.Time
|
|
|
|
|
|
func (t DateTime) MarshalJSON() ([]byte, error) {
|
|
|
var stamp = fmt.Sprintf("\"%s\"", time.Time(t).Format("2006-01-02 15:04:05"))
|
|
|
return []byte(stamp), nil
|
|
|
}
|
|
|
|
|
|
// OrderSent 订单派送.
|
|
|
type OrderSent struct {
|
|
|
ShopID uint `json:"shop_id"` // 店铺id
|
|
|
OID uint `json:"o_id"` // ERP 内部订单号, 聚水潭请求获得
|
|
|
SoID string `json:"so_id"` // 线上订单号
|
|
|
LcName string `json:"lc_name"` // 快递公司
|
|
|
LID string `json:"l_id"` // 快递单号
|
|
|
LcID string `json:"lc_id"` // 快递编号
|
|
|
Modified DateTime `json:"modified"` // datetime 2020-03-12 12:00:00
|
|
|
}
|
|
|
|
|
|
// OrderSentSyncReq 订单派送请求.
|
|
|
type OrderSentSyncReq struct {
|
|
|
Data []*OrderSent
|
|
|
}
|