aa
This commit is contained in:
@@ -338,7 +338,7 @@ func (c *BaseScheduler) SetOrderWaybillTipByOrder(ctx *jxcontext.Context, order
|
||||
} else {
|
||||
//加小费成功扣钱
|
||||
if order.CreateDeliveryType == model.YES {
|
||||
if err = partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), 100, partner.StoreAcctTypeExpendCreateWaybillTip, order.VendorOrderID); err == nil {
|
||||
if err = partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), 100, partner.StoreAcctTypeExpendCreateWaybillTip, order.VendorOrderID, 0); err == nil {
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
@@ -374,7 +374,7 @@ func (c *BaseScheduler) SetOrderWaybillTipByOrder(ctx *jxcontext.Context, order
|
||||
if !flag {
|
||||
//加小费成功扣钱
|
||||
if order.CreateDeliveryType == model.YES {
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), 100, partner.StoreAcctTypeExpendCreateWaybillTip, order.VendorOrderID)
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), 100, partner.StoreAcctTypeExpendCreateWaybillTip, order.VendorOrderID, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,6 +586,8 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
||||
if order.VendorID == model.VendorIDJDShop {
|
||||
s.solutionJdsOrder(bill)
|
||||
}
|
||||
//门店发单的门店,需要根据实际运费更新账户(多退少补)
|
||||
s.updateStoreAccount(order, bill)
|
||||
//订单已经是结束状态之后来的运单143945553920000001
|
||||
if order.Status > model.OrderStatusEndBegin {
|
||||
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
|
||||
@@ -1318,6 +1320,10 @@ func (s *DefScheduler) updateOrderByBill(order *model.GoodsOrder, bill *model.Wa
|
||||
partner.CurOrderManager.UpdateOrderFields(order, updateFields)
|
||||
}
|
||||
|
||||
func (s *DefScheduler) updateStoreAccount(order *model.GoodsOrder, bill *model.Waybill) {
|
||||
|
||||
}
|
||||
|
||||
func (s *DefScheduler) updateBillsInfo(savedOrderInfo *WatchOrderInfo, bill *model.Waybill) (isBillExist bool) {
|
||||
if savedOrderInfo != nil {
|
||||
if savedBill := savedOrderInfo.waybills[bill.WaybillVendorID]; savedBill != nil {
|
||||
|
||||
@@ -152,15 +152,15 @@ func (s *DefScheduler) CreateWaybillOnProviders4SavedOrder(ctx *jxcontext.Contex
|
||||
}
|
||||
newPrice = maxFee
|
||||
}
|
||||
lastFee, _ := partner.CurStoreAcctManager.GetStoreAcctExpendLastCreateWayBillFee(order.VendorOrderID)
|
||||
expend, lastFee, _ := partner.CurStoreAcctManager.GetStoreAcctExpendLastCreateWayBillFee(order.VendorOrderID)
|
||||
if int(newPrice) > lastFee {
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), int(newPrice)-lastFee, partner.StoreAcctTypeExpendCreateWaybillEx, order.VendorOrderID)
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), int(newPrice)-lastFee, partner.StoreAcctTypeExpendCreateWaybill2ndMore, order.VendorOrderID, expend.ID)
|
||||
}
|
||||
} else {
|
||||
if len(courierVendorIDs) == 1 {
|
||||
courierVendorID := courierVendorIDs[0]
|
||||
if _, ok := deliveryFeeMap[courierVendorID]; ok {
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), int(deliveryFeeMap[courierVendorID].DeliveryFee), partner.StoreAcctTypeExpendCreateWaybillEx, order.VendorOrderID)
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), int(deliveryFeeMap[courierVendorID].DeliveryFee), partner.StoreAcctTypeExpendCreateWaybillEx, order.VendorOrderID, 0)
|
||||
}
|
||||
} else if len(courierVendorIDs) == 0 {
|
||||
var maxFee int64
|
||||
@@ -169,7 +169,7 @@ func (s *DefScheduler) CreateWaybillOnProviders4SavedOrder(ctx *jxcontext.Contex
|
||||
v.DeliveryFee = maxFee
|
||||
}
|
||||
}
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), int(maxFee), partner.StoreAcctTypeExpendCreateWaybillEx, order.VendorOrderID)
|
||||
partner.CurStoreAcctManager.InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx, jxutils.GetSaleStoreIDFromOrder(order), int(maxFee), partner.StoreAcctTypeExpendCreateWaybillEx, order.VendorOrderID, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ func (s *DefScheduler) CheckStoreBalance(ctx *jxcontext.Context, order *model.Go
|
||||
}
|
||||
newPrice = maxFee
|
||||
}
|
||||
lastFee, _ := partner.CurStoreAcctManager.GetStoreAcctExpendLastCreateWayBillFee(order.VendorOrderID)
|
||||
_, lastFee, _ := partner.CurStoreAcctManager.GetStoreAcctExpendLastCreateWayBillFee(order.VendorOrderID)
|
||||
if int(newPrice) > lastFee {
|
||||
if storeAcct.AccountBalance < int(newPrice)-lastFee {
|
||||
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("门店账户余额小于[%v]元,不能发配送!", jxutils.IntPrice2Standard(newPrice-int64(lastFee)))
|
||||
|
||||
Reference in New Issue
Block a user