From 361dffc7d815c2fb5ee987bebd478d7d3ede7a15 Mon Sep 17 00:00:00 2001 From: YuanWen Date: Tue, 3 Nov 2026 15:45:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=B8=88=E5=82=85?= =?UTF-8?q?=E7=AB=AF=E5=8A=9F=E8=83=BD=E5=8F=8A=E6=9C=8D=E5=8A=A1=E5=A2=9E?= =?UTF-8?q?=E9=A1=B9=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增师傅端路由和页面配置,切换登录后默认跳转到师傅大厅 - 新增服务分类图标上传功能和增项服务管理模块 - 新增订单、申诉、结算等模型关联关系及后台控制器 - 新增师傅端TabBar组件和消息页面跳转逻辑 - 新增文件上传接口和服务计算逻辑 - 新增各类SVG图标和空状态提示 --- .../application/admin/controller/Appeal.php | 21 + .../application/admin/controller/Invoice.php | 21 + .../application/admin/controller/Master.php | 21 + .../application/admin/controller/Merchant.php | 21 + server/application/admin/controller/Order.php | 21 + .../application/admin/controller/Review.php | 21 + .../application/admin/controller/Service.php | 206 +++- .../application/admin/controller/Settle.php | 21 + .../application/admin/controller/Withdraw.php | 21 + .../admin/controller/service/Addon.php | 51 + server/application/admin/model/Appeal.php | 10 + server/application/admin/model/Invoice.php | 10 + server/application/admin/model/Master.php | 5 + server/application/admin/model/Merchant.php | 5 + server/application/admin/model/Order.php | 10 + server/application/admin/model/Review.php | 15 + server/application/admin/model/Service.php | 5 + server/application/admin/model/Settle.php | 10 + server/application/admin/model/Withdraw.php | 5 + .../application/admin/model/service/Addon.php | 41 + .../application/admin/model/service/Cat.php | 36 + .../application/admin/view/common/script.html | 2 +- .../admin/view/service/addon/add.html | 49 + .../admin/view/service/addon/edit.html | 49 + .../admin/view/service/addon/index.html | 24 + .../admin/view/service/cat/add.html | 14 +- .../admin/view/service/cat/edit.html | 14 +- .../admin/view/service/cat/index.html | 12 +- .../application/admin/view/service/edit.html | 422 +++++-- server/application/api/controller/Auth.php | 2 +- server/application/api/controller/Home.php | 63 +- server/application/api/controller/Master.php | 125 +- server/application/extra/site.php | 2 +- server/application/route.php | 8 + yjyf-app/components/GoodsPickerDrawer.vue | 14 +- yjyf-app/components/YjyfMasterTabBar.vue | 120 ++ yjyf-app/pages.json | 8 + yjyf-app/pages/category/category.vue | 23 +- yjyf-app/pages/master/credit.vue | 209 +++- yjyf-app/pages/master/detail.vue | 1074 +++++++++++++++++ yjyf-app/pages/master/hall.vue | 748 ++++++++++-- yjyf-app/pages/master/orders.vue | 317 ++++- yjyf-app/pages/master/quote.vue | 127 +- yjyf-app/pages/master/success.vue | 428 +++++++ yjyf-app/pages/master/wallet.vue | 178 ++- yjyf-app/pages/master/workbench.vue | 320 +++-- yjyf-app/pages/merchant/workbench.vue | 1 + yjyf-app/pages/message/message.vue | 22 +- yjyf-app/pages/mine/mine.vue | 17 +- yjyf-app/pages/order/quick.vue | 123 +- yjyf-app/static/icons/master/empty-orders.svg | 11 + yjyf-app/static/icons/master/grab-success.svg | 44 + yjyf-app/static/icons/master/menu-credit.svg | 4 + yjyf-app/static/icons/master/menu-hall.svg | 6 + yjyf-app/static/icons/master/menu-orders.svg | 5 + yjyf-app/static/icons/master/menu-quote.svg | 4 + yjyf-app/static/icons/master/menu-service.svg | 4 + yjyf-app/static/icons/master/menu-wallet.svg | 6 + yjyf-app/static/icons/master/nav-arrow.svg | 3 + yjyf-app/static/icons/master/order-loc.svg | 4 + yjyf-app/static/icons/master/order-time.svg | 4 + .../static/icons/master/service-action.svg | 4 + yjyf-app/static/icons/master/share-action.svg | 5 + .../static/icons/master/user-avatar-small.svg | 4 + yjyf-app/static/tabbar/master/hall-active.svg | 6 + yjyf-app/static/tabbar/master/hall.svg | 6 + yjyf-app/static/tabbar/master/home-active.svg | 4 + yjyf-app/static/tabbar/master/home.svg | 4 + .../static/tabbar/master/message-active.svg | 6 + yjyf-app/static/tabbar/master/message.svg | 3 + yjyf-app/static/tabbar/master/mine-active.svg | 4 + yjyf-app/static/tabbar/master/mine.svg | 4 + .../static/tabbar/master/order-active.svg | 4 + yjyf-app/static/tabbar/master/order.svg | 4 + .../static/tabbar/master/orders-active.svg | 5 + yjyf-app/static/tabbar/master/orders.svg | 5 + .../static/tabbar/master/wallet-active.svg | 5 + yjyf-app/static/tabbar/master/wallet.svg | 5 + yjyf-app/static/tabbar/master/work-active.svg | 7 + yjyf-app/static/tabbar/master/work.svg | 6 + yjyf-app/utils/api.js | 6 +- yjyf-app/utils/request.js | 34 + 82 files changed, 4787 insertions(+), 531 deletions(-) create mode 100644 server/application/admin/controller/service/Addon.php create mode 100644 server/application/admin/model/service/Addon.php create mode 100644 server/application/admin/model/service/Cat.php create mode 100644 server/application/admin/view/service/addon/add.html create mode 100644 server/application/admin/view/service/addon/edit.html create mode 100644 server/application/admin/view/service/addon/index.html create mode 100644 yjyf-app/components/YjyfMasterTabBar.vue create mode 100644 yjyf-app/pages/master/detail.vue create mode 100644 yjyf-app/pages/master/success.vue create mode 100644 yjyf-app/static/icons/master/empty-orders.svg create mode 100644 yjyf-app/static/icons/master/grab-success.svg create mode 100644 yjyf-app/static/icons/master/menu-credit.svg create mode 100644 yjyf-app/static/icons/master/menu-hall.svg create mode 100644 yjyf-app/static/icons/master/menu-orders.svg create mode 100644 yjyf-app/static/icons/master/menu-quote.svg create mode 100644 yjyf-app/static/icons/master/menu-service.svg create mode 100644 yjyf-app/static/icons/master/menu-wallet.svg create mode 100644 yjyf-app/static/icons/master/nav-arrow.svg create mode 100644 yjyf-app/static/icons/master/order-loc.svg create mode 100644 yjyf-app/static/icons/master/order-time.svg create mode 100644 yjyf-app/static/icons/master/service-action.svg create mode 100644 yjyf-app/static/icons/master/share-action.svg create mode 100644 yjyf-app/static/icons/master/user-avatar-small.svg create mode 100644 yjyf-app/static/tabbar/master/hall-active.svg create mode 100644 yjyf-app/static/tabbar/master/hall.svg create mode 100644 yjyf-app/static/tabbar/master/home-active.svg create mode 100644 yjyf-app/static/tabbar/master/home.svg create mode 100644 yjyf-app/static/tabbar/master/message-active.svg create mode 100644 yjyf-app/static/tabbar/master/message.svg create mode 100644 yjyf-app/static/tabbar/master/mine-active.svg create mode 100644 yjyf-app/static/tabbar/master/mine.svg create mode 100644 yjyf-app/static/tabbar/master/order-active.svg create mode 100644 yjyf-app/static/tabbar/master/order.svg create mode 100644 yjyf-app/static/tabbar/master/orders-active.svg create mode 100644 yjyf-app/static/tabbar/master/orders.svg create mode 100644 yjyf-app/static/tabbar/master/wallet-active.svg create mode 100644 yjyf-app/static/tabbar/master/wallet.svg create mode 100644 yjyf-app/static/tabbar/master/work-active.svg create mode 100644 yjyf-app/static/tabbar/master/work.svg diff --git a/server/application/admin/controller/Appeal.php b/server/application/admin/controller/Appeal.php index 9605ede..e50ed55 100644 --- a/server/application/admin/controller/Appeal.php +++ b/server/application/admin/controller/Appeal.php @@ -35,4 +35,25 @@ class Appeal extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['order', 'master']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/Invoice.php b/server/application/admin/controller/Invoice.php index 8eb8286..3d27f5d 100644 --- a/server/application/admin/controller/Invoice.php +++ b/server/application/admin/controller/Invoice.php @@ -35,4 +35,25 @@ class Invoice extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['user', 'merchant']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/Master.php b/server/application/admin/controller/Master.php index 388dd57..854d636 100644 --- a/server/application/admin/controller/Master.php +++ b/server/application/admin/controller/Master.php @@ -35,4 +35,25 @@ class Master extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/Merchant.php b/server/application/admin/controller/Merchant.php index 5cad79b..296e01e 100644 --- a/server/application/admin/controller/Merchant.php +++ b/server/application/admin/controller/Merchant.php @@ -35,4 +35,25 @@ class Merchant extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/Order.php b/server/application/admin/controller/Order.php index 68e443b..32c2791 100644 --- a/server/application/admin/controller/Order.php +++ b/server/application/admin/controller/Order.php @@ -40,4 +40,25 @@ class Order extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['user', 'master']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/Review.php b/server/application/admin/controller/Review.php index 1326b04..44685e1 100644 --- a/server/application/admin/controller/Review.php +++ b/server/application/admin/controller/Review.php @@ -34,4 +34,25 @@ class Review extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['user', 'master', 'order']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/Service.php b/server/application/admin/controller/Service.php index 06c2c3a..9f8f71b 100644 --- a/server/application/admin/controller/Service.php +++ b/server/application/admin/controller/Service.php @@ -3,20 +3,24 @@ namespace app\admin\controller; use app\common\controller\Backend; +use think\Db; +use think\exception\PDOException; +use think\exception\ValidateException; +use Exception; /** - * 服务项目 + * 服务项目与商品管理 * * @icon fa fa-circle-o */ class Service extends Backend { - /** * Service模型对象 * @var \app\admin\model\Service */ protected $model = null; + protected $relationSearch = true; public function _initialize() { @@ -24,15 +28,205 @@ class Service extends Backend $this->model = new \app\admin\model\Service; $this->view->assign("priceTypeList", $this->model->getPriceTypeList()); $this->view->assign("statusList", $this->model->getStatusList()); + + // 获取全部可用的公共增项服务列表 + $addonsPool = Db::name('service_addon') + ->where('status', 'normal') + ->order('weigh desc, id asc') + ->select(); + $this->view->assign("addonsPool", $addonsPool); } - + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['cat']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } /** - * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 - * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 - * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + * 添加服务商品 */ + public function add() + { + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + if ($params) { + $params = $this->preExcludeFields($params); + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + // 处理工项类型与增项配置 + $params = $this->formatServiceConfig($params); + + $result = false; + Db::startTrans(); + try { + $result = $this->model->allowField(true)->save($params); + $serviceId = $this->model->id; + + // 处理规格列表 + $this->syncSpecs($serviceId, $this->request->post('specs/a', [])); + + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(); + } else { + $this->error(__('No rows were inserted')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + return $this->view->fetch(); + } + + /** + * 编辑服务商品(工项价格、规格价格、增项服务绑定) + */ + public function edit($ids = null) + { + $row = $this->model->get($ids); + if (!$row) { + $this->error(__('No Results were found')); + } + $adminIds = $this->getDataLimitAdminIds(); + if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) { + $this->error(__('You have no permission')); + } + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + if ($params) { + $params = $this->preExcludeFields($params); + + // 处理工项类型与增项配置 + $params = $this->formatServiceConfig($params); + + $result = false; + Db::startTrans(); + try { + $result = $row->allowField(true)->save($params); + + // 同步处理规格列表 + $this->syncSpecs($row->id, $this->request->post('specs/a', [])); + + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(); + } else { + $this->error(__('No rows were updated')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + + // 解析工项与增项配置以供视图回显 + $serviceTypes = []; + if (!empty($row->service_types)) { + $serviceTypes = is_array($row->service_types) ? $row->service_types : json_decode($row->service_types, true); + } + $addons = []; + if (!empty($row->addons)) { + $addons = is_array($row->addons) ? $row->addons : json_decode($row->addons, true); + } + + // 获取已有规格 + $specs = Db::name('service_spec') + ->where('service_id', $row->id) + ->where('status', 'normal') + ->order('weigh desc, id asc') + ->select(); + + $this->view->assign("row", $row); + $this->view->assign("serviceTypes", $serviceTypes ?: []); + $this->view->assign("assignedAddons", $addons ?: []); + $this->view->assign("specs", $specs ?: []); + return $this->view->fetch(); + } + + /** + * 格式化工项与增项输入数据 + */ + protected function formatServiceConfig($params) + { + // 工项类型 JSON + if (isset($params['service_types_raw'])) { + $params['service_types'] = is_string($params['service_types_raw']) ? $params['service_types_raw'] : json_encode($params['service_types_raw'], JSON_UNESCAPED_UNICODE); + unset($params['service_types_raw']); + } + // 增项服务 JSON + if (isset($params['addons_raw'])) { + $params['addons'] = is_string($params['addons_raw']) ? $params['addons_raw'] : json_encode($params['addons_raw'], JSON_UNESCAPED_UNICODE); + unset($params['addons_raw']); + } + return $params; + } + + /** + * 同步商品规格表 + */ + protected function syncSpecs($serviceId, $specsInput) + { + if (empty($serviceId)) return; + $now = time(); + $keepIds = []; + if (!empty($specsInput) && is_array($specsInput)) { + foreach ($specsInput as $item) { + $name = trim(isset($item['name']) ? $item['name'] : ''); + if ($name === '') continue; + $specPrice = isset($item['base_price']) ? (float)$item['base_price'] : 0.00; + $specDesc = isset($item['description']) ? trim($item['description']) : ''; + $specId = isset($item['id']) ? (int)$item['id'] : 0; + + if ($specId > 0) { + Db::name('service_spec')->where('id', $specId)->where('service_id', $serviceId)->update([ + 'name' => $name, + 'base_price' => $specPrice, + 'description' => $specDesc, + 'updatetime' => $now, + ]); + $keepIds[] = $specId; + } else { + $newId = Db::name('service_spec')->insertGetId([ + 'service_id' => $serviceId, + 'name' => $name, + 'base_price' => $specPrice, + 'description' => $specDesc, + 'weigh' => 0, + 'status' => 'normal', + 'createtime' => $now, + 'updatetime' => $now, + ]); + $keepIds[] = $newId; + } + } + } + // 将未在列表中的历史规格软下架或删除 + $delQuery = Db::name('service_spec')->where('service_id', $serviceId); + if (!empty($keepIds)) { + $delQuery->whereNotIn('id', $keepIds); + } + $delQuery->delete(); + } } diff --git a/server/application/admin/controller/Settle.php b/server/application/admin/controller/Settle.php index e470101..207cf11 100644 --- a/server/application/admin/controller/Settle.php +++ b/server/application/admin/controller/Settle.php @@ -34,4 +34,25 @@ class Settle extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['order', 'master']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/Withdraw.php b/server/application/admin/controller/Withdraw.php index dd93771..d2ffebe 100644 --- a/server/application/admin/controller/Withdraw.php +++ b/server/application/admin/controller/Withdraw.php @@ -35,4 +35,25 @@ class Withdraw extends Backend */ + + protected $relationSearch = true; + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['master']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } } diff --git a/server/application/admin/controller/service/Addon.php b/server/application/admin/controller/service/Addon.php new file mode 100644 index 0000000..c1692d5 --- /dev/null +++ b/server/application/admin/controller/service/Addon.php @@ -0,0 +1,51 @@ +model = new \app\admin\model\service\Addon; + $this->view->assign("statusList", $this->model->getStatusList()); + + // 获取分类列表 + $cats = Db::name('service_cat')->where('status', 'normal')->column('id,name'); + $this->view->assign("catList", [0 => '通用全部类目'] + $cats); + } + + public function index() + { + $this->request->filter(['strip_tags', 'trim']); + if (false === $this->request->isAjax()) { + return $this->view->fetch(); + } + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + [$where, $sort, $order, $offset, $limit] = $this->buildparams(); + $list = $this->model + ->with(['cat']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + $result = ['total' => $list->total(), 'rows' => $list->items()]; + return json($result); + } +} diff --git a/server/application/admin/model/Appeal.php b/server/application/admin/model/Appeal.php index 3994738..d333244 100644 --- a/server/application/admin/model/Appeal.php +++ b/server/application/admin/model/Appeal.php @@ -60,4 +60,14 @@ class Appeal extends Model + + public function order() + { + return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + public function master() + { + return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Invoice.php b/server/application/admin/model/Invoice.php index 072e4fc..eb78ef5 100644 --- a/server/application/admin/model/Invoice.php +++ b/server/application/admin/model/Invoice.php @@ -60,4 +60,14 @@ class Invoice extends Model + + public function user() + { + return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + public function merchant() + { + return $this->belongsTo('Merchant', 'merchant_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Master.php b/server/application/admin/model/Master.php index 41cdf5d..68ad37c 100644 --- a/server/application/admin/model/Master.php +++ b/server/application/admin/model/Master.php @@ -60,4 +60,9 @@ class Master extends Model + + public function user() + { + return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Merchant.php b/server/application/admin/model/Merchant.php index 2c24780..7655c3f 100644 --- a/server/application/admin/model/Merchant.php +++ b/server/application/admin/model/Merchant.php @@ -60,4 +60,9 @@ class Merchant extends Model + + public function user() + { + return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Order.php b/server/application/admin/model/Order.php index 6eefe4e..4f56137 100644 --- a/server/application/admin/model/Order.php +++ b/server/application/admin/model/Order.php @@ -223,4 +223,14 @@ class Order extends Model } + + public function user() + { + return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + public function master() + { + return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Review.php b/server/application/admin/model/Review.php index 87da356..d4d5aa5 100644 --- a/server/application/admin/model/Review.php +++ b/server/application/admin/model/Review.php @@ -46,4 +46,19 @@ class Review extends Model + + public function user() + { + return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + public function master() + { + return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + public function order() + { + return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Service.php b/server/application/admin/model/Service.php index 6e6424b..968c7b1 100644 --- a/server/application/admin/model/Service.php +++ b/server/application/admin/model/Service.php @@ -70,4 +70,9 @@ class Service extends Model + + public function cat() + { + return $this->belongsTo('app\\admin\\model\\service\\Cat', 'cat_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Settle.php b/server/application/admin/model/Settle.php index 1779d8e..605bbdc 100644 --- a/server/application/admin/model/Settle.php +++ b/server/application/admin/model/Settle.php @@ -57,4 +57,14 @@ class Settle extends Model } + + public function order() + { + return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + public function master() + { + return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/Withdraw.php b/server/application/admin/model/Withdraw.php index 094781b..72866bb 100644 --- a/server/application/admin/model/Withdraw.php +++ b/server/application/admin/model/Withdraw.php @@ -60,4 +60,9 @@ class Withdraw extends Model + + public function master() + { + return $this->belongsTo('Master', 'master_id', 'id', [], 'LEFT')->setEagerlyType(0); + } } diff --git a/server/application/admin/model/service/Addon.php b/server/application/admin/model/service/Addon.php new file mode 100644 index 0000000..22063f6 --- /dev/null +++ b/server/application/admin/model/service/Addon.php @@ -0,0 +1,41 @@ + __('Normal'), 'hidden' => __('Hidden')]; + } + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + public function cat() + { + return $this->belongsTo('app\admin\model\service\Cat', 'cat_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/server/application/admin/model/service/Cat.php b/server/application/admin/model/service/Cat.php new file mode 100644 index 0000000..8d04353 --- /dev/null +++ b/server/application/admin/model/service/Cat.php @@ -0,0 +1,36 @@ + __('Normal'), 'hidden' => __('Hidden')]; + } + + public function getStatusTextAttr($value, $data) + { + $value = $value ?: ($data['status'] ?? ''); + $list = $this->getStatusList(); + return $list[$value] ?? ''; + } +} diff --git a/server/application/admin/view/common/script.html b/server/application/admin/view/common/script.html index 04d1e80..e239639 100755 --- a/server/application/admin/view/common/script.html +++ b/server/application/admin/view/common/script.html @@ -1 +1 @@ - + diff --git a/server/application/admin/view/service/addon/add.html b/server/application/admin/view/service/addon/add.html new file mode 100644 index 0000000..266b2dc --- /dev/null +++ b/server/application/admin/view/service/addon/add.html @@ -0,0 +1,49 @@ +
+ +
+ +
+ {:build_select('row[cat_id]', $catList, 0, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])} +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ {foreach name="statusList" item="vo"} + + {/foreach} +
+
+
+ +
diff --git a/server/application/admin/view/service/addon/edit.html b/server/application/admin/view/service/addon/edit.html new file mode 100644 index 0000000..859c731 --- /dev/null +++ b/server/application/admin/view/service/addon/edit.html @@ -0,0 +1,49 @@ +
+ +
+ +
+ {:build_select('row[cat_id]', $catList, $row.cat_id, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])} +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ {foreach name="statusList" item="vo"} + + {/foreach} +
+
+
+ +
diff --git a/server/application/admin/view/service/addon/index.html b/server/application/admin/view/service/addon/index.html new file mode 100644 index 0000000..6745585 --- /dev/null +++ b/server/application/admin/view/service/addon/index.html @@ -0,0 +1,24 @@ +
+ {:build_heading()} + +
+ +
+
diff --git a/server/application/admin/view/service/cat/add.html b/server/application/admin/view/service/cat/add.html index 9c28555..d287d01 100644 --- a/server/application/admin/view/service/cat/add.html +++ b/server/application/admin/view/service/cat/add.html @@ -13,9 +13,17 @@
- +
- +
+ +
+ + +
+ +
+
    @@ -27,13 +35,11 @@
    -
    {foreach name="statusList" item="vo"} {/foreach}
    -
    - +
    - +
    + +
    + + +
    + +
    +
      @@ -27,13 +35,11 @@
      -
      {foreach name="statusList" item="vo"} {/foreach}
      -