订单合并前

This commit is contained in:
苏尹岚
2020-09-01 16:53:44 +08:00
parent 9b14e87249
commit c07a82018b

View File

@@ -1387,9 +1387,28 @@ func MergeJdsOrders(ctx *jxcontext.Context, vendorOrderIDs []string) (vendorOrde
return "", fmt.Errorf("该门店未绑定京狗平台,请先绑定后再转移!门店:[%v]", storeID)
}
stores, _ := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "")
var (
newEarningPrice int64
actualPrice int64
shopPrice int64
salePrice int64
totalShop int64
)
for _, v := range orders {
newEarningPrice += v.NewEarningPrice
actualPrice += v.ActualPayPrice
shopPrice += v.ShopPrice
salePrice += v.SalePrice
totalShop += v.TotalShopMoney
}
store := stores[0]
order := orders[0]
order.ID = 0
order.NewEarningPrice = newEarningPrice
order.ActualPayPrice = actualPrice
order.SalePrice = salePrice
order.ShopPrice = shopPrice
order.TotalShopMoney = totalShop
order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(orders[0].VendorOrderID2)*10000) + utils.Int2Str(99)
order.VendorOrderID2 = strings.Join(orderIDs, ",")
order.Status = model.OrderStatusNew