正在显示
1 个修改的文件
包含
10 行增加
和
3 行删除
@@ -1246,7 +1246,7 @@ class Order extends Api | @@ -1246,7 +1246,7 @@ class Order extends Api | ||
1246 | } | 1246 | } |
1247 | $order = $this->orderModel->where(['id' => $param['order_id']])->find(); | 1247 | $order = $this->orderModel->where(['id' => $param['order_id']])->find(); |
1248 | if (!$order) $this->error('订单不存在'); | 1248 | if (!$order) $this->error('订单不存在'); |
1249 | - if ($order['status'] == 2) $this->error('订单已支付'); | 1249 | + if ($order['status'] == 10) $this->error('订单已支付'); |
1250 | if ($order['status'] == -1) $this->error('订单已取消'); | 1250 | if ($order['status'] == -1) $this->error('订单已取消'); |
1251 | //判断积分 | 1251 | //判断积分 |
1252 | if ($order['score'] > $this->user['score']) $this->error('积分不足'); | 1252 | if ($order['score'] > $this->user['score']) $this->error('积分不足'); |
@@ -1608,12 +1608,19 @@ class Order extends Api | @@ -1608,12 +1608,19 @@ class Order extends Api | ||
1608 | //10分钟内直接全额退款 | 1608 | //10分钟内直接全额退款 |
1609 | $pay = new Pay(); | 1609 | $pay = new Pay(); |
1610 | $userModel = new \app\api\model\User(); | 1610 | $userModel = new \app\api\model\User(); |
1611 | + //查询是否有其他商品没退款的 | ||
1612 | + $last = $this->orderInfoModel->where(['order_id'=>$order_id,'id'=>['<>',$order_info_id],'status'=>1])->count(); | ||
1613 | + //已退款的金额 | ||
1614 | + $refunded_money = $this->orderInfoModel->where(['order_id'=>$order_id,'id'=>['<>',$order_info_id],'status'=>3])->sum('goods_total'); | ||
1615 | + | ||
1616 | + if ($last) $refund_money = $orderInfo['goods_total']; | ||
1617 | + else $refund_money = $order['pay_total'] - $refunded_money; | ||
1611 | if ($orderInfo['pay_type'] == 1){ | 1618 | if ($orderInfo['pay_type'] == 1){ |
1612 | //微信退款 | 1619 | //微信退款 |
1613 | - $result = $pay->refundGoods($order['order_num'],$orderInfo['pay_total'],$orderInfo['id'],$refund_note,$orderInfo['goods_total']); | 1620 | + $result = $pay->refundGoods($order['order_num'],$orderInfo['pay_total'],$orderInfo['id'],$refund_note,$refund_money); |
1614 | }else{ | 1621 | }else{ |
1615 | //余额退款 | 1622 | //余额退款 |
1616 | - $result = $userModel->refundGoods($orderInfo['user_id'],$orderInfo['goods_total'],$orderInfo['id'],$refund_note); | 1623 | + $result = $userModel->refundGoods($orderInfo['user_id'],$refund_money,$orderInfo['id'],$refund_note); |
1617 | } | 1624 | } |
1618 | $msg = '退款'; | 1625 | $msg = '退款'; |
1619 | }else{ | 1626 | }else{ |
-
请 注册 或 登录 后发表评论