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
78988958
Commit
78988958
authored
Aug 06, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
结算全局包邮
parent
cabad9cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
65 deletions
+150
-65
RB_FreeShipping_Extend.cs
Mall.Model/Extend/BaseSetUp/RB_FreeShipping_Extend.cs
+10
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+140
-65
No files found.
Mall.Model/Extend/BaseSetUp/RB_FreeShipping_Extend.cs
View file @
78988958
...
@@ -33,4 +33,14 @@ namespace Mall.Model.Extend.BaseSetUp
...
@@ -33,4 +33,14 @@ namespace Mall.Model.Extend.BaseSetUp
/// </summary>
/// </summary>
public
int
CategoryId
{
get
;
set
;
}
public
int
CategoryId
{
get
;
set
;
}
}
}
/// <summary>
/// 包邮满足的订单商品
/// </summary>
public
class
FreeShippingGoodsDetail
{
public
int
FreeShipping
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
int
GoodsId
{
get
;
set
;
}
public
string
SpecificationKey
{
get
;
set
;
}
}
}
}
Mall.Module.Product/OrderModule.cs
View file @
78988958
...
@@ -1637,8 +1637,10 @@ namespace Mall.Module.Product
...
@@ -1637,8 +1637,10 @@ namespace Mall.Module.Product
}
}
#
region
处理全局包邮
#
region
处理全局包邮
List
<
RB_FreeShipping_Extend
>
freeShippingList
=
new
List
<
RB_FreeShipping_Extend
>();
List
<
RB_FreeShipping_Extend
>
freeShippingList
=
new
List
<
RB_FreeShipping_Extend
>();
List
<
FreeShippingGoodsDetail
>
SatisfiedGoodsList
=
new
List
<
FreeShippingGoodsDetail
>();
//可包邮的商品
if
(
YFCategoryList
.
Any
())
{
if
(
YFCategoryList
.
Any
())
{
string
categoryIds
=
string
.
Join
(
","
,
YFCategoryList
.
Distinct
());
YFCategoryList
=
YFCategoryList
.
Distinct
().
ToList
();
string
categoryIds
=
string
.
Join
(
","
,
YFCategoryList
);
freeShippingList
=
freeShippingRepository
.
GetFreeShippingListByCategoryIds
(
new
RB_FreeShipping_Extend
{
MallBaseId
=
demodel
.
MallBaseId
,
TenantId
=
demodel
.
TenantId
,
CategoryIds
=
categoryIds
});
freeShippingList
=
freeShippingRepository
.
GetFreeShippingListByCategoryIds
(
new
RB_FreeShipping_Extend
{
MallBaseId
=
demodel
.
MallBaseId
,
TenantId
=
demodel
.
TenantId
,
CategoryIds
=
categoryIds
});
}
}
#
endregion
#
endregion
...
@@ -1681,12 +1683,103 @@ namespace Mall.Module.Product
...
@@ -1681,12 +1683,103 @@ namespace Mall.Module.Product
#
region
运费
#
region
运费
decimal
Express
=
0
;
decimal
Express
=
0
;
string
FreeShippingDescription
=
""
;
if
(
defModel
.
Id
>
0
&&
demodel
.
DeliveryMethod
==
OrderDeliveryMethodEnum
.
ExpressDistribution
)
if
(
defModel
.
Id
>
0
&&
demodel
.
DeliveryMethod
==
OrderDeliveryMethodEnum
.
ExpressDistribution
)
{
{
//计算总和
//计算总和
int
exNum
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
).
Sum
(
x
=>
x
.
Number
??
0
);
int
exNum
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
).
Sum
(
x
=>
x
.
Number
??
0
);
decimal
exMoney
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
).
Sum
(
x
=>
x
.
NorGoodsMoney
);
decimal
exMoney
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
).
Sum
(
x
=>
x
.
NorGoodsMoney
);
if
(!((
gmodel
.
FullNumPinkage
>
0
&&
exNum
>=
gmodel
.
FullNumPinkage
)
||
(
gmodel
.
FullMoneyPinkage
>
0
&&
exMoney
>=
gmodel
.
FullMoneyPinkage
)))
if
(!((
gmodel
.
FullNumPinkage
>
0
&&
exNum
>=
gmodel
.
FullNumPinkage
)
||
(
gmodel
.
FullMoneyPinkage
>
0
&&
exMoney
>=
gmodel
.
FullMoneyPinkage
)))
{
bool
IsFreeShipping
=
false
;
if
((
gmodel
.
FullMoneyPinkage
??
0
)
==
0
&&
(
gmodel
.
FullNumPinkage
??
0
)
==
0
&&
YFCategoryList
.
Any
())
{
//查找全局包邮规则
if
(
freeShippingList
!=
null
&&
freeShippingList
.
Any
())
{
var
fullNumPinkageModel
=
freeShippingList
.
Where
(
x
=>
item
.
CategoryIdList
.
Contains
(
x
.
CategoryId
)
&&
x
.
IsFreeShipping
==
1
&&
x
.
IsEnable
==
1
&&
x
.
FullNumPinkage
>
0
&&
x
.
CategoryId
>
0
).
OrderBy
(
x
=>
x
.
FullNumPinkage
).
ThenByDescending
(
x
=>
x
.
ID
).
FirstOrDefault
();
if
(
fullNumPinkageModel
==
null
||
fullNumPinkageModel
.
ID
<=
0
)
{
fullNumPinkageModel
=
freeShippingList
.
Where
(
x
=>
item
.
CategoryIdList
.
Contains
(
x
.
CategoryId
)
&&
x
.
IsFreeShipping
==
1
&&
x
.
IsEnable
==
1
&&
x
.
FullMoneyPinkage
>
0
&&
x
.
CategoryId
>
0
).
OrderBy
(
x
=>
x
.
FullMoneyPinkage
).
ThenByDescending
(
x
=>
x
.
ID
).
FirstOrDefault
();
}
if
(
fullNumPinkageModel
==
null
||
fullNumPinkageModel
.
ID
<=
0
)
{
fullNumPinkageModel
=
freeShippingList
.
Where
(
x
=>
item
.
CategoryIdList
.
Contains
(
x
.
CategoryId
)
&&
x
.
IsFreeShipping
==
1
&&
x
.
IsEnable
==
1
&&
x
.
FullNumPinkage
>
0
&&
x
.
CategoryId
==
0
).
OrderBy
(
x
=>
x
.
FullNumPinkage
).
ThenByDescending
(
x
=>
x
.
ID
).
FirstOrDefault
();
}
if
(
fullNumPinkageModel
==
null
||
fullNumPinkageModel
.
ID
<=
0
)
{
fullNumPinkageModel
=
freeShippingList
.
Where
(
x
=>
item
.
CategoryIdList
.
Contains
(
x
.
CategoryId
)
&&
x
.
IsFreeShipping
==
1
&&
x
.
IsEnable
==
1
&&
x
.
FullMoneyPinkage
>
0
&&
x
.
CategoryId
==
0
).
OrderBy
(
x
=>
x
.
FullMoneyPinkage
).
ThenByDescending
(
x
=>
x
.
ID
).
FirstOrDefault
();
}
if
(
fullNumPinkageModel
!=
null
)
{
//看所有商品是否满足该规则
var
sglist
=
SatisfiedGoodsList
.
Where
(
x
=>
x
.
FreeShipping
!=
fullNumPinkageModel
.
ID
).
ToList
();
var
nosglist
=
SatisfiedGoodsList
.
Where
(
x
=>
x
.
FreeShipping
==
fullNumPinkageModel
.
ID
).
ToList
();
if
(
sglist
.
Any
())
{
//看着商品是否包含在这里面
if
(
sglist
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationKey
==
item
.
SpecificationSort
).
Any
())
{
IsFreeShipping
=
true
;
FreeShippingDescription
=
sglist
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationKey
==
item
.
SpecificationSort
).
FirstOrDefault
().
Name
;
}
}
else
{
//查询出规格下所有的分类
List
<
int
>
GZCList
=
new
List
<
int
>();
if
(
fullNumPinkageModel
.
CategoryId
>=
0
)
{
GZCList
=
freeShippingList
.
Where
(
x
=>
x
.
ID
==
fullNumPinkageModel
.
ID
).
Select
(
x
=>
x
.
CategoryId
).
ToList
();
}
//根据分类 查询出所有的订单商品
foreach
(
var
qitem
in
demodel
.
DetailList
)
{
if
(!
nosglist
.
Where
(
x
=>
x
.
GoodsId
==
qitem
.
GoodsId
&&
x
.
SpecificationKey
==
qitem
.
SpecificationSort
).
Any
())
{
string
Name
=
fullNumPinkageModel
.
Name
;
if
(
fullNumPinkageModel
.
FullNumPinkage
>
0
)
{
Name
+=
":满"
+
fullNumPinkageModel
.
FullNumPinkage
+
"件包邮"
;
}
else
if
(
fullNumPinkageModel
.
FullMoneyPinkage
>
0
)
{
Name
+=
":满"
+
fullNumPinkageModel
.
FullMoneyPinkage
+
"元包邮"
;
}
if
(
GZCList
.
Any
())
{
if
(
qitem
.
CategoryIdList
.
Where
(
x
=>
GZCList
.
Contains
(
x
)).
Any
())
{
SatisfiedGoodsList
.
Add
(
new
FreeShippingGoodsDetail
()
{
FreeShipping
=
fullNumPinkageModel
.
ID
,
Name
=
Name
,
GoodsId
=
qitem
.
GoodsId
??
0
,
SpecificationKey
=
qitem
.
NewSpecificationSort
});
}
}
else
{
SatisfiedGoodsList
.
Add
(
new
FreeShippingGoodsDetail
()
{
FreeShipping
=
fullNumPinkageModel
.
ID
,
Name
=
Name
,
GoodsId
=
qitem
.
GoodsId
??
0
,
SpecificationKey
=
qitem
.
NewSpecificationSort
});
}
}
}
//看着商品是否包含在这里面
if
(
SatisfiedGoodsList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationKey
==
item
.
SpecificationSort
).
Any
())
{
IsFreeShipping
=
true
;
FreeShippingDescription
=
SatisfiedGoodsList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationKey
==
item
.
SpecificationSort
).
FirstOrDefault
().
Name
;
}
}
}
}
}
if
(
IsFreeShipping
==
false
)
{
{
int
FreightId2
=
gmodel
.
FreightId
??
0
;
int
FreightId2
=
gmodel
.
FreightId
??
0
;
if
(
gmodel
.
FreightId
==
0
)
if
(
gmodel
.
FreightId
==
0
)
...
@@ -1766,25 +1859,6 @@ namespace Mall.Module.Product
...
@@ -1766,25 +1859,6 @@ namespace Mall.Module.Product
}
}
}
}
}
}
else
{
if
((
gmodel
.
FullMoneyPinkage
??
0
)
==
0
&&
(
gmodel
.
FullNumPinkage
??
0
)
==
0
&&
YFCategoryList
.
Any
())
{
//查找全局包邮规则
//if (freeShippingList != null && freeShippingList.Any())
//{
// var nowcategory = categoryList.Where(x => x.GoodsId == item.GoodsId).Select(x => x.CategoryId);
// var fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
// if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
// {
// fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
// }
// item.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
//}
//else
//{
// item.FreeShippingModel = new RB_FreeShipping_Extend();
//}
}
}
}
}
}
TotalExpress
+=
Express
;
TotalExpress
+=
Express
;
...
@@ -1832,6 +1906,7 @@ namespace Mall.Module.Product
...
@@ -1832,6 +1906,7 @@ namespace Mall.Module.Product
address_disabled
,
address_disabled
,
pieces
=
gmodel
.
FullNumPinkage
,
//满件包邮
pieces
=
gmodel
.
FullNumPinkage
,
//满件包邮
forehead
=
gmodel
.
FullMoneyPinkage
,
//满额包邮
forehead
=
gmodel
.
FullMoneyPinkage
,
//满额包邮
freeShippingDescription
=
FreeShippingDescription
,
freight_id
=
gmodel
.
FreightId
,
freight_id
=
gmodel
.
FreightId
,
express_price
=
item
.
Express
,
express_price
=
item
.
Express
,
unit_price
=
item
.
Unit_Price
,
unit_price
=
item
.
Unit_Price
,
...
...
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