Commit b5c973f7 by 朱继来

调整售后列表、详情

parent 1b3c1d7b
......@@ -24,6 +24,7 @@ use DB;
use App\Model\UserMainModel;
use App\Model\UserInfoModel;
use App\Model\UserCompanyModel;
use App\Model\OrderModel;
use App\Model\OrderServiceModel;
use App\Model\OrderServiceItemsModel;
use App\Model\OrderServiceLogModel;
......@@ -403,10 +404,16 @@ class WebController extends Controller
$data['title'] = '售后单详情';
$OrderServiceModel = new OrderServiceModel;
$OrderServiceLogModel = new OrderServiceLogModel;
$OrderModel = new OrderModel;
$OrderServiceModel = new OrderServiceModel;
$OrderServiceItemsModel = new OrderServiceItemsModel;
$OrderServiceLogModel = new OrderServiceLogModel;
$order_service = $OrderServiceModel->find($service_id);
$data['service_amount'] = $OrderServiceItemsModel->getServiceAmount($service_id); // 售后金额
$currency = $OrderModel->where('order_id', $order_service['order_id'])->value('currency');
$data['currency_sign'] = $currency == 1 ? '¥' : '$';
// 用户账号
$UserMainModel = new UserMainModel;
......
......@@ -36,11 +36,24 @@ class OrderServiceItemsModel extends Model
}
$v['amount'] = number_format($v['adjust_number'] * $v['adjust_price'], 2);
$v['refund_amount'] = number_format($v['goods_number'] * $v['single_pre_price'], 2);
// $v['refund_amount'] = number_format($v['goods_number'] * $v['single_pre_price'], 2);
$v['apply_reason_val'] = array_get(Config('order_service.apply_reason'), $v['apply_reason'], '');
}
return $data;
}
// 获取售后金额
public function getServiceAmount($service_id)
{
$data = $this->where('service_id', $service_id)->select('adjust_number', '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
......@@ -133,9 +133,15 @@ class OrderServiceModel extends Model
$v['return_status_val'] = array_get(Config('order_service.return_status'), $v['return_status'], '');
$v['auditor_time'] = $v['auditor_time'] ? date('Y-m-d H:i:s', $v['auditor_time']) : '';
if ($v['service_status'] == 1) {
$v['items'] = $OrderServiceItemsModel->where('service_id', $v['id'])->get()->toArray();
$service_items = $OrderServiceItemsModel->where('service_id', $v['id'])->get()->toArray();
$goods_amount = 0;
foreach ($service_items as $item) {
$goods_amount += $item['adjust_price'] * $item['adjust_number'];
}
$v['items'] = $service_items;
$v['service_amount'] = number_format($goods_amount, 2, '.', '');
}
return $data;
......
......@@ -22,7 +22,7 @@ layui.use(['form', 'table', 'element'], function(){
,{field: 'adjust_number', title: '申请数量', width: 120}
,{field: 'adjust_price', title: '售后单价', width: 120}
,{field: 'amount', title: '小计', width: 120}
,{field: 'refund_amount', title: '可退款金额', width: 120}
// ,{field: 'refund_amount', title: '可退款金额', width: 120}
,{field: 'removal_number', title: '已出库数量', width: 120}
,{field: 'put_warehouse_number', title: '退货入库数量', width: 120}
,{field: 'apply_reason_val', title: '申请原因', width: 120}
......
......@@ -26,6 +26,7 @@ layui.use(['form', 'table', 'laydate'], function(){
,{field: 'user_account', title: '用户账号', width: 150}
,{field: 'apply_name', title: '申请人', width: 120}
,{field: 'auditor_name', title: '审核人', width: 120}
,{field: 'service_amount', title: '售后金额', width: 120}
,{field: 'service_status_val', title: '售后状态', templet: '#status', width: 120}
,{field: 'refund_status_val', title: '退款状态', width: 120}
,{field: 'return_status_val', title: '退货状态', width: 120}
......
......@@ -137,6 +137,7 @@
<h2 class="layui-colla-title">售后明细</h2>
<div class="layui-colla-content layui-show">
<table id="order-service-items" lay-filter="order-service-items"></table>
<div style="margin: 20px; font-size: 20px;">售后合计: {{ $currency_sign.$service_amount }}</div>
</div>
</div>
......
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