This commit is contained in:
weiz 2024-03-21 14:37:08 +08:00
parent 55d16cfdb5
commit 7430279c85
2 changed files with 216 additions and 211 deletions

View File

@ -15,10 +15,10 @@
namespace app\adminapi\logic\contract;
use app\common\logic\BaseLogic;
use app\common\model\auth\Admin;
use app\common\model\contract\Contract;
use app\common\model\contract\ContractNegotiation;
use app\common\logic\BaseLogic;
use app\common\model\custom\Custom;
use app\common\model\oa\FlowApprove;
use app\common\model\project\Project;
@ -58,7 +58,7 @@ class ContractNegotiationLogic extends BaseLogic
'labor_costs' => $params['labor_costs'] ?? 0,
'material_costs' => $params['material_costs'] ?? 0,
'warranty_amount' => $params['warranty_amount'] ?? 0,
'warranty_expire_date' => !empty($params['Warranty_expire_date']) ? strtotime($params['Warranty_expire_date']) : 0,
'warranty_expire_date' => !empty($params['warranty_expire_date']) ? strtotime($params['warranty_expire_date']) : 0,
'profit' => $profit,
'profit_rate' => $profit_rate,
'negotiation_content' => $params['negotiation_content'] ?? '',
@ -99,7 +99,7 @@ class ContractNegotiationLogic extends BaseLogic
'labor_costs' => $params['labor_costs'] ?? 0,
'material_costs' => $params['material_costs'] ?? 0,
'warranty_amount' => $params['warranty_amount'] ?? 0,
'warranty_expire_date' => !empty($params['Warranty_expire_date']) ? strtotime($params['Warranty_expire_date']) : 0,
'warranty_expire_date' => !empty($params['warranty_expire_date']) ? strtotime($params['warranty_expire_date']) : 0,
'profit' => $profit,
'profit_rate' => $profit_rate,
'negotiation_content' => $params['negotiation_content'] ?? '',
@ -159,7 +159,8 @@ class ContractNegotiationLogic extends BaseLogic
return $data->toArray();
}
public static function approve($params,$admin_id): bool{
public static function approve($params, $admin_id): bool
{
$data = ContractNegotiation::where('id', $params['id'])->findOrEmpty();
$approve_data = FlowApprove::where('id', $data['approve_id'])->findOrEmpty();
if (!empty($data['approve_id']) && $approve_data['check_status'] != 3) {

View File

@ -28,24 +28,28 @@ use think\model\concern\SoftDelete;
class ContractNegotiation extends BaseModel
{
use SoftDelete;
protected $name = 'contract_negotiation';
protected $deleteTime = 'delete_time';
public function getWarrantyExpireDateAttr($value): string
{
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
return empty($value) ? '' : date('Y-m-d', $value);
}
public function getNegotiationQuotationAttr($value){
public function getNegotiationQuotationAttr($value)
{
return !empty($value) ? json_decode($value) : '';
}
public function getNegotiationBasisAttr($value){
public function getNegotiationBasisAttr($value)
{
return !empty($value) ? json_decode($value) : '';
}
public function getNegotiationTypeTextAttr($value,$data){
public function getNegotiationTypeTextAttr($value, $data)
{
$dict = DictData::where('type_value', 'negotiation_type')->column('name', 'value');
return !empty($data['negotiation_type']) ? $dict[$data['negotiation_type']] : '';
}