|
@@ -490,8 +490,12 @@ func OrderDetails(context *admin.Context) (interface{}, error) {
|
|
|
}
|
|
|
(*res)["productType"] = (*res)["product_type"]
|
|
|
(*res)["orderStatus"] = (*res)["order_status"]
|
|
|
- moneyCorrectionData := util.JysqlDB.Find("moneyCorrection", map[string]interface{}{"orderCode": orderCode}, "", "createTime desc", 0, 0)
|
|
|
- (*res)["moneyCorrectionData"] = moneyCorrectionData
|
|
|
+ moneyCorrectionData := util.JysqlDB.Find("moneyCorrection", map[string]interface{}{"orderCode": orderCode}, "", "createTime desc", -1, -1)
|
|
|
+ if moneyCorrectionData != nil {
|
|
|
+ (*res)["moneyCorrectionData"] = moneyCorrectionData
|
|
|
+ } else {
|
|
|
+ (*res)["moneyCorrectionData"] = []map[string]interface{}{}
|
|
|
+ }
|
|
|
if param.Type == "VIP订阅" || param.Type == "超级订阅" { //VIP订阅
|
|
|
result = VipOrderDetails(res)
|
|
|
} else if param.Type == "数据报告" { //数据报告
|
|
@@ -540,6 +544,7 @@ func ConfirmRefund(context *admin.Context) (interface{}, error) {
|
|
|
IsOffline int `form:"isOffline"` //是否线下订单 0-不是 1-是
|
|
|
RefundStatus int `form:"refundStatus"` //退款状态 1-全额退款 2-部分退款
|
|
|
RefundMoney int `form:"refundMoney"` //退款金额
|
|
|
+ RefundType string `form:"refundType"`
|
|
|
})
|
|
|
err := context.Form(param)
|
|
|
if err != nil {
|
|
@@ -548,6 +553,9 @@ func ConfirmRefund(context *admin.Context) (interface{}, error) {
|
|
|
orderCode := param.OrderCode
|
|
|
qMap := map[string]interface{}{}
|
|
|
qMap["order_code"] = orderCode
|
|
|
+ if param.RefundType == "其他" {
|
|
|
+ param.RefundReason = ""
|
|
|
+ }
|
|
|
if param.IsOffline == 0 {
|
|
|
ok := util.JysqlDB.Update("dataexport_order", qMap, map[string]interface{}{
|
|
|
"refund_status": param.RefundStatus,
|
|
@@ -559,6 +567,7 @@ func ConfirmRefund(context *admin.Context) (interface{}, error) {
|
|
|
"refund_time": qutil.NowFormat(qutil.Date_Full_Layout),
|
|
|
"refund_money": param.RefundMoney,
|
|
|
"refund_reason": param.RefundReason,
|
|
|
+ "refund_type": param.RefundType,
|
|
|
})
|
|
|
data := util.JysqlDB.Find("invoice", qMap, "", "create_time", 0, 0)
|
|
|
if *data != nil && len(*data) != 0 {
|
|
@@ -596,18 +605,23 @@ func ConfirmRefund(context *admin.Context) (interface{}, error) {
|
|
|
"refund_time": qutil.NowFormat(qutil.Date_Full_Layout),
|
|
|
"refund_money": param.RefundMoney,
|
|
|
"refund_reason": param.RefundReason,
|
|
|
+ "refund_type": param.RefundType,
|
|
|
})
|
|
|
if okid > 0 {
|
|
|
orderData := util.JysqlDB.SelectBySql("select (IFNULL( a.pay_money, 0 )-IFNULL(a.commission,0)-IFNULL(a.procedures_money,0))-(select IFNULL(sum(b.return_money),0) from return_money_record b where b.order_code=a.order_code and b.state=1) + (select IFNULL(sum(c.refund_money),0) from refund_record c where c.order_code=a.order_code) as outstandingPayment,(IFNULL( a.pay_money, 0 )-IFNULL(a.commission,0)-IFNULL(a.procedures_money,0)) as moneys from dataexport_order a where a.order_code=?", orderCode)
|
|
|
outstandingPayment := qutil.IntAll((*orderData)[0]["outstandingPayment"]) //未回款金额
|
|
|
moneys := qutil.IntAll((*orderData)[0]["moneys"]) //应收金额
|
|
|
+ return_status := 0
|
|
|
if outstandingPayment == moneys {
|
|
|
param.RefundStatus = 1
|
|
|
+
|
|
|
} else if 0 < outstandingPayment && outstandingPayment < moneys {
|
|
|
param.RefundStatus = 2
|
|
|
+ return_status = 2
|
|
|
}
|
|
|
ok := util.JysqlDB.Update("dataexport_order", qMap, map[string]interface{}{
|
|
|
"refund_status": param.RefundStatus,
|
|
|
+ "return_status": return_status,
|
|
|
})
|
|
|
if ok {
|
|
|
return true, nil
|