- GetStoresOrderSaleInfo添加售后单信息

This commit is contained in:
gazebo
2019-08-16 11:08:09 +08:00
parent b36f8b3ae1
commit 14e3594455
6 changed files with 62 additions and 27 deletions

View File

@@ -236,7 +236,7 @@ func (c *OrderManager) SaveOrder(order *model.GoodsOrder, isAdjust bool, db *dao
return isDuplicated, err
}
func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.DaoDB) (err error) {
func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.DaoDB, storePayPercentage int) (err error) {
globals.SugarLogger.Debugf("updateOrderSkuOtherInfo orderID:%s, VendorStoreID:%s", order.VendorOrderID, order.VendorStoreID)
jxStoreID := jxutils.GetShowStoreIDFromOrder(order)
var opNumStr string
@@ -316,10 +316,10 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
v.JxSkuID = skuBindInfo.SkuID
v.ShopPrice = int64(skuBindInfo.Price)
v.Weight = skuBindInfo.Weight // 以本地信息中的WEIGHT为准
order.ShopPrice += v.ShopPrice * int64(v.Count)
if skuBindInfo.Price == 0 {
globals.SugarLogger.Infof("updateOrderSkuOtherInfo [运营%s]%s订单sku门店价格为零一般原因为没有门店价格信息orderID:%s, StoreID:%d, SkuID:%d, sku:%v", opNumStr, model.VendorChineseNames[order.VendorID], order.VendorOrderID, jxStoreID, v.JxSkuID, v)
}
v.EarningPrice = jxutils.CaculateSkuEarningPrice(v.ShopPrice, v.SalePrice, storePayPercentage)
}
}
@@ -335,7 +335,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
if skuID := jxutils.GetSkuIDFromOrderSku(v); skuID > 0 {
if actStoreSku := actStoreSkuMap.GetActStoreSku(jxStoreID, skuID, order.VendorID); actStoreSku != nil {
v.EarningPrice = actStoreSku.EarningPrice
if v.StoreSubName != "" {
if true { //v.StoreSubName != "" { // 之前这里为什么要加判断?
v.StoreSubID = actStoreSku.ActID
}
}
@@ -361,24 +361,24 @@ func (c *OrderManager) updateOrderOtherInfo(order *model.GoodsOrder, db *dao.Dao
order.JxStoreID = storeDetail.Store.ID
payPercentage = storeDetail.PayPercentage
}
if err = c.updateOrderSkuOtherInfo(order, db); err == nil {
if err = c.updateOrderSkuOtherInfo(order, db, payPercentage); err == nil {
jxutils.RefreshOrderSkuRelated(order)
caculateOrderEarningPrice(order, payPercentage)
// caculateOrderEarningPrice(order, payPercentage)
}
return err
}
// 计算结算给门店的金额
func caculateOrderEarningPrice(order *model.GoodsOrder, storePayPercentage int) {
order.EarningPrice = 0
for _, v := range order.Skus {
skuEarningPrice := v.EarningPrice
if skuEarningPrice == 0 {
skuEarningPrice = jxutils.CaculateSkuEarningPrice(v.ShopPrice, v.SalePrice, storePayPercentage)
}
order.EarningPrice += skuEarningPrice * int64(v.Count)
}
}
// func caculateOrderEarningPrice(order *model.GoodsOrder, storePayPercentage int) {
// order.EarningPrice = 0
// for _, v := range order.Skus {
// skuEarningPrice := v.EarningPrice
// if skuEarningPrice == 0 {
// skuEarningPrice = jxutils.CaculateSkuEarningPrice(v.ShopPrice, v.SalePrice, storePayPercentage)
// }
// order.EarningPrice += skuEarningPrice * int64(v.Count)
// }
// }
func (c *OrderManager) addOrderStatus(orderStatus *model.OrderStatus, db *dao.DaoDB) (isDuplicated bool, order *model.GoodsOrder, err error) {
globals.SugarLogger.Debugf("addOrderStatus refOrderID:%s, orderID:%s", orderStatus.RefVendorOrderID, orderStatus.VendorOrderID)

View File

@@ -907,7 +907,7 @@ func (c *OrderManager) getAfsOrderSkuInfo4ExportOrders(ctx *jxcontext.Context, f
SELECT t2.*
FROM afs_order t1
JOIN order_sku_financial t2 ON t2.vendor_order_id = t1.vendor_order_id AND t2.vendor_id = t1.vendor_id AND t2.is_afs_order = 1
WHERE t1.afs_created_at >= ? AND t1.afs_created_at <= ? AND t1.status = ?
WHERE t1.afs_finished_at >= ? AND t1.afs_finished_at <= ? AND t1.status = ?
`
sqlParams := []interface{}{
fromDate,