正在显示
5 个修改的文件
包含
186 行增加
和
3 行删除
@@ -88,7 +88,7 @@ class MainController extends AdminBaseController | @@ -88,7 +88,7 @@ class MainController extends AdminBaseController | ||
88 | $today_end=$today_start+24*60*60; | 88 | $today_end=$today_start+24*60*60; |
89 | $today_order=Db::name('light_order') | 89 | $today_order=Db::name('light_order') |
90 | ->whereTime('create_time', 'between', [$today_start, $today_end]) | 90 | ->whereTime('create_time', 'between', [$today_start, $today_end]) |
91 | - ->where('status',1) | 91 | + ->whereNotNull('pay_time') |
92 | ->sum('money'); | 92 | ->sum('money'); |
93 | $users=Db::name('users')->count(); | 93 | $users=Db::name('users')->count(); |
94 | $order=Db::name('temple') | 94 | $order=Db::name('temple') |
@@ -109,7 +109,7 @@ class AdminLightOrderController extends AdminBaseController | @@ -109,7 +109,7 @@ class AdminLightOrderController extends AdminBaseController | ||
109 | ->join('temple t','l.temple_id=t.id') | 109 | ->join('temple t','l.temple_id=t.id') |
110 | ->join('temple_area ta','l.area_id=ta.id') | 110 | ->join('temple_area ta','l.area_id=ta.id') |
111 | ->where('lo.users_id',$id) | 111 | ->where('lo.users_id',$id) |
112 | - ->field('lo.*,l.*,u.*,t.name as tname,ta.name as taname,lo.name as loname,lo.id as loid') | 112 | + ->field('lo.*,l.*,u.*,t.name as tname,ta.name as taname,lo.name as loname,lo.id as loid ') |
113 | ->order('lo.create_time','desc') | 113 | ->order('lo.create_time','desc') |
114 | ->paginate('10'); | 114 | ->paginate('10'); |
115 | $this->assign('page',$data->render()); | 115 | $this->assign('page',$data->render()); |
1 | +<?php | ||
2 | +// +---------------------------------------------------------------------- | ||
3 | +// | bronet [ 以客户为中心 以奋斗者为本 ] | ||
4 | +// +---------------------------------------------------------------------- | ||
5 | +// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved. | ||
6 | +// +---------------------------------------------------------------------- | ||
7 | +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) | ||
8 | +// +---------------------------------------------------------------------- | ||
9 | +// | Author:kane < chengjin005@163.com> | ||
10 | +// +---------------------------------------------------------------------- | ||
11 | +namespace app\portal\controller; | ||
12 | + | ||
13 | +use cmf\controller\AdminBaseController; | ||
14 | +use think\Db; | ||
15 | + | ||
16 | +/** | ||
17 | + * Class AdminMoneyController | ||
18 | + * @package app\portal\controller | ||
19 | + * @adminMenuRoot( | ||
20 | + * 'name' =>'财务管理', | ||
21 | + * 'action' =>'default', | ||
22 | + * 'parent' =>'', | ||
23 | + * 'display'=> true, | ||
24 | + * 'order' => 30, | ||
25 | + * 'icon' =>'th', | ||
26 | + * 'remark' =>'财务管理' | ||
27 | + * ) | ||
28 | + */ | ||
29 | +class AdminMoneyController extends AdminBaseController | ||
30 | +{ | ||
31 | + /** | ||
32 | + * 财务列表 | ||
33 | + * @adminMenu( | ||
34 | + * 'name' => '财务列表', | ||
35 | + * 'parent' => 'portal/AdminMoney/default', | ||
36 | + * 'display'=> true, | ||
37 | + * 'hasView'=> true, | ||
38 | + * 'order' => 10000, | ||
39 | + * 'icon' => '', | ||
40 | + * 'remark' => '财务列表', | ||
41 | + * 'param' => '' | ||
42 | + * ) | ||
43 | + */ | ||
44 | + public function index() | ||
45 | + { | ||
46 | + //接收搜索参数 | ||
47 | + $param = $this->request->param(); | ||
48 | + //添加搜索条件 | ||
49 | + $where=[]; | ||
50 | + $temple = empty($param['temple']) ? '' : $param['temple']; | ||
51 | + if (!empty($temple)) { | ||
52 | + $where['t.temple'] = ['like', "%$temple%"]; | ||
53 | + } | ||
54 | + | ||
55 | + $address=empty($param['address']) ? '' : $param['address']; | ||
56 | + if (!empty($address)) { | ||
57 | + $where['t.address'] = $address; | ||
58 | + } | ||
59 | + //所有地区 | ||
60 | + $address_choose=Db::name('temple')->field('address')->distinct('address',true)->select(); | ||
61 | + $this->assign('address_choose',$address_choose); | ||
62 | + | ||
63 | + //数据提取 | ||
64 | + $data=Db::name('temple')->alias('t')->join('light l','l.temple_id=t.id')->where($where)->field('t.*,l.id as lid')->paginate(10)->each(function ($item) { | ||
65 | + $item['money'] = Db::name('light_order')->where('lights_id', $item['lid'])->whereNotNull('pay_time')->sum('money'); | ||
66 | + $item['real_money']=$item['money']*$item['percent']; | ||
67 | + return $item; | ||
68 | + }); | ||
69 | + //向地址传参 | ||
70 | + $data->appends($param); | ||
71 | + $this->assign('page',$data->render()); | ||
72 | + $this->assign('address', isset($param['address']) ? $param['address'] : ''); | ||
73 | + $this->assign('temple', isset($param['temple']) ? $param['temple'] : ''); | ||
74 | + $this->assign('list', $data); | ||
75 | + return $this->fetch(); | ||
76 | + } | ||
77 | + | ||
78 | + | ||
79 | + /** | ||
80 | + * 删除财务 | ||
81 | + * @adminMenu( | ||
82 | + * 'name' => '删除财务', | ||
83 | + * 'parent' => 'index', | ||
84 | + * 'display'=> false, | ||
85 | + * 'hasView'=> false, | ||
86 | + * 'order' => 10000, | ||
87 | + * 'icon' => '', | ||
88 | + * 'remark' => '删除财务', | ||
89 | + * 'param' => '' | ||
90 | + * ) | ||
91 | + */ | ||
92 | + public function delete() | ||
93 | + { | ||
94 | + $id = $this->request->param('id'); | ||
95 | + $re=Db::name('light_order') | ||
96 | + ->alias('lo') | ||
97 | + ->join('light l','lo.light_id=l.id') | ||
98 | + ->where(['l.temple_id'=>$id,'lo.end_time'=>['>',time()]]) | ||
99 | + ->find(); | ||
100 | + if ($re){ | ||
101 | + $this->error('该寺庙下有进行中的订单,不允许删除'); | ||
102 | + } | ||
103 | + Db::name('temple')->where('id', $id)->delete(); | ||
104 | + $this->success('删除成功'); | ||
105 | + } | ||
106 | + | ||
107 | +} |
@@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
30 | <tbody> | 30 | <tbody> |
31 | <foreach name="list" item="vo"> | 31 | <foreach name="list" item="vo"> |
32 | <tr> | 32 | <tr> |
33 | - <td>{$vo.id}</td> | 33 | + <td>{$vo.loid}</td> |
34 | <td>{$vo.order_sn}</td> | 34 | <td>{$vo.order_sn}</td> |
35 | <td>{$vo.address}</td> | 35 | <td>{$vo.address}</td> |
36 | <td>{$vo.tname}</td> | 36 | <td>{$vo.tname}</td> |
1 | +<include file="public@header"/> | ||
2 | +</head> | ||
3 | +<body> | ||
4 | +<div class="wrap"> | ||
5 | + <ul class="nav nav-tabs"> | ||
6 | + <li class="active"><a href="javascript:;">财务列表</a></li> | ||
7 | + </ul> | ||
8 | + <form class="well form-inline margin-top-20" method="post" action="{:url('AdminMoney/index')}"> | ||
9 | + 地区: | ||
10 | + <select class="form-control" name="address" style="width: 140px;"> | ||
11 | + <option value=''>全部</option> | ||
12 | + <foreach name="address_choose" item="vo"> | ||
13 | + <option value="{$vo.address}" <eq name="address" value="$vo.address">selected</eq>>{$vo.address}</option> | ||
14 | + </foreach> | ||
15 | + </select> | ||
16 | + 寺庙名称: | ||
17 | + <input class="form-control" type="text" name="temple" style="width: 200px;" value="{:input('request.temple')}" | ||
18 | + placeholder="请输入寺庙名称"> | ||
19 | + <input type="submit" class="btn btn-primary" value="搜索"/> | ||
20 | + <a class="btn btn-danger" href="{:url('AdminMoney/index')}">清空</a> | ||
21 | + </form> | ||
22 | + <form method="post" class="js-ajax-form margin-top-20"> | ||
23 | + <div class="table-actions"> | ||
24 | + <!--<button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>--> | ||
25 | + </div> | ||
26 | + <table class="table table-hover table-bordered table-list"> | ||
27 | + <thead> | ||
28 | + <tr> | ||
29 | + <th width="50">ID</th> | ||
30 | + <th>地区</th> | ||
31 | + <th>寺庙名称</th> | ||
32 | + <th>营业额</th> | ||
33 | + <th>分成比例</th> | ||
34 | + <th>分成金额</th> | ||
35 | + <th>操作</th> | ||
36 | + </tr> | ||
37 | + </thead> | ||
38 | + <tbody> | ||
39 | + <foreach name="list" item="vo"> | ||
40 | + <tr> | ||
41 | + <td>{$vo.id}</td> | ||
42 | + <td>{$vo.address}</td> | ||
43 | + <td>{$vo.name}</td> | ||
44 | + <td>{$vo.money}</td> | ||
45 | + <td>{$vo.percent*100}%</td> | ||
46 | + <td>{$vo.real_money}</td> | ||
47 | + <td> | ||
48 | + <a href="{:url('AdminLightOrder/edit',array('id'=>$vo['loid']))}">编辑</a> | ||
49 | + <a class="js-ajax-delete" href="{:url('AdminLightOrder/delete',array('id'=>$vo['loid']))}"> | ||
50 | + {:lang('DELETE')} | ||
51 | + </a> | ||
52 | + </td> | ||
53 | + </tr> | ||
54 | + </foreach> | ||
55 | + </tbody> | ||
56 | + <tfoot> | ||
57 | + <tr> | ||
58 | + <th width="50">ID</th> | ||
59 | + <th>地区</th> | ||
60 | + <th>寺庙名称</th> | ||
61 | + <th>营业额</th> | ||
62 | + <th>分成比例</th> | ||
63 | + <th>分成金额</th> | ||
64 | + <th>操作</th> | ||
65 | + </tr> | ||
66 | + </tfoot> | ||
67 | + </table> | ||
68 | + <div class="table-actions"> | ||
69 | + <!--<button type="submit" class="btn btn-primary btn-sm js-ajax-submit">{:lang('SORT')}</button>--> | ||
70 | + </div> | ||
71 | + </form> | ||
72 | + <ul class="pagination">{$page|default=''}</ul> | ||
73 | +</div> | ||
74 | +<script src="__STATIC__/js/admin.js"></script> | ||
75 | +</body> | ||
76 | +</html> |
-
请 注册 或 登录 后发表评论