Merge pull request 'feat(warehouse_order): 根据不同类型计算总价' (#161) from dev into main
Reviewed-on: #161
This commit is contained in:
commit
c309ea8142
@ -237,6 +237,14 @@ class WarehouseOrderController extends BaseAdminController
|
||||
$value->store_name = $find['store_name'] ?? '';
|
||||
$value->store_info = $find['store_info'] ?? '';
|
||||
if($type==2){
|
||||
$value->price = $find['purchase'];
|
||||
$value->total_price=bcmul($find['purchase'],$value['nums'],2);
|
||||
$total_price+=$value->total_price;
|
||||
}elseif($type==3){
|
||||
$value->price = $find['cost'];
|
||||
$value->total_price=bcmul($find['cost'],$value['nums'],2);
|
||||
$total_price+=$value->total_price;
|
||||
}elseif($type==4){
|
||||
$value->price = $find['price'];
|
||||
$value->total_price=bcmul($find['price'],$value['nums'],2);
|
||||
$total_price+=$value->total_price;
|
||||
|
@ -26,7 +26,8 @@ class SupplierLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['mer_name', 'phone'],
|
||||
'=' => ['phone'],
|
||||
'%like%'=>['mer_name']
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ use app\api\validate\CartValidate;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\store\lists\cart\CartList;
|
||||
use app\common\model\order\Cart;
|
||||
use app\common\model\store_product_unit\StoreProductUnit;
|
||||
use app\store\controller\BaseAdminController;
|
||||
|
||||
|
||||
@ -29,18 +30,25 @@ class CartController extends BaseAdminController
|
||||
$params['store_id'] = $adminInfo['store_id'];
|
||||
$result = Cart::where(['uid' => 0, 'staff_id' => $adminInfo['admin_id'], 'store_id' => $adminInfo['store_id'], 'product_id' => $params['product_id'], 'is_fail' => 0, 'is_pay' => 0])->find();
|
||||
//判断起批发价
|
||||
$batch = StoreBranchProduct::where(
|
||||
['product_id'=>$params['product_id'],
|
||||
$branchProduct = StoreBranchProduct::where(
|
||||
[
|
||||
'product_id' => $params['product_id'],
|
||||
'store_id' => $adminInfo['store_id']
|
||||
]
|
||||
)->value('batch');
|
||||
if($params['cart_num'] < $batch){
|
||||
return $this->fail('起批发量低于最低值'.$batch);
|
||||
)->find();
|
||||
if ($params['cart_num'] < $branchProduct['batch']) {
|
||||
return $this->fail('起批发量低于最低值' . $branchProduct['batch']);
|
||||
}
|
||||
$count = Cart::where(['uid' => $params['uid'], 'is_pay' => 0])->count();
|
||||
if ($count > 100) {
|
||||
return $this->fail('购物车商品不能大于100个,请先结算');
|
||||
}
|
||||
if ($params['cart_num'] < 1) {
|
||||
$is_bulk = StoreProductUnit::where('id', $branchProduct['unit'])->value('is_bulk');
|
||||
if ($is_bulk == 0) {
|
||||
return $this->fail('非计量商品,不能有小数');
|
||||
}
|
||||
}
|
||||
//数量下单判断
|
||||
// $stock = StoreBranchProduct::where(
|
||||
// ['product_id'=>$params['product_id'],
|
||||
@ -96,6 +104,4 @@ class CartController extends BaseAdminController
|
||||
return $this->fail(CartLogic::getError());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user