From bbe79e574b0ad5839d2cf4fb356315b0ea8d5038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sun, 17 Apr 2022 16:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E4=BB=98=E9=80=9A?= =?UTF-8?q?=E9=81=93=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/base/Payment.php | 24 +++- app/data/model/BaseUserPayment.php | 10 +- app/data/view/base/payment/index.html | 144 +++++++++++-------- app/data/view/base/payment/index_search.html | 33 ++--- 4 files changed, 122 insertions(+), 89 deletions(-) diff --git a/app/data/controller/base/Payment.php b/app/data/controller/base/Payment.php index 2cd2ed7ab..37d7e0d5c 100644 --- a/app/data/controller/base/Payment.php +++ b/app/data/controller/base/Payment.php @@ -7,6 +7,7 @@ use app\data\service\PaymentService; use app\data\service\UserAdminService; use think\admin\Controller; use think\admin\extend\CodeExtend; +use think\admin\helper\QueryHelper; /** * 支付通道管理 @@ -31,10 +32,25 @@ class Payment extends Controller */ public function index() { - $this->title = '支付通道管理'; - $query = BaseUserPayment::mQuery(); - $query->where(['deleted' => 0])->order('sort desc,id desc'); - $query->like('name,code')->equal('type,status')->dateBetween('create_at')->page(); + $this->type = input('get.type', 'index'); + BaseUserPayment::mQuery()->layTable(function () { + $this->title = '支付通道管理'; + }, function (QueryHelper $query) { + $query->where(['status' => intval($this->type === 'index'), 'deleted' => 0]); + $query->like('name,code')->equal('status,type#ptype')->dateBetween('create_at'); + }); + } + + /** + * 获取支付名称 + * @param array $data + * @return void + */ + protected function _page_filter(array &$data) + { + foreach ($data as &$vo) { + $vo['ntype'] = $this->types[$vo['type']]['name'] ?? $vo['type']; + } } /** diff --git a/app/data/model/BaseUserPayment.php b/app/data/model/BaseUserPayment.php index 897961b59..4ce692e1f 100644 --- a/app/data/model/BaseUserPayment.php +++ b/app/data/model/BaseUserPayment.php @@ -11,5 +11,13 @@ use think\admin\Model; */ class BaseUserPayment extends Model { - + /** + * 格式化创建时间 + * @param string $value + * @return string + */ + public function getCreateAtAttr(string $value): string + { + return format_datetime($value); + } } \ No newline at end of file diff --git a/app/data/view/base/payment/index.html b/app/data/view/base/payment/index.html index fba0065c9..05fd14f27 100644 --- a/app/data/view/base/payment/index.html +++ b/app/data/view/base/payment/index.html @@ -1,4 +1,4 @@ -{extend name="../../admin/view/main"} +{extend name='../../admin/view/table'} {block name="button"} @@ -6,68 +6,90 @@ - + {/block} -{block name='content'} -
- {include file='base/payment/index_search'} - - {notempty name='list'} - - - - - - - - - - - - - {/notempty} - - {foreach $list as $key=>$vo} - - - - - - - - - - - {/foreach} - -
- - - - 支付名称支付编号支付方式使用状态创建时间
- - - - -
- {$vo.name|default=''} -
{$vo.code|default=''}{$types[$vo.type]['name']??$vo.type}{if $vo.status eq 0}已禁用{elseif $vo.status eq 1}已激活{/if}{$vo.create_at|format_datetime} - - 编 辑 - - - - 禁 用 - - 激 活 - - - - 删 除 - -
- {empty name='list'}没有记录哦{else}{$pagehtml|raw|default=''}{/empty} +{block name="content"} +
+
    + {foreach ['index'=>'支付管理','recycle'=>'回 收 站'] as $k=>$v}{if isset($type) and $type eq $k} +
  • {$v}
  • + {else} +
  • {$v}
  • + {/if}{/foreach} +
+
+ {include file='base/payment/index_search'} +
+
+{/block} + +{block name='script'} + + + + + + + + + + {/block} \ No newline at end of file diff --git a/app/data/view/base/payment/index_search.html b/app/data/view/base/payment/index_search.html index 9cb4bbdd7..a4d345f20 100644 --- a/app/data/view/base/payment/index_search.html +++ b/app/data/view/base/payment/index_search.html @@ -1,12 +1,6 @@
条件搜索