更新价格
This commit is contained in:
parent
d2c40275a4
commit
62482c2663
@ -19,7 +19,7 @@ use app\common\model\goods\Unit;
|
|||||||
class CartList extends BaseAdminDataLists implements ListsSearchInterface, ListsExtendInterface
|
class CartList extends BaseAdminDataLists implements ListsSearchInterface, ListsExtendInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $total_price;
|
protected $total_price=0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,12 +58,11 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
$total_price = 0;
|
|
||||||
foreach ($list as $key => &$item) {
|
foreach ($list as $key => &$item) {
|
||||||
$find = Goods::where(['id' => $item['goods_id']])->field('name,imgs,unit,sell')->find();
|
$find = Goods::where(['id' => $item['goods_id']])->field('name,imgs,unit,sell')->find();
|
||||||
if($find){
|
if($find){
|
||||||
$item['goods_total_price'] = bcmul($item['cart_num'], $find['sell'], 2);
|
$item['goods_total_price'] = bcmul($item['cart_num'], $find['sell'], 2);
|
||||||
$total_price += $item['goods_total_price'];
|
$this->total_price=bcadd($this->total_price,$item['goods_total_price'],2);
|
||||||
$item['goods_name'] = $find['name'];
|
$item['goods_name'] = $find['name'];
|
||||||
$item['imgs'] = $find['imgs'];
|
$item['imgs'] = $find['imgs'];
|
||||||
$item['sell'] = $find['sell'];
|
$item['sell'] = $find['sell'];
|
||||||
@ -71,7 +70,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->total_price=$total_price;
|
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
composer.phar
BIN
composer.phar
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user