diff --git a/shopxo/app/plugins/vr_ticket/admin/Admin.php b/shopxo/app/plugins/vr_ticket/admin/Admin.php index 1ba5dbb..6b2c97a 100644 --- a/shopxo/app/plugins/vr_ticket/admin/Admin.php +++ b/shopxo/app/plugins/vr_ticket/admin/Admin.php @@ -316,20 +316,36 @@ class Admin extends Common { $where = []; - $keywords = input('keywords', '', null, 'trim'); - if (!empty($keywords)) { - $where[] = ['order_no|ticket_code|real_name|phone', 'like', "%{$keywords}%"]; + // 逐字段精确搜索(对应视图的独立搜索框) + $order_no = input('order_no', '', null, 'trim'); + if ($order_no !== '') { + $where[] = ['order_no', 'like', "%{$order_no}%"]; + } + $ticket_code = input('ticket_code', '', 's', 'trim'); + if ($ticket_code !== '') { + $where[] = ['ticket_code', 'like', "%{$ticket_code}%"]; + } + $real_name = input('real_name', '', null, 'trim'); + if ($real_name !== '') { + $where[] = ['real_name', 'like', "%{$real_name}%"]; + } + $phone = input('phone', '', null, 'trim'); + if ($phone !== '') { + $where[] = ['phone', 'like', "%{$phone}%"]; } - $verify_status = input('verify_status', '', null); if ($verify_status !== '' && $verify_status !== null) { $where[] = ['verify_status', '=', intval($verify_status)]; } - $goods_id = input('goods_id', 0, 'intval'); - if ($goods_id > 0) { - $where[] = ['goods_id', '=', $goods_id]; - } + // 搜索参数回传(用于表单值保持) + $params = [ + 'order_no' => $order_no, + 'ticket_code' => $ticket_code, + 'real_name' => $real_name, + 'phone' => $phone, + 'verify_status' => $verify_status, + ]; $list = \think\facade\Db::name('vr_tickets') ->where($where) @@ -350,17 +366,11 @@ class Admin extends Common unset($item); } - $status_map = [ - 0 => ['text' => '未核销', 'color' => 'blue'], - 1 => ['text' => '已核销', 'color' => 'green'], - 2 => ['text' => '已退款', 'color' => 'red'], - ]; - return MyView('../../../plugins/vr_ticket/view/admin/ticket/list', [ - 'list' => $list_data['data'], - 'page' => $list->render() ?: '', - 'count' => $list_data['total'], - 'status_map' => $status_map, + 'list' => $list_data['data'], + 'page' => $list->render() ?: '', + 'count' => $list_data['total'], + 'params'=> $params, ]); } @@ -404,13 +414,24 @@ class Admin extends Common /** * 手动核销票(JSON API) */ + /** + * 扫码核销页面(GET)和核销处理(AJAX POST) + * GET: 显示核销表单 + * POST: 处理核销 AJAX 请求 + */ public function TicketVerify() { - if (!(request()->isAjax() && request()->isPost())) { - return DataReturn('非法请求', -1); + // GET 请求 — 显示核销表单页面 + if (!request()->isAjax()) { + return MyView('../../../plugins/vr_ticket/view/admin/ticket/verify', []); } - $ticket_code = input('ticket_code', '', null, 'trim'); + // AJAX POST — 处理核销 + if (!request()->isPost()) { + return json(['code' => -1, 'msg' => '非法请求']); + } + + $ticket_code = input('ticket_code', '', 's', 'trim'); // M-05: verifier_id 从 session 获取,禁止客户端伪造 // $this->admin 来自父类构造函数:AdminService::LoginInfo() diff --git a/shopxo/app/plugins/vr_ticket/view/admin/ticket/list.html b/shopxo/app/plugins/vr_ticket/view/admin/ticket/list.html index 55568d7..a0ccb90 100644 --- a/shopxo/app/plugins/vr_ticket/view/admin/ticket/list.html +++ b/shopxo/app/plugins/vr_ticket/view/admin/ticket/list.html @@ -11,7 +11,7 @@