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
fdfa5dd0
Commit
fdfa5dd0
authored
Jun 12, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整下单优惠券+积分抵扣
parent
f367d62e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
38 deletions
+105
-38
RB_Goods_OrderDetail.cs
Mall.Model/Entity/Product/RB_Goods_OrderDetail.cs
+4
-0
RB_Member_Integral.cs
Mall.Model/Entity/User/RB_Member_Integral.cs
+4
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+97
-38
No files found.
Mall.Model/Entity/Product/RB_Goods_OrderDetail.cs
View file @
fdfa5dd0
...
...
@@ -204,5 +204,9 @@ namespace Mall.Model.Entity.Product
/// 成本单据ID
/// </summary>
public
int
CostFinanceId
{
get
;
set
;
}
/// <summary>
/// 积分赠送
/// </summary>
public
int
?
IntegralGoodsPresent
{
get
;
set
;
}
}
}
Mall.Model/Entity/User/RB_Member_Integral.cs
View file @
fdfa5dd0
...
...
@@ -94,5 +94,9 @@ namespace Mall.Model.Entity.User
/// 备注
/// </summary>
public
string
Remarks
{
get
;
set
;
}
/// <summary>
/// 订单id
/// </summary>
public
int
?
OrderId
{
get
;
set
;
}
}
}
Mall.Module.Product/OrderModule.cs
View file @
fdfa5dd0
...
...
@@ -2016,6 +2016,8 @@ namespace Mall.Module.Product
decimal
TotalExpress
=
0
;
decimal
TotalMoney
=
0
;
string
GoodsIds
=
""
;
int
TotalIntegralNumber
=
0
;
//总使用积分
decimal
TotalIntegralMoney
=
0
;
//总使用积分抵扣金额
List
<
RB_Goods_CouponModel
>
GoodsCouponList
=
new
List
<
RB_Goods_CouponModel
>();
//商品优惠卷 价格(每个商品优惠的价格)
decimal
CouponsMoney
=
0
;
//优惠卷验证
#
region
优惠卷初始化
...
...
@@ -2405,6 +2407,8 @@ namespace Mall.Module.Product
}
if
(
demodel
.
Use_Integral
==
1
)
{
TotalIntegralNumber
+=
(
item
.
IntegralNumber
??
0
);
TotalIntegralMoney
+=
(
item
.
IntegralMoney
??
0
);
item
.
Final_Price
-=
(
item
.
IntegralMoney
??
0
);
}
#
endregion
...
...
@@ -2600,6 +2604,24 @@ namespace Mall.Module.Product
if
(
umodel
.
CouponsNum
<
0
)
{
umodel
.
CouponsNum
=
0
;
}
keyValues
.
Add
(
nameof
(
RB_Member_User_Extend
.
CouponsNum
),
umodel
.
CouponsNum
);
}
if
(
demodel
.
Use_Integral
==
1
&&
TotalIntegralNumber
>
0
)
{
keyValues
.
Add
(
nameof
(
RB_Member_User_Extend
.
Integral
),
(
umodel
.
Integral
??
0
));
member_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Member_Integral
()
{
Id
=
0
,
CreateDate
=
DateTime
.
Now
,
Description
=
"订单使用积分抵扣"
+
TotalIntegralMoney
+
"元"
,
Image
=
0
,
Integral
=
TotalIntegralNumber
,
MallBaseId
=
demodel
.
MallBaseId
,
PlatformType
=
demodel
.
OrderSource
,
Remarks
=
""
,
TenantId
=
demodel
.
TenantId
,
Type
=
Common
.
Enum
.
MarketingCenter
.
RecordTypeEnum
.
Expend
,
UserId
=
demodel
.
UserId
,
OrderId
=
OrderId
},
trans
);
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
...
...
@@ -3358,9 +3380,17 @@ namespace Mall.Module.Product
/// <param name="OrderId"></param>
private
void
InsertOrderDetail
(
RB_Goods_Order_Extend
demodel
,
System
.
Data
.
IDbTransaction
trans
,
int
OrderId
)
{
int
IntegralPresentTotal
=
0
;
foreach
(
var
item
in
demodel
.
DetailList
)
{
int
IntegralPresent
=
item
.
IntegralPresent
??
0
;
//积分
if
(
item
.
IntegralPresent
>
0
)
{
if
(
item
.
IntegralPresentType
==
1
)
{
IntegralPresent
=
Convert
.
ToInt32
(((
item
.
Final_Price
??
0
)
+
(
item
.
FreightMoney
??
0
))
*
(
item
.
IntegralPresent
??
0
)
/
100
);
}
}
//插入订单明细表
int
detailId
=
goods_OrderDetailRepository
.
Insert
(
new
RB_Goods_OrderDetail
()
{
...
...
@@ -3385,22 +3415,11 @@ namespace Mall.Module.Product
TenantId
=
demodel
.
TenantId
,
UpdateDate
=
DateTime
.
Now
,
IsComment
=
2
,
FreightMoney
=
item
.
FreightMoney
FreightMoney
=
item
.
FreightMoney
,
IntegralGoodsPresent
=
IntegralPresent
},
trans
);
item
.
Id
=
detailId
;
//积分
if
(
item
.
IntegralPresent
>
0
)
{
int
IntegralPresent
=
item
.
IntegralPresent
??
0
;
if
(
item
.
IntegralPresentType
==
1
)
{
IntegralPresent
=
Convert
.
ToInt32
(((
item
.
Final_Price
??
0
)
+
(
item
.
FreightMoney
??
0
))
*
(
item
.
IntegralPresent
??
0
)
/
100
);
}
if
(
IntegralPresent
>
0
)
{
IntegralPresentTotal
+=
IntegralPresent
;
}
}
//更新商品数量
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods
.
InventoryNum
),
item
.
InventoryNum
-(
item
.
Number
??
0
)}
...
...
@@ -3456,7 +3475,7 @@ namespace Mall.Module.Product
goods_SpecificationPriceRepository
.
Update
(
keyValuesp
,
wheresp
,
trans
);
}
//记录日志
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Id
=
0
,
Type
=
2
,
...
...
@@ -3465,26 +3484,27 @@ namespace Mall.Module.Product
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
demodel
.
MallBaseId
,
TenantId
=
demodel
.
TenantId
}));
}
},
trans
);
}
if
(
IntegralPresentTotal
>
0
)
{
member_IntegralRepository
.
Insert
(
new
Model
.
Entity
.
User
.
RB_Member_Integral
()
{
Id
=
0
,
CreateDate
=
DateTime
.
Now
,
Description
=
"订单购买赠送积分"
,
Image
=
0
,
Integral
=
IntegralPresentTotal
,
MallBaseId
=
demodel
.
MallBaseId
,
PlatformType
=
demodel
.
OrderSource
,
Remarks
=
""
,
TenantId
=
demodel
.
TenantId
,
Type
=
Common
.
Enum
.
MarketingCenter
.
RecordTypeEnum
.
Income
,
UserId
=
demodel
.
UserId
});
}
//if (IntegralPresentTotal > 0)
//{
// member_IntegralRepository.Insert(new Model.Entity.User.RB_Member_Integral()
// {
// Id = 0,
// CreateDate = DateTime.Now,
// Description = "订单购买赠送积分",
// Image = 0,
// Integral = IntegralPresentTotal,
// MallBaseId = demodel.MallBaseId,
// PlatformType = demodel.OrderSource,
// Remarks = "",
// TenantId = demodel.TenantId,
// Type = Common.Enum.MarketingCenter.RecordTypeEnum.Income,
// UserId = demodel.UserId,
// OrderId = OrderId
// }, trans);
//}
}
/// <summary>
...
...
@@ -3568,6 +3588,7 @@ namespace Mall.Module.Product
//回滚商品库存
if
(
type
==
1
)
{
int
TotalIntegralNumber
=
0
;
var
detailList
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
GoodsId
=
omodel
.
OrderId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
detailList
.
Any
())
{
...
...
@@ -3625,7 +3646,7 @@ namespace Mall.Module.Product
}
};
goodsRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Id
=
0
,
Type
=
2
,
...
...
@@ -3634,10 +3655,48 @@ namespace Mall.Module.Product
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
}));
});
if
(
item
.
IntegralNumber
>
0
)
{
TotalIntegralNumber
+=
(
item
.
IntegralNumber
??
0
);
}
}
}
var
umodel
=
member_UserRepository
.
GetEntity
(
omodel
.
UserId
);
//积分抵扣回滚
if
(
TotalIntegralNumber
>
0
)
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
Integral
),
umodel
.
Integral
+
TotalIntegralNumber
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User_Extend
.
Id
),
FiledValue
=
umodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
member_UserRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
}
//优惠券回滚
if
(!
string
.
IsNullOrEmpty
(
omodel
.
CouponsIds
))
{
var
cList
=
member_CouponRepository
.
GetList
(
new
RB_Member_DiscountCoupon_Extend
()
{
UseState
=
1
,
Ids
=
omodel
.
CouponsIds
,
UserId
=
omodel
.
UserId
,
TenantId
=
omodel
.
TenantId
,
MallBaseId
=
omodel
.
MallBaseId
});
foreach
(
var
item
in
cList
)
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_DiscountCoupon_Extend
.
UseState
),
0
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_DiscountCoupon_Extend
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
member_CouponRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
}
}
//余额支付回滚
}
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Id
=
0
,
...
...
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