文件还在测试中

This commit is contained in:
2026-08-08 15:53:53 +08:00
parent 5f1e7adb64
commit 8101177cb5
241 changed files with 18074 additions and 22 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
/** CRM 客户联系人表单(新增/编辑共用) */
$ct = $contact;
$isEdit = !empty($ct);
$customers = $customers ?? [];
$preId = $preId ?? 0;
$curCustomer = $ct['customer_id'] ?? $preId;
?>
<div class="page-head">
<h1><?php echo $isEdit ? '编辑联系人' : '新增联系人'; ?></h1>
</div>
<div class="panel">
<form method="post" action="<?php echo site_url($isEdit ? 'CRM/contacts/update/' . $ct['id'] : 'CRM/contacts/store'); ?>">
<?php echo csrf_field(); ?>
<div class="form-grid">
<div class="field"><label>所属客户 *</label>
<select name="customer_id" required>
<option value="">— 请选择客户 —</option>
<?php foreach ($customers as $cu): ?>
<option value="<?php echo $cu['id']; ?>" <?php echo (int)($cu['id']) === (int)$curCustomer ? 'selected' : ''; ?>><?php echo e($cu['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>姓名 *</label><input name="name" value="<?php echo e($ct['name'] ?? ''); ?>" required></div>
<div class="field"><label>职位</label><input name="title" value="<?php echo e($ct['title'] ?? ''); ?>" placeholder="如:采购总监"></div>
<div class="field"><label>电话</label><input name="phone" value="<?php echo e($ct['phone'] ?? ''); ?>"></div>
<div class="field"><label>邮箱</label><input name="email" value="<?php echo e($ct['email'] ?? ''); ?>"></div>
<div class="field"><label>微信</label><input name="wechat" value="<?php echo e($ct['wechat'] ?? ''); ?>"></div>
<div class="field field-check">
<label><input type="checkbox" name="is_primary" value="1" <?php echo !empty($ct['is_primary']) ? 'checked' : ''; ?>> 设为主联系人</label>
</div>
</div>
<div class="field"><label>备注</label><textarea name="remark" rows="3"><?php echo e($ct['remark'] ?? ''); ?></textarea></div>
<button class="btn-primary" type="submit">保存</button>
<a class="btn-soft" href="<?php echo site_url($curCustomer ? 'CRM/contacts?customer_id=' . $curCustomer : 'CRM/contacts'); ?>">取消</a>
</form>
</div>
+42
View File
@@ -0,0 +1,42 @@
<?php
/** CRM 客户联系人列表 */
$customer = $customer ?? null;
$title = $customer ? ('『' . e($customer['name']) . '』的联系人') : '全部客户联系人';
$addUrl = $customer ? site_url('CRM/contacts/create?customer_id=' . $customer['id']) : site_url('CRM/contacts/create');
?>
<div class="page-head">
<h1><?php echo e($title); ?></h1>
<a class="btn-primary" href="<?php echo $addUrl; ?>">+ 新增联系人</a>
</div>
<?php if ($customer): ?>
<p class="sub"><a href="<?php echo site_url('CRM/customers'); ?>">← 返回客户列表</a></p>
<?php endif; ?>
<div class="panel">
<table class="tbl">
<thead><tr>
<th>ID</th><?php if (!$customer): ?><th>客户</th><?php endif; ?>
<th>姓名</th><th>职位</th><th>电话</th><th>邮箱</th><th>微信</th><th>主联系人</th><th>操作</th>
</tr></thead>
<tbody>
<?php foreach ($contacts as $ct): ?>
<tr>
<td><?php echo e($ct['id']); ?></td>
<?php if (!$customer): ?><td><?php echo e($ct['customer_name'] ?? '—'); ?></td><?php endif; ?>
<td><?php echo e($ct['name']); ?></td>
<td><?php echo e($ct['title'] ?? ''); ?></td>
<td><?php echo e($ct['phone'] ?? ''); ?></td>
<td><?php echo e($ct['email'] ?? ''); ?></td>
<td><?php echo e($ct['wechat'] ?? ''); ?></td>
<td><?php echo !empty($ct['is_primary']) ? '★ 是' : ''; ?></td>
<td class="row-actions">
<a href="<?php echo site_url('CRM/contacts/edit/' . $ct['id']); ?>">编辑</a>
<a href="<?php echo site_url('CRM/contacts/destroy/' . $ct['id']); ?>" data-confirm="确认删除该联系人?">删除</a>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($contacts)): ?><tr><td colspan="<?php echo $customer ? 8 : 9; ?>" class="muted">暂无联系人,点击右上角新增</td></tr><?php endif; ?>
</tbody>
</table>
</div>
+81
View File
@@ -0,0 +1,81 @@
<?php
/** CRM 客户表单(服装行业) */
$c = $customer;
$isEdit = !empty($c);
$typeOpts = [
'brand' => '品牌方',
'dealer1' => '一级经销商',
'dealer2' => '二级经销商',
'retail' => '直营门店',
'ecom' => '电商',
'export' => '外贸出口',
'oem' => '生产代工',
];
$levelOpts = ['A' => 'A(重点)', 'B' => 'B(普通)', 'C' => 'C(潜在)'];
$industryOpts = ['服装' => '服装', '鞋帽' => '鞋帽', '家纺' => '家纺', '其他' => '其他'];
$statusOpts = [
'lead' => '潜在客户',
'intent' => '意向客户',
'quote' => '报价中',
'cooperating' => '合作中',
'won' => '已成交',
'lost' => '已流失',
'dormant' => '休眠',
];
$curType = $c['type'] ?? 'brand';
$curLevel = $c['level'] ?? 'C';
$curIndustry = $c['industry'] ?? '服装';
$curStatus = $c['status'] ?? 'lead';
?>
<div class="page-head">
<h1><?php echo $isEdit ? '编辑客户' : '新增客户'; ?></h1>
</div>
<div class="panel">
<form method="post" action="<?php echo site_url($isEdit ? 'CRM/customers/update/' . $c['id'] : 'CRM/customers/store'); ?>">
<?php echo csrf_field(); ?>
<div class="form-grid">
<div class="field"><label>客户名称 *</label><input name="name" value="<?php echo e($c['name'] ?? ''); ?>" required></div>
<div class="field"><label>客户编号</label><input name="customer_no" value="<?php echo e($c['customer_no'] ?? ''); ?>" placeholder="如:C-0001"></div>
<div class="field"><label>公司</label><input name="company" value="<?php echo e($c['company'] ?? ''); ?>"></div>
<div class="field"><label>联系人</label><input name="contact" value="<?php echo e($c['contact'] ?? ''); ?>"></div>
<div class="field"><label>电话</label><input name="phone" value="<?php echo e($c['phone'] ?? ''); ?>"></div>
<div class="field"><label>邮箱</label><input name="email" value="<?php echo e($c['email'] ?? ''); ?>"></div>
<div class="field"><label>国家/地区</label><input name="country" value="<?php echo e($c['country'] ?? ''); ?>" placeholder="如:德国 / 广东"></div>
<div class="field"><label>客户类型</label>
<select name="type">
<?php foreach ($typeOpts as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php echo $curType === $k ? 'selected' : ''; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>客户等级</label>
<select name="level">
<?php foreach ($levelOpts as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php echo $curLevel === $k ? 'selected' : ''; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>所属行业</label>
<select name="industry">
<?php foreach ($industryOpts as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php echo $curIndustry === $k ? 'selected' : ''; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>区域</label><input name="region" value="<?php echo e($c['region'] ?? ''); ?>" placeholder="如:华东/华南/海外"></div>
<div class="field"><label>信用额度</label><input name="credit_limit" type="number" step="0.01" value="<?php echo e($c['credit_limit'] ?? '0'); ?>"></div>
<div class="field"><label>客户状态</label>
<select name="status">
<?php foreach ($statusOpts as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php echo $curStatus === $k ? 'selected' : ''; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>来源</label><input name="source" value="<?php echo e($c['source'] ?? ''); ?>" placeholder="如:展会/官网/转介绍"></div>
<div class="field"><label>负责人</label><input name="owner" value="<?php echo e($c['owner'] ?? ''); ?>"></div>
</div>
<div class="field"><label>备注</label><textarea name="remark" rows="3"><?php echo e($c['remark'] ?? ''); ?></textarea></div>
<button class="btn-primary" type="submit">保存</button>
<a class="btn-soft" href="<?php echo site_url('CRM/customers'); ?>">取消</a>
</form>
</div>
+72
View File
@@ -0,0 +1,72 @@
<?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>
+112
View File
@@ -0,0 +1,112 @@
<?php
/** CRM 仪表盘 */
$stageLabel = ['new' => '新线索', 'contact' => '已联系', 'quote' => '报价中', 'won' => '已成交', 'lost' => '已流失'];
$typeLabel = ['brand' => '品牌方', 'dealer1' => '一级经销商', 'dealer2' => '二级经销商', 'retail' => '直营门店', 'ecom' => '电商', 'export' => '外贸出口', 'oem' => '生产代工'];
$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',
];
$recentCustomers = $recentCustomers ?? [];
?>
<div class="page-head">
<h1>CRM 仪表盘</h1>
<p class="sub">客户需求与客户关系总览</p>
</div>
<div class="stat-grid">
<div class="stat-card"><div class="stat-num"><?php echo e($customerTotal); ?></div><div class="stat-label">客户总数</div></div>
<div class="stat-card"><div class="stat-num"><?php echo e($leadTotal); ?></div><div class="stat-label">商机线索</div></div>
<div class="stat-card"><div class="stat-num"><?php echo e($followTotal); ?></div><div class="stat-label">跟进记录</div></div>
<div class="stat-card"><div class="stat-num">¥<?php echo e(number_format($amountTotal, 2)); ?></div><div class="stat-label">商机金额合计</div></div>
</div>
<div class="quick-actions">
<a class="qa-card" href="<?php echo site_url('CRM/customers/create'); ?>">
<span class="qa-ico"></span><span class="qa-t">录入新客户</span><span class="qa-d">新增品牌方/经销商等</span>
</a>
<a class="qa-card" href="<?php echo site_url('CRM/contacts'); ?>">
<span class="qa-ico">👥</span><span class="qa-t">客户联系人</span><span class="qa-d">维护对接人多人对接</span>
</a>
<a class="qa-card" href="<?php echo site_url('CRM/customers'); ?>">
<span class="qa-ico">🔄</span><span class="qa-t">更新客户状态</span><span class="qa-d">在编辑页调整阶段/状态</span>
</a>
<a class="qa-card" href="<?php echo site_url('CRM/leads/create'); ?>">
<span class="qa-ico">💡</span><span class="qa-t">新建商机</span><span class="qa-d">登记线索与金额</span>
</a>
</div>
<div class="two-col">
<div class="panel">
<h3>商机阶段分布</h3>
<?php if (empty($stageCount)): ?><p class="muted">暂无商机数据</p><?php else: ?>
<table class="tbl">
<thead><tr><th>阶段</th><th>数量</th></tr></thead>
<tbody>
<?php foreach ($stageCount as $k => $v): ?>
<tr><td><?php echo e($stageLabel[$k] ?? $k); ?></td><td><?php echo e($v); ?></td></tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<div class="panel">
<h3>客户类型分布</h3>
<?php if (empty($typeCount)): ?><p class="muted">暂无客户数据</p><?php else: ?>
<table class="tbl">
<thead><tr><th>类型</th><th>数量</th></tr></thead>
<tbody>
<?php foreach ($typeCount as $k => $v): ?>
<tr><td><?php echo e($typeLabel[$k] ?? $k); ?></td><td><?php echo e($v); ?></td></tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
</div>
<div class="panel">
<h3>最近客户</h3>
<?php if (empty($recentCustomers)): ?><p class="muted">暂无客户,点击上方「录入新客户」开始</p><?php else: ?>
<table class="tbl">
<thead><tr><th>ID</th><th>客户名称</th><th>类型</th><th>状态</th><th>负责人</th><th>操作</th></tr></thead>
<tbody>
<?php foreach ($recentCustomers as $c): ?>
<tr>
<td><?php echo e($c['id']); ?></td>
<td><?php echo e($c['name']); ?></td>
<td><?php echo e($typeLabel[$c['type'] ?? ''] ?? $c['type'] ?? ''); ?></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['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']); ?>">联系人</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<div class="panel">
<h3>最近跟进</h3>
<?php if (empty($recent)): ?><p class="muted">暂无跟进记录</p><?php else: ?>
<table class="tbl">
<thead><tr><th>时间</th><th>客户ID</th><th>内容</th><th>下次跟进</th></tr></thead>
<tbody>
<?php foreach ($recent as $r): ?>
<tr>
<td><?php echo e($r['created_at'] ?? ''); ?></td>
<td>#<?php echo e($r['customer_id'] ?? ''); ?></td>
<td><?php echo e(mb_substr($r['content'] ?? '', 0, 40)); ?></td>
<td><?php echo e($r['next_at'] ?? ''); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
+36
View File
@@ -0,0 +1,36 @@
<?php
/** CRM 跟进表单 */
$f = $follow;
$isEdit = !empty($f);
$wayOpts = ['tel' => '电话', 'wechat' => '微信', 'visit' => '拜访', 'email' => '邮件', 'other' => '其他'];
$curWay = $f['way'] ?? 'tel';
?>
<div class="page-head"><h1><?php echo $isEdit ? '编辑跟进' : '新增跟进'; ?></h1></div>
<div class="panel">
<form method="post" action="<?php echo site_url($isEdit ? 'CRM/followups/update/' . $f['id'] : 'CRM/followups/store'); ?>">
<?php echo csrf_field(); ?>
<div class="form-grid">
<div class="field"><label>关联客户 *</label>
<select name="customer_id">
<option value="0">未关联</option>
<?php foreach ($customers as $c): ?>
<option value="<?php echo e($c['id']); ?>" <?php echo ($f['customer_id'] ?? 0) == $c['id'] ? 'selected' : ''; ?>><?php echo e($c['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>跟进方式</label>
<select name="way">
<?php foreach ($wayOpts as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php echo $curWay === $k ? 'selected' : ''; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>下次跟进</label><input name="next_at" type="date" value="<?php echo e($f['next_at'] ?? ''); ?>"></div>
<div class="field"><label>跟进结果</label><input name="result" value="<?php echo e($f['result'] ?? ''); ?>" placeholder="如:已寄样/待报价"></div>
<div class="field"><label>负责人</label><input name="owner" value="<?php echo e($f['owner'] ?? ''); ?>"></div>
</div>
<div class="field"><label>跟进内容 *</label><textarea name="content" rows="4" required><?php echo e($f['content'] ?? ''); ?></textarea></div>
<button class="btn-primary" type="submit">保存</button>
<a class="btn-soft" href="<?php echo site_url('CRM/followups'); ?>">取消</a>
</form>
</div>
+32
View File
@@ -0,0 +1,32 @@
<?php
/** CRM 跟进记录列表 */
$wayLabel = ['tel' => '电话', 'wechat' => '微信', 'visit' => '拜访', 'email' => '邮件', 'other' => '其他'];
?>
<div class="page-head">
<h1>跟进记录</h1>
<a class="btn-primary" href="<?php echo site_url('CRM/followups/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></tr></thead>
<tbody>
<?php foreach ($follows as $f): ?>
<tr>
<td><?php echo e($f['id']); ?></td>
<td><?php echo e($f['created_at'] ?? ''); ?></td>
<td><?php echo e($cmap[$f['customer_id']] ?? ('#' . $f['customer_id'])); ?></td>
<td><?php echo e($wayLabel[$f['way'] ?? ''] ?? $f['way'] ?? ''); ?></td>
<td><?php echo e(mb_substr($f['content'] ?? '', 0, 40)); ?></td>
<td><?php echo e($f['result'] ?? ''); ?></td>
<td><?php echo e($f['next_at'] ?? ''); ?></td>
<td><?php echo e($f['owner'] ?? ''); ?></td>
<td class="row-actions">
<a href="<?php echo site_url('CRM/followups/edit/' . $f['id']); ?>">编辑</a>
<a href="<?php echo site_url('CRM/followups/destroy/' . $f['id']); ?>" data-confirm="确认删除?">删除</a>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($follows)): ?><tr><td colspan="9" class="muted">暂无跟进记录</td></tr><?php endif; ?>
</tbody>
</table>
</div>
+46
View File
@@ -0,0 +1,46 @@
<?php
/** CRM 商机表单 */
$l = $lead;
$isEdit = !empty($l);
$stageLabel = ['new' => '新线索', 'contact' => '已联系', 'quote' => '报价中', 'won' => '已成交', 'lost' => '已流失'];
$srcOpts = ['expo' => '展会', 'referral' => '转介绍', 'online' => '线上', 'web' => '官网', 'tel' => '电话', 'other' => '其他'];
$curSrc = $l['source'] ?? 'expo';
?>
<div class="page-head"><h1><?php echo $isEdit ? '编辑商机' : '新增商机'; ?></h1></div>
<div class="panel">
<form method="post" action="<?php echo site_url($isEdit ? 'CRM/leads/update/' . $l['id'] : 'CRM/leads/store'); ?>">
<?php echo csrf_field(); ?>
<div class="form-grid">
<div class="field"><label>关联客户 *</label>
<select name="customer_id">
<option value="0">未关联</option>
<?php foreach ($customers as $c): ?>
<option value="<?php echo e($c['id']); ?>" <?php echo ($l['customer_id'] ?? 0) == $c['id'] ? 'selected' : ''; ?>><?php echo e($c['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>商机标题 *</label><input name="title" value="<?php echo e($l['title'] ?? ''); ?>" required></div>
<div class="field"><label>金额</label><input name="amount" type="number" step="0.01" value="<?php echo e($l['amount'] ?? '0'); ?>"></div>
<div class="field"><label>阶段</label>
<select name="stage">
<?php foreach ($stageLabel as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php echo ($l['stage'] ?? 'new') === $k ? 'selected' : ''; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>来源渠道</label>
<select name="source">
<?php foreach ($srcOpts as $k => $v): ?>
<option value="<?php echo $k; ?>" <?php echo $curSrc === $k ? 'selected' : ''; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="field"><label>成交概率(%)</label><input name="probability" type="number" min="0" max="100" value="<?php echo e($l['probability'] ?? '0'); ?>"></div>
<div class="field"><label>预计成交日期</label><input name="expected_close" type="date" value="<?php echo e($l['expected_close'] ?? ''); ?>"></div>
<div class="field"><label>负责人</label><input name="owner" value="<?php echo e($l['owner'] ?? ''); ?>"></div>
</div>
<div class="field"><label>备注</label><textarea name="remark" rows="3"><?php echo e($l['remark'] ?? ''); ?></textarea></div>
<button class="btn-primary" type="submit">保存</button>
<a class="btn-soft" href="<?php echo site_url('CRM/leads'); ?>">取消</a>
</form>
</div>
+34
View File
@@ -0,0 +1,34 @@
<?php
/** CRM 商机线索列表 */
$stageLabel = ['new' => '新线索', 'contact' => '已联系', 'quote' => '报价中', 'won' => '已成交', 'lost' => '已流失'];
$sourceLabel = ['expo' => '展会', 'referral' => '转介绍', 'online' => '线上', 'web' => '官网', 'tel' => '电话', 'other' => '其他'];
?>
<div class="page-head">
<h1>商机线索</h1>
<a class="btn-primary" href="<?php echo site_url('CRM/leads/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></tr></thead>
<tbody>
<?php foreach ($leads as $l): ?>
<tr>
<td><?php echo e($l['id']); ?></td>
<td><?php echo e($l['title']); ?></td>
<td><?php echo e($cmap[$l['customer_id']] ?? ('#' . $l['customer_id'])); ?></td>
<td>¥<?php echo e(number_format((float)($l['amount'] ?? 0), 2)); ?></td>
<td><?php echo e($stageLabel[$l['stage'] ?? ''] ?? $l['stage'] ?? ''); ?></td>
<td><?php echo e($sourceLabel[$l['source'] ?? ''] ?? $l['source'] ?? ''); ?></td>
<td><?php echo e((int)($l['probability'] ?? 0)); ?>%</td>
<td><?php echo e($l['expected_close'] ?? ''); ?></td>
<td><?php echo e($l['owner'] ?? ''); ?></td>
<td class="row-actions">
<a href="<?php echo site_url('CRM/leads/edit/' . $l['id']); ?>">编辑</a>
<a href="<?php echo site_url('CRM/leads/destroy/' . $l['id']); ?>" data-confirm="确认删除?">删除</a>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($leads)): ?><tr><td colspan="10" class="muted">暂无商机,点击右上角新增</td></tr><?php endif; ?>
</tbody>
</table>
</div>