You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
163 lines
4.5 KiB
163 lines
4.5 KiB
package order
|
|
|
|
import (
|
|
"base/app/common"
|
|
"base/app/lib/bean"
|
|
"base/app/logic/customer/order"
|
|
"base/app/logic/customer/user"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Sale struct {
|
|
}
|
|
type argsSaleLists struct {
|
|
order.SaleListsSearch
|
|
bean.Page
|
|
}
|
|
|
|
// Lists @Title 买车订单
|
|
func (*Sale) Lists(c *gin.Context) {
|
|
args := argsSaleLists{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
lists, total := order.SaleLogic.Lists(user.UserLogic.GetCustomerId(c), args.SaleListsSearch, args.Page)
|
|
bean.Response.ResultSuc(c, "操作成功", bean.ResultLists{
|
|
List: lists,
|
|
Total: total,
|
|
})
|
|
}
|
|
|
|
//type argsSaleSign struct {
|
|
// OrderId uint `binding:"required" label:"订单"`
|
|
// Sign string `binding:"required" label:"签名"`
|
|
//}
|
|
//
|
|
//// Sign @Title 签订合同
|
|
//func (*Sale) Sign(c *gin.Context) {
|
|
// args := argsSaleSign{}
|
|
// if err := c.ShouldBind(&args); err != nil {
|
|
// bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
// return
|
|
// }
|
|
// if err := order.SaleLogic.Sign(user.UserLogic.GetCustomerId(c), args.OrderId, args.Sign); err != nil {
|
|
// bean.Response.ResultFail(c, 10002, err.Error())
|
|
// return
|
|
// }
|
|
// bean.Response.ResultSuc(c, "操作成功", nil)
|
|
//}
|
|
|
|
type argsSaleDeposit struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
}
|
|
|
|
// Deposit @Title 定金支付
|
|
func (*Sale) Deposit(c *gin.Context) {
|
|
args := argsSaleDeposit{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
customerInfo := user.UserLogic.GetCustomerInfo(c)
|
|
result, err := order.SaleLogic.Deposit(customerInfo.Id, args.OrderId, customerInfo.OpenId)
|
|
if err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", result)
|
|
}
|
|
|
|
type argsSaleTestReport struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
}
|
|
|
|
// TestReport @Title 申请测试报告
|
|
func (*Sale) TestReport(c *gin.Context) {
|
|
args := argsSaleTestReport{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
if err := order.SaleLogic.TestReport(user.UserLogic.GetCustomerId(c), args.OrderId); err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", nil)
|
|
}
|
|
|
|
type argsSaleDownPayment struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
Proof string `binding:"required" label:"支付凭证"`
|
|
}
|
|
|
|
// DownPayment @Title 支付首付
|
|
func (*Sale) DownPayment(c *gin.Context) {
|
|
args := argsSaleDownPayment{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
if err := order.SaleLogic.DownPayment(user.UserLogic.GetCustomerId(c), args.OrderId, args.Proof); err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", nil)
|
|
}
|
|
|
|
type argsSaleTransfer struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
}
|
|
|
|
// Transfer @Title 申请过户
|
|
func (*Sale) Transfer(c *gin.Context) {
|
|
args := argsSaleTransfer{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
if err := order.SaleLogic.Transfer(user.UserLogic.GetCustomerId(c), args.OrderId); err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", nil)
|
|
}
|
|
|
|
type argsSaleBalancePayment struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
Proof string `binding:"required" label:"支付凭证"`
|
|
}
|
|
|
|
// BalancePayment @Title 支付尾款
|
|
func (*Sale) BalancePayment(c *gin.Context) {
|
|
args := argsSaleBalancePayment{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
if err := order.SaleLogic.BalancePayment(user.UserLogic.GetCustomerId(c), args.OrderId, args.Proof); err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", nil)
|
|
}
|
|
|
|
type argsSaleInfo struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
}
|
|
|
|
// Info @Title 订单详情
|
|
func (*Sale) Info(c *gin.Context) {
|
|
args := argsSaleInfo{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
result, err := order.SaleLogic.Info(user.UserLogic.GetCustomerId(c), args.OrderId)
|
|
if err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", result)
|
|
}
|