From 4805e306ec6d505f6bb579da6c1248d2dbe86904 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Sun, 15 Sep 2024 14:58:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=A7=84=E6=A0=BC=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/shop/LocalStoreGoodsLogic.php | 12 +++++++ .../view/shop/local_store_goods/detail.html | 33 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/app/admin/logic/shop/LocalStoreGoodsLogic.php b/app/admin/logic/shop/LocalStoreGoodsLogic.php index a822ee5f..ece638d7 100755 --- a/app/admin/logic/shop/LocalStoreGoodsLogic.php +++ b/app/admin/logic/shop/LocalStoreGoodsLogic.php @@ -5,6 +5,7 @@ namespace app\admin\logic\shop; use app\common\basics\Logic; use app\common\enum\LocalStoreGoodsEnum; use app\common\model\localstore\LocalStoreGoods; +use app\common\model\localstore\LocalStoreGoodsItem; use think\facade\Config; class LocalStoreGoodsLogic extends Logic @@ -79,6 +80,17 @@ class LocalStoreGoodsLogic extends Logic { $data = LocalStoreGoods::with('pic')->where(['id' => $id])->find()->toArray(); + // 查找多规格 + if ($data['is_multiple_spec'] == 1) { + $data['item'] = LocalStoreGoodsItem::where([ + 'goods_id' => $id + ])->field('id, image, spec_value_str, price, stock, note')->select(); + + foreach ($data['item'] as &$v) { + $v['image'] = Config::get('aliyunoss.domain') . $v['image']; + } + } +// dump($data);die; if ($data) { foreach ($data['pic'] as &$v) { $v['url'] = Config::get('aliyunoss.domain') . $v['url']; diff --git a/app/admin/view/shop/local_store_goods/detail.html b/app/admin/view/shop/local_store_goods/detail.html index 3cbc88f9..fe472926 100755 --- a/app/admin/view/shop/local_store_goods/detail.html +++ b/app/admin/view/shop/local_store_goods/detail.html @@ -24,6 +24,20 @@ margin-right: 20px; line-height: 36px; } + + .flex { + display: flex; + align-items: center; + justify-content: flex-start; + } + + .flex:not(:first-child) { + margin-left: 15px; + } + + .m-r-10 { + margin-right: 10px; + }
@@ -61,6 +75,25 @@
+ {if condition="$data.is_multiple_spec == 1"} +
+ +
+ {foreach $data.item as $key => $value} +
+
+ img +
+
规格名称:{$value.spec_value_str}
+
价格:¥{$value.price}
+
库存:¥{$value.stock}
+
备注:{$value.note ? $value.note : '无'}
+
+ {/foreach} +
+
+ {/if} +