From 31f2be73d4194f0e695e62ab72b5670b94f77481 Mon Sep 17 00:00:00 2001 From: augushong Date: Tue, 16 Aug 2022 16:32:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E7=9A=84=E6=A1=88=E4=BE=8B=E6=9F=A5=E8=AF=A2=EF=BC=9B?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86=E6=8A=80=E6=9C=AF=E5=80=BA?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/mall/Goods.php | 15 ++-- app/admin/model/MallGoods.php | 10 ++- app/admin/view/mall/goods/read.html | 113 +++++++++++++++++++++++++++ public/static/admin/js/mall/goods.js | 13 ++- 4 files changed, 144 insertions(+), 7 deletions(-) create mode 100644 app/admin/view/mall/goods/read.html diff --git a/app/admin/controller/mall/Goods.php b/app/admin/controller/mall/Goods.php index b4dcc0a..10b4b9d 100644 --- a/app/admin/controller/mall/Goods.php +++ b/app/admin/controller/mall/Goods.php @@ -9,11 +9,7 @@ use app\admin\traits\Curd; use app\common\controller\AdminController; use app\admin\service\annotation\ControllerAnnotation; use app\admin\service\annotation\NodeAnotation; -use PhpOffice\PhpSpreadsheet\Cell\Coordinate; -use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use think\App; -use think\helper\Arr; /** * Class Goods @@ -87,5 +83,14 @@ class Goods extends AdminController $this->assign('row', $row); return $this->fetch(); } - + + public function read($id) + { + + $row = $this->model->find($id); + + $this->assign('row', $row); + + return $this->fetch(); + } } diff --git a/app/admin/model/MallGoods.php b/app/admin/model/MallGoods.php index 3a86c55..0212957 100644 --- a/app/admin/model/MallGoods.php +++ b/app/admin/model/MallGoods.php @@ -15,4 +15,12 @@ class MallGoods extends TimeModel return $this->belongsTo('app\admin\model\MallCate', 'cate_id', 'id'); } -} \ No newline at end of file + public function getTagListTitleAttr() + { + $tags = $this->getAttr('tag'); + + $list_tag = MallTag::whereIn('id', $tags)->column('title'); + + return $list_tag; + } +} diff --git a/app/admin/view/mall/goods/read.html b/app/admin/view/mall/goods/read.html new file mode 100644 index 0000000..8a40057 --- /dev/null +++ b/app/admin/view/mall/goods/read.html @@ -0,0 +1,113 @@ + +
+ +
+
+
+
+
+ 商品分类 +
+
+ {$row->cate->title} +
+
+
+
+ 商品标题 +
+
+ {$row->title} +
+
+
+
+ 封面 +
+
+ +
+
+
+
+ 市场价格 +
+
+ {$row->market_price} +
+
+
+
+ 折扣价格 +
+
+ {$row->discount_price} +
+
+
+
+ 虚拟销量 +
+
+ {$row->virtual_sales} +
+
+
+
+ 添加时间 +
+
+ {$row->create_time} +
+
+
+
+ 库存统计 +
+
+ {$row->total_stock} +
+
+
+
+ 剩余库存 +
+
+ {$row->stock} +
+
+
+
+ 标签 +
+
+ {volist name='$row->tag_list_title' id='vo'} +
{$vo}
+ {/volist} +
+
+
+
+ 备注信息 +
+
+ {$row.remark} +
+
+ +
+
+ 商品详情 +
+
+
+ {$row.describe|raw|htmlspecialchars_decode} +
+
+
+
+ +
+
+ +
\ No newline at end of file diff --git a/public/static/admin/js/mall/goods.js b/public/static/admin/js/mall/goods.js index 7a31d7f..fd98f99 100644 --- a/public/static/admin/js/mall/goods.js +++ b/public/static/admin/js/mall/goods.js @@ -10,6 +10,7 @@ define(["jquery", "easy-admin"], function ($, ea) { export_url: 'mall.goods/export', modify_url: 'mall.goods/modify', stock_url: 'mall.goods/stock', + read_url: 'mall.goods/read', }; var Controller = { @@ -65,7 +66,14 @@ define(["jquery", "easy-admin"], function ($, ea) { method: 'open', auth: 'stock', class: 'layui-btn layui-btn-xs layui-btn-normal', - }], + }, { + text: '详情', + url: init.read_url, + method: 'open', + auth: 'edit', + extend: 'data-full="true"', + class: 'layui-btn layui-btn-xs layui-btn-primary', + },], 'delete'] } ]], @@ -82,6 +90,9 @@ define(["jquery", "easy-admin"], function ($, ea) { stock: function () { ea.listen(); }, + read: function () { + ea.listen(); + }, }; return Controller; }); \ No newline at end of file