This commit is contained in:
邹宗楠
2023-02-23 14:27:06 +08:00
parent fcebf15b62
commit 7b18452932
12 changed files with 118 additions and 27 deletions

View File

@@ -209,6 +209,15 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m
}
}
}
// 目前存在当订单为平台自配送时,本地储存新订单的结算信息是包含了配送费的!所以结算信息不对!
// 修改为订单完成时更新订单的结算信息
settlementAmount, err3 := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID).GetOrderSettleAccounts(order)
if err3 == nil && settlementAmount != model.NO {
order.TotalShopMoney = settlementAmount
dao.UpdateEntity(db, order, "TotalShopMoney")
}
//更新订单new_earning_price
if order.EarningType == model.EarningTypePoints {
waybill, _ := c.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID)
@@ -2508,7 +2517,20 @@ func UpdateTiktokShopTotalMoney() {
}
nextStartIndex = next
v.TotalShopMoney = totalShopMoney
if _, err := dao.UpdateEntity(db, v, "TotalShopMoney"); err != nil {
if v.EarningType == model.EarningTypePoints {
waybill, _ := partner.CurOrderManager.LoadWaybill(v.VendorWaybillID, v.WaybillVendorID)
// store, _ := c.LoadStoreDetail(jxutils.GetSaleStoreIDFromOrder(order), order.VendorID)
if waybill == nil {
if (v.NewEarningPrice == 0 || v.NewEarningPrice != v.TotalShopMoney*int64(100-v.OrderPayPercentage/2)/int64(100)) && v.OrderPayPercentage <= 50 {
v.NewEarningPrice = v.TotalShopMoney * int64(100-v.OrderPayPercentage/2) / int64(100)
}
} else {
if (v.NewEarningPrice == 0 || v.NewEarningPrice != (v.TotalShopMoney-waybill.DesiredFee)*int64(100-v.OrderPayPercentage/2)/int64(100)) && v.OrderPayPercentage <= 50 {
v.NewEarningPrice = v.TotalShopMoney*int64(100-v.OrderPayPercentage/2)/int64(100) - waybill.DesiredFee
}
}
}
if _, err := dao.UpdateEntity(db, v, "TotalShopMoney", "NewEarningPrice"); err != nil {
globals.SugarLogger.Errorf("更新本地订单结算信息错误 : %s", err)
continue
}