feat: 修改了商品列表和商品逻辑,增加了VIP价格字段,并更新了分类统计功能。
This commit is contained in:
parent
37f7d9ef4e
commit
69236a50d2
@ -46,7 +46,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreProduct::where($this->searchWhere)
|
||||
->field(['id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code'])
|
||||
->field(['id', 'image', 'store_name', 'cate_id', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
|
@ -116,16 +116,16 @@ class StoreProductLogic extends BaseLogic
|
||||
'purchase' => $params['purchase'],
|
||||
'rose' => $params['rose'],
|
||||
'is_return' => $params['is_return'],
|
||||
'price' => $params['price'],
|
||||
'vip_price' => $params['vip_price'],
|
||||
'cost' => $params['cost'],
|
||||
|
||||
];
|
||||
if ($params['rose'] > 0) {
|
||||
$rose_price = bcmul($params['cost'], bcdiv($params['rose'], 100, 2), 2);
|
||||
$data['price'] = bcadd($params['cost'], $rose_price, 2);
|
||||
} else {
|
||||
$data['price'] = 0;
|
||||
}
|
||||
StoreProduct::where('id', $params['id'])->update($data);
|
||||
|
||||
StoreBranchProduct::where('product_id', $params['id'])->update([
|
||||
'price' => $params['price'], 'vip_price' => $params['vip_price'],
|
||||
'cost' => $params['cost']
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user