需求按钮状态优化
This commit is contained in:
@@ -531,41 +531,53 @@ Page({
|
||||
return !!error;
|
||||
},
|
||||
|
||||
// 表单验证
|
||||
// 表单验证:按页面从上到下的顺序,提示第一个未填字段
|
||||
validateForm() {
|
||||
const { formData } = this.data;
|
||||
const missing = (title) => {
|
||||
wx.showToast({
|
||||
title,
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
};
|
||||
const blank = (value) => String(value === undefined || value === null ? '' : value).trim() === '';
|
||||
const emptyAmount = (value) => blank(value) || Number(value) === 0;
|
||||
const contractType = formData.contractType;
|
||||
if (contractType === 'personal') {
|
||||
// 身份证号暂不采集
|
||||
if (!formData.name || !formData.phone) {
|
||||
wx.showToast({
|
||||
title: '请填写完整的个人信息',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
if (blank(formData.name)) {
|
||||
return missing('请填写个人姓名');
|
||||
}
|
||||
if (blank(formData.phone)) {
|
||||
return missing('请填写联系电话');
|
||||
}
|
||||
if (this.hasPhoneError(formData.phone, 'phoneError')) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!formData.companyName || !formData.legalPerson || !formData.companyPhone) {
|
||||
wx.showToast({
|
||||
title: '请填写完整的企业信息',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
if (blank(formData.companyName)) {
|
||||
return missing('请填写企业名称');
|
||||
}
|
||||
if (blank(formData.legalPerson)) {
|
||||
return missing('请填写法定代表人');
|
||||
}
|
||||
if (blank(formData.companyPhone)) {
|
||||
return missing('请填写联系电话');
|
||||
}
|
||||
if (this.hasPhoneError(formData.companyPhone, 'companyPhoneError')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!formData.taskContent || !formData.needDays || !formData.totalCost) {
|
||||
wx.showToast({
|
||||
title: '请填写完整的开发信息',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
if (blank(formData.taskContent)) {
|
||||
return missing('请填写开发内容');
|
||||
}
|
||||
if (emptyAmount(formData.totalCost)) {
|
||||
return missing('请填写总费用');
|
||||
}
|
||||
if (emptyAmount(formData.needDays)) {
|
||||
return missing('请填写开发工期');
|
||||
}
|
||||
|
||||
if (this.data.attachFiles.some(item => item.status !== 'done')) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -283,6 +283,14 @@ Page({
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
// 交易完成只允许发布者和接单开发者进入详情
|
||||
if (item.button && item.button.key === 'finished' && !item.isMy && !item.isMyWin) {
|
||||
wx.showToast({
|
||||
title: '仅发布者和接单开发者可查看',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 参与投标仅开发者可进入报价;未入驻先提示,确定后再去申请
|
||||
if (item.button && item.button.key === 'bid') {
|
||||
const role = (wx.getStorageSync('userInfo') || {}).role || '';
|
||||
|
||||
@@ -80,7 +80,7 @@ Page({
|
||||
|
||||
/**
|
||||
* 拉取最新角色并写回本地缓存
|
||||
* 入驻审核通过后,用户回到小程序触发 onShow 即可看到「进入接单大厅」入口
|
||||
* 未入驻显示「开发者入驻」;审核通过后回到首页即可看到「进入接单大厅」
|
||||
*/
|
||||
refreshRole() {
|
||||
if (this._roleLoading) {
|
||||
@@ -165,6 +165,12 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
toDeveloperJoin() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/developer/join/index',
|
||||
});
|
||||
},
|
||||
|
||||
onBannerChange(e) {
|
||||
const current = Number((e.detail && e.detail.current) || 0);
|
||||
if (current === this.data.bannerCurrent) {
|
||||
|
||||
@@ -48,6 +48,11 @@
|
||||
进入接单大厅
|
||||
</t-button>
|
||||
</view>
|
||||
<view class="home-page-padding" wx:else>
|
||||
<t-button theme="default" size="" block bind:tap="toDeveloperJoin">
|
||||
开发者入驻
|
||||
</t-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<t-toast id="t-toast" />
|
||||
|
||||
@@ -10,7 +10,7 @@ Component({
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
value: '我的支付订单',
|
||||
value: '我的订单',
|
||||
},
|
||||
desc: {
|
||||
type: String,
|
||||
|
||||
Reference in New Issue
Block a user