Commit 201205df by 朱继来

调整

parent a1930e00
...@@ -1751,8 +1751,8 @@ Class OrderController extends Controller ...@@ -1751,8 +1751,8 @@ Class OrderController extends Controller
$this->getBuyerName($response); $this->getBuyerName($response);
// 获取售后金额 // 获取售后金额
$OrderServiceItemsModel = new OrderServiceItemsModel; $OrderServiceModel = new OrderServiceModel;
$response['service_amount'] = $OrderServiceItemsModel->getServiceAmount('', $id); $response['service_amount'] = $OrderServiceModel->getRefundedAmount($id);
return $response; return $response;
} }
......
...@@ -44,13 +44,9 @@ class OrderServiceItemsModel extends Model ...@@ -44,13 +44,9 @@ class OrderServiceItemsModel extends Model
} }
// 获取售后金额 // 获取售后金额
public function getServiceAmount($service_id='', $order_id='') public function getServiceAmount($service_id)
{ {
$map = []; $data = $this->where('service_id', $service_id)->select('adjust_number', 'adjust_price')->get()->toArray();
$service_id && $map['service_id'] = $service_id;
$order_id && $map['order_id'] = $order_id;
$data = $this->where($map)->select('adjust_number', 'adjust_price')->get()->toArray();
$amount = 0; $amount = 0;
foreach ($data as $v) { foreach ($data as $v) {
......
...@@ -271,4 +271,23 @@ class OrderServiceModel extends Model ...@@ -271,4 +271,23 @@ class OrderServiceModel extends Model
return [0, '', $goods]; return [0, '', $goods];
} }
// 获取已退款的售后金额
public function getRefundedAmount($order_id)
{
$data = $this->from('lie_order_service as s')
->leftJoin('lie_order_service_items as i', 's.id', '=', 'i.service_id')
->where('s.refund_status', 3)
->where('i.order_id', $order_id)
->select('i.adjust_number', 'i.adjust_price')
->get()
->toArray();
$amount = 0;
foreach ($data as $v) {
$amount += $v['adjust_price'] * $v['adjust_number'];
}
return number_format($amount, 2, '.', '');
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment