添加饿了退单,美团账单刷新
This commit is contained in:
@@ -31,17 +31,46 @@ type Bill struct {
|
||||
3)想要实现的效果;
|
||||
4)预计开发周期和上线时间;
|
||||
5)商家公司授权开通日账单接口的证明。(点击下载授权证明模板,授权证明以附件形式提供。)*/
|
||||
func (a *API) GetStoreBillList(param *Bill) (*StoreBillListRes, error) {
|
||||
result, err := a.AccessAPI3("bill/list", true, utils.Struct2Map(param, "", false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
func (a *API) GetStoreBillList(param *Bill) (map[string]*SettleOrderList, error) {
|
||||
orderSettle := make(map[string]*SettleOrderList, 0)
|
||||
|
||||
for {
|
||||
result, err := a.AccessAPI3("bill/list", true, utils.Struct2Map(param, "", false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var data *StoreBillListRes
|
||||
if err := utils.Map2StructByJson(result, &data, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, v := range data.Data {
|
||||
settle, ok := orderSettle[v.WmOrderViewId]
|
||||
if !ok {
|
||||
settle = &SettleOrderList{OrderId: v.WmOrderViewId}
|
||||
}
|
||||
switch v.BillChargeType {
|
||||
case BillChargeTypeOrder: // 平台结算
|
||||
settle.PlatformSettlement = v.SettleAmount
|
||||
case BillChargeTypeWayBillFee: // 运费
|
||||
settle.DeliveryFee = v.SettleAmount
|
||||
case BillChargeTypeTimingFee: // 定时宝
|
||||
settle.TimingFee = v.SettleAmount
|
||||
default:
|
||||
continue
|
||||
}
|
||||
orderSettle[v.WmOrderViewId] = settle
|
||||
}
|
||||
|
||||
if int64(data.ExtraInfo.TotalCount) >= (param.Offset * param.Limit) {
|
||||
param.Offset += param.Limit
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var data *StoreBillListRes
|
||||
if err := utils.Map2StructByJson(result, &data, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
return orderSettle, nil
|
||||
}
|
||||
|
||||
// StoreBillListReq 门店结算查询条件
|
||||
@@ -129,7 +158,7 @@ type WmAppOrderSkuBenefitDetailList struct {
|
||||
}
|
||||
|
||||
type wmAppOrderActDetails struct {
|
||||
actId int64 `json:"act_id"` // 商品参与活动的活动id
|
||||
ActId int64 `json:"act_id"` // 商品参与活动的活动id
|
||||
MTType int `json:"type"` // 参与活动的活动类型,参考值:1-首单立减;2-满减优惠;4-套餐惠赠优惠;9-美团红包;11-提前下单减优惠;17-折扣商品;18-美团专送再减;20-第二份半价优惠;22-门店新客立减;27-指定商品满减;40-加价购;43-X元M件;46-超值换购;66-会员折扣商品;101-商家代金券优惠;117-商品优惠券;118-商品折扣券;900-首单红包优惠。
|
||||
PoiCharge float64 `json:"poiCharge"` // 本活动id及活动类型下商家承担的金额,单位分。
|
||||
}
|
||||
@@ -138,12 +167,20 @@ type MedicalInsuranceFee struct {
|
||||
Name string `json:"name"` // 商品名称。
|
||||
SkuId string `json:"sku_id"` // 商品sku的规格编码,SKU码/货号。
|
||||
Count int `json:"count"` // 商品数量 注:当字段count=0时,此账单记录为商家发起的按重量退差价,但结算类型仍为“26-闪购品类订单部分退款”(billChargeType=26)。
|
||||
totalOriginPrice float64 `json:"totalOriginPrice"` // 商品原价总价(含商品包装盒费),单位分。
|
||||
totalPoiCharge float64 `json:"totalPoiCharge"` // 配送费优惠商家承担总金额,单位分。
|
||||
wmAppOrderShippingActDetailList []wmAppOrderShippingActDetailList `json:"wmAppOrderShippingActDetailList"` // sku商品参与的配送费活动详情。
|
||||
TotalOriginPrice float64 `json:"totalOriginPrice"` // 商品原价总价(含商品包装盒费),单位分。
|
||||
TotalPoiCharge float64 `json:"totalPoiCharge"` // 配送费优惠商家承担总金额,单位分。
|
||||
WmAppOrderShippingActDetailList []wmAppOrderShippingActDetailList `json:"wmAppOrderShippingActDetailList"` // sku商品参与的配送费活动详情。
|
||||
}
|
||||
|
||||
type wmAppOrderShippingActDetailList struct {
|
||||
MTType int `json:"type"` // 参与配送费活动的活动类型,参考值:9-美团红包,21-会员免配送费,25-立减配送费,30-满减配送费,36-新人减配送费,54-新客专享减配送费,59-新客专享减配送费,300-商家会员减配送费,302-预订单减配送费,304-减免运费券,101-商家代金券优惠,305-津贴优惠。
|
||||
PoiCharge float64 `json:"poiCharge"` // 商家承担金额,单位分。
|
||||
}
|
||||
|
||||
// SettleOrderList 返回值
|
||||
type SettleOrderList struct {
|
||||
OrderId string `json:"order_id"` // 订单id
|
||||
TimingFee int64 `json:"timing_fee"` // 准时保险费
|
||||
DeliveryFee int64 `json:"delivery_fee"` // 配送费
|
||||
PlatformSettlement int64 `json:"platform_settlement"` // 平台结算金额
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user