From 6bfbd1f4002389a235c67f2f7bc103e9d4b2a9c1 Mon Sep 17 00:00:00 2001 From: hdm Date: Tue, 13 Dec 2022 22:06:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=88=E5=90=8C=E5=88=B0?= =?UTF-8?q?=E6=9C=9F=E5=89=8D=E6=8F=90=E9=86=92=EF=BC=8C=E6=8F=90=E5=89=8D?= =?UTF-8?q?30=E5=A4=A9=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 5 +---- app/contract/model/Contract.php | 1 + app/contract/view/index/index.html | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/common.php b/app/common.php index f9f6053..518a105 100644 --- a/app/common.php +++ b/app/common.php @@ -1510,10 +1510,7 @@ function advancedDate($type) } /** - * 间隔时间段格式化 - * @param int $time 时间戳 - * @param string $format 格式 【d:显示到天 i显示到分钟 s显示到秒】 - * @return string + * 计算按天数 */ function countDays($a, $b = 0) { diff --git a/app/contract/model/Contract.php b/app/contract/model/Contract.php index 6377831..814adb5 100644 --- a/app/contract/model/Contract.php +++ b/app/contract/model/Contract.php @@ -65,6 +65,7 @@ class Contract extends Model $item->type_name = self::$Type[(int)$item->type_a]; $item->status_name = self::$Status[(int)$item->check_status]; $item->chack_status_name = self::$Status[(int) $item->CheckStatus]; + $item->delay = countDays(date("Y-m-d"),date('Y-m-d', $item->end_time)); if($item->cost == 0){ $item->cost = '-'; } diff --git a/app/contract/view/index/index.html b/app/contract/view/index/index.html index 45b65c9..1d40a7e 100644 --- a/app/contract/view/index/index.html +++ b/app/contract/view/index/index.html @@ -93,6 +93,21 @@ var html = '' + d.type_name + ''; return html; } + },{ + field: 'interval_time', + title: '合同有效时间', + align: 'center', + width: 248, + templet: function (d) { + var html = d.interval_time; + if (d.delay > 0 && d.delay < 30) { + html += '' + d.delay + '天后到期'; + } + if (d.delay == 0) { + html += '已过期'; + } + return html; + } },{ field: 'cost', title: '合同金额/元',