feat: 添加导出功能和优化代码
This commit is contained in:
parent
18a7332f47
commit
730dc78269
@ -10,13 +10,14 @@ use app\common\model\auth\Admin;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\warehouse\Warehouse;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
|
||||
/**
|
||||
* 仓储商品单列表
|
||||
* Class WarehouseOrderLists
|
||||
* @package app\admin\listswarehouse_order
|
||||
*/
|
||||
class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
||||
{
|
||||
|
||||
|
||||
@ -91,5 +92,55 @@ class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInter
|
||||
{
|
||||
return WarehouseOrder::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
$financial_pm = $this->request->get('financial_pm');
|
||||
if ($financial_pm == 0) {
|
||||
return '出库单列表';
|
||||
} else {
|
||||
return '入库单列表';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @date 2022/11/24 16:17
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
$financial_pm = $this->request->get('financial_pm');
|
||||
if ($financial_pm == 1) {
|
||||
$data = [
|
||||
'create_time' => '操作时间',
|
||||
'warehouse_name' => '仓库',
|
||||
'supplier_name' => '供应商',
|
||||
'code' => '单号',
|
||||
'financial_pm_name' => '状态',
|
||||
'admin_name' => '填写人员',
|
||||
'completed_amount' => '已结金额',
|
||||
'outstanding_amount' => '未结金额',
|
||||
'total_price' => '总金额',
|
||||
'mark' => '备注',
|
||||
];
|
||||
} else {
|
||||
$data = [
|
||||
'create_time' => '操作时间',
|
||||
'warehouse_name' => '仓库',
|
||||
'supplier_name' => '供应商',
|
||||
'code' => '单号',
|
||||
'financial_pm_name' => '状态',
|
||||
'admin_name' => '填写人员',
|
||||
'total_price' => '总金额',
|
||||
'mark' => '备注',
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ use app\common\model\store_order\StoreOrder;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\logic\CommissionnLogic;
|
||||
use app\common\logic\PayNotifyLogic;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct;
|
||||
@ -42,11 +43,12 @@ class StoreOrderLogic extends BaseLogic
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
$cartId = [];
|
||||
$vendors_store=DictData::where('type_value','vendors_store')->column('value');
|
||||
foreach ($params['product_arr'] as $k => $v) {
|
||||
$v['uid'] = $params['user_id'];
|
||||
$v['store_id'] = $params['store_id'];
|
||||
$v['cart_num'] = $v['stock'];
|
||||
if(in_array($params['store_id'],[17,18])){
|
||||
if(in_array($params['store_id'],$vendors_store)){
|
||||
StoreBranchProduct::where('id', $v['id'])->update(['price' => $v['price'], 'vip_price' => $v['price'], 'cost' => $v['price'], 'purchase' => $v['price']]);
|
||||
}
|
||||
unset($v['id']);
|
||||
|
@ -95,8 +95,12 @@ class OrderLogic extends BaseLogic
|
||||
if($source==0){
|
||||
$source=$v['source'];
|
||||
}
|
||||
if ($source == 2) {
|
||||
$field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
|
||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
|
||||
} else {
|
||||
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
|
||||
|
||||
}
|
||||
if (!$find) {
|
||||
throw new BusinessException('商品不存在');
|
||||
}
|
||||
|
@ -188,6 +188,10 @@ class CapitalFlowLogic extends BaseLogic
|
||||
return "订单退回到采购款{$amount}元";
|
||||
case 'store_paid_deposit_add':
|
||||
return "门店增加保证金{$amount}元";
|
||||
case 'store_attrition_add':
|
||||
return "门店增加损耗金{$amount}元";
|
||||
case 'store_money_add':
|
||||
return "门店增加余额{$amount}元";
|
||||
default:
|
||||
return "订单支付{$amount}元";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user