feat(SystemStoreStorageLists): 优化了系统商店存储列表的商品名称和图片获取方式
This commit is contained in:
parent
a5ccb95cf2
commit
a6031b3318
@ -59,8 +59,8 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
|
||||
$item['staff_name'] = '无';
|
||||
}
|
||||
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image')->find();
|
||||
$item['store_name']=$find['store_name'];
|
||||
$item['image']=$find['image'];
|
||||
$item['store_name']=$find['store_name']??'';
|
||||
$item['image']=$find['image']??'';
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
116
app/admin/logic/purchase_order/PurchaseOrderLogic.php
Normal file
116
app/admin/logic/purchase_order/PurchaseOrderLogic.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic\purchase_order;
|
||||
|
||||
|
||||
use app\common\model\purchase_order\PurchaseOrder;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 采购订单逻辑
|
||||
* Class PurchaseOrderLogic
|
||||
* @package app\admin\logic\purchase_order
|
||||
*/
|
||||
class PurchaseOrderLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加采购订单
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
PurchaseOrder::create([
|
||||
'store_id' => $params['store_id'],
|
||||
'order_arr' => $params['order_arr'],
|
||||
'order_id' => $params['order_id'],
|
||||
'total' => $params['total'],
|
||||
'actual' => $params['actual'],
|
||||
'money' => $params['money'],
|
||||
'paid' => $params['paid'],
|
||||
'file' => $params['file'],
|
||||
'data' => $params['data'],
|
||||
'is_opurchase' => $params['is_opurchase'],
|
||||
'is_mer' => $params['is_mer'],
|
||||
'storage' => $params['storage']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑采购订单
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
PurchaseOrder::where('id', $params['id'])->update([
|
||||
'store_id' => $params['store_id'],
|
||||
'order_arr' => $params['order_arr'],
|
||||
'order_id' => $params['order_id'],
|
||||
'total' => $params['total'],
|
||||
'actual' => $params['actual'],
|
||||
'money' => $params['money'],
|
||||
'paid' => $params['paid'],
|
||||
'file' => $params['file'],
|
||||
'data' => $params['data'],
|
||||
'is_opurchase' => $params['is_opurchase'],
|
||||
'is_mer' => $params['is_mer'],
|
||||
'storage' => $params['storage']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除采购订单
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return PurchaseOrder::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取采购订单详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return PurchaseOrder::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
86
app/admin/validate/purchase_order/PurchaseOrderValidate.php
Normal file
86
app/admin/validate/purchase_order/PurchaseOrderValidate.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\purchase_order;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 采购订单验证器
|
||||
* Class PurchaseOrderValidate
|
||||
* @package app\admin\validate\purchase_order
|
||||
*/
|
||||
class PurchaseOrderValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'store_id' => 'require',
|
||||
'order_id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'store_id' => '所属商户',
|
||||
'order_id' => '单据编号',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return PurchaseOrderValidate
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['store_id','order_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return PurchaseOrderValidate
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','store_id','order_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return PurchaseOrderValidate
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return PurchaseOrderValidate
|
||||
* @author admin
|
||||
* @date 2024/08/01 16:32
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user