价格方案优化

This commit is contained in:
“wanyongkang”
2021-05-11 14:32:34 +08:00
parent 5305cb5e12
commit 7178575309
12 changed files with 43 additions and 287 deletions

View File

@@ -263,7 +263,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
var dis_price = 1000000M;
if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){
if((userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)) && userEntity.discount_id >= 0){
//根据折扣设置价格
var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id);
if (discount != null)
@@ -273,54 +273,6 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
is_user_price = false;
}
}
if(userEntity.agent_id == 0){
var cost_price = price;
if(cost_price > dis_price){
cost_price = dis_price;
}
//自动使用折扣
var cost = 0M;
if (request.OrderType == OrderType.New || request.OrderType == OrderType.AgainBuy)
{
cost = cost_price * request.ConnectCount;
}
if (request.OrderType == OrderType.News)
{
var accounts = GreateBatchAccount(request.Account, request.MinPostfix, request.MaxPostfix);
cost = cost_price * request.ConnectCount * accounts.Count;
}
if (request.OrderType == OrderType.AgainBuys)
{
int count = request.Account.Split(",").Length;
cost = cost_price * request.ConnectCount * count;
}
var cost_money = cost + userEntity.ConsumeAmount;
var discount_reset = 100;
if (cost_money>=200 && cost_money<500){
discount_reset = 90;
} else if(cost_money>=500 && cost_money<1500) {
discount_reset = 80;
} else if(cost_money>=1500 && cost_money<3000) {
discount_reset = 70;
} else if(cost_money>=3000 && cost_money<6000) {
discount_reset = 65;
} else if(cost_money>=6000) {
discount_reset = 60;
}
if (discount != null)
{
if(discount_reset<discount.discount){
dis_price = packageEntity.LinePrice * discount_reset / 100;
}
} else {
dis_price = packageEntity.LinePrice * discount_reset / 100;
}
}
} else {
//根据会员价
var userPrice = await this.m_ProductUserPriceService.Query(true).FirstOrDefaultAsync(m => m.UserId == userId && m.PackageId == packageEntity.Id && m.Status == 1);
@@ -824,7 +776,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
//根据折扣设置价格
var score_money = 0.00M;
if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){
if((userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)) && userEntity.discount_id >= 0){
//获取代理折扣
var discount = await m_ProductPriceSchemeService.GetById(agentEntity.discount_id);
var packageEntity = await m_ProductPackageService.GetById(order.PackageId);
@@ -1009,7 +961,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
//折扣
var refundDayPrice = 10.00M;
var userEntity = await m_UserService.GetById(userId);
if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){
if((userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)) && userEntity.discount_id >= 0){
//获取代理折扣
var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id);
if (discount != null){
@@ -1100,7 +1052,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
//
var re_money = 0.00M;
if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){
if((userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)) && userEntity.discount_id >= 0){
//获取代理折扣
var discount = await m_ProductPriceSchemeService.GetById(agentEntity.discount_id);
re_money = useDay * (refundDayPrice - (product.RefundDayPrice).ToDecimal() * discount.discount / 100) * accountInfo.ConnectCount;
@@ -1165,7 +1117,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
//折扣
var refundDayPrice = 10.00M;
var userEntity = await m_UserService.GetById(userId);
if(userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)){
if((userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)) && userEntity.discount_id >= 0){
//获取代理折扣
var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id);
if (discount != null){