结账第二期

This commit is contained in:
renyutian
2019-04-03 17:49:30 +08:00
parent 7b43e7d6e9
commit 632aa6aa3d
17 changed files with 1028 additions and 231 deletions

View File

@@ -43,3 +43,15 @@ type PagedInfo struct {
TotalCount int `json:"totalCount"`
Data interface{} `json:"data"`
}
type OrderFinancialExt struct {
OrderFinancial
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` //
OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"` // 订单妥投/完成时间
StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
StoreName string `orm:"size(64)" json:"storeName"` //
Status int `json:"status"` // 参见OrderStatus*相关的常量定义
Skus []*OrderSkuFinancial `orm:"-" json:"skus"` // 正向订单购买商品列表
Discounts []*OrderDiscountFinancial `orm:"-" json:"discounts"` // 正向订单享受优惠列表
}

View File

@@ -5,33 +5,39 @@ import "time"
type OrderFinancial struct {
ModelIDCUL
VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 平台id
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 订单ID
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 订单ID2,饿百独有
DeliveryConfirmTime time.Time `orm:"type(datetime);index" json:"deliveryConfirmTime"` // 订单妥投/完成时间
ShopPriceMoney int64 `json:"shopPriceMoney"` // 门店价-左右商品在京西的价格总和报价模式会用到0
SalePriceMoney int64 `json:"salePriceMoney"` // 商品标价总额(用户下单满减之前的商品售价)+
ActualPayMoney int64 `json:"actualPayMoney"` // 用户实际支付金额0
TotalDiscountMoney int64 `json:"totalDiscountMoney"` // 订单总优惠(订单主体+运费)-
DiscountMoney int64 `json:"discountMoney"` // 订单主体优惠0
ReceivableFreight int64 `json:"receivableFreight"` // 订单应收运费0
FreightMoney int64 `json:"freightMoney"` // 用户支付运费0
FreightDiscountMoney int64 `json:"freightDiscountMoney"` // 订单运费优惠(商家设置满减discountType == 8)0
VendorFreightDiscountMoney int64 `json:"vendorFreightDiscountMoney"` // 订单运费优惠(平台运费优惠discountType == 7/12/15)+
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 订单远距离费-
FreightTipsMoney int64 `json:"freightTipsMoney"` // 订单费-
DonationMoney int64 `json:"donationMoney"` // 公益捐款-
SelfDeliveryDiscountMoney int64 `json:"selfDeliveryDiscountMoney"` // 平台承担运费补贴(商家自送)+
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台订单活动补贴1+
BoxMoney int64 `json:"boxMoney"` // 餐盒费1+
PmMoney int64 `json:"pmMoney"` // 平台费1-
ShopMoney int64 `json:"shopMoney"` // 应结金额-第三方平台结算给京西的金额M
ShopMoneyByCal int64 `json:"shopMoneyByCal"` // 应结金额-通过公式计算平台结给京西的金额M
PmMoneyFormJx int64 `json:"pmMoneyFormJx"` // 京西平台费-
FreightMoneyFromJx int64 `json:"freightMoneyFromJx"` // 转自送-->美团/达达订单产生运费0
FreightMoneyFromJxByShop int64 `json:"freightMoneyFromJxByShop"` // 转自送-->美团/达达订单产生运费,由商家承担的部分-
SubsidyMoneyFromJx int64 `json:"subsidyMoneyFromJx"` // 京西补贴,针对单品活动补贴+
ShopMoneyFromJx int64 `json:"shopMoneyFromJx"` // 店铺应结金额-京西结算给店铺的金额M
VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 平台id
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 订单ID
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 订单ID2,饿百独有
// DeliveryConfirmTime time.Time `orm:"type(datetime);index" json:"deliveryConfirmTime"` // 订单妥投/完成时间
ShopPriceMoney int64 `json:"shopPriceMoney"` // 门店价-左右商品在京西的价格总和报价模式会用到0
SalePriceMoney int64 `json:"salePriceMoney"` // 商品标价总额(用户下单满减之前的商品售价)+
ActualPayMoney int64 `json:"actualPayMoney"` // 用户实际支付金额0
TotalDiscountMoney int64 `json:"totalDiscountMoney"` // 订单总优惠(订单主体+运费)-
DiscountMoney int64 `json:"discountMoney"` // 订单主体优惠0
PointsDeductionMoney int64 `json:"pointsDeductionMoney"` // 积分抵扣金额0
ReceivableFreight int64 `json:"receivableFreight"` // 订单应收运费0
FreightMoney int64 `json:"freightMoney"` // 用户支付运费0
FreightDiscountMoney int64 `json:"freightDiscountMoney"` // 订单运费优惠(商家设置满减discountType == 8)0
PmFreightDiscountMoney int64 `json:"pmFreightDiscountMoney"` // 订单运费优惠(平台运费优惠discountType == 7/12/15)+
DistanceFreightMoney int64 `json:"distanceFreightMoney"` // 订单远距离费-
FreightTipsMoney int64 `json:"freightTipsMoney"` // 订单小费-
DonationMoney int64 `json:"donationMoney"` // 公益捐款-
SelfDeliveryDiscountMoney int64 `json:"selfDeliveryDiscountMoney"` // 平台承担运费补贴(商家自送)+
PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台对单条sku补贴的金额
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台活动补贴(订单主体活动补贴+订单单条sku补贴1+
BoxMoney int64 `json:"boxMoney"` // order餐盒费1+
SkuBoxMoney int64 `json:"skuBoxMoney"` // sku餐盒费
PmMoney int64 `json:"pmMoney"` // 平台费1-
ShopMoney int64 `json:"shopMoney"` // 应结金额-第三方平台结算给京西的金额M
ShopMoneyByCal int64 `json:"shopMoneyByCal"` // 应结金额-通过公式计算平台结给京西的金额M
JxPmMoney int64 `json:"jxPmMoney"` // 京西平台费-
JxFreightMoney int64 `json:"jxFreightMoney"` // 转自送-->美团/达达订单产生运费0
JxFreightMoneyByShop int64 `json:"jxFreightMoneyByShop"` // 转自送-->美团/达达订单产生运费,由商家承担的部分-
JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西总补贴
JxSkuSubsidyMoney int64 `json:"jxSkuSubsidyMoney"` // 京西补贴给单条sku的金额
JxShopMoney int64 `json:"jxShopMoney"` // 店铺应结金额-京西结算给店铺的金额M
Skus []*OrderSkuFinancial `orm:"-" json:"skus"` // 正向订单购买商品列表
Discounts []*OrderDiscountFinancial `orm:"-" json:"discounts"` // 正向订单享受优惠列表
}
func (o *OrderFinancial) TableUnique() [][]string {
@@ -40,62 +46,99 @@ func (o *OrderFinancial) TableUnique() [][]string {
}
}
type AfterSalesOrder struct {
type OrderDiscountFinancial struct {
ModelIDCUL
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 关联原始订单ID2,饿百独有
AfterSalesOrderID string `orm:"column(after_sales_order_id);size(48)" json:"afterSalesOrderID"` // 售后订单ID
ConfirmTime time.Time `orm:"type(datetime);index" json:"confirmTime"` // 售后单完成时间
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid
StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
SkuUserMoney int64 `json:"skuUserMoney"` // 用户支付菜品金额
FreightUserMoney int64 `json:"freightUserMoney"` // 用户支付运费金额
AfsFreightMoney int64 `json:"afsFreightMoney"` // 退货取件费
BoxMoney int64 `json:"boxMoney"` // 应退包装费金额
TongchengFreightMoney int64 `json:"tongchengFreightMoney"` // 退货单产生的同城送费用
MealBoxMoney int64 `json:"mealBoxMoney"` // 应退订单餐盒费
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台补贴金额
RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 1
RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M
// SkuJxMoney int64 `json:"SkuJxMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴
Skus []*AfterSalesOrderSku `orm:"-" json:"-"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 订单ID
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 订单ID2,饿百独有
VendorActivityID string `orm:"column(vendor_activity_id);size(48)" json:"vendorActivityID"` // 活动ID 活动ID的存在使原本的通过城市/下单时间-活动时间/金额……一系列匹配来确认活动归属的费时且准确度低的行为有了改变的可能--通过编码精确定位
// ActivityName string `orm:"size(255)" json:"activityName"` // 活动名
// ActivityMoney int64 `json:"activityMoney"` // 优惠金额
// Remark string `orm:"size(255)" json:"remark"` // 备注
}
func (o *AfterSalesOrder) TableUnique() [][]string {
// 设置主键 "VendorOrderID", "DiscountCode", "VendorID" 一个订单不可能享受同一优惠2次
func (o *OrderDiscountFinancial) TableUnique() [][]string {
return [][]string{
[]string{"AfterSalesOrderID", "VendorID"},
[]string{"VendorOrderID", "VendorActivityID", "VendorID"},
}
}
type AfterSalesOrderSku struct {
type AfsOrder struct {
ModelIDCUL
VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 平台id
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 关联原始订单ID2,饿百独有
AfterSalesOrderID string `orm:"column(after_sales_order_id);size(48)" json:"afterSalesOrderID"` // 售后订单ID
ConfirmTime time.Time `orm:"type(datetime)" json:"confirmTime"` // 订单成时间
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid
StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
VendorSkuID string `orm:"column(vendor_sku_id);size(48)" json:"vendorSkuID"` // 平台skuid
SkuID int `orm:"column(sku_id)" json:"skuID"` // 平台返回的京西skuid
JxSkuID int `orm:"column(jx_sku_id)" json:"jxSkuID"` // 京西skuid
Name string `orm:"size(255)" json:"name"` // 商品名
SkuUserMoney int64 `json:"skuUserMoney"` // 用户支付金额
SkuVendorMoney int64 `json:"skuVendorMoney"` // 平台补贴金额
SkuRefundMoney int64 `json:"skuRefundMoney"` // 平台扣款总额 1
SkuRefundMoneyByCal int64 `json:"skuRefundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M
// CreatedAt time.Time `orm:"type(datetime);index" json:"createdAt"` // 订单创建时间
// SkuJxMoney int64 `json:"skuJxFee"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 关联原始订单ID2,饿百独有
AfsOrderID string `orm:"column(afs_order_id);size(48)" json:"afsOrderID"` // 售后订单ID
AfsCreateAt time.Time `orm:"type(datetime);index" json:"afsCreateAt"` // 订单成时间
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid
StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
SkuUserMoney int64 `json:"skuUserMoney"` // 用户支付菜品金额
FreightUserMoney int64 `json:"freightUserMoney"` // 用户支付运费金额
AfsFreightMoney int64 `json:"afsFreightMoney"` // 退货取件费
BoxMoney int64 `json:"boxMoney"` // 应退包装费金额
TongchengFreightMoney int64 `json:"tongchengFreightMoney"` // 退货单产生的同城送费用
SkuBoxMoney int64 `json:"skuBoxMoney"` // 应退订单餐盒费
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台总补贴金额
PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台sku补贴金额
RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 1
RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣京西的金额M
// JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴
Skus []*OrderSkuFinancial `orm:"-" json:"skus"`
}
func (o *AfterSalesOrderSku) TableIndex() [][]string {
func (o *AfsOrder) TableUnique() [][]string {
return [][]string{
[]string{"AfterSalesOrderID", "SkuID", "VendorID"},
[]string{"AfsOrderID", "VendorID"},
}
}
type OrderSkuFinancial struct {
ModelIDCUL
VendorID int `orm:"column(vendor_id)" json:"vendorID"` // 平台id
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID
VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 关联原始订单ID2,饿百独有
AfsOrderID string `orm:"column(order_financial_id);size(48)" json:"afsOrderID"` // 订单结账ID
IsAfsOrder int8 `json:"isAfsOrder"` // 0--正向单, 1--售后单
// ConfirmTime time.Time `orm:"type(datetime)" json:"confirmTime"` // 订单生成/完成时间
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid
StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID
JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid
VendorSkuID string `orm:"column(vendor_sku_id);size(48)" json:"vendorSkuID"` // 平台skuid
SkuID int `orm:"column(sku_id)" json:"skuID"` // 平台返回的京西skuid
JxSkuID int `orm:"column(jx_sku_id)" json:"jxSkuID"` // 京西skuid
PromotionType int `json:"promotionType"` // 商品级别促销类型 (1、无优惠;2、秒杀(已经下线);3、单品直降;4、限时抢购;1202、加价购;1203、满赠(标识商品);6、买赠(买A送B标识B);9999、表示一个普通商品参与捆绑促销设置的捆绑类型;9998、表示一个商品参与了捆绑促销并且还参与了其他促销类型;9997、表示一个商品参与了捆绑促销但是金额拆分不尽,9996:组合购,8001:轻松购会员价,8:第二件N折,9:拼团促销)
Name string `orm:"size(255)" json:"name"` // 商品名
ShopPrice int64 `json:"shopPrice"` // 门店标价
SalePrice int64 `json:"salePrice"` // 售卖价
Count int `json:"count"` // 订单下单数量
SkuBoxMoney int64 `json:"skuBoxMoney"` // sku餐盒费(美团/饿百的单条sku存在这个概念)
UserMoney int64 `json:"userMoney"` // 用户支付金额
PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台补贴总金额
PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台补贴sku金额
PmDeductionsMoney int64 `json:"pmDeductionsMoney"` // 单条sku需要承担的平台扣费金额
ShopMoney int64 `json:"shopMoney"` // 应结金额-第三方平台结算给京西的金额M
ShopMoneyByCal int64 `json:"shopMoneyByCal"` // 应结金额-通过公式计算平台结给京西的金额M
JxSubsidyMoney int64 `json:"jxSubsidyMoney"` // 京西总补贴
JxSkuSubsidyMoney int64 `json:"jxSkuSubsidyMoney"` // 京西补贴,针对单品活动补贴
JxDeductionsMoney int64 `json:"jxDeductionsMoney"` // 单条sku需要承担的京西扣费金额
JxShopMoney int64 `json:"jxShopMoney"` // 店铺应结金额-京西结算给店铺的金额M
RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 暂时无用
RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M
// CreatedAt time.Time `orm:"type(datetime);index" json:"createdAt"` // 订单创建时间
// JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴
// SkuType int `json:"-"` // 当前如果为gift就为1否则缺省为0
}
func (o *OrderSkuFinancial) TableUnique() [][]string {
return [][]string{
[]string{"VendorOrderID", "SkuID", "PromotionType", "IsAfsOrder", "VendorID"},
}
}