需求按钮状态优化

This commit is contained in:
Dev
2026-10-28 17:36:00 +08:00
parent d47beb3f56
commit 7fa0d3ff04
3 changed files with 16 additions and 11 deletions
@@ -142,9 +142,15 @@ class Demand extends Api
} else { } else {
$button = ['key' => DemandService::BUTTON_DELIVER_GOODS, 'name' => '去发货', 'theme' => 'danger']; $button = ['key' => DemandService::BUTTON_DELIVER_GOODS, 'name' => '去发货', 'theme' => 'danger'];
} }
} elseif ((int)$item->status === DemandService::STATUS_ACCEPTING && $item->isMyWin && (int)$item->accept_status === CommonService::ONGOING) {
// 与「我投标的」一致:接单开发者等待客户验收
$button = ['key' => '', 'name' => '待验收', 'theme' => 'light'];
} elseif (in_array((int)$item->status, [DemandService::STATUS_NO, DemandService::STATUS_CANCEL], true)) {
// 已关闭、已取消不再因为投过标而显示「已投标」
$button = ['name' => '查看详情', 'theme' => 'light'];
} elseif ($item->is_bid) { } elseif ($item->is_bid) {
$button = ['key' => '', 'name' => '已投标', 'theme' => 'light']; $button = ['key' => '', 'name' => '已投标', 'theme' => 'light'];
} elseif ($item->status == 1) { } elseif ((int)$item->status === DemandService::STATUS_BIDDING && !$item->isMy) {
$button = ['key' => 'bid', 'name' => '参与投标', 'theme' => 'danger']; $button = ['key' => 'bid', 'name' => '参与投标', 'theme' => 'danger'];
} }
} elseif ($opType == 'myQuote') { } elseif ($opType == 'myQuote') {
@@ -159,7 +165,7 @@ class Demand extends Api
} }
} elseif ($item->status == 3 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) { } elseif ($item->status == 3 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
$button = ['key' => DemandService::BUTTON_COMPLETE_WORK, 'name' => '工作完成', 'theme' => 'danger']; $button = ['key' => DemandService::BUTTON_COMPLETE_WORK, 'name' => '工作完成', 'theme' => 'danger'];
} elseif ($item->status == 4 && $item->accept_status == 1) { } elseif ((int)$item->status === DemandService::STATUS_ACCEPTING && $item->isMyWin && (int)$item->accept_status === CommonService::ONGOING) {
$button = ['key' => '', 'name' => '待验收', 'theme' => 'light']; $button = ['key' => '', 'name' => '待验收', 'theme' => 'light'];
} elseif ($item->status == 5 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) { } elseif ($item->status == 5 && $item->isMyWin && $item->winBidding->bidding_status == 2 && $item->winBidding->process_status == 2) {
//客户支付尾款后,开发者发货交付 //客户支付尾款后,开发者发货交付
@@ -168,7 +174,7 @@ class Demand extends Api
} else { } else {
$button = ['key' => DemandService::BUTTON_DELIVER_GOODS, 'name' => '去发货', 'theme' => 'danger']; $button = ['key' => DemandService::BUTTON_DELIVER_GOODS, 'name' => '去发货', 'theme' => 'danger'];
} }
} elseif ($item->status == 5 && $item->accept_status == 2) { } elseif ((int)$item->status === DemandService::STATUS_CONFIRM_RECEIPT && $item->isMyWin && (int)$item->accept_status === CommonService::SUCCESS) {
$button = ['key' => '', 'name' => '待收货', 'theme' => 'light']; $button = ['key' => '', 'name' => '待收货', 'theme' => 'light'];
} }
} elseif ($opType == 'my') { } elseif ($opType == 'my') {
@@ -1,6 +1,8 @@
// demandInfo 首屏为 null,所有判断需先做空值保护 // demandInfo 首屏为 null,所有判断需先做空值保护
var canSubmitBidding = function (demandInfo) { var canSubmitBidding = function (demandInfo) {
if (!demandInfo) return false; if (!demandInfo) return false;
// 发布者不能给自己的需求报名
if (demandInfo.isMy) return false;
return demandInfo.status == 1 && !demandInfo.myBidding; return demandInfo.status == 1 && !demandInfo.myBidding;
} }
+5 -8
View File
@@ -283,16 +283,12 @@ Page({
if (!item) { if (!item) {
return; return;
} }
// 交易完成只允许发布者和接单开发者进入详情 // 交易完成只允许发布者和接单开发者进入详情,其他人点击无反应
if (item.button && item.button.key === 'finished' && !item.isMy && !item.isMyWin) { if (item.button && item.button.key === 'finished' && !item.isMy && !item.isMyWin) {
wx.showToast({
title: '仅发布者和接单开发者可查看',
icon: 'none',
});
return; return;
} }
// 参与投标仅开发者可进入报价;未入驻先提示,确定后再去申请 // 参与投标仅开发者可进入报价;发布者不能给自己报名。未入驻先提示,确定后再去申请
if (item.button && item.button.key === 'bid') { if (item.button && item.button.key === 'bid' && !item.isMy) {
const role = (wx.getStorageSync('userInfo') || {}).role || ''; const role = (wx.getStorageSync('userInfo') || {}).role || '';
if (role !== 'dev') { if (role !== 'dev') {
wx.showModal({ wx.showModal({
@@ -314,7 +310,8 @@ Page({
} }
const { id } = item; const { id } = item;
const type = this.data.opType; const type = this.data.opType;
const opType = type == 'all' || type == 'myQuote' ? 'quote' : 'view'; // 大厅和我投标的默认是开发者视角;发布者看自己的需求走客户视角,避免进入报名
const opType = (type == 'all' || type == 'myQuote') && !item.isMy ? 'quote' : 'view';
//按后端返回的按钮动作标识判断(acceptPassed=验收), //按后端返回的按钮动作标识判断(acceptPassed=验收),
//命中时带标记,详情页据此弹出「先到沟通群体验后再验收」的提示 //命中时带标记,详情页据此弹出「先到沟通群体验后再验收」的提示
const isAccept = !!item.button && item.button.key === 'acceptPassed'; const isAccept = !!item.button && item.button.key === 'acceptPassed';