需求按钮状态优化

This commit is contained in:
Dev
2026-10-28 16:59:16 +08:00
parent f552fb957f
commit d47beb3f56
13 changed files with 166 additions and 43 deletions
+11 -2
View File
@@ -39,7 +39,16 @@ Page({
return new Promise((resolve) => {
fetchDemandDetail({ id: id }).then(
(res) => {
console.log(res);
if (!res || res.code !== 1 || !res.data) {
wx.showToast({ title: (res && res.msg) || '加载失败', icon: 'none' });
if (!this.data.demandInfo) {
setTimeout(() => {
wx.navigateBack({ delta: 1 });
}, 1500);
}
resolve();
return;
}
const demandInfo = res.data;
this.setData({
demandInfo,
@@ -47,7 +56,7 @@ Page({
}, () => resolve()); // setData 回调:页面已重新渲染
},
() => {
//接口异常处理
wx.showToast({ title: '网络异常,请重试', icon: 'none' });
resolve();
},
);
@@ -42,7 +42,7 @@
</view>
<view class="file-empty" wx:else>暂无附件</view>
</t-collapse-panel>
<t-collapse-panel header="{{opType=='quote' ? '我的报价' : '开发人员报价'}}" value="{{3}}" expandIcon>
<t-collapse-panel wx:if="{{_calc.canSeeQuote(demandInfo)}}" header="{{opType=='quote' ? '我的报价' : '开发人员报价'}}" value="{{3}}" expandIcon>
<view>
<t-input style="--td-input-border-color: rgb(238, 116, 2);" placeholder="填写报价金额" suffix="元" align="right" type="number" value="{{opType=='quote' ? demandInfo.myBidding.quoted_price || demandInfo.demand_contracts.total_amount ||quotedPrice : demandInfo.winBidding.quoted_price}}" disabled="{{opType=='quote' && (!demandInfo.myBidding && !demandInfo.demand_contracts) ? false : true}}" tips="{{opType=='quote' && actualAccount > 0 ? '预计到手金额 ' + actualAccount + '元,已扣平台服务费' + commissionPercent + '%和' + platformName + '支付费率' + payFeePercent + '%' : ''}}" data-field="quotedPrice" bindchange="onInputChange">
<view slot="label" class="custom-label">报价</view>
@@ -53,8 +53,8 @@
<t-input label="{{opType=='quote' ? '我的优势' : 'Ta的优势'}}" placeholder="{{opType=='quote' ? '请填写您的优势技能' : '优势技能'}}" disabled="{{opType=='quote' && !demandInfo.myBidding ? false : true}}" value="{{opType=='quote' ? demandInfo.myBidding.remark : demandInfo.winBidding.remark}}" data-field="remark" bindchange="onInputChange" />
</view>
</t-collapse-panel>
<!-- 交付内容:开发者发货后展示,客户确认收货前可查看 -->
<block wx:if="{{_calc.getDelivery(demandInfo)}}">
<!-- 交付内容:仅发布者和接单开发者可见 -->
<block wx:if="{{_calc.canSeeDelivery(demandInfo)}}">
<t-collapse-panel header="交付内容" value="{{4}}" expandIcon>
<view class="delivery-section">
<view class="delivery-title">开发完成凭证截图</view>
@@ -82,6 +82,20 @@ var getDelivery = function (demandInfo) {
return demandInfo.delivery || null;
}
// 成交报价仅发布者和接单开发者可见;招标中其它开发者只看到自己的报价表单
var canSeeQuote = function (demandInfo) {
if (!demandInfo) return false;
if (demandInfo.isMy || demandInfo.isMyWin) return true;
return demandInfo.status == 1;
}
// 交付内容仅发布者和接单开发者可见
var canSeeDelivery = function (demandInfo) {
if (!demandInfo) return false;
if (!demandInfo.isMy && !demandInfo.isMyWin) return false;
return !!getDelivery(demandInfo);
}
// 开发者待发货:需求待收货(客户已付尾款)、自己中标且尚未交付
var canDeliverGoods = function (demandInfo) {
if (!demandInfo) return false;
@@ -134,6 +148,8 @@ module.exports = {
canConfirmReceipt: canConfirmReceipt,
isWaitingDeliver: isWaitingDeliver,
getDelivery: getDelivery,
canSeeQuote: canSeeQuote,
canSeeDelivery: canSeeDelivery,
canDeliverGoods: canDeliverGoods,
isDelivered: isDelivered,
isDevView: isDevView,