From 32e079b44f06b8db74ea4b9e80712179f4317539 Mon Sep 17 00:00:00 2001 From: qinzexin <“731344816@qq.com”> Date: Wed, 18 Jun 2025 18:29:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=A4=84=E7=90=86=E5=BC=80?= =?UTF-8?q?=E7=A5=A8=E6=B5=81=E7=A8=8B=20=E6=90=9C=E7=B4=A2=E9=87=8C?= =?UTF-8?q?=EF=BC=8C=E5=B9=B3=E5=8F=B0=E6=B4=BB=E5=8A=A8=E7=B1=BB=E5=88=AB?= =?UTF-8?q?=EF=BC=8C=E4=B9=9F=E8=83=BD=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/manystore/Index.php | 78 ++++----- .../school/activity/order/Order.php | 7 + .../admin/controller/user/invoice/Apply.php | 149 ++++++++++++++++ .../admin/lang/zh-cn/user/invoice/apply.php | 4 +- .../admin/view/user/invoice/apply/add.html | 95 ++++++----- .../admin/view/user/invoice/apply/edit.html | 95 +++++++---- .../common/model/school/activity/Activity.php | 19 ++- .../model/school/activity/order/Order.php | 8 +- .../common/model/user/invoice/Apply.php | 160 +++++++++++++++++- .../lang/zh-cn/user/invoice/apply.php | 4 +- .../view/user/invoice/apply/edit.html | 20 +++ .../js/backend/school/activity/order/order.js | 46 ++++- .../assets/js/backend/user/invoice/apply.js | 54 +++++- .../assets/js/manystore/user/invoice/apply.js | 4 + 14 files changed, 607 insertions(+), 136 deletions(-) diff --git a/application/admin/controller/manystore/Index.php b/application/admin/controller/manystore/Index.php index 58f3b56..5360889 100644 --- a/application/admin/controller/manystore/Index.php +++ b/application/admin/controller/manystore/Index.php @@ -400,13 +400,13 @@ class Index extends Backend if($order)throw new \Exception("存在正在使用中的课程订单或存在正在售后中的课程订单无法继续操作!"); // 课程存在售后订单则不允许操作 //有课程不允许删 - $classesLib = ClassesLib::where("manystore_id",$id)->find(); - if($classesLib)throw new \Exception("请先删除课程后再删除机构!"); +// $classesLib = ClassesLib::where("manystore_id",$id)->find(); +// if($classesLib)throw new \Exception("请先删除课程后再删除机构!"); // 课程存在售后订单则不允许操作 - $order = \app\common\model\school\classes\activity\order\Order::where("manystore_id",$id)->where("status","not in","-3,6,9")->find(); - if($order)throw new \Exception("存在正在使用中的活动订单报名学员,无法继续操作!"); +// $order = \app\common\model\school\classes\activity\order\Order::where("manystore_id",$id)->where("status","not in","-3,6,9")->find(); +// if($order)throw new \Exception("存在正在使用中的活动订单报名学员,无法继续操作!"); $activity = Activity::where("manystore_id",$id)->find(); if($activity)throw new \Exception("请先删除活动后再删除机构!"); @@ -741,42 +741,42 @@ class Index extends Backend exception('账号信息删除失败'); } $result = $this->shopModel->where(array('id'=>$row['shop_id']))->delete(); - \app\common\model\manystore\UserAuth::where(array('shop_id'=>$row['shop_id']))->delete(); - \app\common\model\school\classes\Teacher::where(array('shop_id'=>$row['shop_id']))->delete(); - \app\common\model\school\classes\Verification::where(array('shop_id'=>$row['shop_id']))->delete(); - Order::where(array('shop_id'=>$row['shop_id']))->delete(); - OrderDetail::where(array('shop_id'=>$row['shop_id']))->delete(); +// \app\common\model\manystore\UserAuth::where(array('shop_id'=>$row['shop_id']))->delete(); +// \app\common\model\school\classes\Teacher::where(array('shop_id'=>$row['shop_id']))->delete(); +// \app\common\model\school\classes\Verification::where(array('shop_id'=>$row['shop_id']))->delete(); +// Order::where(array('shop_id'=>$row['shop_id']))->delete(); +// OrderDetail::where(array('shop_id'=>$row['shop_id']))->delete(); - \app\admin\model\school\classes\activity\order\Order::where(array('shop_id'=>$row['shop_id']))->delete(); - \app\admin\model\school\classes\activity\order\OrderDetail::where(array('shop_id'=>$row['shop_id']))->delete(); - - \app\admin\model\school\classes\hour\Order::where(array('shop_id'=>$row['shop_id']))->delete(); - ServiceOrder::where(array('shop_id'=>$row['shop_id']))->delete(); - $classesLibs = \app\common\model\school\classes\ClassesLib::where(array('shop_id'=>$row['shop_id']))->select(); - foreach( $classesLibs as $lib){ - $specs = $lib->specs; - foreach ($specs as $spec){ - $spec->delete(); - } - $lib->delete(); - } - //删除活动及其规格 - $activitys = \app\common\model\school\classes\activity\Activity::where(array('shop_id'=>$row['shop_id']))->select(); - foreach ($activitys as $activity){ - $specs = $activity->items; - foreach ($specs as $spec){ - $spec->delete(); - } - $activity->delete(); - } - $activityauths = \app\common\model\school\classes\activity\ActivityAuth::where(array('shop_id'=>$row['shop_id']))->select(); - foreach ($activityauths as $activity){ - $specs = $activity->itemauths; - foreach ($specs as $spec){ - $spec->delete(); - } - $activity->delete(); - } +// \app\admin\model\school\classes\activity\order\Order::where(array('shop_id'=>$row['shop_id']))->delete(); +// \app\admin\model\school\classes\activity\order\OrderDetail::where(array('shop_id'=>$row['shop_id']))->delete(); +// +// \app\admin\model\school\classes\hour\Order::where(array('shop_id'=>$row['shop_id']))->delete(); +// ServiceOrder::where(array('shop_id'=>$row['shop_id']))->delete(); +// $classesLibs = \app\common\model\school\classes\ClassesLib::where(array('shop_id'=>$row['shop_id']))->select(); +// foreach( $classesLibs as $lib){ +// $specs = $lib->specs; +// foreach ($specs as $spec){ +// $spec->delete(); +// } +// $lib->delete(); +// } +// //删除活动及其规格 +// $activitys = \app\common\model\school\classes\activity\Activity::where(array('shop_id'=>$row['shop_id']))->select(); +// foreach ($activitys as $activity){ +// $specs = $activity->items; +// foreach ($specs as $spec){ +// $spec->delete(); +// } +// $activity->delete(); +// } +// $activityauths = \app\common\model\school\classes\activity\ActivityAuth::where(array('shop_id'=>$row['shop_id']))->select(); +// foreach ($activityauths as $activity){ +// $specs = $activity->itemauths; +// foreach ($specs as $spec){ +// $spec->delete(); +// } +// $activity->delete(); +// } Admin::where(array('admin_shop_id'=>$row['shop_id']))->update(['admin_shop_id'=>0]); diff --git a/application/admin/controller/school/activity/order/Order.php b/application/admin/controller/school/activity/order/Order.php index 88b7594..c27769d 100644 --- a/application/admin/controller/school/activity/order/Order.php +++ b/application/admin/controller/school/activity/order/Order.php @@ -325,4 +325,11 @@ class Order extends Backend + + + + + + + } diff --git a/application/admin/controller/user/invoice/Apply.php b/application/admin/controller/user/invoice/Apply.php index 3bbdfac..c2a8343 100644 --- a/application/admin/controller/user/invoice/Apply.php +++ b/application/admin/controller/user/invoice/Apply.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; /** * 个人发票申请管理 @@ -74,4 +78,149 @@ class Apply extends Backend return $this->view->fetch(); } + // if($this->request->isPost()) + // { + // try{ + // $params = $this->request->post("row/a"); + //// $order_no = $params["order_no"]; + //// $reject_reason = $params["reject_reason"] ?? ""; + //// $price = $params["price"] ?? 0; + //// $status = $params["status"]; + // $model = (new \app\common\model\user\invoice\Apply()); + // $model->add($row["order_no"],$params,$this->auth->id,'admin',false,true); + // + // }catch (\Exception $e){ + // $this->error($e->getMessage()); + // } + // + // $this->success("已完成售后审核"); + // } + + + + + /** + * 添加 + * + * @return string + * @throws \think\Exception + */ + public function add() + { + if (false === $this->request->isPost()) { + return $this->view->fetch(); + } + $params = $this->request->post('row/a'); + + $order_no = $this->request->param('order_no/s'); + 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; + } + + try{ + + + $model = (new \app\common\model\user\invoice\Apply()); + $model->add($order_no,$params,$this->auth->id,'admin',false,true); + + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + $this->success("申请成功!"); + + + + +// $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); +// } +// $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; + try{ + $desc = $params["desc"]; + $model = (new \app\common\model\user\invoice\Apply()); + $model->examine($ids,$desc,$this->auth->id,'admin',false,true); + $row->allowField(true)->save($params); + }catch (\Exception $e){ + $this->error($e->getMessage()); + } + + $this->success("设置成功!"); + + + +// 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); +// } +// $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/user/invoice/apply.php b/application/admin/lang/zh-cn/user/invoice/apply.php index a046589..5a6585d 100644 --- a/application/admin/lang/zh-cn/user/invoice/apply.php +++ b/application/admin/lang/zh-cn/user/invoice/apply.php @@ -10,7 +10,9 @@ return [ 'Apply_type' => '申请类型', 'Apply_type 1' => '单开', 'Apply_type 2' => '连开', - 'Price' => '申请金额', + 'Price' => '申请实付金额', + 'Fee_price' => '平台手续费', + 'Desc' => '开票备注', 'Head_type' => '抬头类型', 'Head_type personal' => '个人或事业单位', 'Head_type corporate' => '企业', diff --git a/application/admin/view/user/invoice/apply/add.html b/application/admin/view/user/invoice/apply/add.html index a04d6dc..3107388 100644 --- a/application/admin/view/user/invoice/apply/add.html +++ b/application/admin/view/user/invoice/apply/add.html @@ -1,47 +1,47 @@