diff --git a/business/partner/purchase/tao_vegetable/order.go b/business/partner/purchase/tao_vegetable/order.go index 180a37211..7f1967d05 100644 --- a/business/partner/purchase/tao_vegetable/order.go +++ b/business/partner/purchase/tao_vegetable/order.go @@ -97,17 +97,23 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(originalList[1])) order.DiscountMoney = *orderDetail.DiscountFee - //var salePrice int64 = 0 - //var weight int = 0 order.PmSubsidyMoney = *orderDetail.SkuDiscountPlatformFee // 平台承担优惠 // 添加需要赠送的东西(暂时没有赠品套餐直接商品) multiSkuMap := make(map[int]int) + var ( + skuSalePrice int64 = 0 // 商品售卖价 + merchantDiscountsPrice int64 = 0 // 商户优惠价 + // 平台优惠价 + platformDiscountsPrice int64 = *orderDetail.PlatformDeduction.BaseLogisticsFee + *orderDetail.PlatformDeduction.TechnicalServiceFee + *orderDetail.PlatformDeduction.PayServiceFee + *orderDetail.PlatformDeduction.ThirdpartnarFee + ) if len(*orderDetail.SubOrderResponseList) > 0 { for _, extra := range *orderDetail.SubOrderResponseList { // 这个是包装袋的价格,用户退款是包装袋未推送退款,导致本地订单退款状态无法更新,取消包装袋的记录 if *extra.SkuCode == "6108080" { continue } + skuSalePrice += *extra.OriginalFee + merchantDiscountsPrice += *extra.DiscountMerchantFee sku := &model.OrderSku{ VendorOrderID: order.VendorOrderID, VendorSubOrderID: *extra.OutSubOrderId, @@ -200,7 +206,7 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve v.IsVendorAct = model.YES } } - // 抖音订单手机号和收货地址是否同城(虚拟号,无法获取到正确地址) + //订单手机号和收货地址是否同城(虚拟号,无法获取到正确地址) order.PhoneAscription = model.PhoneAscriptionAddressNo + "-" + "归属信息不匹配:" + "虚拟电话号码" // 本地获取订单记录 @@ -217,6 +223,28 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode string, vendorOrderID int64, ve order.StoreName = "未获取到" // 真实门店名称 } + //结算类型 + if store.PayPercentage < 50 { + order.EarningType = model.EarningTypePoints + } else { + order.EarningType = model.EarningTypeQuote + } + + // 平台结算金额 + order.TotalShopMoney = skuSalePrice + *orderDetail.PostFee - merchantDiscountsPrice - platformDiscountsPrice + if order.EarningType == model.EarningTypePoints { + waybill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) + if waybill == nil { + if (order.NewEarningPrice == 0 || order.NewEarningPrice != order.TotalShopMoney*int64(100-order.OrderPayPercentage/2)/int64(100)) && order.OrderPayPercentage <= 50 { + order.NewEarningPrice = order.TotalShopMoney * int64(100-order.OrderPayPercentage/2) / int64(100) + } + } else { + if (order.NewEarningPrice == 0 || order.NewEarningPrice != (order.TotalShopMoney-waybill.DesiredFee)*int64(100-order.OrderPayPercentage/2)/int64(100)) && order.OrderPayPercentage <= 50 { + order.NewEarningPrice = order.TotalShopMoney*int64(100-order.OrderPayPercentage/2)/int64(100) - waybill.DesiredFee + } + } + } + return order, orderMap, err }