新增分比退款

This commit is contained in:
2024-02-19 17:13:19 +08:00
parent 478ac7a5a3
commit 35d63981ed
4 changed files with 13 additions and 4 deletions
+2 -1
View File
@@ -36,7 +36,8 @@ type GetOrderInquiryPage struct {
// CancelOrderInquiry 取消问诊订单
type CancelOrderInquiry struct {
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
RefundAmount float64 `json:"refund_amount" form:"refund_amount" validate:"required" label:"退款金额"`
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
}
// GetOrderInquiryRecordPage 获取问诊记录列表-分页
+7 -1
View File
@@ -70,6 +70,11 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
return false, errors.New("订单未支付,无需取消")
}
// 检测退款金额
if req.RefundAmount > orderInquiry.PaymentAmountTotal {
return false, errors.New("退款金额不可超过实付金额")
}
// 订单完成时间预留5分钟进行操作
if !orderInquiry.CompleteTime.IsEmpty() {
// 计算三天后的时间
@@ -113,6 +118,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
OutTradeNo: orderInquiry.InquiryNo,
OutRefundNo: inquiryRefundNo,
Reason: "客服取消",
RefundAmount: int64(req.RefundAmount * 100),
PaymentAmountTotal: int64(orderInquiry.PaymentAmountTotal * 100),
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientInquiryRefundNotifyUrl,
}
@@ -196,7 +202,7 @@ func (r *OrderInquiryService) CancelOrderInquiry(req requests.CancelOrderInquiry
InquiryRefundNo: inquiryRefundNo,
RefundId: refundId,
InquiryRefundStatus: inquiryRefundStatus,
RefundTotal: orderInquiry.PaymentAmountTotal,
RefundTotal: req.RefundAmount,
RefundReason: req.CancelRemarks,
SuccessTime: model.LocalTime(successTime),
}
+1
View File
@@ -167,6 +167,7 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
OutTradeNo: orderProduct.OrderProductNo,
OutRefundNo: refundNo,
Reason: "客服取消",
RefundAmount: int64(orderProduct.PaymentAmountTotal * 100),
PaymentAmountTotal: int64(orderProduct.PaymentAmountTotal * 100),
NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.PatientProductRefundNotifyUrl,
}