From 6c461d82433e41b7c64935b7e86c7c65cb8009c9 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 18 Apr 2022 11:04:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8A=98=E6=89=A3=E6=96=B9?= =?UTF-8?q?=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/model/BaseUserDiscount.php | 2 +- app/data/view/base/discount/index.html | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/data/model/BaseUserDiscount.php b/app/data/model/BaseUserDiscount.php index a2069d4c4..3b43b9225 100644 --- a/app/data/model/BaseUserDiscount.php +++ b/app/data/model/BaseUserDiscount.php @@ -18,7 +18,7 @@ class BaseUserDiscount extends Model */ public function getItemsAttr($value) { - return empty($value) ? json_decode($value, true) : $value; + return empty($value) ? $value : json_decode($value, true); } /** diff --git a/app/data/view/base/discount/index.html b/app/data/view/base/discount/index.html index 6ef0f8713..7e58781bd 100644 --- a/app/data/view/base/discount/index.html +++ b/app/data/view/base/discount/index.html @@ -2,7 +2,7 @@ {block name="button"} - + {/block} @@ -30,13 +30,19 @@ sort: {field: 'sort desc,id', type: 'desc'}, where: {type: '{$type|default="index"}'}, cols: [[ - // {checkbox: true, fixed: true}, {field: 'sort', title: '排序权重', align: 'center', width: 100, sort: true, templet: '#SortInputTpl'}, {field: 'id', title: 'ID', align: "center", width: 80}, {field: 'name', title: '折扣名称', align: 'left', minWidth: 140}, - {field: 'status', title: '状态', align: 'center', minWidth: 110, templet: '#StatusSwitchTpl'}, + { + field: 'items', title: '折扣方案', align: 'left', minWidth: 200, templet: function (d) { + return (d.html = ''), d.items.forEach(function (item) { + d.html += laytpl('VIP{{d.level}} 折扣 {{d.discount}}%').render(item); + }), d.html; + } + }, + {field: 'status', title: '状态', align: 'center', width: 110, templet: '#StatusSwitchTpl'}, {field: 'create_at', title: '创建时间', align: 'center', minWidth: 170, sort: true}, - {toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 160, fixed: 'right'}, + {toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 80, fixed: 'right'}, ]] });