From e596d11cee6d40aa09bff62efbfefd5e6e541858 Mon Sep 17 00:00:00 2001 From: liaojinling <360197197@qq.com> Date: Sun, 9 Feb 2020 19:49:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E9=95=BF=E6=8A=BC=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PresidentDepositController.class.php | 150 +++++++ .../Admin/View/PresidentDeposit/form.html | 413 ++++++++++++++++++ .../Admin/View/PresidentDeposit/records.html | 354 +++++++++++++++ .../Service/PresidentDepositService.class.php | 33 ++ Data/update.sql | 18 + 5 files changed, 968 insertions(+) create mode 100644 Application/Admin/Controller/PresidentDepositController.class.php create mode 100644 Application/Admin/View/PresidentDeposit/form.html create mode 100644 Application/Admin/View/PresidentDeposit/records.html create mode 100644 Application/Base/Service/PresidentDepositService.class.php diff --git a/Application/Admin/Controller/PresidentDepositController.class.php b/Application/Admin/Controller/PresidentDepositController.class.php new file mode 100644 index 000000000..43e4a6c7a --- /dev/null +++ b/Application/Admin/Controller/PresidentDepositController.class.php @@ -0,0 +1,150 @@ +where(['company_belong' => 1, 'level' => 1])->select(); + $relationQuery = M('promote_company', 'tab_')->field(['id', 'company_name']); + $promotes = $this->mergeOneReletions('company', $promotes, $relationQuery, 'company_id', 'id'); + $relationQuery = M('president_deposit', 'tab_'); + $promotes = $this->mergeOneReletions('presidentDeposit', $promotes, $relationQuery, 'id', 'promote_id'); + /*echo '
';
+        var_dump($promotes);
+        echo '
'; + die();*/ + $this->assign('payWays', PresidentDepositService::$payWays); + $this->assign('payTypes', PresidentDepositService::$payTypes); + $this->assign('statusList', PresidentDepositService::$statusList); + $this->assign('promotes', $promotes); + $this->display(); + } + + private function mergeOneReletions($name, $records, $relationQuery, $selfColumn, $relationColumn = 'id') + { + $values = array_column($records, $selfColumn); + $rows = $relationQuery->where([$relationColumn => ['in', $values]])->select(); + foreach ($records as &$record) { + $record[$name] = null; + } + foreach ($records as &$record) { + foreach ($rows as $row) { + if ($record[$selfColumn] == $row[$relationColumn]) { + $record[$name] = $row; + } + } + } + return $records; + } + + public function edit() + { + $id = I('id', 0); + $promote = M('promote', 'tab_')->field(['account', 'id'])->where(['id' => $id])->find(); + $this->assign('payWays', PresidentDepositService::$payWays); + $this->assign('payTypes', PresidentDepositService::$payTypes); + $this->assign('promote', $promote); + $this->display('form'); + } + + public function save() + { + $payWay = I('pay_way', 0); + $payType = I('pay_type', 0); + $promoteId = I('id', 0); + $payAccount = I('pay_account', 0); + $amount = I('amount', 0); + $payer = I('payer', 0); + + $record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find(); + + if (!$record) { + $data = []; + $data['pay_way'] = $payWay; + $data['pay_type'] = $payType; + $data['promote_id'] = $promoteId; + $data['pay_account'] = $payAccount; + $data['amount'] = $amount; + $data['payer'] = $payer; + M('president_deposit', 'tab_')->add($data); + } + } + + public function delete() + { + $promoteId = I('id', 0); + M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->delete(); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '删除成功' + ]); + } + + public function noDeposit() + { + $promoteId = I('id', 0); + $record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find(); + + if (!$record) { + $data = []; + $data['pay_way'] = 0; + $data['pay_type'] = PresidentDepositService::PAY_TYPE_NONE; + $data['promote_id'] = $promoteId; + $data['pay_account'] = ''; + $data['amount'] = 0; + $data['payer'] = ''; + $data['create_time'] = time(); + $data['update_time'] = time(); + M('president_deposit', 'tab_')->add($data); + } + $this->ajaxReturn([ + 'status' => 1, + 'message' => '操作成功' + ]); + } + + public function refund() + { + $promoteIds = I('ids', []); + if (count($promoteIds) == 0) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '无选中项' + ]); + } + M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->update([ + 'status' => $payType, + 'refund_time' => time() + ]); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '操作成功' + ]); + } + + public function payConfirm() + { + $promoteIds = I('ids', []); + if (count($promoteIds) == 0) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '无选中项' + ]); + } + M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->update([ + 'status' => $payType, + 'pay_confirm_time' => time() + ]); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '操作成功' + ]); + } +} diff --git a/Application/Admin/View/PresidentDeposit/form.html b/Application/Admin/View/PresidentDeposit/form.html new file mode 100644 index 000000000..48ca11a4a --- /dev/null +++ b/Application/Admin/View/PresidentDeposit/form.html @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
*会长账号: + {$promote.account} + +
*押金付款方式: + + +
*付款方式: + + +
*金额: + + +
*付款人: + + +
*付款账号: + + +
+
+ +
+ + + 返回 + +
+
+
+
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + \ No newline at end of file diff --git a/Application/Admin/View/PresidentDeposit/records.html b/Application/Admin/View/PresidentDeposit/records.html new file mode 100644 index 000000000..bd77471e9 --- /dev/null +++ b/Application/Admin/View/PresidentDeposit/records.html @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ 搜索 +
+ +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 所属推广公司会长账号工会类型付款人付款方式账号押金类型审批时间押金金额会长申请时间押金状态押金确认时间操作
aOh! 暂时还没有内容!
+ + + + + + {$data.company.company_name}{$data.account}{$data.company_belong} +
+ + 编辑 + 删除 + + 查看 + +
+
------------------ + +
+
+
+
+ + 导出 + + {$_page|default=''} +
+ + + +
+
+ + + +
    +
  1. +
    + *说明: + +
    +
    驳回
    +
  2. +
  3. +
    + *汇款证明: +
    + +
    +
    选择文件
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    保存
    +
  4. +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/Application/Base/Service/PresidentDepositService.class.php b/Application/Base/Service/PresidentDepositService.class.php new file mode 100644 index 000000000..8d6299baa --- /dev/null +++ b/Application/Base/Service/PresidentDepositService.class.php @@ -0,0 +1,33 @@ + '银行转账', + 2 => '支付宝转账', + 3 => '微信转账', + ]; + + public static $payTypes = [ + self::PAY_TYPE_CASH => '线下转账', + self::PAY_TYPE_DIVIDE => '分成款扣除', + self::PAY_TYPE_NONE => '无需押金', + ]; + + public static $statusList = [ + 0 => '待确认', + 1 => '已收到', + 2 => '已退款', + ]; +} \ No newline at end of file diff --git a/Data/update.sql b/Data/update.sql index 9cc0cdb92..22f32d69e 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1147,3 +1147,21 @@ CREATE TABLE `tab_company_info` ( `last_up_time` int(10) NOT NULL DEFAULT '0' COMMENT '最后更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='内部公司信息'; + +CREATE TABLE `tab_president_deposit` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', + `promote_id` varchar(60) NOT NULL COMMENT '会长ID', + `payer` varchar(50) NOT NULL DEFAULT '' COMMENT '付款人', + `amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '金额', + `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态', + `pay_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '押金付款方式', + `pay_way` tinyint(1) NOT NULL DEFAULT '0' COMMENT '付款方式', + `pay_account` varchar(60) NOT NULL DEFAULT '' COMMENT '付款账号', + `verify_time` int(10) NOT NULL DEFAULT '0' COMMENT '审核时间', + `pay_confirm_time` int(10) NOT NULL DEFAULT '0' COMMENT '押金确认时间', + `refund_time` int(10) NOT NULL DEFAULT '0' COMMENT '退款时间', + `create_time` int(10) NOT NULL DEFAULT '0' COMMENT '添加时间', + `update_time` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会长押金'; +