73 lines
3.2 KiB
PHP
73 lines
3.2 KiB
PHP
<?php
|
|
/** CRM 客户列表(服装行业:品牌方/经销商分级/区域/信用额度) */
|
|
$typeLabel = [
|
|
'brand' => '品牌方',
|
|
'dealer1' => '一级经销商',
|
|
'dealer2' => '二级经销商',
|
|
'retail' => '直营门店',
|
|
'ecom' => '电商',
|
|
'export' => '外贸出口',
|
|
'oem' => '生产代工',
|
|
];
|
|
$levelLabel = ['A' => 'A(重点)', 'B' => 'B(普通)', 'C' => 'C(潜在)'];
|
|
$statusLabel = [
|
|
'lead' => '潜在客户',
|
|
'intent' => '意向客户',
|
|
'quote' => '报价中',
|
|
'cooperating' => '合作中',
|
|
'won' => '已成交',
|
|
'lost' => '已流失',
|
|
'dormant' => '休眠',
|
|
];
|
|
$statusClass = [
|
|
'lead' => 'st-grey',
|
|
'intent' => 'st-blue',
|
|
'quote' => 'st-purple',
|
|
'cooperating' => 'st-green',
|
|
'won' => 'st-gold',
|
|
'lost' => 'st-red',
|
|
'dormant' => 'st-grey',
|
|
];
|
|
?>
|
|
<div class="page-head">
|
|
<h1>客户管理</h1>
|
|
<a class="btn-primary" href="<?php echo site_url('CRM/customers/create'); ?>">+ 新增客户</a>
|
|
</div>
|
|
|
|
<div class="panel">
|
|
<table class="tbl">
|
|
<thead><tr>
|
|
<th>ID</th><th>客户名称</th><th>公司</th><th>联系人</th><th>电话</th><th>国家/地区</th>
|
|
<th>类型</th><th>等级</th><th>状态</th><th>行业</th><th>区域</th><th>信用额度</th><th>负责人</th><th>操作</th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<?php foreach ($customers as $c): ?>
|
|
<tr>
|
|
<td><?php echo e($c['id']); ?></td>
|
|
<td><?php echo e($c['name']); ?></td>
|
|
<td><?php echo e($c['company'] ?? ''); ?></td>
|
|
<td><?php echo e($c['contact'] ?? ''); ?></td>
|
|
<td><?php echo e($c['phone'] ?? ''); ?></td>
|
|
<td><?php echo e($c['country'] ?? ''); ?></td>
|
|
<td><?php echo e($typeLabel[$c['type'] ?? ''] ?? $c['type'] ?? ''); ?></td>
|
|
<td><?php echo e($levelLabel[$c['level'] ?? ''] ?? $c['level'] ?? ''); ?></td>
|
|
<td><span class="badge <?php echo e($statusClass[$c['status'] ?? 'lead'] ?? 'st-grey'); ?>"><?php echo e($statusLabel[$c['status'] ?? 'lead'] ?? '潜在客户'); ?></span></td>
|
|
<td><?php echo e($c['industry'] ?? ''); ?></td>
|
|
<td><?php echo e($c['region'] ?? ''); ?></td>
|
|
<td><?php echo e(number_format((float)($c['credit_limit'] ?? 0), 2)); ?></td>
|
|
<td><?php echo e($c['owner'] ?? ''); ?></td>
|
|
<td class="row-actions">
|
|
<a href="<?php echo site_url('CRM/customers/edit/' . $c['id']); ?>">编辑</a>
|
|
<a href="<?php echo site_url('CRM/contacts?customer_id=' . $c['id']); ?>">联系人<?php
|
|
$cc = $contactCounts[$c['id']] ?? 0;
|
|
if ($cc > 0) echo ' (' . $cc . ')';
|
|
?></a>
|
|
<a href="<?php echo site_url('CRM/customers/destroy/' . $c['id']); ?>" data-confirm="确认删除?">删除</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php if (empty($customers)): ?><tr><td colspan="14" class="muted">暂无客户,点击右上角新增</td></tr><?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|