验收环节优化
This commit is contained in:
@@ -117,69 +117,71 @@ class Demand extends Api
|
||||
}
|
||||
$btnNameFun = function ($opType, $item) {
|
||||
$button = ['name' => '查看详情', 'theme' => 'light'];
|
||||
// key 为按钮动作标识(复用 DemandService::BUTTON_* 常量),
|
||||
// 前端据此判断按钮类型,避免依赖中文文案;无动作的展示型按钮 key 为空
|
||||
if ($opType == 'all') {
|
||||
if ($item->status == 1 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 1) {
|
||||
$button = ['name' => '确认接单', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_CONFIRM, 'name' => '确认接单', 'theme' => 'danger'];
|
||||
} elseif ($item->status == 2 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
|
||||
if ($item->demand_contracts && $item->demand_contracts->status == ContractService::STATUS_FINISHED && $item->demand_contracts->status2 == ContractService::STATUS_ONGOING) {
|
||||
// 开发者已签约,等待客户签约
|
||||
$button = ['name' => '签约中', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '签约中', 'theme' => 'light'];
|
||||
} else {
|
||||
$button = ['name' => '合同签约', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_CONTRACT_DEV, 'name' => '合同签约', 'theme' => 'danger'];
|
||||
}
|
||||
} elseif ($item->status == 3 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
|
||||
$button = ['name' => '工作完成', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_COMPLETE_WORK, 'name' => '工作完成', 'theme' => 'danger'];
|
||||
} elseif ($item->status == 5 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
|
||||
//客户支付尾款后,开发者发货交付
|
||||
if ($item->hasDelivery) {
|
||||
$button = ['name' => '已发货', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '已发货', 'theme' => 'light'];
|
||||
} else {
|
||||
$button = ['name' => '去发货', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_DELIVER_GOODS, 'name' => '去发货', 'theme' => 'danger'];
|
||||
}
|
||||
} elseif ($item->is_bid) {
|
||||
$button = ['name' => '已投标', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '已投标', 'theme' => 'light'];
|
||||
} elseif ($item->status == 1) {
|
||||
$button = ['name' => '参与投标', 'theme' => 'danger'];
|
||||
$button = ['key' => 'bid', 'name' => '参与投标', 'theme' => 'danger'];
|
||||
}
|
||||
} elseif ($opType == 'myQuote') {
|
||||
if ($item->status == 1 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 1) {
|
||||
$button = ['name' => '确认接单', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_CONFIRM, 'name' => '确认接单', 'theme' => 'danger'];
|
||||
} elseif ($item->status == 2 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
|
||||
if ($item->demand_contracts && $item->demand_contracts->status == ContractService::STATUS_FINISHED && $item->demand_contracts->status2 == ContractService::STATUS_ONGOING) {
|
||||
// 开发者已签约,等待客户签约
|
||||
$button = ['name' => '签约中', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '签约中', 'theme' => 'light'];
|
||||
} else {
|
||||
$button = ['name' => '合同签约', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_CONTRACT_DEV, 'name' => '合同签约', 'theme' => 'danger'];
|
||||
}
|
||||
} elseif ($item->status == 3 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
|
||||
$button = ['name' => '工作完成', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_COMPLETE_WORK, 'name' => '工作完成', 'theme' => 'danger'];
|
||||
} elseif ($item->status == 4 && $item->accept_status == 1) {
|
||||
$button = ['name' => '待验收', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '待验收', 'theme' => 'light'];
|
||||
} elseif ($item->status == 5 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
|
||||
//客户支付尾款后,开发者发货交付
|
||||
if ($item->hasDelivery) {
|
||||
$button = ['name' => '已发货', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '已发货', 'theme' => 'light'];
|
||||
} else {
|
||||
$button = ['name' => '去发货', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_DELIVER_GOODS, 'name' => '去发货', 'theme' => 'danger'];
|
||||
}
|
||||
} elseif ($item->status == 5 && $item->accept_status == 2) {
|
||||
$button = ['name' => '待收货', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '待收货', 'theme' => 'light'];
|
||||
}
|
||||
} elseif ($opType == 'my') {
|
||||
if ($item->status == 2 && $item->demand_contracts && $item->demand_contracts->status2 == 1) {
|
||||
$button = ['name' => '合同签约', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_CONTRACT_CUSTOMER, 'name' => '合同签约', 'theme' => 'danger'];
|
||||
} elseif ($item->status == 2) {
|
||||
$button = ['name' => '详聊沟通', 'theme' => 'danger'];
|
||||
$button = ['key' => '', 'name' => '详聊沟通', 'theme' => 'danger'];
|
||||
} elseif ($item->status == 3 && $item->work_status == 1) {
|
||||
$button = ['name' => '工作中', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '工作中', 'theme' => 'light'];
|
||||
} elseif ($item->status == 4 && $item->accept_status == 1) {
|
||||
$button = ['name' => '前去验收', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_ACCEPT_PASSED, 'name' => '前去验收', 'theme' => 'danger'];
|
||||
} elseif ($item->status == 5 && $item->accept_status == 2) {
|
||||
//开发者发货后客户才能确认收货
|
||||
if ($item->hasDelivery) {
|
||||
$button = ['name' => '确认收货', 'theme' => 'danger'];
|
||||
$button = ['key' => DemandService::BUTTON_CONFIRM_RECEIPT, 'name' => '确认收货', 'theme' => 'danger'];
|
||||
} else {
|
||||
$button = ['name' => '待发货', 'theme' => 'light'];
|
||||
$button = ['key' => '', 'name' => '待发货', 'theme' => 'light'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user