+ UpdateWaybillTip

This commit is contained in:
gazebo
2019-07-30 14:43:28 +08:00
parent 15c6607eb2
commit e7bad7dc25
3 changed files with 31 additions and 6 deletions

View File

@@ -48,3 +48,8 @@ type IPurchasePlatformOrderHandler interface {
// // 确认收到退货
ConfirmReceivedReturnGoods(ctx *jxcontext.Context, order *model.AfsOrder) (err error)
}
type IUpdateWaybillTip interface {
// 添加快递小费这个不是递增的最后一次操作会覆盖之前的设置但只能增加不能减少且tipFee只能为100的倍数
UpdateWaybillTip(ctx *jxcontext.Context, order *model.GoodsOrder, tipFee int64) (err error)
}

View File

@@ -425,15 +425,15 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
}
fromDate := utils.Time2Date(queryDate)
toDate := fromDate.Add(24*time.Hour - 1)
params := map[string]interface{}{
"orderPurchaseTime_begin": utils.Time2Str(fromDate),
"orderPurchaseTime_end": utils.Time2Str(toDate),
jdapi.KeyPageNo: jdapi.AllPage,
queryParam := &jdapi.OrderQueryParam{
OrderPurchaseTimeBegin: utils.Time2Str(fromDate),
OrderPurchaseTimeEnd: utils.Time2Str(toDate),
PageNo: jdapi.AllPage,
}
if vendorStoreID != "" {
params["deliveryStationNo"] = vendorStoreID
queryParam.DeliveryStationNo = vendorStoreID
}
orderList, _, err := api.JdAPI.OrderQuery2(params)
orderList, _, err := api.JdAPI.OrderQuery2(queryParam)
if err == nil {
vendorOrderIDs = make([]string, len(orderList))
for k, v := range orderList {
@@ -442,3 +442,16 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
}
return vendorOrderIDs, err
}
func (c *PurchaseHandler) UpdateWaybillTip(ctx *jxcontext.Context, order *model.GoodsOrder, tipFee int64) (err error) {
orderInfo, err := api.JdAPI.QuerySingleOrder2(order.VendorOrderID)
if err == nil {
tip2Add := int(tipFee) - orderInfo.Tips
if tip2Add > 0 {
if globals.EnableJdStoreWrite {
err = api.JdAPI.OrderAddTips(order.VendorOrderID, tip2Add, ctx.GetUserName())
}
}
}
return err
}

View File

@@ -575,3 +575,10 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, parentTask tasksch.
}
return vendorOrderIDs, err
}
func (c *PurchaseHandler) UpdateWaybillTip(ctx *jxcontext.Context, order *model.GoodsOrder, tipFee int64) (err error) {
if globals.EnableMtwmStoreWrite {
err = api.MtwmAPI.OrderUpdateTip(utils.Str2Int64(order.VendorOrderID), jxutils.IntPrice2Standard(tipFee))
}
return err
}