Browse Source

fix:详情修改

duxin 5 days ago
parent
commit
d8a0bb33c4
2 changed files with 8 additions and 2 deletions
  1. 6 0
      internal/logic/order/editBatchReturn.go
  2. 2 2
      internal/logic/order/list.go

+ 6 - 0
internal/logic/order/editBatchReturn.go

@@ -252,6 +252,12 @@ func EditBatchReturn(ctx context.Context, param model.OrdersEditBatchReturn) err
 				log.Printf("%s 回款销售业绩生效异常 %v", orderCode, err)
 			}
 		}
+		//回款更新订单详情支付状态
+		if _, err := g.DB().Update(ctx, "jy_order_detail", g.Map{
+			"pay_status": 1,
+		}, " order_code=?", id, orderCode); err != nil {
+			log.Printf("%s 回款更新订单详情支付状态异常 %v", orderCode, err)
+		}
 	}
 	log.Println("p718 ", allReturnOrder)
 	for _, orderCode := range allReturnOrder {

+ 2 - 2
internal/logic/order/list.go

@@ -261,7 +261,7 @@ LEFT JOIN contract e ON a.order_code = e.order_code
 LEFT JOIN (
     SELECT 
         orderCode,
-        SUM(orderMoney) AS orderMoney
+        SUM(payMoney) AS orderMoney
     FROM 
         moneyCorrection
     GROUP BY 
@@ -274,7 +274,7 @@ LEFT JOIN (
 		whereSql = fmt.Sprintf(" where %s", strings.Join(orderSql, " and "))
 	}
 	//列表
-	sql := fmt.Sprintf(sqlWhere, " a.id, a.order_channel, a.is_backstage_order, a.order_code,\n a.personPhone,\n a.personName,\n  a.create_time,\n a.order_money,\n  a.company_name,\n    a.user_phone,\n    a.user_nickname,\n    a.buy_subject,\n    a.audit_status,\n    a.order_status,\n    (IFNULL(CASE WHEN a.is_backstage_order = 1 THEN a.pay_money ELSE a.order_money END, 0)) - IFNULL(g.orderMoney, 0) as pay_money,\n    a.commission,\n    a.return_status,\n    IFNULL(c.return_money, 0) as return_money,\n    IFNULL(b.invoiced_amount, 0) as invoiced_amount,\n    a.refund_status,\n    IFNULL(d.refund_money, 0) as refund_money,\n    e.contract_status,\n    DATE(e.contract_time) as contract_time,\n    e.contract_archive_status,\n    DATE(e.contract_archive_time) as contract_archive_time,\n  h.name as ent_user_name", productSql, channelSql, whereSql)
+	sql := fmt.Sprintf(sqlWhere, " a.id, a.order_channel, a.is_backstage_order, a.order_code,\n a.personPhone,\n a.personName,\n  a.create_time,\n a.order_money,\n  a.company_name,\n    a.user_phone,\n    a.user_nickname,\n    a.buy_subject,\n    a.audit_status,\n    a.order_status,\n    (IFNULL(CASE WHEN a.is_backstage_order = 1 THEN a.pay_money ELSE a.order_money END, 0)) + IFNULL(g.orderMoney, 0) as pay_money,\n    a.commission,\n    a.return_status,\n    IFNULL(c.return_money, 0) as return_money,\n    IFNULL(b.invoiced_amount, 0) as invoiced_amount,\n    a.refund_status,\n    IFNULL(d.refund_money, 0) as refund_money,\n    e.contract_status,\n    DATE(e.contract_time) as contract_time,\n    e.contract_archive_status,\n    DATE(e.contract_archive_time) as contract_archive_time,\n  h.name as ent_user_name", productSql, channelSql, whereSql)
 	//数量
 	sqlCount := fmt.Sprintf(sqlWhere, " count(1) ", productSql, channelSql, whereSql)
 	//合同总金额