新增取消订单备注
This commit is contained in:
parent
3a82611c6f
commit
69208b27be
@ -99,9 +99,21 @@ func (r *OrderInquiry) CancelOrderInquiry(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
req := requests.OrderInquiryRequest{}
|
||||
if err := c.ShouldBind(&req.CancelOrderInquiry); err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 参数验证
|
||||
if err := global.Validate.Struct(req.CancelOrderInquiry); err != nil {
|
||||
responses.FailWithMessage(utils.Translate(err), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
orderInquiryService := service.OrderInquiryService{}
|
||||
_, err = orderInquiryService.CancelOrderInquiry(orderInquiryId)
|
||||
_, err = orderInquiryService.CancelOrderInquiry(req.CancelOrderInquiry, orderInquiryId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
|
||||
@ -2,6 +2,7 @@ package requests
|
||||
|
||||
type OrderInquiryRequest struct {
|
||||
GetOrderInquiryPage // 获取问诊订单列表-分页
|
||||
CancelOrderInquiry // 取消问诊订单
|
||||
}
|
||||
|
||||
// GetOrderInquiryPage 获取问诊订单列表-分页
|
||||
@ -26,3 +27,8 @@ type GetOrderInquiryPage struct {
|
||||
PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"`
|
||||
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||
}
|
||||
|
||||
// CancelOrderInquiry 取消问诊订单
|
||||
type CancelOrderInquiry struct {
|
||||
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses/orderEvaluationResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryCouponResponse"
|
||||
"hospital-admin-api/api/responses/orderInquiryRefundResponse"
|
||||
@ -21,7 +22,7 @@ type OrderInquiryService struct {
|
||||
}
|
||||
|
||||
// CancelOrderInquiry 取消问诊订单
|
||||
func (r *OrderInquiryService) CancelOrderInquiry(orderInquiryId int64) (bool, error) {
|
||||
func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry, orderInquiryId int64) (bool, error) {
|
||||
// 获取订单数据
|
||||
orderInquiryDao := dao.OrderInquiryDao{}
|
||||
orderInquiry, err := orderInquiryDao.GetOrderInquiryById(orderInquiryId)
|
||||
@ -182,7 +183,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(orderInquiryId int64) (bool, er
|
||||
orderInquiryData["inquiry_status"] = 7 // 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||||
orderInquiryData["cancel_time"] = time.Now().Format("2006-01-02 15:04:05") // 订单取消时间
|
||||
orderInquiryData["cancel_reason"] = 4 // 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||||
orderInquiryData["cancel_remarks"] = "客服取消" // 取消订单备注(自动添加)
|
||||
orderInquiryData["cancel_remarks"] = req.CancelRemarks // 取消订单备注(自动添加)
|
||||
|
||||
// 修改问诊订单退款状态
|
||||
err = orderInquiryDao.EditOrderInquiryById(tx, orderInquiryId, orderInquiryData)
|
||||
@ -200,7 +201,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(orderInquiryId int64) (bool, er
|
||||
RefundId: refundId,
|
||||
InquiryRefundStatus: inquiryRefundStatus,
|
||||
RefundTotal: orderInquiry.PaymentAmountTotal,
|
||||
RefundReason: "客服取消",
|
||||
RefundReason: req.CancelRemarks,
|
||||
SuccessTime: model.LocalTime(successTime),
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user