From 28c957163be873a2ad3494da6352f3632c30f6ca Mon Sep 17 00:00:00 2001 From: qinzexin <“731344816@qq.com”> Date: Fri, 27 Jun 2025 18:37:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E7=90=86=E4=BA=BA?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/manystore/Index.php | 2 +- .../admin/controller/manystore/ShopApply.php | 7 ++ .../admin/controller/user/invoice/Header.php | 109 ++++++++++++++++++ application/admin/lang/zh-cn.php | 2 +- .../admin/view/manystore/index/add.html | 6 +- .../view/manystore/shop_apply/index.html | 3 + .../admin/view/user/invoice/header/add.html | 6 + .../admin/view/user/invoice/header/edit.html | 6 + .../common/model/dyqc/ManystoreShop.php | 18 ++- .../common/model/manystore/ShopApply.php | 2 +- .../controller/user/invoice/Header.php | 10 ++ application/manystore/lang/zh-cn.php | 2 +- .../manystore/view/dashboard/index.html | 21 ++-- .../view/user/invoice/apply/edit.html | 5 + .../view/user/invoice/header/add.html | 8 ++ .../view/user/invoice/header/edit.html | 7 ++ public/assets/js/backend/manystore/index.js | 4 +- .../assets/js/backend/manystore/shop_apply.js | 5 +- .../assets/js/backend/user/invoice/header.js | 41 +++++++ .../assets/js/manystore/user/invoice/apply.js | 41 +++++++ .../js/manystore/user/invoice/header.js | 43 +++++++ 21 files changed, 327 insertions(+), 21 deletions(-) diff --git a/application/admin/controller/manystore/Index.php b/application/admin/controller/manystore/Index.php index 5360889..57cd125 100644 --- a/application/admin/controller/manystore/Index.php +++ b/application/admin/controller/manystore/Index.php @@ -62,7 +62,7 @@ class Index extends Backend protected $error_auth = false; protected $qSwitch = true; - protected $qFields = ["user_id","name","address_detail","type","tel","legal_entity","shop_apply_id"]; + protected $qFields = ["images","image","logo","user_id","name","address_detail","type","tel","legal_entity","shop_apply_id"]; protected function checkAssemblyParameters(){ diff --git a/application/admin/controller/manystore/ShopApply.php b/application/admin/controller/manystore/ShopApply.php index 5eba6db..6e046a3 100644 --- a/application/admin/controller/manystore/ShopApply.php +++ b/application/admin/controller/manystore/ShopApply.php @@ -24,6 +24,13 @@ class ShopApply extends Backend $this->model = new \app\admin\model\manystore\ShopApply; $this->view->assign("typeList", $this->model->getTypeList()); + $this->view->assign("default_data_json", json_encode( [ +// 'name' => '默认机构名称', + 'logo' => config("site.shop_default_image"), + 'image' => config("site.shop_default_timage"), + 'images' => config("site.shop_default_images"), + ], JSON_UNESCAPED_UNICODE) ); + } diff --git a/application/admin/controller/user/invoice/Header.php b/application/admin/controller/user/invoice/Header.php index 476d962..09d0425 100644 --- a/application/admin/controller/user/invoice/Header.php +++ b/application/admin/controller/user/invoice/Header.php @@ -3,6 +3,10 @@ namespace app\admin\controller\user\invoice; use app\common\controller\Backend; +use think\Db; +use think\exception\DbException; +use think\exception\PDOException; +use think\exception\ValidateException; /** * 个人发票抬头管理 @@ -73,4 +77,109 @@ class Header extends Backend return $this->view->fetch(); } + + + + + /** + * 添加 + * + * @return string + * @throws \think\Exception + */ + public function add() + { + if (false === $this->request->isPost()) { + return $this->view->fetch(); + } + $params = $this->request->post('row/a'); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); + } + $params = $this->preExcludeFields($params); + + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException()->validate($validate); + } + + $params["is_default"] = $params["is_default"] ?? '0'; + if($params["is_default"] == '1'){ + $this->model::where('user_id',$params['user_id'])->update(['is_default'=>'0']); + } + + $result = $this->model->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + + /** + * 编辑 + * + * @param $ids + * @return string + * @throws DbException + * @throws \think\Exception + */ + 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 (false === $this->request->isPost()) { + $this->view->assign('row', $row); + return $this->view->fetch(); + } + $params = $this->request->post('row/a'); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); + } + $params = $this->preExcludeFields($params); + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; + $row->validateFailException()->validate($validate); + } + + $params["is_default"] = $params["is_default"] ?? '0'; + if($params["is_default"] == '1'){ + $this->model::where('user_id',$params['user_id'])->update(['is_default'=>'0']); + } + + $result = $row->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if (false === $result) { + $this->error(__('No rows were updated')); + } + $this->success(); + } + } diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index f7420df..6c87471 100644 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -203,7 +203,7 @@ return [ 'Third group' => '三级管理组', 'Second group 2' => '二级管理组2', 'Third group 2' => '三级管理组2', - 'Dashboard tips' => '用于展示当前系统中的统计数据、统计报表及重要实时数据', + 'Dashboard tips' => '', 'Config tips' => '可以在此增改系统的变量和分组,也可以自定义分组和变量', 'Category tips' => '分类类型请在常规管理->系统配置->字典配置中添加', 'Attachment tips' => '主要用于管理上传到服务器或第三方存储的数据', diff --git a/application/admin/view/manystore/index/add.html b/application/admin/view/manystore/index/add.html index 1dab7ab..c3bf5f5 100644 --- a/application/admin/view/manystore/index/add.html +++ b/application/admin/view/manystore/index/add.html @@ -102,7 +102,7 @@