详情页修改类型值

This commit is contained in:
Yao 2024-09-26 17:36:51 +08:00
parent 9a7362e1a8
commit 5d8d41392c
2 changed files with 12 additions and 7 deletions

@ -23,11 +23,11 @@
</colgroup>
<thead>
<tr style="background-color: #f3f5f9">
<th style="width: 120px;text-align: center">商品</th>
<th style="width: 120px;text-align: center">商品规格</th>
<th style="width: 60px;text-align: center">商品价格</th>
<th style="width: 30px;text-align: center">抢购价格</th>
<th style="width: 30px;text-align: center">库存</th>
<th style="width: 240px;text-align: center">商品</th>
<th style="width: 240px;text-align: center">商品规格</th>
<th style="width: 120px;text-align: center">商品价格</th>
<th style="width: 120px;text-align: center">抢购价格</th>
<th style="width: 120px;text-align: center">库存</th>
</tr>
</thead>
<tbody>

@ -100,8 +100,11 @@ class GoodsLogic extends Logic
// 转数组
$goodsDetailArr = $goodsDetail->toArray();
$goodsDetailArr['poster'] = !empty($goodsDetailArr['poster']) ? UrlServer::getFileUrl($goodsDetailArr['poster']) : '';
$goodsDetailArr['poster'] = !empty($goodsDetailArr['poster']) ? UrlServer::getFileUrl($goodsDetailArr['poster']) : '';
foreach ($goodsDetailArr['goods_item'] as &$valItem){
$valItem['limited_num'] = 0;
}
// 新增点击记录
GoodsClick::create([
'shop_id' => $goodsDetailArr['shop_id'],
@ -212,6 +215,7 @@ class GoodsLogic extends Logic
'type' => 0,
'type_desc' => '普通商品'
];
// 检查商品是否在参与活动,替换商品价格
$goodsDetailArr = self::checkActivity($goodsDetailArr);
// 检查商品是否参与抢购活动,替换商品价格、库存。
@ -1084,7 +1088,7 @@ class GoodsLogic extends Logic
// 获取该商品的秒杀信息
$GroupbuyGoods_info = GroupbuyGoods::where([
'goods_id' => $goods['id'],
])->column('goods_id,item_id,activity_price,stock', 'item_id');
])->column('goods_id,item_id,activity_price,stock,limited_num', 'item_id');
}
@ -1106,6 +1110,7 @@ class GoodsLogic extends Logic
$item['price'] = $GroupbuyGoods_info[$item['id']]['activity_price'];
// SKU库存替换抢购库存
$item['stock'] = $GroupbuyGoods_info[$item['id']]['stock'];
$item['limited_num'] =$GroupbuyGoods_info[$item['id']]['limited_num'];
}
$goods['activity'] = [