Pārlūkot izejas kodu

fix:合同金额修改

duxin 1 mēnesi atpakaļ
vecāks
revīzija
6c76f82d91

+ 1 - 1
internal/controller/orderSurplusPrice.go

@@ -20,7 +20,7 @@ func OrderSurplusPrice(r *ghttp.Request) {
 		}
 		var price int
 		for key, value := range param.OrderArr {
-			orderData, _ := g.DB().GetOne(r.Context(), "select  (IFNULL( a.pay_money, 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)+(select IFNULL(sum(payMoney),0) as return_money from moneyCorrection c where c.orderCode=a.order_code) as outstandingPayment, a.*  from  dataexport_order a where  a.id=?", value["orderId"])
+			orderData, _ := g.DB().GetOne(r.Context(), "SELECT     (IFNULL(CASE WHEN a.is_backstage_order = 1 THEN a.pay_money ELSE a.order_money END, 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) +     (SELECT IFNULL(SUM(payMoney), 0) FROM moneyCorrection c WHERE c.orderCode = a.order_code) AS outstandingPayment,     a.*  FROM      dataexport_order a  WHERE      a.id = ?", value["orderId"])
 			if orderData.IsEmpty() {
 				continue
 			}

+ 1 - 1
internal/logic/order/detail.go

@@ -21,7 +21,7 @@ func init() {
 func Detail(ctx context.Context, param model.OrderDetailParams) (map[string]interface{}, error) {
 	result := make(map[string]interface{})
 	//订单 暂无备注字段
-	orderData, err := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT d.*,d.pay_money+(select IFNULL(sum(payMoney),0) as return_money from moneyCorrection where orderCode='%s') as new_pay_money,d.commission+(select IFNULL(sum(commission),0) as return_commission from moneyCorrection where orderCode='%s') as new_commission,(select a.item_name AS order_parent_name from dict_item a where  a.item_code=d.order_channel ) AS order_channel_new FROM  dataexport_order d WHERE order_code ='%s' `, param.OrderCode, param.OrderCode, param.OrderCode))
+	orderData, err := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT d.*,(IFNULL(CASE WHEN d.is_backstage_order = 1 THEN d.pay_money ELSE d.order_money END, 0))+(select IFNULL(sum(payMoney),0) as return_money from moneyCorrection where orderCode='%s') as new_pay_money,d.commission+(select IFNULL(sum(commission),0) as return_commission from moneyCorrection where orderCode='%s') as new_commission,(select a.item_name AS order_parent_name from dict_item a where  a.item_code=d.order_channel ) AS order_channel_new FROM  dataexport_order d WHERE order_code ='%s' `, param.OrderCode, param.OrderCode, param.OrderCode))
 	if err != nil || orderData.IsEmpty() {
 		return nil, err
 	}