From dd6b9d9699420818985dd4312a8552c431e64c69 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Wed, 1 Dec 2021 16:53:44 +0800 Subject: [PATCH] settter --- app/controller/manager/Bill.php | 69 +++++- app/controller/manager/Coupon.php | 13 +- app/controller/manager/Index.php | 12 +- app/model/Business.php | 4 + app/model/Member.php | 2 + app/model/Recharge.php | 3 +- app/repository/BillRepository.php | 220 ++++++++++++++++-- app/repository/BusinessRepository.php | 12 +- app/repository/CmsRepository.php | 27 +++ app/traits/cms/MenuTrait.php | 26 +++ public/static/manager/js/bill_deduction.js | 132 +++++++++++ public/static/manager/js/bill_recharge.js | 116 +++++++++ .../manager/js/business/business_wait_list.js | 22 +- public/static/manager/js/consumer/index.js | 2 +- view/manager/bill/deduction.html | 115 +++++++++ view/manager/bill/recharge.html | 113 +++++++++ .../business/business_deduction_list.html | 3 +- view/manager/business/business_wait_list.html | 10 +- view/manager/role/rule.html | 2 +- 19 files changed, 831 insertions(+), 72 deletions(-) create mode 100644 public/static/manager/js/bill_deduction.js create mode 100644 public/static/manager/js/bill_recharge.js create mode 100644 view/manager/bill/deduction.html create mode 100644 view/manager/bill/recharge.html diff --git a/app/controller/manager/Bill.php b/app/controller/manager/Bill.php index 11dd844..1394f26 100644 --- a/app/controller/manager/Bill.php +++ b/app/controller/manager/Bill.php @@ -14,7 +14,6 @@ class Bill extends Base * 流水列表 * * @return Json|View - * @throws Exception */ public function index() { @@ -25,11 +24,11 @@ class Bill extends Base $keyword = $this->request->param('keyword/s', ''); $page = $this->request->param('page/d', 1); $size = $this->request->param('size/d', 30); - $orders = ['id' => 'desc']; + $orders = ['a.id' => 'desc']; $list = $repo->billList($page, $size, $keyword, $startTime, $endTime, $orders); - $list['agency_money_sum'] = BillRepository::getInstance()->getAgencyMoneySum(CouponBill::agency_money, $startTime, $endTime); - $list['admin_money_sum'] = BillRepository::getInstance()->getAgencyMoneySum(CouponBill::admin_money, $startTime, $endTime); - $list['consumer_money_sum'] = BillRepository::getInstance()->getAgencyMoneySum(CouponBill::consumer_money, $startTime, $endTime); + $list['agency_money_sum'] = BillRepository::getInstance()->getAgencyMoneySum(CouponBill::agency_money, $keyword, $startTime, $endTime); + $list['admin_money_sum'] = BillRepository::getInstance()->getAgencyMoneySum(CouponBill::admin_money, $keyword, $startTime, $endTime); + $list['consumer_money_sum'] = BillRepository::getInstance()->getAgencyMoneySum(CouponBill::consumer_money, $keyword, $startTime, $endTime); return $this->json(0, 'success', $list); } @@ -43,5 +42,65 @@ class Bill extends Base return $this->view(); } + /** + * 充值流水 + * + * @return Json|View + * @throws Exception + */ + public function recharge() + { + $startTime = input("start_time/s", date("Y-m-d H:i:s", strtotime(date("Y-m-d") . " -1 month"))); + $endTime = input("end_time/s", date("Y-m-d 00:00:00")); + if ($this->request->isPost()) { + $repo = BillRepository::getInstance(); + $keyword = $this->request->param('keyword/s', ''); + $page = $this->request->param('page/d', 1); + $size = $this->request->param('size/d', 30); + $orders = ['a.id' => 'desc']; + $list = $repo->rechargeBillList($page, $size, $keyword, $startTime, $endTime, $orders); + $list['recharge_money_sum'] = BillRepository::getInstance()->getRechargeMoneySum($keyword, $startTime, $endTime); + + return $this->json(0, 'success', $list); + } + + $this->data["recharge_money_sum"] = BillRepository::getInstance()->getRechargeMoneySum(); + + $this->data["startTime"] = $startTime; + $this->data["endTime"] = $endTime; + + return $this->view(); + } + + /** + * 扣款流水 + * + * @return Json|View + * @throws Exception + */ + public function deduction() + { + $startTime = input("start_time/s", date("Y-m-d H:i:s", strtotime(date("Y-m-d") . " -1 month"))); + $endTime = input("end_time/s", date("Y-m-d 00:00:00")); + if ($this->request->isPost()) { + $repo = BillRepository::getInstance(); + $keyword = $this->request->param('keyword/s', ''); + $page = $this->request->param('page/d', 1); + $size = $this->request->param('size/d', 30); + $orders = ['a.id' => 'desc']; + $list = $repo->deductionBillList($page, $size, $keyword, $startTime, $endTime, $orders); + $list['deduction_money_sum'] = BillRepository::getInstance()->getDeductionMoneySum($keyword,$startTime, $endTime); + + return $this->json(0, 'success', $list); + } + + $this->data["deduction_money_sum"] = BillRepository::getInstance()->getDeductionMoneySum(); + + $this->data["startTime"] = $startTime; + $this->data["endTime"] = $endTime; + + return $this->view(); + } + } \ No newline at end of file diff --git a/app/controller/manager/Coupon.php b/app/controller/manager/Coupon.php index e7e8ca8..1a1fa82 100644 --- a/app/controller/manager/Coupon.php +++ b/app/controller/manager/Coupon.php @@ -71,22 +71,23 @@ class Coupon extends Base ->when(Member::is_agency($this->auth['roles']),function ($q){ $q->where( 'agency_code', '=', $this->auth['business_code']); }) - ->field("code,business_name,business_subtitle,type") - ->with('category'); + ->field("code,business_name,business_subtitle,type"); + //->with('category'); }); } if(Member::is_agency($this->auth['roles'])){ + return $q::hasWhere('business', function ($q) { $q//如果是渠道商或者工作人员 只查看自己的下级商家 ->where( 'agency_code', '=', $this->auth['business_code']) - ->field("code,business_name,business_subtitle,type") - ->with('category'); + ->field("code,business_name,business_subtitle,type"); + //->with('category'); }); }else{ return $q->with(["business" => function ($query) { - $query->field("code,business_name,business_subtitle,type") - ->with('category'); + $query->field("code,business_name,business_subtitle,type"); + //->with('category'); }]); } diff --git a/app/controller/manager/Index.php b/app/controller/manager/Index.php index bb6b670..06cba41 100644 --- a/app/controller/manager/Index.php +++ b/app/controller/manager/Index.php @@ -60,14 +60,10 @@ class Index extends Base $res['homeInfo'] = ['title' => '控制台', 'href' => "manager/index/dashboard"]; $res['logoInfo'] = ['title' => '恒美植发', 'href' => "", 'image' => '/static/manager/image/logo.png']; - $menus = CmsRepository::getInstance()->getMenuList(Menu::TYPE_MENU, Menu::SHOW_YES)->toArray(); - foreach ($menus as $k => $m) { - $menus[$k]['icon'] = !empty($m['icon']) ? 'fa '.$m['icon'] : ''; - $menus[$k]['href'] = ltrim($m['href'], '/'); - } - - $menus = CmsRepository::getInstance()->buildMenuChild(0, $menus, 'child',); - + $menus = CmsRepository::getInstance()->getMenuList(Menu::TYPE_MENU, Menu::SHOW_YES)->toArray(); + $userId = $this->auth['user_id'] ?? 0; + $menus = CmsRepository::getInstance()->handMenuRule($userId, $menus); + $menus = CmsRepository::getInstance()->buildMenuChild(0, $menus, 'child'); $res['menuInfo'] = $menus; return json($res); diff --git a/app/model/Business.php b/app/model/Business.php index db7020e..f0bc82e 100644 --- a/app/model/Business.php +++ b/app/model/Business.php @@ -16,4 +16,8 @@ class Business extends Base { return $this->hasOne(Account::class, 'business_code',"code"); } + public function agency() + { + return $this->hasOne(self::class,"code","agency_code"); + } } diff --git a/app/model/Member.php b/app/model/Member.php index 9eabf77..1d01c7e 100644 --- a/app/model/Member.php +++ b/app/model/Member.php @@ -86,6 +86,7 @@ class Member extends Base /** * 验证当前用户是否是渠道商 * @param string $roles + * @return bool */ public static function is_agency(string $roles) { @@ -101,6 +102,7 @@ class Member extends Base } if (in_array(self::STAFF_ROLE_ID, $roles) || in_array(self::ANENT_ROLE_ID, $roles)) { + return true; } return false; diff --git a/app/model/Recharge.php b/app/model/Recharge.php index 53e5ba4..906bcb8 100644 --- a/app/model/Recharge.php +++ b/app/model/Recharge.php @@ -19,6 +19,7 @@ class Recharge extends Base public function business() { - return $this->hasOne(Business::class,"code","business_code")->bind(["business_name"]); + return $this->hasOne(Business::class,"code","business_code"); } + } \ No newline at end of file diff --git a/app/repository/BillRepository.php b/app/repository/BillRepository.php index 450ea62..5d2a702 100644 --- a/app/repository/BillRepository.php +++ b/app/repository/BillRepository.php @@ -3,7 +3,9 @@ namespace app\repository; use app\model\CouponBill; +use app\model\Deduction; use app\model\Member as MemberModel; +use app\model\Recharge; use app\service\Repository; use think\Collection; use think\Model; @@ -27,11 +29,8 @@ class BillRepository extends Repository * @param null $endTime * @param array $orders * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException */ - public function billList($page, $size, $keyword = null, $startTime = null, $endTime = null, $orders = ["id" => "desc"]) + public function billList($page, $size, $keyword = null, $startTime = null, $endTime = null, $orders = ["id" => "desc"]) { $failData = [ 'total' => 0, @@ -40,14 +39,13 @@ class BillRepository extends Repository 'list' => new Collection(), ]; $rep = CouponBill::alias("a") - ->join("business b","a.business_code = b.code") - ->join("account c","a.user_code = c.user_code") - ->join("coupon_main d","a.coupon_main_id = d.id") - - ->when(!empty($keyword),function ($q) use($keyword){ + ->join("business b", "a.business_code = b.code") + ->join("account c", "a.user_code = c.user_code") + ->join("coupon_main d", "a.coupon_main_id = d.id") + ->when(!empty($keyword), function ($q) use ($keyword) { $q->where("b.business_name|c.nick_name|d.name", "like", "%$keyword%"); }) - ->when(MemberModel::is_agency(session("auth")['roles']),function ($q) { + ->when(MemberModel::is_agency(session("auth")['roles']), function ($q) { $q->where("b.agency_code", "=", session("auth")['business_code']); }) ->when(!empty($startTime), function ($q) use ($startTime) { @@ -56,11 +54,7 @@ class BillRepository extends Repository ->when(!empty($endTime), function ($q) use ($endTime) { $q->whereTime("a.create_time", "<=", $endTime); }) - ->field("a.*,b.business_name,c.nick_name,c.avatar_url,d.name as coupon_main_name") - ; - - - + ->field("a.*,b.business_name,c.nick_name,c.avatar_url,d.name as coupon_main_name"); $failData ['total'] = $rep->count(); $failData ['list'] = $rep @@ -70,26 +64,202 @@ class BillRepository extends Repository return $failData; } + /** + * 充值流水列表 + * @param $page + * @param $size + * @param $keyword + * @param null $startTime + * @param null $endTime + * @param array $orders + * @return array + */ + public function rechargeBillList($page, $size, $keyword = null, $startTime = null, $endTime = null, $orders = ["a.id" => "desc"]) + { + + $failData = [ + 'total' => 0, + 'current' => $page, + 'size' => $size, + 'list' => new Collection(), + ]; + $rep = Recharge::alias("a") + ->join("account b", "a.open_id = b.open_id") + ->join("business c", "a.business_code = c.code") + ->join("member d", "a.member_id = d.id", "left") + ->join("business e", "c.agency_code = e.code", "left") + ->when(!empty($startTime), function ($q) use ($startTime) { + $q->whereTime("a.update_time", ">=", $startTime); + }) + ->when(!empty($keyword), function ($q) use ($keyword) { + $q->where("c.business_name|e.business_name", "like", "%$keyword%"); + }) + ->when(!empty($endTime), function ($q) use ($endTime) { + $q->whereTime("a.update_time", "<=", $endTime); + }) + ->field( + [ + "a.*", + "b.nick_name", + "b.avatar_url", + "d.nickname as member_nickname", + "c.business_name", + "e.business_name as agency_business_name", + ] + ); + + $failData ['total'] = $rep->count(); + $failData ['list'] = $rep + ->page($page, $size) + ->order($orders) + ->select(); + return $failData; + } + + /** + * 扣款流水列表 + * @param $page + * @param $size + * @param $keyword + * @param null $startTime + * @param null $endTime + * @param array $orders + * @return array + */ + public function deductionBillList($page, $size, $keyword = null, $startTime = null, $endTime = null, $orders = ["id" => "desc"]) + { + + $failData = [ + 'total' => 0, + 'current' => $page, + 'size' => $size, + 'list' => new Collection(), + ]; + $rep = Deduction::alias("a") + ->join("business c", "a.business_code = c.code") + ->join("business f", "f.code = c.agency_code", "left") + ->join("coupon_main e", "a.coupon_main_id = e.id") + ->join("coupon_bill d", "a.bill_id = d.id") + ->join("account b", "d.user_code = b.user_code", "left") + ->when(!empty($startTime), function ($q) use ($startTime) { + $q->whereTime("a.create_time", ">=", $startTime); + }) + ->when(!empty($keyword), function ($q) use ($keyword) { + $q->where("c.business_name|f.business_name", "like", "%" . $keyword . "%"); + }) + ->when(!empty($endTime), function ($q) use ($endTime) { + $q->whereTime("a.create_time", "<=", $endTime); + }) + ->field( + [ + "a.money", + "a.balance", + "a.create_time", + "b.nick_name", + "b.avatar_url", + "e.name as coupon_main_name", + "c.business_name", + "f.business_name as agency_business_name", + + "d.consumer_money", + "d.admin_money", + "d.agency_money", + + "d.lat", + "d.lng", + + ] + ); + + $failData ['total'] = $rep->count(); + $failData ['list'] = $rep + ->page($page, $size) + ->order($orders) + ->select(); + return $failData; + } /** * 总收益 * @param $field + * @param null $keyword * @param null $start_time * @param null $end_time * @return float */ - public function getAgencyMoneySum($field, $start_time = null, $end_time = null) + public function getAgencyMoneySum($field, $keyword = null, $start_time = null, $end_time = null) { - return CouponBill::when(!empty($start_time), function ($q) use ($start_time) { - $q->whereTime("create_time", ">=", $start_time); - }) - ->when(!empty($end_time), function ($q) use ($end_time) { - $q->whereTime("create_time", "<=", $end_time); - }) - ->when(MemberModel::is_agency(session("auth")['roles']),function ($q) { - $q->where("agency_code", "=", session("auth")['business_code']); + return CouponBill::alias("a") + ->join("business b", "a.business_code = b.code", "left") + ->join("business e", "a.agency_code = e.code", "left") + ->join("account c", "a.user_code = c.user_code") + ->join("coupon_main d", "a.coupon_main_id = d.id") + ->when(!empty($keyword), function ($q) use ($keyword) { + $q->whereTime("c.business_name|e.business_name", "like", "%" . $keyword . "%"); }) - ->sum($field); + ->when(!empty($start_time), function ($q) use ($start_time) { + $q->whereTime("a.create_time", ">=", $start_time); + }) + ->when(!empty($end_time), function ($q) use ($end_time) { + $q->whereTime("a.create_time", "<=", $end_time); + }) + ->when(MemberModel::is_agency(session("auth")['roles']), function ($q) { + $q->where("a.agency_code", "=", session("auth")['business_code']); + }) + ->sum("a." . $field); + } + + /** + * 总充值流水 + * @param null $keyword + * @param null $start_time + * @param null $end_time + * @return float + */ + public function getRechargeMoneySum($keyword = null, $start_time = null, $end_time = null) + { + return Recharge::alias("a") + ->join("account b", "a.open_id = b.open_id") + ->join("business c", "a.business_code = c.code") + ->join("member d", "a.member_id = d.id", "left") + ->join("business e", "c.agency_code = e.code", "left") + ->when(!empty($keyword), function ($q) use ($keyword) { + $q->whereTime("c.business_name|e.business_name", "like", "%" . $keyword . "%"); + }) + ->when(!empty($start_time), function ($q) use ($start_time) { + $q->whereTime("a.update_time", ">=", $start_time); + }) + ->when(!empty($end_time), function ($q) use ($end_time) { + $q->whereTime("a.update_time", "<=", $end_time); + }) + ->sum("a.money"); + } + + /** + * 总扣款流水 + * @param null $keyword + * @param null $start_time + * @param null $end_time + * @return float + */ + public function getDeductionMoneySum($keyword = null,$start_time = null, $end_time = null) + { + return Deduction::alias("a") + ->join("business c", "a.business_code = c.code") + ->join("business f", "f.code = c.agency_code", "left") + ->join("coupon_main e", "a.coupon_main_id = e.id") + ->join("coupon_bill d", "a.bill_id = d.id") + ->join("account b", "d.user_code = b.user_code", "left") + ->when(!empty($keyword), function ($q) use ($keyword) { + $q->where("c.business_name|f.business_name", "like", "%" . $keyword . "%"); + }) + ->when(!empty($start_time), function ($q) use ($start_time) { + $q->whereTime("a.create_time", ">=", $start_time); + }) + ->when(!empty($end_time), function ($q) use ($end_time) { + $q->whereTime("a.create_time", "<=", $end_time); + }) + ->sum("a.money"); } } \ No newline at end of file diff --git a/app/repository/BusinessRepository.php b/app/repository/BusinessRepository.php index 5c62796..17215cd 100644 --- a/app/repository/BusinessRepository.php +++ b/app/repository/BusinessRepository.php @@ -37,13 +37,21 @@ class BusinessRepository extends Repository { $q = $this->model->alias("a") ->join("account b", "a.code = b.business_code") + ->join("category c", "a.type = c.id","left") ->field(["a.code as business_code", "b.avatar_url", "b.nick_name as account_nick_name", "a.business_name", "a.total_recharge", "a.id as basiness_id", - "a.balance"]) + "a.balance", + "a.contact_name", + "a.contact_phone", + "a.business_address", + "a.business_license", + "a.state", + "c.name as type_name", + ]) ->group("a.id"); $data = [ 'total' => 0, @@ -102,7 +110,7 @@ class BusinessRepository extends Repository public function businessDeductionList($where, int $page = 1, int $limit = 0, array $order = ["create_time" => "desc", "id" => "desc"]) { return Deduction::findList($where, [], $page, $limit, function ($q) { - return $q->with("couponMain"); + return $q->with(["couponMain","bill"]); }, $order); } diff --git a/app/repository/CmsRepository.php b/app/repository/CmsRepository.php index 435f5b7..2100793 100644 --- a/app/repository/CmsRepository.php +++ b/app/repository/CmsRepository.php @@ -5,6 +5,7 @@ namespace app\repository; use app\traits\cms\ArticleTrait; use app\traits\cms\MenuTrait; use app\traits\CmsCategoryTrait; +use tauthz\facade\Enforcer; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; @@ -46,4 +47,30 @@ class CmsRepository extends Repository return $list; } + + /** + * 获取后台用户权限列表 + * + * @param int $accountId + * @return array + */ + public function getUserRules(int $accountId): array + { + $rules = []; + $roles = Enforcer::getRolesForUser($accountId); + foreach ($roles as $role) { + $rules = array_merge($rules, Enforcer::getPermissionsForUser($role)); + } + + $ruleNameList = []; + foreach ($rules as $rule) { + if (isset($rule[2])) { + $ruleNameList[] = $rule[1].':'.$rule[2]; + } else { + $ruleNameList[] = $rule[1]; + } + } + + return array_unique($ruleNameList); + } } \ No newline at end of file diff --git a/app/traits/cms/MenuTrait.php b/app/traits/cms/MenuTrait.php index 7a0acb0..d06d0a2 100644 --- a/app/traits/cms/MenuTrait.php +++ b/app/traits/cms/MenuTrait.php @@ -3,6 +3,7 @@ namespace app\traits\cms; use app\model\Menu; +use app\repository\CmsRepository; use tauthz\facade\Enforcer; use think\Collection; @@ -46,6 +47,31 @@ trait MenuTrait return $treeList; } + + //菜单权限过滤 + public function handMenuRule(int $accountId, array $menus): array + { + $rules = CmsRepository::getInstance()->getUserRules($accountId); + + foreach ($menus as $k => $m) { + $menus[$k]['icon'] = !empty($m['icon']) ? 'fa '.$m['icon'] : ''; + $menus[$k]['href'] = ltrim($m['href'], '/'); + + if ($m['pid'] !== 0) { + $name = $m['name']; + $nameArr = explode(':', $name); + if (count($nameArr) <= 1) { + $name = $name.':index'; + } + + if (!in_array($name, $rules)) { + unset($menus[$k]); + } + } + } + return $menus; + } + /** * 检测批量数据下 是否有子栏目 * diff --git a/public/static/manager/js/bill_deduction.js b/public/static/manager/js/bill_deduction.js new file mode 100644 index 0000000..935bc90 --- /dev/null +++ b/public/static/manager/js/bill_deduction.js @@ -0,0 +1,132 @@ +layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"], function () { + let $ = layui.jquery, + form = layui.form, + table = layui.table, + layer = layui.layer, + xmSelect = layui.xmSelect, + miniTab = layui.miniTab, + laydate = layui.laydate ; + + /**** index begin ***/ + //index页面 + if ($('.location-index-page').length > 0) { + miniTab.listen(); + var exportDataTitle= + [ + "消费者昵称","扣款优惠券名称", + "所属商家名称","商家所属平台商", + "扣款总额","当前余额", + "消费者红包","平台商佣金", + "太古佣金","扣款时间", + "经纬度" + ]; + var exportData =[]; + // 渲染表格 + let listUrl = $('#table-container').data('url'); + let insTb = table.render({ + elem: '#table-container', + toolbar: '#toolbar-tpl', + defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可 + title: '搜索' + , layEvent: 'search' + , icon: 'layui-icon-search' + },'filter'], + url: listUrl, + method: 'post', + even: true, + limits: [10,20,50,100,200,500,1000], + request: { + pageName: 'page', + limitName: 'size', + }, + parseData: function (res) { + //console.log(res) + $("#deduction_money_sum").text(res.data.deduction_money_sum?res.data.deduction_money_sum:0) + + return { + "code": res.code, //解析接口状态 + "msg": res.msg, //解析提示文本 + "count": res.data.total, //解析数据长度 + "data": res.data.list //解析数据列表 + }; + }, + page: true, + cols: [[ + {type: 'checkbox'}, + { field:"nick_name",title: '消费者昵称'}, + {templet: "#row-avatar_url",field:"avatar_url",title: '消费者头像'}, + {field:"coupon_main_name",title: '扣款优惠券名称'}, + + {field:"business_name",title: '所属商家名称'}, + {field:"agency_business_name",title: '商家所属平台商'}, + {field: "money", title: '扣款总额'}, + {field: "balance", title: '当前余额'}, + + {field: "consumer_money", title: '消费者红包'}, + {field: "agency_money", title: '平台商佣金'}, + {field: "admin_money", title: '太古佣金'}, + {field: "create_time", title: '扣款时间'}, + {templet: "#row-position", title: '经纬度'}, + // {templet: '#row-operate', minWidth: 200, fixed: 'right', align: 'center', title: '操作'} + ]], + done: function (res, curr, count) { + Tools.setInsTb(insTb); + var rdata=[]; + res.data.forEach(function (d,index) { + rdata[index] = [ + d.nick_name , + d.coupon_main_name , + d.business_name , + d.agency_business_name , + d.money, + d.balance, + d.consumer_money, + d.agency_money, + d.admin_money, + d.create_time, + d.lng + "," + d.lat + + ] + }) + exportData=rdata + } + }); + $("#exports").on("click",function(){ + //console.log(exportData) + table.exportFile(exportDataTitle,exportData, 'xls'); + return false; + }) + + + + + // 监听搜索操作 + form.on('submit(data-search-btn)', function (data) { + //执行搜索重载 + table.reload('table-container', { + page: {curr: 1} + , where: data.field + }, 'data'); + + return false; + }); + + //日期时间选择器 + laydate.render({ + elem: '#start_time' + ,type: 'datetime' + }); + + //日期时间选择器 + laydate.render({ + elem: '#end_time' + ,type: 'datetime' + }); + + + + + } + /*** index end ***/ + +}); \ No newline at end of file diff --git a/public/static/manager/js/bill_recharge.js b/public/static/manager/js/bill_recharge.js new file mode 100644 index 0000000..261e1cb --- /dev/null +++ b/public/static/manager/js/bill_recharge.js @@ -0,0 +1,116 @@ +layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect',"laydate"], function () { + let $ = layui.jquery, + form = layui.form, + table = layui.table, + layer = layui.layer, + xmSelect = layui.xmSelect, + miniTab = layui.miniTab, + laydate = layui.laydate ; + + /**** index begin ***/ + //index页面 + if ($('.location-index-page').length > 0) { + miniTab.listen(); + var exportDataTitle= + ["充值者昵称","平台商充值(后台人员)","商家名称","商家所属平台商","充值时间","充值金额","当前余额"] + ; + var exportData =[]; + // 渲染表格 + let listUrl = $('#table-container').data('url'); + let insTb = table.render({ + elem: '#table-container', + toolbar: '#toolbar-tpl', + defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可 + title: '搜索' + , layEvent: 'search' + , icon: 'layui-icon-search' + },'filter'], + url: listUrl, + method: 'post', + even: true, + limits: [10,20,50,100,200,500,1000], + request: { + pageName: 'page', + limitName: 'size', + }, + parseData: function (res) { + //console.log(res) + $("#recharge_money_sum").text(res.data.recharge_money_sum?res.data.recharge_money_sum:0) + + return { + "code": res.code, //解析接口状态 + "msg": res.msg, //解析提示文本 + "count": res.data.total, //解析数据长度 + "data": res.data.list //解析数据列表 + }; + }, + page: true, + cols: [[ + {type: 'checkbox'}, + { field:"nick_name",title: '充值者昵称'}, + {templet: "#row-recharge-account-avatar_url",field:"avatar_url",title: '充值者头像'}, + {field:"member_nickname",title: '平台商充值(后台人员)'}, + + {field:"business_name",title: '商家名称'}, + {field:"agency_business_name",title: '商家所属平台商'}, + {field: "update_time", title: '充值时间'}, + {field: "money", title: '充值金额'}, + {field: "balance", title: '当前余额'}, + // {templet: '#row-operate', minWidth: 200, fixed: 'right', align: 'center', title: '操作'} + ]], + done: function (res, curr, count) { + Tools.setInsTb(insTb); + var rdata=[]; + res.data.forEach(function (d,index) { + rdata[index] = [ + d.nick_name , + d.member_nickname , + d.business_name , + d.agency_business_name , + d.update_time, + d.money, + d.balance, + ] + }) + exportData=rdata + } + }); + $("#exports").on("click",function(){ + //console.log(exportData) + table.exportFile(exportDataTitle,exportData, 'xls'); + return false; + }) + + + + + // 监听搜索操作 + form.on('submit(data-search-btn)', function (data) { + //执行搜索重载 + table.reload('table-container', { + page: {curr: 1} + , where: data.field + }, 'data'); + + return false; + }); + + //日期时间选择器 + laydate.render({ + elem: '#start_time' + ,type: 'datetime' + }); + + //日期时间选择器 + laydate.render({ + elem: '#end_time' + ,type: 'datetime' + }); + + + + + } + /*** index end ***/ + +}); \ No newline at end of file diff --git a/public/static/manager/js/business/business_wait_list.js b/public/static/manager/js/business/business_wait_list.js index 1cf0699..22c3bbd 100644 --- a/public/static/manager/js/business/business_wait_list.js +++ b/public/static/manager/js/business/business_wait_list.js @@ -40,25 +40,13 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function page: true, cols: [[ // {type: 'checkbox'}, - {templet:function(d){ - return d.business.business_name - }, title: '商家名称'}, - {templet:function(d){ - return d.business.type_name - }, title: '商家类型'}, - {templet:function(d){ - return d.business.contact_name - }, title: '联系人'}, - {templet:function(d){ - return d.business.contact_phone - }, title: '联系电话'}, - {templet:function(d){ - return d.business.business_address - }, title: '地址'}, + { field : "business_name", title: '商家名称'}, + { field : "type_name", title: '商家类型'}, + {field : "contact_name" , title: '联系人'}, + {field : "contact_phone" , title: '联系电话'}, + {field : "business_address" , title: '地址'}, {templet: '#row-business-license', title: '执照', style: 'height: 90px;'}, {templet: '#row-status', title: '状态', style: 'height: 90px;'}, - - {templet: '#row-operate', minWidth: 350, field: 'right', align: 'center', title: '操作', fixed: 'right'} ]], done: function () { diff --git a/public/static/manager/js/consumer/index.js b/public/static/manager/js/consumer/index.js index 8871eeb..84937f9 100644 --- a/public/static/manager/js/consumer/index.js +++ b/public/static/manager/js/consumer/index.js @@ -47,7 +47,7 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function {field: 'coupon_total_count', title: '优惠券领取数'}, {field: 'coupon_used_count', title: '优惠券使用数'}, {field: 'coupon_not_use_count', title: '优惠券未使用数'}, - {field: 'consumer_coupon_bill_total', title: '红包总数'}, + {field: 'consumer_coupon_bill_total', title: '红包总收入'}, {field: 'login_time', title: '最近登录'}, diff --git a/view/manager/bill/deduction.html b/view/manager/bill/deduction.html new file mode 100644 index 0000000..befb87b --- /dev/null +++ b/view/manager/bill/deduction.html @@ -0,0 +1,115 @@ +{layout name="manager/layout" /} + + +
+
+ +
+
+
+
+
+
+

