chore: 优化系统功能与界面体验
- 升级系统版本至1.0.100 - 新增订单详情页物流、资质等信息展示 - 优化师傅报价页收益计算与显示 - 新增企业资质管理模块 - 优化后台标签页管理与交互 - 修复标签解析与地址脱敏问题 - 优化预约时段选择逻辑 - 调整服务类型配置界面布局
这个提交包含在:
@@ -33,7 +33,141 @@ class Merchant extends Backend
|
||||
/** 独立展示用户提交的企业资质;审核接口沿用原权限。 */
|
||||
public function certificates()
|
||||
{
|
||||
return $this->view->fetch();
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
$certStatusList = ['pending' => '待审核', 'pass' => '已通过', 'reject' => '已驳回'];
|
||||
if (false === $this->request->isAjax()) {
|
||||
$this->view->assign('certStatusList', $certStatusList);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
$offset = max(0, (int)$this->request->get('offset', 0));
|
||||
$limit = min(100, max(1, (int)$this->request->get('limit', 20)));
|
||||
$search = trim((string)$this->request->get('search', ''));
|
||||
$sort = (string)$this->request->get('sort', 'id');
|
||||
$order = strtolower((string)$this->request->get('order', 'desc')) === 'asc' ? 'asc' : 'desc';
|
||||
|
||||
$fieldMap = [
|
||||
'id' => 'c.id',
|
||||
'company_name' => 'c.company_name',
|
||||
'license_no' => 'c.license_no',
|
||||
'legal_person' => 'c.legal_person',
|
||||
'verify_status' => 'c.verify_status',
|
||||
'audit_msg' => 'c.audit_msg',
|
||||
'createtime' => 'c.createtime',
|
||||
'updatetime' => 'c.updatetime',
|
||||
'nickname' => 'u.nickname',
|
||||
'mobile' => 'u.mobile',
|
||||
'user_type' => 'u.user_type',
|
||||
];
|
||||
$sortCol = $fieldMap[$sort] ?? 'c.id';
|
||||
|
||||
$filter = json_decode((string)$this->request->get('filter', '{}'), true);
|
||||
$op = json_decode((string)$this->request->get('op', '{}'), true);
|
||||
$filter = is_array($filter) ? $filter : [];
|
||||
$op = is_array($op) ? $op : [];
|
||||
|
||||
$makeQuery = function () use ($search, $filter, $op, $fieldMap) {
|
||||
$query = Db::name('user_enterprise_cert')->alias('c')->join('user u', 'u.id = c.user_id', 'LEFT');
|
||||
if ($search !== '') {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('c.company_name', 'like', '%' . $search . '%')
|
||||
->whereOr('c.license_no', 'like', '%' . $search . '%')
|
||||
->whereOr('c.legal_person', 'like', '%' . $search . '%')
|
||||
->whereOr('u.nickname', 'like', '%' . $search . '%')
|
||||
->whereOr('u.mobile', 'like', '%' . $search . '%');
|
||||
});
|
||||
}
|
||||
foreach ($filter as $k => $v) {
|
||||
if (!isset($fieldMap[$k]) || $v === '' || $v === null) {
|
||||
continue;
|
||||
}
|
||||
$col = $fieldMap[$k];
|
||||
$sym = strtoupper(trim((string)($op[$k] ?? '=')));
|
||||
if ($sym === 'LIKE') {
|
||||
$query->where($col, 'like', '%' . $v . '%');
|
||||
} elseif ($sym === 'RANGE' && is_string($v) && strpos($v, ' - ') !== false) {
|
||||
[$startStr, $endStr] = explode(' - ', $v, 2);
|
||||
$start = strtotime(trim($startStr));
|
||||
$end = strtotime(trim($endStr));
|
||||
if ($start !== false && $end !== false) {
|
||||
$query->where($col, 'between', [$start, $end]);
|
||||
}
|
||||
} else {
|
||||
$query->where($col, '=', $v);
|
||||
}
|
||||
}
|
||||
return $query;
|
||||
};
|
||||
|
||||
$total = $makeQuery()->count();
|
||||
$rows = $makeQuery()
|
||||
->field('c.*, u.nickname, u.mobile, u.user_type')
|
||||
->order($sortCol, $order)
|
||||
->limit($offset, $limit)
|
||||
->select();
|
||||
|
||||
foreach ($rows as &$row) {
|
||||
$row['license_url'] = !empty($row['license_image']) ? cdnurl($row['license_image'], true) : '';
|
||||
}
|
||||
unset($row);
|
||||
|
||||
return json(['total' => $total, 'rows' => $rows]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业资质详情与审核弹窗(待审核时可提交审核结论,已处理时展示只读审核结果)
|
||||
*/
|
||||
public function auditCert($ids = null)
|
||||
{
|
||||
$id = (int)$ids;
|
||||
$row = Db::name('user_enterprise_cert')->alias('c')
|
||||
->join('user u', 'u.id = c.user_id', 'LEFT')
|
||||
->field('c.*, u.nickname, u.mobile, u.user_type')
|
||||
->where('c.id', $id)
|
||||
->find();
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
|
||||
$canAudit = $this->auth->check('merchant/edit') || $this->auth->check('merchant/auditcert');
|
||||
|
||||
if (false === $this->request->isPost()) {
|
||||
$row['license_url'] = !empty($row['license_image']) ? cdnurl($row['license_image'], true) : '';
|
||||
$this->view->assign('row', $row);
|
||||
$this->view->assign('canAudit', $canAudit);
|
||||
return $this->view->fetch('audit_cert');
|
||||
}
|
||||
|
||||
if (!$canAudit) {
|
||||
$this->error('无权审核企业资质');
|
||||
}
|
||||
|
||||
$params = $this->request->post('row/a', []);
|
||||
$decision = trim((string)($params['verify_status'] ?? ''));
|
||||
$reason = trim((string)($params['audit_msg'] ?? ''));
|
||||
|
||||
if (!in_array($decision, ['pass', 'reject'], true)) {
|
||||
$this->error('请选择审核结论(通过或驳回)');
|
||||
}
|
||||
if ($decision === 'reject' && $reason === '') {
|
||||
$this->error('驳回申请时必须填写驳回原因');
|
||||
}
|
||||
if (mb_strlen($reason) > 500) {
|
||||
$this->error('审核意见不能超过500字');
|
||||
}
|
||||
|
||||
$updated = Db::name('user_enterprise_cert')
|
||||
->where('id', $id)
|
||||
->where('verify_status', 'pending')
|
||||
->update([
|
||||
'verify_status' => $decision,
|
||||
'audit_msg' => $decision === 'reject' ? $reason : '',
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
if (!$updated) {
|
||||
$this->error('申请不存在或已处理,请刷新');
|
||||
}
|
||||
$this->success('审核完成');
|
||||
}
|
||||
|
||||
public function index()
|
||||
|
||||
在新工单中引用
屏蔽一个用户