From 53252d6d87a34c3c6dd6d484120adf874922a61d Mon Sep 17 00:00:00 2001 From: MiAn Date: Tue, 24 Nov 2026 14:36:27 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=B8=8E=E7=95=8C=E9=9D=A2=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 升级系统版本至1.0.100 - 新增订单详情页物流、资质等信息展示 - 优化师傅报价页收益计算与显示 - 新增企业资质管理模块 - 优化后台标签页管理与交互 - 修复标签解析与地址脱敏问题 - 优化预约时段选择逻辑 - 调整服务类型配置界面布局 --- .../application/admin/controller/Appeal.php | 5 +- .../application/admin/controller/Merchant.php | 136 ++++++++++- .../application/admin/controller/Review.php | 9 +- .../application/admin/controller/Showcase.php | 6 +- .../admin/controller/general/Config.php | 15 +- .../application/admin/view/common/header.html | 30 ++- .../application/admin/view/common/meta.html | 6 +- .../admin/view/finance_config/index.html | 14 +- .../admin/view/general/profile/index.html | 4 +- server/application/admin/view/home/index.html | 23 +- .../application/admin/view/index/login.html | 36 +-- .../application/admin/view/master/detail.html | 6 +- .../admin/view/merchant/audit_cert.html | 218 ++++++++++++++++++ .../admin/view/merchant/certificates.html | 28 ++- .../admin/view/service/type/add.html | 59 ++--- .../admin/view/service/type/edit.html | 59 ++--- server/application/api/controller/Home.php | 34 ++- server/application/api/controller/Master.php | 17 +- server/application/extra/site.php | 2 +- .../assets/js/backend/general/profile.js | 2 +- server/public/assets/js/backend/index.js | 159 +++++++++++++ server/public/assets/js/backend/merchant.js | 161 ++++++++++--- server/public/assets/js/backend/review.js | 10 + yjyf-app/components/AppointTimeDrawer.vue | 68 +++++- yjyf-app/components/FeeDetailDrawer.vue | 78 ++++--- yjyf-app/components/user/UserHomeView.vue | 8 +- yjyf-app/pages/index/index.vue | 2 +- yjyf-app/pages/order/create.vue | 21 +- yjyf-app/pages/order/detail.vue | 31 +++ yjyf-app/pages/order/quick.vue | 209 +++++++++++++---- .../components/master/MasterHallView.vue | 5 + yjyf-master-app/pages/master/detail.vue | 38 +-- yjyf-master-app/pages/master/quote.vue | 5 +- 33 files changed, 1219 insertions(+), 285 deletions(-) create mode 100644 server/application/admin/view/merchant/audit_cert.html diff --git a/server/application/admin/controller/Appeal.php b/server/application/admin/controller/Appeal.php index b03f210..1af0239 100644 --- a/server/application/admin/controller/Appeal.php +++ b/server/application/admin/controller/Appeal.php @@ -250,10 +250,7 @@ class Appeal extends Backend $appealImages = array_values(array_filter(array_map('trim', explode(',', (string)$row['images'])))); $reviewImages = $review ? array_values(array_filter(array_map('trim', explode(',', (string)$review['images'])))) : []; - $orderStatusMap = [ - 0 => '待支付', 1 => '待接单', 2 => '待上门', 3 => '已到达', - 4 => '服务中', 5 => '待验收', 6 => '已完成', 9 => '已取消', 10 => '售后/异常' - ]; + $orderStatusMap = (new \app\admin\model\Order())->getStatusList(); $this->view->assign([ 'row' => $row, diff --git a/server/application/admin/controller/Merchant.php b/server/application/admin/controller/Merchant.php index 970b905..856cbca 100644 --- a/server/application/admin/controller/Merchant.php +++ b/server/application/admin/controller/Merchant.php @@ -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() diff --git a/server/application/admin/controller/Review.php b/server/application/admin/controller/Review.php index 8bbe9fa..75ed11a 100644 --- a/server/application/admin/controller/Review.php +++ b/server/application/admin/controller/Review.php @@ -241,7 +241,11 @@ class Review extends Backend */ protected function parseTags($raw) { - $raw = trim((string)$raw); + $raw = trim(html_entity_decode((string)$raw, ENT_QUOTES, 'UTF-8')); + // 兼容双重 HTML 转义 + if (strpos($raw, '"') !== false || strpos($raw, ''') !== false) { + $raw = trim(html_entity_decode($raw, ENT_QUOTES, 'UTF-8')); + } if ($raw === '') { return []; } @@ -250,6 +254,9 @@ class Review extends Backend if (is_array($arr)) { return array_values(array_filter(array_map('trim', $arr))); } + if (preg_match_all('/"([^"]+)"/', $raw, $m) && !empty($m[1])) { + return array_values(array_filter(array_map('trim', $m[1]))); + } } return array_values(array_filter(array_map('trim', explode(',', $raw)))); } diff --git a/server/application/admin/controller/Showcase.php b/server/application/admin/controller/Showcase.php index bfb0704..639cf15 100644 --- a/server/application/admin/controller/Showcase.php +++ b/server/application/admin/controller/Showcase.php @@ -154,7 +154,7 @@ class Showcase extends Backend protected function parseTags($raw) { - $raw = trim((string)$raw); + $raw = trim(html_entity_decode((string)$raw, ENT_QUOTES, 'UTF-8')); if ($raw === '') { return []; } @@ -163,6 +163,10 @@ class Showcase extends Backend if (is_array($arr)) { return array_values(array_filter(array_map('trim', $arr))); } + // 兼容非标准 JSON(如空格分隔未加逗号) + if (preg_match_all('/"([^"]+)"/', $raw, $m) && !empty($m[1])) { + return array_values(array_filter(array_map('trim', $m[1]))); + } } return array_values(array_filter(array_map('trim', explode(',', $raw)))); } diff --git a/server/application/admin/controller/general/Config.php b/server/application/admin/controller/general/Config.php index f41cc25..cb08ccf 100755 --- a/server/application/admin/controller/general/Config.php +++ b/server/application/admin/controller/general/Config.php @@ -75,10 +75,19 @@ class Config extends Backend } $siteList[$v['group']]['list'][] = $value; } - $index = 0; + $hasActive = false; foreach ($siteList as $k => &$v) { - $v['active'] = !$index ? true : false; - $index++; + if (!$hasActive && !empty($v['list'])) { + $v['active'] = true; + $hasActive = true; + } else { + $v['active'] = false; + } + } + unset($v); + if (!$hasActive && !empty($siteList)) { + $firstKey = array_key_first($siteList); + $siteList[$firstKey]['active'] = true; } $this->view->assign('siteList', $siteList); $this->view->assign('typeList', ConfigModel::getTypeList()); diff --git a/server/application/admin/view/common/header.html b/server/application/admin/view/common/header.html index af376b4..c7b262a 100755 --- a/server/application/admin/view/common/header.html +++ b/server/application/admin/view/common/header.html @@ -17,9 +17,33 @@ - +