|
@@ -24,6 +24,7 @@ type OrderController struct {
|
|
|
// @Param EndDate query string false "结束时间,列如2021-03-06 "
|
|
|
// @Param AdminId query string false "销售ID "
|
|
|
// @Param OrderType query int false "订单类型 1:畅读卡订单,2:单场付费订单"
|
|
|
+// @Param OrderStatus query int false "订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"
|
|
|
// @Param PaymentProject query string false "付款项目"
|
|
|
// @Param OrderCode query string false "订单编号"
|
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
@@ -46,11 +47,13 @@ func (this *OrderController) OrderList() {
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
orderType, _ := this.GetInt("OrderType", 1)
|
|
|
+ orderStatus, _ := this.GetInt("OrderStatus", -1)
|
|
|
startDate := this.GetString("StartDate")
|
|
|
endDate := this.GetString("EndDate")
|
|
|
adminId := this.GetString("AdminId")
|
|
|
orderCode := this.GetString("OrderCode")
|
|
|
keyWord := this.GetString("KeyWord")
|
|
|
+ paymentProject := this.GetString("PaymentProject")
|
|
|
var startSize int
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize20
|
|
@@ -61,7 +64,6 @@ func (this *OrderController) OrderList() {
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
-
|
|
|
if orderType > 0 { //订单类型 1:畅读卡订单,2:单场付费订单
|
|
|
condition += ` AND order_type = ? `
|
|
|
pars = append(pars, orderType)
|
|
@@ -76,12 +78,22 @@ func (this *OrderController) OrderList() {
|
|
|
condition += ` AND seller_id IN (` + adminId + `) `
|
|
|
}
|
|
|
|
|
|
+ if orderStatus > -1 { //订单状态
|
|
|
+ condition += ` AND order_status = ? `
|
|
|
+ pars = append(pars, orderStatus)
|
|
|
+ }
|
|
|
+
|
|
|
if orderCode != "" { //订单编号
|
|
|
orderCode = "%" + orderCode + "%"
|
|
|
condition += ` AND order_code LIKE ? `
|
|
|
pars = append(pars, orderCode)
|
|
|
}
|
|
|
|
|
|
+ if paymentProject != "" { //付款项目
|
|
|
+ condition += ` AND goods_name = ? `
|
|
|
+ pars = append(pars, paymentProject)
|
|
|
+ }
|
|
|
+
|
|
|
if keyWord != "" { //用户姓名,手机号
|
|
|
keyWord = "%" + keyWord + "%"
|
|
|
condition += ` AND (mobile LIKE ? OR real_name LIKE ? ) `
|
|
@@ -116,12 +128,22 @@ func (this *OrderController) OrderList() {
|
|
|
item.HttpUrl = utils.CYGX_WEB_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
|
|
|
}
|
|
|
item.OrderStatus = v.OrderStatus
|
|
|
- if v.OrderStatus == 0 {
|
|
|
+
|
|
|
+ switch item.OrderStatus {
|
|
|
+ case 0:
|
|
|
item.OrderStatusText = "已取消"
|
|
|
- } else if v.OrderStatus == 1 {
|
|
|
+ case 1:
|
|
|
item.OrderStatusText = "待支付"
|
|
|
- } else if v.OrderStatus == 2 {
|
|
|
+ case 2:
|
|
|
item.OrderStatusText = "已支付"
|
|
|
+ case 3:
|
|
|
+ item.OrderStatusText = "退款成功"
|
|
|
+ case 4:
|
|
|
+ item.OrderStatusText = "退款处理中"
|
|
|
+ case 5:
|
|
|
+ item.OrderStatusText = "退款异常"
|
|
|
+ case 6:
|
|
|
+ item.OrderStatusText = "退款关闭"
|
|
|
}
|
|
|
item.UserId = v.UserId
|
|
|
item.RealName = v.RealName
|
|
@@ -223,6 +245,7 @@ func (this *UserController) OrderRefund() {
|
|
|
// @Param EndDate query string false "结束时间,列如2021-03-06 "
|
|
|
// @Param AdminId query string false "销售ID "
|
|
|
// @Param OrderType query int false "订单类型 1:畅读卡订单,2:单场付费订单"
|
|
|
+// @Param OrderStatus query int false "订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"
|
|
|
// @Param PaymentProject query string false "付款项目"
|
|
|
// @Param OrderCode query string false "订单编号"
|
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
@@ -245,11 +268,13 @@ func (this *OrderController) OrderRefundList() {
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
orderType, _ := this.GetInt("OrderType", 1)
|
|
|
+ orderStatus, _ := this.GetInt("OrderStatus", -1)
|
|
|
startDate := this.GetString("StartDate")
|
|
|
endDate := this.GetString("EndDate")
|
|
|
adminId := this.GetString("AdminId")
|
|
|
orderCode := this.GetString("OrderCode")
|
|
|
keyWord := this.GetString("KeyWord")
|
|
|
+ paymentProject := this.GetString("PaymentProject")
|
|
|
var startSize int
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize20
|
|
@@ -260,7 +285,7 @@ func (this *OrderController) OrderRefundList() {
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
- condition += ` AND order_status = 3 `
|
|
|
+ condition += ` AND order_status IN (3,4,5,6) `
|
|
|
if orderType > 0 { //订单类型 1:畅读卡订单,2:单场付费订单
|
|
|
condition += ` AND order_type = ? `
|
|
|
pars = append(pars, orderType)
|
|
@@ -275,12 +300,22 @@ func (this *OrderController) OrderRefundList() {
|
|
|
condition += ` AND seller_id IN (` + adminId + `) `
|
|
|
}
|
|
|
|
|
|
+ if orderStatus > -1 { //订单状态
|
|
|
+ condition += ` AND order_status = ? `
|
|
|
+ pars = append(pars, orderStatus)
|
|
|
+ }
|
|
|
+
|
|
|
if orderCode != "" { //订单编号
|
|
|
orderCode = "%" + orderCode + "%"
|
|
|
condition += ` AND order_code LIKE ? `
|
|
|
pars = append(pars, orderCode)
|
|
|
}
|
|
|
|
|
|
+ if paymentProject != "" { //付款项目
|
|
|
+ condition += ` AND goods_name = ? `
|
|
|
+ pars = append(pars, paymentProject)
|
|
|
+ }
|
|
|
+
|
|
|
if keyWord != "" { //用户姓名,手机号
|
|
|
keyWord = "%" + keyWord + "%"
|
|
|
condition += ` AND (mobile LIKE ? OR real_name LIKE ? ) `
|
|
@@ -314,11 +349,17 @@ func (this *OrderController) OrderRefundList() {
|
|
|
case "activity": //活动详情
|
|
|
item.HttpUrl = utils.CYGX_WEB_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
|
|
|
}
|
|
|
+ //OrderStatus int `comment:"订单状态,0:已取消、1:待支付、2:已支付、3:退款成功、4:退款处理中、5:退款异常、6:退款关闭"`
|
|
|
item.OrderStatus = v.OrderStatus
|
|
|
- if v.OrderStatus == 3 {
|
|
|
+ switch item.OrderStatus {
|
|
|
+ case 3:
|
|
|
item.OrderStatusText = "退款成功"
|
|
|
- } else {
|
|
|
+ case 4:
|
|
|
+ item.OrderStatusText = "退款处理中"
|
|
|
+ case 5:
|
|
|
item.OrderStatusText = "退款异常"
|
|
|
+ case 6:
|
|
|
+ item.OrderStatusText = "退款关闭"
|
|
|
}
|
|
|
item.UserId = v.UserId
|
|
|
item.RealName = v.RealName
|
|
@@ -350,3 +391,69 @@ func (this *OrderController) OrderRefundList() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 退款撤销
|
|
|
+// @Description 退款撤销接口
|
|
|
+// @Param request body cygx.UserRemarAddReq true "type json string"
|
|
|
+// @Success 200 操作成功
|
|
|
+// @router /order/refund_revoke [post]
|
|
|
+func (this *UserController) OrderRefundRevoke() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req cygx.CygxOrderRefundReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ orderCode := req.OrderCode
|
|
|
+ orderDetail, err := cygx.GetCygxOrderDetailByOrderCode(orderCode)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败, Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if orderDetail.OrderStatus != 4 {
|
|
|
+ br.Msg = "订单状态异常!"
|
|
|
+ br.ErrMsg = "订单状态异常,orderCode:" + orderCode
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ item := new(cygx.CygxOrderAction)
|
|
|
+ item.Action = "关闭退款"
|
|
|
+ item.OrderStatus = 6
|
|
|
+ item.OrderStatusText = "关闭退款"
|
|
|
+ item.OrderCode = orderDetail.OrderCode
|
|
|
+ item.UserId = orderDetail.UserId
|
|
|
+ item.RealName = orderDetail.RealName
|
|
|
+ item.Mobile = orderDetail.Mobile
|
|
|
+ item.Email = orderDetail.Email
|
|
|
+ item.CompanyId = orderDetail.CompanyId
|
|
|
+ item.CompanyName = orderDetail.CompanyName
|
|
|
+ item.SellerName = orderDetail.SellerName
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ item.AdminId = sysUser.AdminId
|
|
|
+ item.AdminName = sysUser.RealName
|
|
|
+
|
|
|
+ err = cygx.AddCygxOrderRefundRevoke(item)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "新增失败."
|
|
|
+ br.ErrMsg = "新增失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|