订单新增earningprice2

This commit is contained in:
苏尹岚
2020-03-19 16:34:30 +08:00
parent cb9c465e10
commit b6126857cc
7 changed files with 27 additions and 4 deletions

View File

@@ -37,6 +37,13 @@ func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *
courierVendorID := storeCourier.VendorID
bill, err2 := c.CreateWaybill(courierVendorID, order, maxDeliveryFee)
if err = err2; err == nil {
stores, _ := dao.GetStoreList(dao.GetDB(), []int{order.StoreID}, nil, nil, nil, "")
if len(stores) > 0 {
if stores[0].PayPercentage <= 50 {
order.EarningPrice2 = (order.TotalShopMoney - bill.DesiredFee) * int64((100 - stores[0].PayPercentage/2)) / 10000
dao.UpdateEntity(dao.GetDB(), order, "EarningPrice2")
}
}
globals.SugarLogger.Debugf("CreateWaybillOnProviders orderID:%s userName:%s vendorID:%d bill:%v", order.VendorOrderID, userName, courierVendorID, bill)
bills = append(bills, bill)
if createOnlyOne {