Merge pull request 'dev' (#249) from dev into main
Reviewed-on: https://gitea.lihaink.cn/mkm/multi-store/pulls/249
This commit is contained in:
commit
2b4011c575
@ -135,7 +135,7 @@ class StoreOrderController extends BaseAdminController
|
|||||||
if ($res == false) {
|
if ($res == false) {
|
||||||
return $this->fail('退款失败');
|
return $this->fail('退款失败');
|
||||||
}
|
}
|
||||||
return $this->success('退款成功');
|
return $this->success('退款成功',[],1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,7 @@ use app\common\model\warehouse_product\WarehouseProduct;
|
|||||||
*/
|
*/
|
||||||
class BeforehandOrderThreeLists extends BaseAdminDataLists implements ListsSearchInterface
|
class BeforehandOrderThreeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
{
|
{
|
||||||
|
public $outbound_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 设置搜索条件
|
* @notes 设置搜索条件
|
||||||
@ -48,6 +48,7 @@ class BeforehandOrderThreeLists extends BaseAdminDataLists implements ListsSearc
|
|||||||
if(empty($outbound_id)){
|
if(empty($outbound_id)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
$this->outbound_id=$outbound_id;
|
||||||
$this->searchWhere[]=['oid','=',$outbound_id];
|
$this->searchWhere[]=['oid','=',$outbound_id];
|
||||||
$this->searchWhere[]=['financial_pm','=',0];
|
$this->searchWhere[]=['financial_pm','=',0];
|
||||||
return WarehouseProduct::where($this->searchWhere)->select()
|
return WarehouseProduct::where($this->searchWhere)->select()
|
||||||
@ -79,7 +80,11 @@ class BeforehandOrderThreeLists extends BaseAdminDataLists implements ListsSearc
|
|||||||
*/
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
return WarehouseProduct::where($this->searchWhere)->count();
|
if($this->outbound_id>0){
|
||||||
|
return WarehouseProduct::where($this->searchWhere)->count();
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -19,7 +19,7 @@ use app\common\model\warehouse_product\WarehouseProduct;
|
|||||||
class BeforehandOrderTwoLists extends BaseAdminDataLists implements ListsSearchInterface
|
class BeforehandOrderTwoLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public $warehousing_id;
|
||||||
/**
|
/**
|
||||||
* @notes 设置搜索条件
|
* @notes 设置搜索条件
|
||||||
* @return \string[][]
|
* @return \string[][]
|
||||||
@ -48,6 +48,7 @@ class BeforehandOrderTwoLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
if(empty($warehousing_id)){
|
if(empty($warehousing_id)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
$this->warehousing_id=$warehousing_id;
|
||||||
$this->searchWhere[]=['oid','=',$warehousing_id];
|
$this->searchWhere[]=['oid','=',$warehousing_id];
|
||||||
$this->searchWhere[]=['financial_pm','=',1];
|
$this->searchWhere[]=['financial_pm','=',1];
|
||||||
return WarehouseProduct::where($this->searchWhere)->select()
|
return WarehouseProduct::where($this->searchWhere)->select()
|
||||||
@ -79,7 +80,11 @@ class BeforehandOrderTwoLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
*/
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
return WarehouseProduct::where($this->searchWhere)->count();
|
if($this->warehousing_id>0){
|
||||||
|
return WarehouseProduct::where($this->searchWhere)->count();
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -41,6 +41,7 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
$total_price = 0;
|
$total_price = 0;
|
||||||
$uid = $params['uid'] ?? 0;
|
$uid = $params['uid'] ?? 0;
|
||||||
foreach ($params['product_arr'] as $k => $v) {
|
foreach ($params['product_arr'] as $k => $v) {
|
||||||
|
$datas[$k]['mark'] = $v['mark']??'';
|
||||||
$datas[$k]['product_id'] = $v['product_id'];
|
$datas[$k]['product_id'] = $v['product_id'];
|
||||||
$datas[$k]['uid'] = $uid;
|
$datas[$k]['uid'] = $uid;
|
||||||
$datas[$k]['cart_num'] = $v['nums'];
|
$datas[$k]['cart_num'] = $v['nums'];
|
||||||
@ -61,7 +62,8 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
'pay_type' => 0,
|
'pay_type' => 0,
|
||||||
'deduction_price' => 0,
|
'deduction_price' => 0,
|
||||||
'paid' => 0,
|
'paid' => 0,
|
||||||
'mark' => $params['mark'] ?? ''
|
'mark' => $params['mark'] ?? '',
|
||||||
|
'order_type' => $params['order_type'] ?? 0
|
||||||
]);
|
]);
|
||||||
foreach ($datas as $k => $v) {
|
foreach ($datas as $k => $v) {
|
||||||
$datas[$k]['bhoid'] = $order['id'];
|
$datas[$k]['bhoid'] = $order['id'];
|
||||||
@ -156,6 +158,7 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
'store_id' => $store_id,
|
'store_id' => $store_id,
|
||||||
'financial_pm' => 0,
|
'financial_pm' => 0,
|
||||||
'batch' => 1,
|
'batch' => 1,
|
||||||
|
'order_type' => $order['order_type'],
|
||||||
'nums' => $arr['cart_num'],
|
'nums' => $arr['cart_num'],
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'admin_id' => $admin_id,
|
'admin_id' => $admin_id,
|
||||||
|
@ -97,8 +97,8 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
BeforehandOrderCartInfo::where('id', $params['id'])->update([
|
BeforehandOrderCartInfo::where('id', $params['id'])->update([
|
||||||
'price' => $params['purchase'],
|
'price' => $params['purchases'],
|
||||||
'total_price' => $params['total_price'],
|
'total_price' => bcmul($params['purchases'],$params['nums'],2),
|
||||||
'cart_num' => $params['nums'],
|
'cart_num' => $params['nums'],
|
||||||
]);
|
]);
|
||||||
$bhoid = $params['bhoid'];
|
$bhoid = $params['bhoid'];
|
||||||
@ -117,6 +117,9 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function oneClickStorage($params)
|
public static function oneClickStorage($params)
|
||||||
{
|
{
|
||||||
|
if($params['bhoid']<=0){
|
||||||
|
throw new BusinessException('参数错误');
|
||||||
|
}
|
||||||
$count = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0, 'buyer_nums' => 0])->count('id');
|
$count = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0, 'buyer_nums' => 0])->count('id');
|
||||||
$warehousing_id = BeforehandOrder::where('id', $params['bhoid'])->value('warehousing_id');
|
$warehousing_id = BeforehandOrder::where('id', $params['bhoid'])->value('warehousing_id');
|
||||||
|
|
||||||
|
@ -64,18 +64,22 @@ class SystemStoreStorageLogic extends BaseLogic
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$find=SystemStoreStorage::where(['id' => $params['id']])->find();
|
$find=SystemStoreStorage::where(['id' => $params['id']])->find();
|
||||||
|
|
||||||
if($find){
|
if($find){
|
||||||
$find->save(['status'=>1,'staff_id'=>$params['staff_id']??0,'admin_id'=>$params['admin_id']??0,'mark'=>'入库时间:'.date('Y-m-d H:i:s',time())]);
|
if($find['order_type']==1){
|
||||||
$branch_product=StoreBranchProduct::where(['product_id'=>$find['product_id'],'store_id'=>$find['store_id']])->find();
|
$find->save(['status'=>1,'staff_id'=>$params['staff_id']??0,'admin_id'=>$params['admin_id']??0,'mark'=>'入库时间:'.date('Y-m-d H:i:s',time())]);
|
||||||
if($branch_product){
|
$branch_product=StoreBranchProduct::where(['product_id'=>$find['product_id'],'store_id'=>$find['store_id']])->find();
|
||||||
$branch_product->save(['stock'=>$branch_product['stock']+$find['nums']]);
|
if($branch_product){
|
||||||
|
$branch_product->save(['stock'=>$branch_product['stock']+$find['nums']]);
|
||||||
|
}else{
|
||||||
|
$storeProduct = StoreProduct::where('id', $find['product_id'])->findOrEmpty();
|
||||||
|
$storeBranchProduct = StoreProductLogic::ordinary(['id' => $find['product_id']], $find['store_id'], 0, $storeProduct);
|
||||||
|
$storeBranchProduct->stock = $find['nums'];
|
||||||
|
$storeBranchProduct->save();
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$storeProduct = StoreProduct::where('id', $find['product_id'])->findOrEmpty();
|
$find->save(['status'=>1,'staff_id'=>$params['staff_id']??0,'admin_id'=>$params['admin_id']??0,'mark'=>'确认时间:'.date('Y-m-d H:i:s',time())]);
|
||||||
$storeBranchProduct = StoreProductLogic::ordinary(['id' => $find['product_id']], $find['store_id'], 0, $storeProduct);
|
|
||||||
$storeBranchProduct->stock = $find['nums'];
|
|
||||||
$storeBranchProduct->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
|
@ -154,6 +154,7 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
SystemStoreStorage::create([
|
SystemStoreStorage::create([
|
||||||
'store_id' => $params['store_id'],
|
'store_id' => $params['store_id'],
|
||||||
'admin_id' => $params['admin_id'],
|
'admin_id' => $params['admin_id'],
|
||||||
|
'order_type' => $params['order_type'],
|
||||||
'staff_id' => 0,
|
'staff_id' => 0,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'product_id' => $params['product_id'],
|
'product_id' => $params['product_id'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user