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
9d3d507a
Commit
9d3d507a
authored
May 15, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序订单+售后订单基础
parent
7409b012
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1673 additions
and
286 deletions
+1673
-286
RB_Goods_Order.cs
Mall.Model/Entity/Product/RB_Goods_Order.cs
+1
-1
RB_Goods_OrderAfterSale.cs
Mall.Model/Entity/Product/RB_Goods_OrderAfterSale.cs
+182
-0
RB_Goods_OrderAfterSaleLog.cs
Mall.Model/Entity/Product/RB_Goods_OrderAfterSaleLog.cs
+74
-0
RB_Goods_OrderExpress.cs
Mall.Model/Entity/Product/RB_Goods_OrderExpress.cs
+4
-0
RB_Goods_OrderAfterSaleLog_Extend.cs
...Model/Extend/Product/RB_Goods_OrderAfterSaleLog_Extend.cs
+18
-0
RB_Goods_OrderAfterSale_Extend.cs
Mall.Model/Extend/Product/RB_Goods_OrderAfterSale_Extend.cs
+49
-0
RB_Goods_Order_Extend.cs
Mall.Model/Extend/Product/RB_Goods_Order_Extend.cs
+11
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+939
-270
RB_Goods_OrderAfterSaleLogRepository.cs
...epository/Product/RB_Goods_OrderAfterSaleLogRepository.cs
+46
-0
RB_Goods_OrderAfterSaleRepository.cs
Mall.Repository/Product/RB_Goods_OrderAfterSaleRepository.cs
+116
-0
RB_Goods_OrderRepository.cs
Mall.Repository/Product/RB_Goods_OrderRepository.cs
+4
-0
AppletOrderController.cs
Mall.WebApi/Controllers/Product/AppletOrderController.cs
+161
-10
OrderController.cs
Mall.WebApi/Controllers/Product/OrderController.cs
+68
-5
No files found.
Mall.Model/Entity/Product/RB_Goods_Order.cs
View file @
9d3d507a
...
...
@@ -178,7 +178,7 @@ namespace Mall.Model.Entity.Product
/// <summary>
/// 收货地址
/// </summary>
public
string
Sh
i
ppingAddress
public
string
Sh
o
ppingAddress
{
get
;
set
;
...
...
Mall.Model/Entity/Product/RB_Goods_OrderAfterSale.cs
0 → 100644
View file @
9d3d507a
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.Product
{
/// <summary>
/// 商品订单售后表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_OrderAfterSale
{
/// <summary>
/// ReOrderId
/// </summary>
public
int
ReOrderId
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 订单id
/// </summary>
public
int
?
OrderId
{
get
;
set
;
}
/// <summary>
/// 订单明细id
/// </summary>
public
int
?
OrderDetialId
{
get
;
set
;
}
/// <summary>
/// 售后订单号
/// </summary>
public
string
ReOrderNo
{
get
;
set
;
}
/// <summary>
/// 类型 1退货退款 2换货
/// </summary>
public
int
?
Type
{
get
;
set
;
}
/// <summary>
/// 原因
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 退货数量
/// </summary>
public
int
?
ReNumber
{
get
;
set
;
}
/// <summary>
/// 客人付款金额
/// </summary>
public
decimal
?
Income
{
get
;
set
;
}
/// <summary>
/// 退款金额
/// </summary>
public
decimal
?
Refund
{
get
;
set
;
}
/// <summary>
/// 实际退款金额
/// </summary>
public
decimal
?
RefundActual
{
get
;
set
;
}
/// <summary>
/// 凭证图片 json格式
/// </summary>
public
string
Voucher
{
get
;
set
;
}
/// <summary>
/// 售后状态 1待审核 2待买家发货 3已发货待商家处理(待卖家收货) 4待卖家退款 5已完成 6已拒绝
/// </summary>
public
int
?
ReOrderStatus
{
get
;
set
;
}
/// <summary>
/// 商家收货地址id
/// </summary>
public
int
?
DeliveryId
{
get
;
set
;
}
/// <summary>
/// 客人退货物流id
/// </summary>
public
int
?
ReExpressId
{
get
;
set
;
}
/// <summary>
/// 客人退货快递单号
/// </summary>
public
string
ReExpressNumber
{
get
;
set
;
}
/// <summary>
/// 同意/拒绝时间
/// </summary>
public
DateTime
?
AuditTime
{
get
;
set
;
}
/// <summary>
/// 完成时间
/// </summary>
public
DateTime
?
FinishTime
{
get
;
set
;
}
/// <summary>
/// 删除状态
/// </summary>
public
int
?
Status
{
get
;
set
;
}
/// <summary>
/// 商户号
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
}
}
Mall.Model/Entity/Product/RB_Goods_OrderAfterSaleLog.cs
0 → 100644
View file @
9d3d507a
using
Mall.Common.AOP
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.Product
{
/// <summary>
/// 商品订单售后操作流程表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_OrderAfterSaleLog
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 售后订单id
/// </summary>
public
int
?
ReOrderId
{
get
;
set
;
}
/// <summary>
/// 类型 1买家 2卖家
/// </summary>
public
int
?
Type
{
get
;
set
;
}
/// <summary>
/// 内容
/// </summary>
public
string
Content
{
get
;
set
;
}
/// <summary>
/// 商户号
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
}
}
Mall.Model/Entity/Product/RB_Goods_OrderExpress.cs
View file @
9d3d507a
...
...
@@ -94,5 +94,9 @@ namespace Mall.Model.Entity.Product
get
;
set
;
}
/// <summary>
/// 换货时 售后订单id
/// </summary>
public
int
?
AfterSaleOrderId
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_OrderAfterSaleLog_Extend.cs
0 → 100644
View file @
9d3d507a
using
Mall.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
namespace
Mall.Model.Extend.Product
{
/// <summary>
/// 商品订单售后流程表扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_OrderAfterSaleLog_Extend
:
RB_Goods_OrderAfterSaleLog
{
}
}
Mall.Model/Extend/Product/RB_Goods_OrderAfterSale_Extend.cs
0 → 100644
View file @
9d3d507a
using
Mall.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
namespace
Mall.Model.Extend.Product
{
/// <summary>
/// 商品订单售后表扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_OrderAfterSale_Extend
:
RB_Goods_OrderAfterSale
{
/// <summary>
/// 订单号
/// </summary>
public
string
OrderNo
{
get
;
set
;
}
/// <summary>
/// 用户名
/// </summary>
public
string
UserName
{
get
;
set
;
}
/// <summary>
/// 商品名称
/// </summary>
public
string
GoodsName
{
get
;
set
;
}
/// <summary>
/// 收件人
/// </summary>
public
string
Consignee
{
get
;
set
;
}
/// <summary>
/// 收件人电话
/// </summary>
public
string
Mobile
{
get
;
set
;
}
/// <summary>
/// 用户平台
/// </summary>
public
int
OrderSource
{
get
;
set
;
}
/// <summary>
/// 开始时间
/// </summary>
public
string
StartTime
{
get
;
set
;
}
/// <summary>
/// 结束时间
/// </summary>
public
string
EndTime
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_Order_Extend.cs
View file @
9d3d507a
...
...
@@ -13,8 +13,15 @@ namespace Mall.Model.Extend.Product
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_Order_Extend
:
RB_Goods_Order
{
/// <summary>
/// 是否来自购物车 1是 2否
/// </summary>
public
int
?
IsFormShoppingCart
{
get
;
set
;
}
/// <summary>
/// 购物车ids
/// </summary>
public
List
<
int
>
ShoppingCartIdList
{
get
;
set
;
}
/// <summary>
/// 收货地址id
/// </summary>
public
int
?
ShoppingAddressId
{
get
;
set
;
}
...
...
@@ -57,6 +64,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
int
?
OrderType
{
get
;
set
;
}
/// <summary>
/// 多个状态查询
/// </summary>
public
string
OrderStatusIds
{
get
;
set
;
}
/// <summary>
/// 明细列表
/// </summary>
public
List
<
RB_Goods_OrderDetail_Extend
>
DetailList
{
get
;
set
;
}
...
...
Mall.Module.Product/OrderModule.cs
View file @
9d3d507a
...
...
@@ -330,10 +330,11 @@ namespace Mall.Module.Product
/// 删除购物车
/// </summary>
/// <param name="shoppingCartIds"></param>
/// <param name="userId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
DelGoodsShoppingCartInfo
(
string
shoppingCartIds
,
int
tenantId
,
int
mallBaseId
)
public
bool
DelGoodsShoppingCartInfo
(
string
shoppingCartIds
,
int
userId
,
int
tenantId
,
int
mallBaseId
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_ShoppingCart
.
Status
),
1
},
...
...
@@ -345,6 +346,11 @@ namespace Mall.Module.Product
FiledValue
=
shoppingCartIds
,
OperatorEnum
=
OperatorEnum
.
IN
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
UserId
),
FiledValue
=
userId
,
OperatorEnum
=
OperatorEnum
.
IN
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
TenantId
),
FiledValue
=
tenantId
,
...
...
@@ -361,8 +367,214 @@ namespace Mall.Module.Product
#
endregion
#
region
小程序下单
/// <summary>
/// 小程序我的订单列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_Order_Extend
>
GetAppletGoodsMyOrderPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_Order_Extend
demodel
)
{
var
list
=
goods_OrderRepository
.
GetOrderPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
//查询订单明细
var
dlist
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
OrderIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
OrderId
))
});
//查询图片
List
<
RB_Material_Info_Extend
>
Mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(
dlist
.
Any
())
{
Mlist
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
MaterialIds
=
string
.
Join
(
","
,
dlist
.
Select
(
x
=>
x
.
CoverImage
))
});
foreach
(
var
item
in
dlist
)
{
item
.
CoverImagePath
=
Mlist
.
Where
(
x
=>
x
.
Id
==
item
.
CoverImage
).
FirstOrDefault
()?.
Path
??
""
;
}
}
string
areaIds1
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Province
??
0
).
Distinct
());
string
areaIds2
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
City
??
0
).
Distinct
());
string
areaIds3
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
District
??
0
).
Distinct
());
string
areaIds
=
"0"
;
if
(!
string
.
IsNullOrEmpty
(
areaIds1
))
{
areaIds
+=
","
+
areaIds1
;
}
if
(!
string
.
IsNullOrEmpty
(
areaIds2
))
{
areaIds
+=
","
+
areaIds2
;
}
if
(!
string
.
IsNullOrEmpty
(
areaIds3
))
{
areaIds
+=
","
+
areaIds3
;
}
var
arealist
=
destinationRepository
.
GetDictvalueListForIds
(
areaIds
);
foreach
(
var
item
in
list
)
{
item
.
DetailList
=
dlist
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
item
.
DistrictAddress
=
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
Province
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
City
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
District
).
FirstOrDefault
()?.
Name
??
""
);
}
}
return
list
;
}
/// <summary>
/// 获取我的订单详情
/// </summary>
/// <param name="orderId"></param>
/// <param name="userId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
ApiResult
GetAppletMyOrderInfo
(
int
orderId
,
int
userId
,
int
tenantId
,
int
mallBaseId
)
{
var
model
=
goods_OrderRepository
.
GetEntity
(
orderId
).
RefMapperTo
<
RB_Goods_Order_Extend
>();
if
(
model
==
null
||
model
.
UserId
!=
userId
)
{
return
ApiResult
.
Failed
(
"订单信息不存在,请核实后再试"
);
}
//查询订单明细
var
dlist
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderId
});
//查询图片
List
<
RB_Material_Info_Extend
>
Mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(
dlist
.
Any
())
{
Mlist
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
MaterialIds
=
string
.
Join
(
","
,
dlist
.
Select
(
x
=>
x
.
CoverImage
))
});
foreach
(
var
item
in
dlist
)
{
item
.
CoverImagePath
=
Mlist
.
Where
(
x
=>
x
.
Id
==
item
.
CoverImage
).
FirstOrDefault
()?.
Path
??
""
;
}
}
model
.
DetailList
=
dlist
;
//地址
model
.
DistrictAddress
=
(
destinationRepository
.
GetEntity
(
model
.
Province
)?.
Name
??
""
)
+
" "
+
(
destinationRepository
.
GetEntity
(
model
.
City
)?.
Name
??
""
)
+
" "
+
(
destinationRepository
.
GetEntity
(
model
.
District
)?.
Name
??
""
);
//物流
var
erlist
=
goods_ExpressRelevanceRepository
.
GetList
(
new
RB_Goods_ExpressRelevance_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderId
});
List
<
RB_Goods_OrderExpress_Extend
>
oeList
=
new
List
<
RB_Goods_OrderExpress_Extend
>();
if
(
erlist
.
Any
())
{
oeList
=
goods_OrderExpressRepository
.
GetList
(
new
RB_Goods_OrderExpress_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderExpressIds
=
string
.
Join
(
","
,
erlist
.
Select
(
x
=>
x
.
OrderExpressId
))
});
foreach
(
var
item
in
oeList
)
{
item
.
ExpressName
=
logistics_ExpressRepository
.
GetEntity
(
item
.
ExpressId
)?.
Name
??
""
;
}
}
return
ApiResult
.
Success
(
""
,
new
{
model
.
OrderId
,
model
.
OrderNo
,
model
.
OrderStatus
,
OrderStatusName
=
model
.
OrderStatus
.
GetEnumName
(),
CreateDate
=
model
.
CreateDate
.
HasValue
?
model
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
CancelTime
=
model
.
CancelTime
.
HasValue
?
model
.
CancelTime
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
model
.
PaymentWay
,
PaymentWayName
=
model
.
PaymentWay
.
GetEnumName
(),
model
.
DeliveryMethod
,
DeliveryMethodName
=
model
.
DeliveryMethod
.
GetEnumName
(),
model
.
PreferPrice
,
model
.
Income
,
model
.
CouponMoney
,
model
.
FreightMoney
,
model
.
Consignee
,
model
.
Mobile
,
model
.
DistrictAddress
,
model
.
ShoppingAddress
,
IsHaveExpress
=
erlist
.
Any
()?
1
:
2
,
DetailList
=
model
.
DetailList
.
Select
(
x
=>
new
{
DetailId
=
x
.
Id
,
x
.
GoodsId
,
x
.
GoodsName
,
x
.
CoverImagePath
,
x
.
Specification
,
x
.
Number
,
x
.
Final_Price
}),
model
.
IsApplyForCancel
,
model
.
RejectRemark
});
}
/// <summary>
/// 获取我的订单快递信息
/// </summary>
/// <param name="orderId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
object
GetAppletMyOrderExpressInfo
(
int
orderId
,
int
tenantId
,
int
mallBaseId
)
{
//查询订单明细
var
dlist
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderId
});
//查询图片
List
<
RB_Material_Info_Extend
>
Mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(
dlist
.
Any
())
{
Mlist
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
MaterialIds
=
string
.
Join
(
","
,
dlist
.
Select
(
x
=>
x
.
CoverImage
))
});
foreach
(
var
item
in
dlist
)
{
item
.
CoverImagePath
=
Mlist
.
Where
(
x
=>
x
.
Id
==
item
.
CoverImage
).
FirstOrDefault
()?.
Path
??
""
;
}
}
//物流
var
erlist
=
goods_ExpressRelevanceRepository
.
GetList
(
new
RB_Goods_ExpressRelevance_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderId
});
List
<
RB_Goods_OrderExpress_Extend
>
oeList
=
new
List
<
RB_Goods_OrderExpress_Extend
>();
if
(
erlist
.
Any
())
{
oeList
=
goods_OrderExpressRepository
.
GetList
(
new
RB_Goods_OrderExpress_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderExpressIds
=
string
.
Join
(
","
,
erlist
.
Select
(
x
=>
x
.
OrderExpressId
))
});
foreach
(
var
item
in
oeList
)
{
item
.
ExpressName
=
logistics_ExpressRepository
.
GetEntity
(
item
.
ExpressId
)?.
Name
??
""
;
}
}
return
oeList
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
ExpressId
,
x
.
ExpressName
,
x
.
ExpressNumber
,
x
.
PostCode
,
x
.
Remark
,
x
.
Type
,
GoodsList
=
GetGoodsListForExpress
(
dlist
,
erlist
,
x
.
Id
).
Select
(
z
=>
new
{
z
.
Id
,
z
.
CoverImagePath
,
z
.
GoodsName
})
});
}
/// <summary>
/// 获取售后页面
/// </summary>
/// <param name="orderDetailId"></param>
/// <param name="userId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
ApiResult
GetAppletMyOrderAfterSaleInfo
(
int
orderDetailId
,
int
userId
,
int
tenantId
,
int
mallBaseId
)
{
var
dModel
=
goods_OrderDetailRepository
.
GetEntity
<
RB_Goods_OrderDetail_Extend
>(
orderDetailId
);
if
(
dModel
==
null
)
{
return
ApiResult
.
Failed
(
"未查询到订单商品信息"
);
}
dModel
.
CoverImagePath
=
material_InfoRepository
.
GetEntity
(
dModel
.
CoverImage
)?.
Path
??
""
;
return
ApiResult
.
Success
(
""
,
new
{
DetailId
=
dModel
.
Id
,
dModel
.
CoverImagePath
,
dModel
.
GoodsId
,
dModel
.
GoodsName
,
dModel
.
Specification
,
dModel
.
Number
,
dModel
.
Final_Price
});
}
#
region
小程序
下单
/// <summary>
/// 获取小程序结算页面详情
...
...
@@ -469,6 +681,10 @@ namespace Mall.Module.Product
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
gmodel
.
SpecificationNameList
.
Add
(
"规格:"
+
gmodel
.
DefaultSpecificationName
);
if
(
item
.
Number
>
gmodel
.
InventoryNum
)
{
return
ApiResult
.
Failed
(
"商品库存不足:"
+
gmodel
.
Name
);
}
}
else
{
...
...
@@ -486,6 +702,10 @@ namespace Mall.Module.Product
gmodel
.
SellingPrice
=
speciPModel
?.
SellingPrice
??
0
;
gmodel
.
InventoryNum
=
speciPModel
?.
InventoryNum
??
0
;
GoodsWeight
=
speciPModel
?.
GoodsWeight
??
0
;
if
(
item
.
Number
>
speciPModel
.
InventoryNum
)
{
return
ApiResult
.
Failed
(
"商品库存不足:"
+
gmodel
.
Name
);
}
}
#
endregion
//会员价格
...
...
@@ -714,6 +934,16 @@ namespace Mall.Module.Product
{
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
();
GoodsWeight
=
speciPModel
?.
GoodsWeight
??
0
;
if
(
item
.
Number
>
speciPModel
.
InventoryNum
)
{
return
ApiResult
.
Failed
(
"商品库存不足:"
+
gmodel
.
Name
);
}
}
else
{
if
(
item
.
Number
>
gmodel
.
InventoryNum
)
{
return
ApiResult
.
Failed
(
"商品库存不足:"
+
gmodel
.
Name
);
}
}
#
endregion
//运费
...
...
@@ -906,7 +1136,7 @@ namespace Mall.Module.Product
}
}
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
if
(
!
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
();
gmodel
.
SellingPrice
=
speciPModel
?.
SellingPrice
??
0
;
...
...
@@ -915,6 +1145,16 @@ namespace Mall.Module.Product
item
.
InventoryNum
=
speciPModel
?.
InventoryNum
??
0
;
item
.
SpeciPriceId
=
speciPModel
?.
Id
??
0
;
item
.
ProductCode
=
speciPModel
?.
GoodsNumbers
??
""
;
if
(
item
.
Number
>
speciPModel
.
InventoryNum
)
{
return
ApiResult
.
Failed
(
"商品库存不足:"
+
gmodel
.
Name
);
}
}
else
{
if
(
item
.
Number
>
gmodel
.
InventoryNum
)
{
return
ApiResult
.
Failed
(
"商品库存不足:"
+
gmodel
.
Name
);
}
}
#
endregion
//会员价格
...
...
@@ -1049,7 +1289,7 @@ namespace Mall.Module.Product
//优惠卷验证
decimal
CouponsMoney
=
0
;
List
<
RB_Member_DiscountCoupon_Extend
>
cList
=
new
List
<
RB_Member_DiscountCoupon_Extend
>();
if
(
string
.
IsNullOrEmpty
(
demodel
.
CouponsIds
))
if
(
!
string
.
IsNullOrEmpty
(
demodel
.
CouponsIds
))
{
cList
=
member_CouponRepository
.
GetList
(
new
RB_Member_DiscountCoupon_Extend
()
{
UseState
=
0
,
CouponIds
=
demodel
.
CouponsIds
,
UserId
=
umodel
.
Id
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
string
[]
arr
=
demodel
.
CouponsIds
.
Split
(
","
);
...
...
@@ -1134,13 +1374,15 @@ namespace Mall.Module.Product
var
trans
=
goods_OrderRepository
.
DbTransaction
;
try
{
demodel
.
OrderNo
=
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssffffff"
);
demodel
.
PaymentWay
=
OrderPaymentTypeEnum
.
OnlinePayment
;
//先默认在线支付
demodel
.
Remark
??=
""
;
demodel
.
ApplyForCancelStatus
??=
0
;
int
OrderId
=
goods_OrderRepository
.
Insert
(
demodel
,
trans
);
if
(
OrderId
>
0
)
{
//插入订单明细+ 商品库存更新
InsertOrderDetail
(
demodel
,
trans
,
OrderId
);
//任务执行返佣 失败查看日志,手动返佣(空闲可增加手动返佣接口)
Task
.
Run
(()
=>
InsertOrderCommission
(
demodel
,
umodel
,
GoodsIds
,
OrderId
));
//用户订单数增加
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User_Extend
.
OrderNum
),(
umodel
.
OrderNum
??
0
)+
1
}
...
...
@@ -1170,6 +1412,40 @@ namespace Mall.Module.Product
member_CouponRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
}
}
//来自购物车的话 需清除购物车数据
if
(
demodel
.
IsFormShoppingCart
==
1
)
{
foreach
(
var
cartItem
in
demodel
.
ShoppingCartIdList
)
{
Dictionary
<
string
,
object
>
keyValues2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_ShoppingCart
.
Status
),
1
},
{
nameof
(
RB_Goods_ShoppingCart
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
Id
),
FiledValue
=
cartItem
,
OperatorEnum
=
OperatorEnum
.
IN
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
UserId
),
FiledValue
=
demodel
.
UserId
,
OperatorEnum
=
OperatorEnum
.
IN
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
TenantId
),
FiledValue
=
demodel
.
TenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
MallBaseId
),
FiledValue
=
demodel
.
MallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_ShoppingCartRepository
.
Update
(
keyValues2
,
wheres2
);
}
}
//任务执行返佣 失败查看日志,手动返佣(空闲可增加手动返佣接口)
Task
.
Run
(()
=>
InsertOrderCommission
(
demodel
,
umodel
,
GoodsIds
,
OrderId
));
//记录日志
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
...
...
@@ -1182,6 +1458,8 @@ namespace Mall.Module.Product
TenantId
=
demodel
.
TenantId
}));
}
goods_OrderRepository
.
DBSession
.
Commit
();
return
ApiResult
.
Success
();
}
catch
(
Exception
ex
)
{
...
...
@@ -1189,8 +1467,6 @@ namespace Mall.Module.Product
goods_OrderRepository
.
DBSession
.
Rollback
(
"SetAppletGoodsOrderInfo"
);
return
ApiResult
.
Failed
();
}
return
ApiResult
.
Success
();
}
/// <summary>
...
...
@@ -1223,14 +1499,22 @@ namespace Mall.Module.Product
if
(
umodel
.
IsDistributor
!=
1
)
{
OneUserId
=
umodel
.
SuperiorId
??
0
;
}
else
{
OneUserId
=
umodel
.
Id
;
}
break
;
case
2
:
if
(
OneUserId
>
0
)
{
if
(
umodel
.
IsDistributor
!=
1
)
{
TwoUserId
=
member_UserRepository
.
GetEntity
(
OneUserId
).
SuperiorId
??
0
;
}
else
{
TwoUserId
=
umodel
.
SuperiorId
??
0
;
}
}
break
;
case
3
:
if
(
TwoUserId
>
0
)
{
ThreeUserId
=
member_UserRepository
.
GetEntity
(
TwoUserId
).
SuperiorId
??
0
;
}
break
;
}
}
}
if
(
OneUserId
>
0
)
{
if
(
OneUserId
>
0
)
{
OneDistributorGrade
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
UserId
=
OneUserId
})?.
FirstOrDefault
()?.
GradeId
??
0
;
...
...
@@ -1517,6 +1801,7 @@ namespace Mall.Module.Product
}
}
}
}
goods_OrderCommissionRepository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
...
...
@@ -1543,7 +1828,7 @@ namespace Mall.Module.Product
CostMoney
=
item
.
CostMoney
,
CoverImage
=
item
.
CoverImage
,
CreateDate
=
DateTime
.
Now
,
DiscountRate
=
item
.
DiscountRate
,
DiscountRate
=
item
.
DiscountRate
??
0
,
Final_Price
=
item
.
Final_Price
,
GoodsId
=
item
.
GoodsId
,
GoodsName
=
item
.
GoodsName
,
...
...
@@ -1630,6 +1915,168 @@ namespace Mall.Module.Product
}
}
/// <summary>
/// 用户取消订单
/// </summary>
/// <param name="orderId"></param>
/// <param name="type"></param>
/// <param name="remark"></param>
/// <param name="userId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
CancelAppletGoodsOrderInfo
(
int
orderId
,
int
type
,
string
remark
,
int
userId
,
int
tenantId
,
int
mallBaseId
)
{
var
omodel
=
goods_OrderRepository
.
GetEntity
(
orderId
);
if
(
omodel
==
null
)
{
return
false
;
}
if
(
type
==
1
)
{
if
(
omodel
.
OrderStatus
!=
OrderStatusEnum
.
NonPayment
)
{
return
false
;
}
}
else
if
(
type
==
2
)
{
if
(
omodel
.
OrderStatus
!=
OrderStatusEnum
.
WaitSendGoods
)
{
return
false
;
}
//物流
var
erlist
=
goods_ExpressRelevanceRepository
.
GetList
(
new
RB_Goods_ExpressRelevance_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderId
});
if
(
erlist
.
Any
())
{
return
false
;
//已有商品发货,无法退款
}
}
var
trans
=
goods_OrderRepository
.
DbTransaction
;
try
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
};
if
(
type
==
1
)
{
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
OrderStatusEnum
.
Cancel
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
CancelTime
),
DateTime
.
Now
);
}
else
{
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
OrderStatusEnum
.
WaitDeal
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
IsApplyForCancel
),
1
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
HistoryOrderStatus
),
(
int
)
omodel
.
OrderStatus
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
CancelRemark
),
remark
);
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Order
.
OrderId
),
FiledValue
=
orderId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Order
.
UserId
),
FiledValue
=
userId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Order
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Order
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
goods_OrderRepository
.
Update
(
keyValues
,
wheres
,
trans
);
if
(
flag
)
{
//回滚商品库存
if
(
type
==
1
)
{
var
detailList
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
GoodsId
=
omodel
.
OrderId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
detailList
.
Any
())
{
string
goodsIds
=
string
.
Join
(
","
,
detailList
.
Select
(
x
=>
x
.
GoodsId
??
0
).
Distinct
());
var
goodsList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
detailList
)
{
var
gmodel
=
goodsList
.
Where
(
x
=>
x
.
Id
==
item
.
GoodsId
).
FirstOrDefault
();
if
(
gmodel
==
null
)
{
continue
;
}
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
if
(
gmodel
.
IsCustomSpecification
==
1
)
{
continue
;
}
}
else
{
if
(
gmodel
.
IsCustomSpecification
!=
1
)
{
continue
;
}
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
();
if
(
speciPModel
==
null
)
{
continue
;
}
//更新商品规格表库存 + 商品表总库存
Dictionary
<
string
,
object
>
keyValues2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_SpecificationPrice
.
InventoryNum
),
(
speciPModel
.
InventoryNum
??
0
)+(
item
.
Number
??
0
)}
};
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_SpecificationPrice
.
Id
),
FiledValue
=
speciPModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_SpecificationPriceRepository
.
Update
(
keyValues2
,
wheres2
,
trans
);
}
//更新商品表库存
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods
.
InventoryNum
),
(
gmodel
.
InventoryNum
??
0
)+(
item
.
Number
??
0
)}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods
.
Id
),
FiledValue
=
gmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goodsRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Id
=
0
,
Type
=
2
,
SourceId
=
item
.
GoodsId
,
Content
=
$"取消订单
{
orderId
}
,还原商品库存:"
+
item
.
Number
,
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
}));
}
}
}
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Id
=
0
,
Type
=
1
,
SourceId
=
orderId
,
Content
=
type
==
1
?
"客人取消订单"
:
"客人申请取消订单"
,
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
}));
}
goods_OrderRepository
.
DBSession
.
Commit
();
return
flag
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"CancelAppletGoodsOrderInfo"
);
goods_OrderRepository
.
DBSession
.
Rollback
();
return
false
;
}
}
#
endregion
#
region
订单管理
...
...
@@ -1749,10 +2196,10 @@ namespace Mall.Module.Product
item
.
DetailList
=
dlist
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
string
areaName
=
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
Province
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
City
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
District
).
FirstOrDefault
()?.
Name
??
""
);
item
.
Sh
ippingAddress
=
areaName
+
" "
+
item
.
Shi
ppingAddress
;
item
.
Sh
oppingAddress
=
areaName
+
" "
+
item
.
Sho
ppingAddress
;
item
.
OrderCommissionList
=
oclist
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
item
.
IsOrderCommission
=
item
.
OrderCommissionList
.
FirstOrDefault
().
IsGoodsDistribution
??
2
;
item
.
IsOrderCommission
=
item
.
OrderCommissionList
.
FirstOrDefault
()
?
.
IsGoodsDistribution
??
2
;
}
}
return
list
;
...
...
@@ -1821,7 +2268,7 @@ namespace Mall.Module.Product
item
.
DetailList
=
dlist
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
string
areaName
=
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
Province
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
City
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
item
.
District
).
FirstOrDefault
()?.
Name
??
""
);
item
.
Sh
ippingAddress
=
areaName
+
" "
+
item
.
Shi
ppingAddress
;
item
.
Sh
oppingAddress
=
areaName
+
" "
+
item
.
Sho
ppingAddress
;
item
.
OrderCommissionList
=
oclist
.
Where
(
x
=>
x
.
OrderId
==
item
.
OrderId
).
ToList
();
item
.
IsOrderCommission
=
item
.
OrderCommissionList
.
FirstOrDefault
().
IsGoodsDistribution
??
2
;
...
...
@@ -2019,6 +2466,9 @@ namespace Mall.Module.Product
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
SetOrderApplyForCancelAudit
(
RB_Goods_Order_Extend
omodel
,
int
type
,
string
remark
,
int
tenantId
,
int
mallBaseId
)
{
var
trans
=
goods_OrderRepository
.
DbTransaction
;
try
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
};
if
(
type
==
1
)
...
...
@@ -2028,7 +2478,9 @@ namespace Mall.Module.Product
}
else
{
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
ApplyForCancelStatus
),
2
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
omodel
.
HistoryOrderStatus
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
RejectRemark
),
remark
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
IsApplyForCancel
),
2
);
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
...
...
@@ -2048,10 +2500,81 @@ namespace Mall.Module.Product
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
goods_OrderRepository
.
Update
(
keyValues
,
where
s
);
bool
flag
=
goods_OrderRepository
.
Update
(
keyValues
,
wheres
,
tran
s
);
if
(
flag
)
{
if
(
type
==
1
)
{
//回滚商品库存
var
detailList
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
GoodsId
=
omodel
.
OrderId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
detailList
.
Any
())
{
string
goodsIds
=
string
.
Join
(
","
,
detailList
.
Select
(
x
=>
x
.
GoodsId
??
0
).
Distinct
());
var
goodsList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
detailList
)
{
var
gmodel
=
goodsList
.
Where
(
x
=>
x
.
Id
==
item
.
GoodsId
).
FirstOrDefault
();
if
(
gmodel
==
null
)
{
continue
;
}
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
if
(
gmodel
.
IsCustomSpecification
==
1
)
{
continue
;
}
}
else
{
if
(
gmodel
.
IsCustomSpecification
!=
1
)
{
continue
;
}
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
();
if
(
speciPModel
==
null
)
{
continue
;
}
//更新商品规格表库存 + 商品表总库存
Dictionary
<
string
,
object
>
keyValues2
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_SpecificationPrice
.
InventoryNum
),
(
speciPModel
.
InventoryNum
??
0
)+(
item
.
Number
??
0
)}
};
List
<
WhereHelper
>
wheres2
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_SpecificationPrice
.
Id
),
FiledValue
=
speciPModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_SpecificationPriceRepository
.
Update
(
keyValues2
,
wheres2
,
trans
);
}
//更新商品表库存
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods
.
InventoryNum
),
(
gmodel
.
InventoryNum
??
0
)+(
item
.
Number
??
0
)}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods
.
Id
),
FiledValue
=
gmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goodsRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Id
=
0
,
Type
=
2
,
SourceId
=
item
.
GoodsId
,
Content
=
$"同意客人申请取消订单
{
omodel
.
OrderId
}
,还原商品库存:"
+
item
.
Number
,
CreateDate
=
DateTime
.
Now
,
MallBaseId
=
mallBaseId
,
TenantId
=
tenantId
}));
}
}
//同意 需原路退款
}
...
...
@@ -2071,8 +2594,16 @@ namespace Mall.Module.Product
Type
=
1
});
}
goods_OrderRepository
.
DBSession
.
Commit
();
return
flag
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
""
);
goods_OrderRepository
.
DBSession
.
Rollback
();
return
false
;
}
}
/// <summary>
/// 修改订单收货地址
...
...
@@ -2091,7 +2622,7 @@ namespace Mall.Module.Product
{
nameof
(
RB_Goods_Order
.
Province
),
demodel
.
Province
},
{
nameof
(
RB_Goods_Order
.
City
),
demodel
.
City
},
{
nameof
(
RB_Goods_Order
.
District
),
demodel
.
District
},
{
nameof
(
RB_Goods_Order
.
Sh
ippingAddress
),
demodel
.
Shi
ppingAddress
}
{
nameof
(
RB_Goods_Order
.
Sh
oppingAddress
),
demodel
.
Sho
ppingAddress
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
...
...
@@ -2116,7 +2647,7 @@ namespace Mall.Module.Product
//记录日志
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Content
=
$"修改收货地址,历史:
{
omodel
.
Consignee
}
{
omodel
.
Mobile
}
{
omodel
.
Province
}
{
omodel
.
City
}
{
omodel
.
District
}
{
omodel
.
Sh
i
ppingAddress
}
"
,
Content
=
$"修改收货地址,历史:
{
omodel
.
Consignee
}
{
omodel
.
Mobile
}
{
omodel
.
Province
}
{
omodel
.
City
}
{
omodel
.
District
}
{
omodel
.
Sh
o
ppingAddress
}
"
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
MallBaseId
=
demodel
.
MallBaseId
,
...
...
@@ -2151,10 +2682,14 @@ namespace Mall.Module.Product
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
OrderStatusEnum
.
Cancel
);
break
;
case
4
:
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
Recycled
),
1
);
break
;
case
5
:
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
OrderStatusEnum
.
Received
);
break
;
case
6
:
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
OrderStatusEnum
.
Completed
);
break
;
case
5
:
//确认收货
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
OrderStatusEnum
.
Received
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
ReceivingTime
),
DateTime
.
Now
);
break
;
case
6
:
//确认完成
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
OrderStatus
),
OrderStatusEnum
.
Completed
);
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
FinishTime
),
DateTime
.
Now
);
break
;
case
7
:
keyValues
.
Add
(
nameof
(
RB_Goods_Order
.
Recycled
),
2
);
break
;
case
8
:
...
...
@@ -2215,6 +2750,137 @@ namespace Mall.Module.Product
return
flag
;
}
/// <summary>
/// 修改订单明细价格
/// </summary>
/// <param name="orderDetailId"></param>
/// <param name="income"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
SetOrderDetialMoneyInfo
(
int
orderDetailId
,
decimal
income
,
int
tenantId
,
int
mallBaseId
)
{
var
detModel
=
goods_OrderDetailRepository
.
GetEntity
(
orderDetailId
);
if
(
detModel
==
null
)
{
return
false
;
}
var
orderModel
=
goods_OrderRepository
.
GetEntity
(
detModel
.
OrderId
);
if
(
orderModel
==
null
)
{
return
false
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_OrderDetail
.
Final_Price
),
income
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
Id
),
FiledValue
=
orderDetailId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
goods_OrderDetailRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//修改订单付款总额
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_Order
.
Income
),
orderModel
.
Income
+
(
income
-
(
detModel
.
Final_Price
??
0
))
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Order
.
OrderId
),
FiledValue
=
orderModel
.
OrderId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_OrderRepository
.
Update
(
keyValues1
,
wheres1
);
//记录日志
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Content
=
"修改订单商品价格:"
+
income
+
";历史:价格:"
+
detModel
.
Final_Price
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
MallBaseId
=
mallBaseId
,
SourceId
=
orderModel
.
OrderId
,
TenantId
=
tenantId
,
Type
=
1
}));
}
return
flag
;
}
/// <summary>
/// 修改订单金额+运费
/// </summary>
/// <param name="orderId"></param>
/// <param name="income"></param>
/// <param name="freightMoney"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
SetOrderMoneyOrFreightInfo
(
int
orderId
,
decimal
income
,
decimal
freightMoney
,
int
tenantId
,
int
mallBaseId
)
{
var
orderModel
=
goods_OrderRepository
.
GetEntity
(
orderId
);
if
(
orderModel
==
null
)
{
return
false
;
}
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_Order
.
Income
),
income
},
{
nameof
(
RB_Goods_Order
.
FreightMoney
),
freightMoney
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_Order
.
OrderId
),
FiledValue
=
orderModel
.
OrderId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderDetail
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
var
flag
=
goods_OrderRepository
.
Update
(
keyValues1
,
wheres1
);
if
(
flag
)
{
//记录日志
Task
.
Run
(()
=>
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Content
=
"修改订单价格:"
+
income
+
" /运费:"
+
freightMoney
+
";历史:价格:"
+
orderModel
.
Income
+
" /运费:"
+
orderModel
.
FreightMoney
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
MallBaseId
=
mallBaseId
,
SourceId
=
orderModel
.
OrderId
,
TenantId
=
tenantId
,
Type
=
1
}));
}
return
flag
;
}
/// <summary>
/// 根据订单好获取物流id
/// </summary>
...
...
@@ -2299,6 +2965,7 @@ namespace Mall.Module.Product
}
//查询订单明细
var
dlist
=
goods_OrderDetailRepository
.
GetOrderDetailList
(
new
RB_Goods_OrderDetail_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderId
});
var
erList
=
goods_ExpressRelevanceRepository
.
GetList
(
new
RB_Goods_ExpressRelevance_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
OrderId
=
orderId
});
//查询图片
List
<
RB_Material_Info_Extend
>
Mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(
dlist
.
Any
())
...
...
@@ -2307,6 +2974,7 @@ namespace Mall.Module.Product
foreach
(
var
item
in
dlist
)
{
item
.
CoverImagePath
=
Mlist
.
Where
(
x
=>
x
.
Id
==
item
.
CoverImage
).
FirstOrDefault
()?.
Path
??
""
;
item
.
IsBindExpress
=
erList
.
Where
(
x
=>
x
.
OrderDetailId
==
item
.
Id
).
Any
()
?
1
:
2
;
}
}
model
.
DetailList
=
dlist
;
...
...
@@ -2360,7 +3028,7 @@ namespace Mall.Module.Product
model
.
Consignee
,
model
.
Mobile
,
model
.
DistrictAddress
,
model
.
Sh
i
ppingAddress
,
model
.
Sh
o
ppingAddress
,
model
.
Country
,
model
.
Province
,
model
.
City
,
...
...
@@ -2397,7 +3065,8 @@ namespace Mall.Module.Product
x
.
Unit_Price
,
x
.
Number
,
x
.
Original_Price
,
x
.
Final_Price
x
.
Final_Price
,
x
.
IsBindExpress
})
});
}
...
...
Mall.Repository/Product/RB_Goods_OrderAfterSaleLogRepository.cs
0 → 100644
View file @
9d3d507a
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
using
Mall.Model.Extend.Product
;
using
System.Linq
;
using
Mall.Model.Entity.User
;
namespace
Mall.Repository.Product
{
/// <summary>
/// 商品订单售后流程仓储层
/// </summary>
public
class
RB_Goods_OrderAfterSaleLogRepository
:
RepositoryBase
<
RB_Goods_OrderAfterSaleLog
>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_OrderAfterSaleLog_Extend
>
GetList
(
RB_Goods_OrderAfterSaleLog_Extend
dmodel
)
{
string
where
=
$" 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_OrderAfterSaleLog
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_OrderAfterSaleLog
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_OrderAfterSaleLog
.
Type
)}
=
{
dmodel
.
Type
}
"
;
}
if
(
dmodel
.
ReOrderId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_OrderAfterSaleLog
.
ReOrderId
)}
=
{
dmodel
.
ReOrderId
}
"
;
}
string
sql
=
$@"SELECT * FROM RB_Goods_OrderAfterSaleLog where
{
where
}
order by Id desc"
;
return
Get
<
RB_Goods_OrderAfterSaleLog_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/Product/RB_Goods_OrderAfterSaleRepository.cs
0 → 100644
View file @
9d3d507a
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
using
Mall.Model.Extend.Product
;
using
System.Linq
;
using
Mall.Model.Entity.User
;
namespace
Mall.Repository.Product
{
/// <summary>
/// 商品订单售后仓储层
/// </summary>
public
class
RB_Goods_OrderAfterSaleRepository
:
RepositoryBase
<
RB_Goods_OrderAfterSale
>
{
/// <summary>
/// 获取售后订单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_OrderAfterSale_Extend
>
GetERPPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_OrderAfterSale_Extend
dmodel
)
{
string
where
=
$" 1=1 and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
UserName
))
{
where
+=
$" and mu.
{
nameof
(
RB_Member_User
.
Name
)}
like '%
{
dmodel
.
UserName
}
%'"
;
}
if
(
dmodel
.
OrderId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
OrderId
)}
=
{
dmodel
.
OrderId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
ReOrderNo
))
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
ReOrderNo
)}
like '%
{
dmodel
.
ReOrderNo
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
OrderNo
))
{
where
+=
$" and o.
{
nameof
(
RB_Goods_Order
.
OrderNo
)}
like '%
{
dmodel
.
OrderNo
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Consignee
))
{
where
+=
$" and o.
{
nameof
(
RB_Goods_Order
.
Consignee
)}
like '%
{
dmodel
.
Consignee
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Mobile
))
{
where
+=
$" and o.
{
nameof
(
RB_Goods_Order
.
Mobile
)}
like '%
{
dmodel
.
Mobile
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
GoodsName
))
{
where
+=
$" and od.
{
nameof
(
RB_Goods_OrderDetail
.
GoodsName
)}
like '%
{
dmodel
.
GoodsName
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
StartTime
))
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
CreateDate
)}
>='
{
dmodel
.
StartTime
}
'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
EndTime
))
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
CreateDate
)}
<='
{
dmodel
.
EndTime
}
23:59:59'"
;
}
string
sql
=
$@"SELECT oas.*,mu.Name as UserName FROM rb_goods_orderaftersale oas
INNER JOIN rb_goods_order o on oas.OrderId=o.OrderId
INNER JOIN rb_goods_orderdetail od on od.Id=oas.OrderDetialId
INNER JOIN rb_member_user mu on mu.Id=oas.UserId
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Goods_OrderAfterSale_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 获取售后订单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_OrderAfterSale_Extend
>
GetAppletPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_OrderAfterSale_Extend
dmodel
)
{
string
where
=
$" 1=1 and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
OrderId
>
0
)
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
OrderId
)}
=
{
dmodel
.
OrderId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
ReOrderNo
))
{
where
+=
$" and oas.
{
nameof
(
RB_Goods_OrderAfterSale
.
ReOrderNo
)}
like '%
{
dmodel
.
ReOrderNo
}
%'"
;
}
string
sql
=
$@"SELECT oas.* FROM rb_goods_orderaftersale oas
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Goods_OrderAfterSale_Extend
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
}
}
Mall.Repository/Product/RB_Goods_OrderRepository.cs
View file @
9d3d507a
...
...
@@ -63,6 +63,10 @@ namespace Mall.Repository.Product
{
where
+=
$@" and o.
{
nameof
(
RB_Goods_Order
.
OrderStatus
)}
=
{(
int
)
dmodel
.
OrderStatus
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
OrderStatusIds
))
{
where
+=
$@" and o.
{
nameof
(
RB_Goods_Order
.
OrderStatus
)}
in(
{
dmodel
.
OrderStatusIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
OrderNo
))
{
where
+=
$@" and o.
{
nameof
(
RB_Goods_Order
.
OrderNo
)}
like '%
{
dmodel
.
OrderNo
}
%'"
;
...
...
Mall.WebApi/Controllers/Product/AppletOrderController.cs
View file @
9d3d507a
...
...
@@ -135,7 +135,7 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
ParamIsNull
(
""
);
}
bool
flag
=
orderModule
.
DelGoodsShoppingCartInfo
(
ShoppingCartIds
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
bool
flag
=
orderModule
.
DelGoodsShoppingCartInfo
(
ShoppingCartIds
,
userInfo
.
UserId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
...
...
@@ -150,6 +150,133 @@ namespace Mall.WebApi.Controllers.MallBase
#
region
订单管理
/// <summary>
/// 我的订单分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAppletGoodsMyOrderPageList
()
{
var
parms
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Goods_Order_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Order_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
Recycled
=
1
;
if
(
demodel
.
OrderStatus
==
Common
.
Enum
.
Goods
.
OrderStatusEnum
.
WaitSendGoods
)
{
demodel
.
OrderStatusIds
=
"2,6"
;
//待处理也是待发货状态才有的
demodel
.
OrderStatus
=
0
;
}
var
list
=
orderModule
.
GetAppletGoodsMyOrderPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
OrderId
,
x
.
OrderNo
,
x
.
DeliveryMethod
,
DeliveryMethodName
=
x
.
DeliveryMethod
.
GetEnumName
(),
x
.
Income
,
x
.
FreightMoney
,
x
.
CouponMoney
,
x
.
PaymentWay
,
PaymentWayName
=
x
.
PaymentWay
.
GetEnumName
(),
DetailList
=
x
.
DetailList
.
Select
(
y
=>
new
{
y
.
Id
,
y
.
CoverImagePath
,
y
.
OrderType
,
OrderTypeName
=
y
.
OrderType
.
GetEnumName
(),
y
.
GoodsName
,
y
.
Specification
,
y
.
ProductCode
,
y
.
Final_Price
,
y
.
Number
}),
x
.
OrderStatus
,
OrderStatusName
=
x
.
OrderStatus
.
GetEnumName
(),
x
.
TenantId
,
x
.
MallBaseId
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取我的订单详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAppletMyOrderInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderId
=
parms
.
GetInt
(
"OrderId"
,
0
);
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
return
orderModule
.
GetAppletMyOrderInfo
(
OrderId
,
userInfo
.
UserId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
}
/// <summary>
/// 获取我的订单商品售后初始信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAppletMyOrderAfterSaleInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderDetailId
=
parms
.
GetInt
(
"OrderDetailId"
,
0
);
if
(
OrderDetailId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
return
orderModule
.
GetAppletMyOrderAfterSaleInfo
(
OrderDetailId
,
userInfo
.
UserId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
}
/// <summary>
/// 申请售后
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetAppletMyOrderAfterSale
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderDetailId
=
parms
.
GetInt
(
"OrderDetailId"
,
0
);
if
(
OrderDetailId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
return
ApiResult
.
Success
();
}
/// <summary>
/// 获取我的订单快递信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAppletMyOrderExpressInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderId
=
parms
.
GetInt
(
"OrderId"
,
0
);
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
Robj
=
orderModule
.
GetAppletMyOrderExpressInfo
(
OrderId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
return
ApiResult
.
Success
(
""
,
Robj
);
}
/// <summary>
/// 结算页面详情
/// </summary>
...
...
@@ -224,6 +351,11 @@ namespace Mall.WebApi.Controllers.MallBase
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
RB_Goods_Order_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Order_Extend
>(
req
.
msg
.
ToString
());
if
(
demodel
.
IsFormShoppingCart
==
1
)
{
if
(
demodel
.
ShoppingCartIdList
==
null
||
!
demodel
.
ShoppingCartIdList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递购物车id"
);
}
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Consignee
))
{
return
ApiResult
.
ParamIsNull
(
"请传递收件人"
);
}
...
...
@@ -236,18 +368,11 @@ namespace Mall.WebApi.Controllers.MallBase
{
return
ApiResult
.
ParamIsNull
(
"收货地址有误"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Sh
i
ppingAddress
))
{
if
(
string
.
IsNullOrEmpty
(
demodel
.
Sh
o
ppingAddress
))
{
return
ApiResult
.
ParamIsNull
(
"收货详细地址不能为空"
);
}
}
else
{
if
(
string
.
IsNullOrEmpty
(
demodel
.
Consignee
))
{
return
ApiResult
.
ParamIsNull
(
"收件人不能为空"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Mobile
))
{
return
ApiResult
.
ParamIsNull
(
"收件人手机不能为空"
);
}
}
if
(
demodel
.
DetailList
==
null
||
!
demodel
.
DetailList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递商品信息"
);
}
...
...
@@ -268,6 +393,7 @@ namespace Mall.WebApi.Controllers.MallBase
#
region
赋默认值
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
Country
??=
2
;
demodel
.
OrderStatus
=
Common
.
Enum
.
Goods
.
OrderStatusEnum
.
NonPayment
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
Fee
??=
0
;
...
...
@@ -286,6 +412,31 @@ namespace Mall.WebApi.Controllers.MallBase
return
orderModule
.
SetAppletGoodsOrderInfo
(
demodel
);
}
/// <summary>
/// 未付款取消订单/已付款申请取消订单
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
CancelAppletGoodsOrderInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderId
=
parms
.
GetInt
(
"OrderId"
,
0
);
int
Type
=
parms
.
GetInt
(
"Type"
,
1
);
//1未付款取消 2已付款未发货申请取消
string
Remark
=
parms
.
GetStringValue
(
"Remark"
);
//type=2 申请备注
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
if
(
Type
==
2
)
{
if
(
string
.
IsNullOrEmpty
(
Remark
))
{
return
ApiResult
.
ParamIsNull
(
"请输入取消申请备注"
);
}
}
bool
flag
=
orderModule
.
CancelAppletGoodsOrderInfo
(
OrderId
,
Type
,
Remark
,
userInfo
.
UserId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/Product/OrderController.cs
View file @
9d3d507a
...
...
@@ -76,7 +76,7 @@ namespace Mall.WebApi.Controllers.MallBase
x
.
Consignee
,
x
.
Mobile
,
x
.
DistrictAddress
,
x
.
Sh
i
ppingAddress
,
x
.
Sh
o
ppingAddress
,
x
.
BuyerMessage
,
x
.
Remark
,
x
.
OrderStatus
,
...
...
@@ -184,7 +184,7 @@ namespace Mall.WebApi.Controllers.MallBase
case
11
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Mobile
)
{
});
break
;
case
12
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Sh
i
ppingAddress
)
{
});
break
;
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Sh
o
ppingAddress
)
{
});
break
;
case
13
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
PreferPrice
??
0
).
ToString
())
{
});
break
;
case
14
:
...
...
@@ -521,6 +521,69 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 修改订单明细价格
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOrderDetialMoneyInfo
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderDetailId
=
parms
.
GetInt
(
"OrderDetailId"
,
0
);
decimal
Income
=
parms
.
GetDecimal
(
"Income"
);
if
(
OrderDetailId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递订单明细id"
);
}
if
(
Income
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递价格"
);
}
bool
flag
=
orderModule
.
SetOrderDetialMoneyInfo
(
OrderDetailId
,
Income
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 修改订单价格/运费
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetOrderMoneyOrFreightInfo
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderId
=
parms
.
GetInt
(
"OrderId"
,
0
);
decimal
Income
=
parms
.
GetDecimal
(
"Income"
);
decimal
FreightMoney
=
parms
.
GetDecimal
(
"FreightMoney"
);
if
(
OrderId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递订单明细id"
);
}
if
(
Income
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递价格"
);
}
if
(
FreightMoney
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递运费"
);
}
bool
flag
=
orderModule
.
SetOrderMoneyOrFreightInfo
(
OrderId
,
Income
,
FreightMoney
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 设置订单收货地址
/// </summary>
...
...
@@ -542,7 +605,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
return
ApiResult
.
ParamIsNull
(
"请选择区域"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Sh
i
ppingAddress
))
{
if
(
string
.
IsNullOrEmpty
(
demodel
.
Sh
o
ppingAddress
))
{
return
ApiResult
.
ParamIsNull
(
"请输入详细地址"
);
}
...
...
@@ -803,7 +866,7 @@ namespace Mall.WebApi.Controllers.MallBase
}),
x
.
Consignee
,
x
.
Mobile
,
x
.
Sh
i
ppingAddress
,
x
.
Sh
o
ppingAddress
,
x
.
BuyerMessage
,
x
.
Remark
,
x
.
OrderStatus
,
...
...
@@ -938,7 +1001,7 @@ namespace Mall.WebApi.Controllers.MallBase
case
11
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Mobile
)
{
});
break
;
case
12
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Sh
i
ppingAddress
)
{
});
break
;
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Sh
o
ppingAddress
)
{
});
break
;
case
13
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
PreferPrice
??
0
).
ToString
())
{
});
break
;
case
14
:
...
...
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