核销时间(聂总需求)

This commit is contained in:
jianghanbo 2024-11-14 10:58:30 +08:00
parent d485eb6cd7
commit 8192dc3c8f
5 changed files with 49 additions and 11 deletions

View File

@ -77,6 +77,12 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="当月核销数量(按核销时间)" width="160">
<template slot-scope="scope">
{{ scope.row.month_write_num }}
</template>
</el-table-column>
<el-table-column align="center" label="当月核销率(按订单)" width="160"> <el-table-column align="center" label="当月核销率(按订单)" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.month_write_rate }}% {{ scope.row.month_write_rate }}%

View File

@ -272,7 +272,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态" width="80"> <el-table-column align="center" label="状态" width="80" @sort-change="orderSort">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div
style="padding: 1px 5px; border-radius: 3px" style="padding: 1px 5px; border-radius: 3px"
@ -301,6 +301,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column sortable="custom" align="center" label="核销日期" width="90" prop="verification_date" />
<el-table-column <el-table-column
align="center" align="center"
@ -774,6 +775,9 @@ export default {
}); });
await this.onOneClickRepair({ id: arr.join() }); await this.onOneClickRepair({ id: arr.join() });
}, },
orderSort(data) {
console.log(data);
},
async getList($is_excel) { async getList($is_excel) {
this.listQuery.excel = null; this.listQuery.excel = null;
if ($is_excel == 1) { if ($is_excel == 1) {

View File

@ -39,8 +39,9 @@ module.exports = {
proxy: { proxy: {
"/dev-api": { "/dev-api": {
// 接口地址 以 api开头的都走下面的配置 // 接口地址 以 api开头的都走下面的配置
target: 'https://www.szjinao.cn', // 代理目标地址为后端服务器地址 127.0.0.1 192.168.1.2 // target: 'https://www.szjinao.cn', // 代理目标地址为后端服务器地址 127.0.0.1 192.168.1.2
// target: "http://hex.jipinq.cn", // 代理目标地址为后端服务器地址 127.0.0.1 192.168.1.2 // target: "http://hex.jipinq.cn", // 代理目标地址为后端服务器地址 127.0.0.1 192.168.1.2
target: "http://192.168.0.100:8787",
ws: true, // 是否支持 websocket 请求 支持 ws: true, // 是否支持 websocket 请求 支持
changeOrigin: true, // 是否启用跨域 changeOrigin: true, // 是否启用跨域
pathRewrite: { pathRewrite: {

View File

@ -77,6 +77,7 @@ class DataController extends base
'm_total_price' => 0, 'm_total_price' => 0,
'm_assets' => 0, 'm_assets' => 0,
'm_asset_price' => 0, 'm_asset_price' => 0,
'month_write_num' => 0,
'name' => '合计', 'name' => '合计',
'admin' => [ 'admin' => [
'username' => '合计', 'username' => '合计',
@ -96,6 +97,8 @@ class DataController extends base
$list[$k]['month_write_rate'] = 0; $list[$k]['month_write_rate'] = 0;
// 当月核销率(按销售额) // 当月核销率(按销售额)
$list[$k]['month_write_rate_price'] = 0; $list[$k]['month_write_rate_price'] = 0;
// 当月核销数(按核销时间)
$list[$k]['month_write_num'] = Orders::query()->where('verification_date', '>', date('Y-m-01'))->count();
if (isset($currentList[$v['admin_id']])) { if (isset($currentList[$v['admin_id']])) {
$currentAdmin = $currentList[$v['admin_id']]; $currentAdmin = $currentList[$v['admin_id']];
$list[$k]['month_write_rate'] = number_format(($currentAdmin['assets']/$currentAdmin['orders'])*100,2); $list[$k]['month_write_rate'] = number_format(($currentAdmin['assets']/$currentAdmin['orders'])*100,2);
@ -113,11 +116,20 @@ class DataController extends base
$totalArr[1]['asset_price'] += $list[$k]['asset_price']; $totalArr[1]['asset_price'] += $list[$k]['asset_price'];
$totalArr[1]['nopays'] += $list[$k]['nopays']; $totalArr[1]['nopays'] += $list[$k]['nopays'];
$totalArr[1]['nopay_price'] += $list[$k]['nopay_price']; $totalArr[1]['nopay_price'] += $list[$k]['nopay_price'];
$totalArr[1]['month_write_num'] += $list[$k]['month_write_num'];
}
if (isset($totalArr[1]['orders']) && $totalArr[1]['orders'] > 0) {
$totalArr[1]['write_rate'] = $totalArr[1]['orders'] ?: (float)number_format(($totalArr[1]['assets']/$totalArr[1]['orders'])*100,2);
}
if (isset($totalArr[1]['total_price']) && $totalArr[1]['total_price'] > 0) {
$totalArr[1]['write_rate_price'] = $totalArr[1]['total_price'] ?: (float)number_format(($totalArr[1]['asset_price']/$totalArr[1]['total_price'])*100,2);
}
if (isset($totalArr[1]['m_orders']) && $totalArr[1]['m_orders'] > 0) {
$totalArr[1]['month_write_rate'] = $totalArr[1]['m_orders'] ?: (float)number_format(($totalArr[1]['m_assets']/$totalArr[1]['m_orders'])*100,2);
}
if (isset($totalArr[1]['m_total_price']) && $totalArr[1]['m_total_price'] > 0) {
$totalArr[1]['month_write_rate_price'] = $totalArr[1]['m_total_price'] ?: (float)number_format(($totalArr[1]['m_asset_price']/$totalArr[1]['m_total_price'])*100,2);
} }
$totalArr[1]['write_rate'] = (float)number_format(($totalArr[1]['assets']/$totalArr[1]['orders'])*100,2);
$totalArr[1]['write_rate_price'] = (float)number_format(($totalArr[1]['asset_price']/$totalArr[1]['total_price'])*100,2);
$totalArr[1]['month_write_rate'] = (float)number_format(($totalArr[1]['m_assets']/$totalArr[1]['m_orders'])*100,2);
$totalArr[1]['month_write_rate_price'] = (float)number_format(($totalArr[1]['m_asset_price']/$totalArr[1]['m_total_price'])*100,2);
$list = array_merge($list->toArray(), $totalArr); $list = array_merge($list->toArray(), $totalArr);
$excel = $request->get('excel'); $excel = $request->get('excel');
@ -228,4 +240,4 @@ class DataController extends base
return $this->success($list); return $this->success($list);
} }
} }

View File

@ -44,12 +44,22 @@ class OrderController extends base
// $where[] = ['appointment_status', '=', $appointment_status]; // $where[] = ['appointment_status', '=', $appointment_status];
// } // }
switch ($request->get('order_by')) {
case 'verify_date_asc':
$orderBy['verification_date'] = 'asc';
break;
case 'verify_date_desc':
$orderBy['verification_date'] = 'desc';
break;
default:
$orderBy['create_at'] = 'desc';
break;
}
$status = $request->get('status', null); $status = $request->get('status', null);
$query = Orders::attimes($timetype, $times)->with(['admin','anchor','backs', 'mobileInfo'])->where($where) $query = Orders::attimes($timetype, $times)->with(['admin','anchor','backs', 'mobileInfo'])->where($where)
->order('create_at','desc') ->order($orderBy);
->order('update_time','desc')
->order('id','desc');
if($os_status) { if($os_status) {
if ($os_status[0] == array_search(Orders::OSS[4],Orders::OSS)){ if ($os_status[0] == array_search(Orders::OSS[4],Orders::OSS)){
@ -306,6 +316,11 @@ class OrderController extends base
$item->next_follow = strtotime($next_follow??'') * 1000; $item->next_follow = strtotime($next_follow??'') * 1000;
$item->remark = $desc; $item->remark = $desc;
// 记录核销日期
if ($status == 2 && $item->status !=2) {
$item->verification_date = date('Y-m-d H:i:s');
}
$back = $item->save(); $back = $item->save();
// } // }
@ -664,4 +679,4 @@ class OrderController extends base
return $this->error(2006, '出错了:' . $e->getMessage()); return $this->error(2006, '出错了:' . $e->getMessage());
} }
} }
} }