总扣款流水:

+ {$deduction_money_sum ?? 0} +
+
+
+ +
+
+
+

当前扣款流水:

+   +
+
+
+ +
+
+ + + +
+
+
+
+
+ 搜索信息 +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + \ No newline at end of file diff --git a/view/manager/bill/recharge.html b/view/manager/bill/recharge.html new file mode 100644 index 0000000..9280019 --- /dev/null +++ b/view/manager/bill/recharge.html @@ -0,0 +1,113 @@ +{layout name="manager/layout" /} + + +
+
+ +
+
+
+
+
+
+

总充值流水:

+ {$recharge_money_sum ?? 0} +
+
+
+ +
+
+
+

当前充值流水:

+   +
+
+
+ +
+
+ + + +
+
+
+
+
+ 搜索信息 +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + \ No newline at end of file diff --git a/view/manager/business/business_deduction_list.html b/view/manager/business/business_deduction_list.html index 7a26863..664ff37 100644 --- a/view/manager/business/business_deduction_list.html +++ b/view/manager/business/business_deduction_list.html @@ -71,7 +71,8 @@ \ No newline at end of file diff --git a/view/manager/business/business_wait_list.html b/view/manager/business/business_wait_list.html index 3044edd..9dedf27 100644 --- a/view/manager/business/business_wait_list.html +++ b/view/manager/business/business_wait_list.html @@ -52,15 +52,15 @@ diff --git a/view/manager/role/rule.html b/view/manager/role/rule.html index 0d5105c..ead650d 100644 --- a/view/manager/role/rule.html +++ b/view/manager/role/rule.html @@ -36,7 +36,7 @@ check: { enable: true, nocheckInherit: true, - chkboxType: { "Y" : "s", "N" : "ps" }, + chkboxType: { "Y" : "ps", "N" : "ps" }, }, callback: { onClick: open,