Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
bb3d7da0
Commit
bb3d7da0
authored
Jun 02, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分销
parent
0367ae6c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
105 additions
and
3 deletions
+105
-3
RB_Distributor_HPGradeRatio_Extend.cs
Mall.Model/Extend/User/RB_Distributor_HPGradeRatio_Extend.cs
+5
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+1
-1
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+2
-2
UserModule.cs
Mall.Module.User/UserModule.cs
+73
-0
RB_Distributor_HPCommissionRepository.cs
....Repository/User/RB_Distributor_HPCommissionRepository.cs
+3
-0
RB_Distributor_HPGradeRatioRepository.cs
....Repository/User/RB_Distributor_HPGradeRatioRepository.cs
+3
-0
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+18
-0
No files found.
Mall.Model/Extend/User/RB_Distributor_HPGradeRatio_Extend.cs
View file @
bb3d7da0
...
...
@@ -25,5 +25,10 @@ namespace Mall.Model.Extend.User
/// 等级名称
/// </summary>
public
string
GradeName
{
get
;
set
;
}
/// <summary>
/// 是否直客 1是 2否
/// </summary>
public
int
?
IsGuest
{
get
;
set
;
}
}
}
Mall.Module.Product/OrderModule.cs
View file @
bb3d7da0
...
...
@@ -2574,7 +2574,7 @@ namespace Mall.Module.Product
if
(
item
.
CostMoney
>
0
)
{
//成本价格大于0的才进行返佣
string
categoryids
=
string
.
Join
(
","
,
item
.
CategoryIdList
);
var
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
CategoryIdsT
=
categoryids
});
var
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
CategoryIdsT
=
categoryids
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
if
(
hpcList
.
Any
())
{
RB_Distributor_HPCommission_Extend
hpcModel
;
...
...
Mall.Module.Product/ProductModule.cs
View file @
bb3d7da0
...
...
@@ -773,7 +773,7 @@ namespace Mall.Module.Product
//获取和平分销返佣
if
(
disModel
.
HPGradeId
>
0
&&
model
.
CostPrice
>
0
)
{
string
categoryids
=
string
.
Join
(
","
,
model
.
CategoryList
.
Select
(
x
=>
x
.
CategoryId
));
var
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
CategoryIdsT
=
categoryids
});
var
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
CategoryIdsT
=
categoryids
,
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
});
if
(
hpcList
.
Any
())
{
RB_Distributor_HPCommission_Extend
hpcModel
;
...
...
@@ -1137,7 +1137,7 @@ namespace Mall.Module.Product
if
(
disModel
.
HPGradeId
>
0
&&
model
.
CostPrice
>
0
)
{
string
categoryids
=
string
.
Join
(
","
,
model
.
CategoryList
.
Select
(
x
=>
x
.
CategoryId
));
var
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
CategoryIdsT
=
categoryids
});
var
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
CategoryIdsT
=
categoryids
,
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
});
if
(
hpcList
.
Any
())
{
RB_Distributor_HPCommission_Extend
hpcModel
;
...
...
Mall.Module.User/UserModule.cs
View file @
bb3d7da0
...
...
@@ -3359,6 +3359,79 @@ namespace Mall.Module.User
};
}
/// <summary>
/// 获取商品建议价格
/// </summary>
/// <param name="categoryIds"></param>
/// <param name="costPrice"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
object
GetHpGoodsSuggestPrice
(
string
categoryIds
,
decimal
costPrice
,
int
tenantId
,
int
mallBaseId
)
{
//判断是否开启和平返佣
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_HPCommission_Extend
.
Status
),
FiledValue
=
0
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_HPCommission_Extend
.
Enabled
),
FiledValue
=
1
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_HPCommission_Extend
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_HPCommission_Extend
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
if
(!
distributor_HPCommissionRepository
.
Exists
(
wheres
))
{
return
new
{
Status
=
2
,
Msg
=
"未配置和平返佣"
};
}
List
<
RB_Distributor_HPCommission_Extend
>
hpcList
=
new
List
<
RB_Distributor_HPCommission_Extend
>();
if
(
string
.
IsNullOrEmpty
(
categoryIds
))
{
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
IsCommon
=
1
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
}
else
{
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
CategoryIds
=
categoryIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
}
if
(
hpcList
.
Any
())
{
var
hpcModel
=
hpcList
.
FirstOrDefault
();
//查询直客毛利率
var
gList
=
distributor_HPGradeRatioRepository
.
GetList
(
new
RB_Distributor_HPGradeRatio_Extend
()
{
CommissionId
=
hpcModel
.
Id
,
IsGuest
=
1
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
var
ratioModel
=
gList
.
FirstOrDefault
();
if
(
ratioModel
!=
null
)
{
decimal
MPrice
=
costPrice
/
(
1
-
((
ratioModel
.
CommissionRatio
??
0
)
/
100
));
MPrice
=
Math
.
Ceiling
(
MPrice
);
return
new
{
Status
=
1
,
MPrice
,
Msg
=
""
};
}
}
return
new
{
Status
=
3
,
Msg
=
"未匹配到适用的返佣"
};
}
#
endregion
}
}
Mall.Repository/User/RB_Distributor_HPCommissionRepository.cs
View file @
bb3d7da0
...
...
@@ -89,6 +89,9 @@ where {where} group by h.Id order by h.Id desc";
{
where
+=
$@" and h.
{
nameof
(
RB_Distributor_HPCommission
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
IsCommon
==
1
)
{
where
+=
$@" and h.
{
nameof
(
RB_Distributor_HPCommission
.
IsCommon
)}
=1"
;
}
string
sql
=
$@"select h.* from RB_Distributor_HPCommission h
left join RB_Distributor_HPCategory c on h.Id = c.CommissionId
...
...
Mall.Repository/User/RB_Distributor_HPGradeRatioRepository.cs
View file @
bb3d7da0
...
...
@@ -36,6 +36,9 @@ namespace Mall.Repository.User
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
CommissionIds
))
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_HPGradeRatio
.
CommissionId
)}
in(
{
dmodel
.
CommissionIds
}
)"
;
}
if
(
dmodel
.
IsGuest
==
1
)
{
where
+=
$@" and g.
{
nameof
(
RB_Distributor_HPGradeInfo
.
IsGuest
)}
=1"
;
}
string
sql
=
$@"select r.*,g.Grade,g.GradeName from RB_Distributor_HPGradeRatio r
inner join RB_Distributor_HPGradeInfo g on r.GradeId = g.Id
...
...
Mall.WebApi/Controllers/User/UserController.cs
View file @
bb3d7da0
...
...
@@ -2486,6 +2486,24 @@ namespace Mall.WebApi.Controllers.User
return
ApiResult
.
Success
(
""
,
obj
);
}
/// <summary>
/// 获取商品建议价格
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetHpGoodsSuggestPrice
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
string
CategoryIds
=
parms
.
GetStringValue
(
"CategoryIds"
);
decimal
CostPrice
=
parms
.
GetDecimal
(
"CostPrice"
);
if
(
CostPrice
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递成本价格"
);
}
var
obj
=
userModule
.
GetHpGoodsSuggestPrice
(
CategoryIds
,
CostPrice
,
req
.
TenantId
,
req
.
MallBaseId
);
return
ApiResult
.
Success
(
""
,
obj
);
}
#
endregion
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment