feat: 订单列表添加产品店铺信息展示
This commit is contained in:
parent
496f20252a
commit
ec71741e53
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\store_cash_finance_flow;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\store_cash_finance_flow\StoreCashFinanceFlowLists;
|
||||
use app\admin\logic\store_cash_finance_flow\StoreCashFinanceFlowLogic;
|
||||
use app\admin\validate\store_cash_finance_flow\StoreCashFinanceFlowValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 现金流水控制器
|
||||
* Class StoreCashFinanceFlowController
|
||||
* @package app\admin\controller\store_cash_finance_flow
|
||||
*/
|
||||
class StoreCashFinanceFlowController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取现金流水列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new StoreCashFinanceFlowLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加现金流水
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new StoreCashFinanceFlowValidate())->post()->goCheck('add');
|
||||
$result = StoreCashFinanceFlowLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(StoreCashFinanceFlowLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑现金流水
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new StoreCashFinanceFlowValidate())->post()->goCheck('edit');
|
||||
$result = StoreCashFinanceFlowLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(StoreCashFinanceFlowLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除现金流水
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new StoreCashFinanceFlowValidate())->post()->goCheck('delete');
|
||||
StoreCashFinanceFlowLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取现金流水详情
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new StoreCashFinanceFlowValidate())->goCheck('detail');
|
||||
$result = StoreCashFinanceFlowLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\store_cash_finance_flow;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 现金流水列表
|
||||
* Class StoreCashFinanceFlowLists
|
||||
* @package app\admin\listsstore_cash_finance_flow
|
||||
*/
|
||||
class StoreCashFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_id', 'create_time'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取现金流水列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return StoreCashFinanceFlow::where($this->searchWhere)
|
||||
->field(['id', 'store_id', 'cash_price', 'receivable', 'receipts', 'admin_id', 'file', 'remark', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取现金流水数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return StoreCashFinanceFlow::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,7 @@ use app\common\enum\OrderEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
|
||||
/**
|
||||
* 订单列表列表
|
||||
@ -65,6 +65,11 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
->select()->each(function ($item) {
|
||||
$item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : '';
|
||||
$item['status_name'] = OrderEnum::getOrderType($item['status']) ?? '';
|
||||
for($i=0;$i<3;$i++){
|
||||
$find= StoreBranchProduct::where('id',$item['product'][$i]['product_id'])->field('store_name,image')->find();
|
||||
$item['product'][$i]['store_name']=$find['store_name'];
|
||||
$item['product'][$i]['image']=$find['image'];
|
||||
}
|
||||
|
||||
return $item;
|
||||
})
|
||||
|
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic\store_cash_finance_flow;
|
||||
|
||||
|
||||
use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 现金流水逻辑
|
||||
* Class StoreCashFinanceFlowLogic
|
||||
* @package app\admin\logic\store_cash_finance_flow
|
||||
*/
|
||||
class StoreCashFinanceFlowLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加现金流水
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
StoreCashFinanceFlow::create([
|
||||
|
||||
]);
|
||||
|
||||
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/06/06 10:29
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
StoreCashFinanceFlow::where('id', $params['id'])->update([
|
||||
'file' => $params['file']
|
||||
]);
|
||||
|
||||
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/06/06 10:29
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return StoreCashFinanceFlow::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取现金流水详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return StoreCashFinanceFlow::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\store_cash_finance_flow;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 现金流水验证器
|
||||
* Class StoreCashFinanceFlowValidate
|
||||
* @package app\admin\validate\store_cash_finance_flow
|
||||
*/
|
||||
class StoreCashFinanceFlowValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return StoreCashFinanceFlowValidate
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return StoreCashFinanceFlowValidate
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return StoreCashFinanceFlowValidate
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return StoreCashFinanceFlowValidate
|
||||
* @author admin
|
||||
* @date 2024/06/06 10:29
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\store_cash_finance_flow;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 现金流水模型
|
||||
* Class StoreCashFinanceFlow
|
||||
* @package app\common\model\store_cash_finance_flow
|
||||
*/
|
||||
class StoreCashFinanceFlow extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'store_cash_finance_flow';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user