Commit a1930e00 by 朱继来

调整详情页售后金额

parent 709bc2c1
......@@ -1750,6 +1750,10 @@ Class OrderController extends Controller
// 获取数组中的采购人id的名字
$this->getBuyerName($response);
// 获取售后金额
$OrderServiceItemsModel = new OrderServiceItemsModel;
$response['service_amount'] = $OrderServiceItemsModel->getServiceAmount('', $id);
return $response;
}
......
......@@ -44,9 +44,13 @@ class OrderServiceItemsModel extends Model
}
// 获取售后金额
public function getServiceAmount($service_id)
public function getServiceAmount($service_id='', $order_id='')
{
$data = $this->where('service_id', $service_id)->select('adjust_number', 'adjust_price')->get()->toArray();
$map = [];
$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;
foreach ($data as $v) {
......
......@@ -67,7 +67,7 @@
<?php if ($order_info['order_goods_type'] == 1) { ?>
<th>售后数量</th>
<th>剩余数量</th>
<th>售后单价</th>
<!-- <th>售后单价</th> -->
<?php } ?>
<th>状态</th>
</tr>
......@@ -150,9 +150,9 @@
<?php
if ($order_info['order_goods_type'] == 1) {
$service_number = App\Http\Controllers\getOrderServiceNum($v['order_id'], $v['goods_id'], 2);
$service_price = App\Http\Controllers\getOrderServiceNum($v['order_id'], $v['goods_id'], 2, 'adjust_price');
// $service_price = App\Http\Controllers\getOrderServiceNum($v['order_id'], $v['goods_id'], 2, 'adjust_price');
echo '<td>'.$service_number.'</td><td>'.($v['goods_number'] - $service_number).'</td><td>'.$service_price.'</td>';
echo '<td>'.$service_number.'</td><td>'.($v['goods_number'] - $service_number).'</td>';
}
?>
<td><?= $v['status'] == 1 ? '正常' : '<i class="error">已关闭</i>' ?></td>
......@@ -341,11 +341,11 @@
</tr>
<?php } ?>
<?php if ($order_info['order_goods_type'] == 1 && isset($service_number) && isset($service_price)) { ?>
<?php if ($order_info['order_goods_type'] == 1 && $service_amount != 0) { ?>
<tr>
<td>售后金额:</td>
<td>
<span class="amount" style="color:red;font-size:20px"><?= '- '.number_format($service_number * $service_price, 2) ?></span>
<span class="amount" style="color:red;font-size:20px"><?= '- '.$service_amount ?></span>
</td>
</tr>
<?php } ?>
......
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