Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
php_frq_api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ec08dd6a
authored
May 13, 2021
by
duwenjun
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
关闭报价
parent
ef3e99f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
3 deletions
app/Http/Controllers/ApiController.php
app/Model/QuoteModel.php
app/Http/Controllers/ApiController.php
View file @
ec08dd6a
...
@@ -213,7 +213,13 @@ class ApiController extends Controller
...
@@ -213,7 +213,13 @@ class ApiController extends Controller
Export
((
new
QuoteModel
())
->
cancel
(
$input
));
Export
((
new
QuoteModel
())
->
cancel
(
$input
));
}
}
// 撤销报价
// 关闭报价
public
function
ApiCloseQuote
(
$input
,
$id
)
{
Export
((
new
QuoteModel
())
->
close
(
$input
));
}
// 删除报价
public
function
ApiDelQuote
(
$input
,
$id
)
public
function
ApiDelQuote
(
$input
,
$id
)
{
{
Export
((
new
QuoteModel
())
->
del
(
$input
));
Export
((
new
QuoteModel
())
->
del
(
$input
));
...
...
app/Model/QuoteModel.php
View file @
ec08dd6a
...
@@ -432,7 +432,7 @@ class QuoteModel extends Model
...
@@ -432,7 +432,7 @@ class QuoteModel extends Model
if
(
!
$count
)
{
if
(
!
$count
)
{
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
update
([
'status'
=>
1
]);
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
update
([
'status'
=>
1
]);
}
else
{
// 若不为0,且该询价明细状态为‘已选中’,则更新为已报价
}
else
{
// 若不为0,且该询价明细状态为‘已选中’,则更新为已报价
$status
=
$InquiryItemsModel
->
where
(
'i
nquiry_items_i
d'
,
$status
=
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
value
(
'status'
);
$quote_info
[
'inquiry_items_id'
])
->
value
(
'status'
);
if
(
$status
==
3
)
{
if
(
$status
==
3
)
{
...
@@ -465,6 +465,50 @@ class QuoteModel extends Model
...
@@ -465,6 +465,50 @@ class QuoteModel extends Model
return
[
0
,
'撤销成功'
];
return
[
0
,
'撤销成功'
];
}
}
// 关闭报价
public
function
close
(
$input
)
{
$id
=
$input
[
'id'
];
if
(
!
$id
)
{
return
[
-
1
,
'参数缺失'
];
}
try
{
$quote_info
=
$this
->
find
(
$id
);
if
(
empty
(
$quote_info
))
{
return
[
1
,
'报价单不存在,请检查'
];
}
if
(
$quote_info
[
'status'
]
==
self
::
STATUS_CLOSE
)
{
return
[
1
,
'关闭失败,该报价已关闭,请刷新页面查看'
];
}
if
(
$quote_info
[
'status'
]
!==
self
::
STATUS_OFFER
)
{
return
[
1
,
'关闭失败,该报价状态不能关闭'
];
}
$res
=
$this
->
where
(
'id'
,
$id
)
->
where
(
'status'
,
self
::
STATUS_OFFER
)
->
update
([
'status'
=>
self
::
STATUS_CLOSE
]);
// 查看当前询价明细的报价数量,若为0,则更新询价明细状态为待报价
$count
=
$this
->
where
(
'inquiry_items_id'
,
$quote_info
[
'inquiry_items_id'
])
->
whereNotIn
(
'status'
,
[
self
::
STATUS_CANCEL
,
self
::
STATUS_CLOSE
,
self
::
STATUS_DEL
])
->
count
();
$InquiryItemsModel
=
new
InquiryItemsModel
;
if
(
!
$count
)
{
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
update
([
'status'
=>
1
]);
}
else
{
// 若不为0,且该询价明细状态为‘已选中’,则更新为已报价
$status
=
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
value
(
'status'
);
if
(
$status
==
3
)
{
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
update
([
'status'
=>
2
]);
}
}
}
catch
(
Exception
$e
)
{
return
[
1
,
$e
->
getMessage
()];
}
return
[
0
,
'撤销成功'
];
}
// 删除报价
// 删除报价
public
function
del
(
$input
)
public
function
del
(
$input
)
{
{
...
@@ -475,6 +519,9 @@ class QuoteModel extends Model
...
@@ -475,6 +519,9 @@ class QuoteModel extends Model
try
{
try
{
$quote_info
=
$this
->
find
(
$id
);
$quote_info
=
$this
->
find
(
$id
);
if
(
empty
(
$quote_info
))
{
return
[
1
,
'报价单不存在,请检查'
];
}
if
(
$quote_info
[
'status'
]
==
self
::
STATUS_DEL
)
{
if
(
$quote_info
[
'status'
]
==
self
::
STATUS_DEL
)
{
return
[
1
,
'删除失败,该报价已删除,请刷新页面查看'
];
return
[
1
,
'删除失败,该报价已删除,请刷新页面查看'
];
...
@@ -491,7 +538,7 @@ class QuoteModel extends Model
...
@@ -491,7 +538,7 @@ class QuoteModel extends Model
if
(
!
$count
)
{
if
(
!
$count
)
{
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
update
([
'status'
=>
1
]);
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
update
([
'status'
=>
1
]);
}
else
{
// 若不为0,且该询价明细状态为‘已选中’,则更新为已报价
}
else
{
// 若不为0,且该询价明细状态为‘已选中’,则更新为已报价
$status
=
$InquiryItemsModel
->
where
(
'i
nquiry_items_i
d'
,
$status
=
$InquiryItemsModel
->
where
(
'id'
,
$quote_info
[
'inquiry_items_id'
])
->
value
(
'status'
);
$quote_info
[
'inquiry_items_id'
])
->
value
(
'status'
);
if
(
$status
==
3
)
{
if
(
$status
==
3
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment