暂时去除处方平台取消订单

This commit is contained in:
wucongxing 2023-09-13 11:37:11 +08:00
parent 29e05ef1ce
commit 84c7997f12

View File

@ -8,7 +8,6 @@ import (
"hospital-admin-api/api/requests" "hospital-admin-api/api/requests"
"hospital-admin-api/api/responses/orderProductResponse" "hospital-admin-api/api/responses/orderProductResponse"
"hospital-admin-api/config" "hospital-admin-api/config"
"hospital-admin-api/extend/prescription"
"hospital-admin-api/extend/weChat" "hospital-admin-api/extend/weChat"
"hospital-admin-api/global" "hospital-admin-api/global"
"strconv" "strconv"
@ -143,6 +142,11 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
return false, errors.New("订单已取消,无法取消") return false, errors.New("订单已取消,无法取消")
} }
// 已上报暂不允许取消订单
if orderProduct.ReportPreStatus == 1 {
return false, errors.New("订单已上报,暂不允许取消")
}
// 检测订单退款状态 // 检测订单退款状态
if orderProduct.RefundStatus == 1 { if orderProduct.RefundStatus == 1 {
return false, errors.New("订单申请退款中,无法取消") return false, errors.New("订单申请退款中,无法取消")
@ -184,12 +188,12 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
var successTime time.Time var successTime time.Time
var refundId string var refundId string
// 通知处方平台订单取消 // // 通知处方平台订单取消
_, err = prescription.NoticePreOrderCancel(orderProduct.OrderProductNo) // _, err = prescription.NoticePreOrderCancel(orderProduct.OrderProductNo)
if err != nil { // if err != nil {
tx.Rollback() // tx.Rollback()
return false, errors.New("取消订单失败") // return false, err
} // }
// 微信退款 // 微信退款
refundRequest := weChat.RefundRequest{ refundRequest := weChat.RefundRequest{
@ -250,6 +254,7 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
orderProductData["cancel_time"] = time.Now().Format("2006-01-02 15:04:05") // 订单取消时间 orderProductData["cancel_time"] = time.Now().Format("2006-01-02 15:04:05") // 订单取消时间
orderProductData["cancel_reason"] = 4 // 订单取消原因1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消) orderProductData["cancel_reason"] = 4 // 订单取消原因1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消)
orderProductData["cancel_remarks"] = req.CancelRemarks // 取消订单备注(自动添加) orderProductData["cancel_remarks"] = req.CancelRemarks // 取消订单备注(自动添加)
// orderProductData["report_pre_status"] = 3 // 上报处方平台状态0:未上报 1:已上报 2:上报失败 3:上报取消)
err = orderProductDao.EditOrderProductById(tx, orderProductId, orderProductData) err = orderProductDao.EditOrderProductById(tx, orderProductId, orderProductData)
if err != nil { if err != nil {
tx.Rollback() tx.Rollback()