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.
89 lines
2.3 KiB
89 lines
2.3 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 CallCar struct {
|
|
}
|
|
type argsCallCarLists struct {
|
|
order.CallCarSearch
|
|
bean.Page
|
|
}
|
|
|
|
// Lists @Title 叫车订单列表
|
|
func (*CallCar) Lists(c *gin.Context) {
|
|
args := argsCallCarLists{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
lists, total := order.CallCarLogic.Lists(user.UserLogic.GetCustomerId(c), args.CallCarSearch, args.Page)
|
|
bean.Response.ResultSuc(c, "操作成功", bean.ResultLists{
|
|
List: lists,
|
|
Total: total,
|
|
})
|
|
}
|
|
|
|
type argsCallCarInfo struct {
|
|
CallCarId uint `binding:"required" label:"叫车"`
|
|
}
|
|
|
|
// Info @Title 详情
|
|
func (*CallCar) Info(c *gin.Context) {
|
|
args := argsCallCarInfo{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
result, err := order.CallCarLogic.Info(user.UserLogic.GetCustomerId(c), args.CallCarId)
|
|
if err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", result)
|
|
}
|
|
|
|
type argsCallCarPay struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
}
|
|
|
|
// Pay @Title 叫车支付
|
|
func (*CallCar) Pay(c *gin.Context) {
|
|
args := argsCallCarPay{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
result, err := order.CallCarLogic.Pay(user.UserLogic.GetCustomerId(c), args.OrderId)
|
|
if err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", result)
|
|
}
|
|
|
|
type argsCallCarRefund struct {
|
|
OrderId uint `binding:"required" label:"订单"`
|
|
Reason string `binding:"required" label:"理由"`
|
|
Proof string `binding:"required" label:"凭证"`
|
|
}
|
|
|
|
// Refund @Title 申请退款
|
|
func (*CallCar) Refund(c *gin.Context) {
|
|
args := argsCallCarRefund{}
|
|
if err := c.ShouldBind(&args); err != nil {
|
|
bean.Response.ResultFail(c, 10001, common.GetVerErr(err))
|
|
return
|
|
}
|
|
if err := order.CallCarLogic.Refund(user.UserLogic.GetCustomerId(c), args.OrderId, args.Reason, args.Proof); err != nil {
|
|
bean.Response.ResultFail(c, 10002, err.Error())
|
|
return
|
|
}
|
|
bean.Response.ResultSuc(c, "操作成功", nil)
|
|
}
|