添加开发者发货功能

This commit is contained in:
Dev
2026-09-30 14:56:56 +08:00
parent f13a5e682a
commit bc17810445
14 changed files with 768 additions and 4 deletions
+19 -1
View File
@@ -11,7 +11,7 @@ Page({
needDays: '',
remark: '',
actualAccount: 0,
activeValues: [0, 1, 2, 3],
activeValues: [0, 1, 2, 3, 4],
demandInfo: null
},
@@ -103,6 +103,24 @@ Page({
urls: images
});
},
//交付凭证截图预览
onDeliveryImagePreview(e) {
const { images, index } = e.currentTarget.dataset;
const urls = (images || []).map(item => item.url);
if (!urls.length) {
return;
}
wx.previewImage({
current: urls[index],
urls
});
},
//去发货(交付开发成果)
deliverGoods() {
wx.navigateTo({
url: `/pages/demand/deliver/index?demandId=${this.data.id}`,
});
},
//参与竞标
submitBidding() {
const { id, quotedPrice, needDays, remark } = this.data;
@@ -53,6 +53,33 @@
<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)}}">
<t-collapse-panel header="交付内容" value="{{4}}" expandIcon>
<view class="delivery-section">
<view class="delivery-title">开发完成凭证截图</view>
<view class="delivery-images">
<image wx:for="{{_calc.getDelivery(demandInfo).images}}" wx:key="index" class="delivery-image" src="{{item.url}}" mode="aspectFill" data-index="{{index}}" data-images="{{_calc.getDelivery(demandInfo).images}}" bindtap="onDeliveryImagePreview" />
</view>
<view class="delivery-title">交付附件</view>
<view class="file-list">
<view class="file-item" wx:for="{{_calc.getDelivery(demandInfo).files}}" wx:key="index">
<view class="file-item__name">
<t-tag max-width="420rpx" variant="light">{{item.name}}</t-tag>
</view>
<view class="file-item__ops">
<button class="mini-btn" type="default" size="mini" data-url="{{item.url}}" bindtap="fileUrlCopy">复制</button>
<button class="mini-btn mini-btn--primary" size="mini" data-url="{{item.url}}" bindtap="fileView">预览</button>
</view>
</view>
</view>
<block wx:if="{{_calc.getDelivery(demandInfo).remark}}">
<view class="delivery-title">发货备注</view>
<view class="delivery-remark">{{_calc.getDelivery(demandInfo).remark}}</view>
</block>
</view>
</t-collapse-panel>
</block>
</t-collapse>
@@ -73,6 +100,10 @@
<t-button theme="light" size="large" data-status="0" bind:tap="completeWork">完成失败</t-button>
<t-button theme="danger" size="large" data-status="1" bind:tap="completeWork" block>工作完成</t-button>
</view>
<view class="button-layout-flex" wx:elif="{{_calc.canDeliverGoods(demandInfo)}}">
<t-button theme="danger" size="large" bind:tap="deliverGoods" block>去发货</t-button>
</view>
<t-button wx:elif="{{_calc.isDelivered(demandInfo)}}" theme="light" size="large" disabled block>已发货(等待客户确认收货)</t-button>
</block>
</view>
<!-- 需求方 -->
@@ -64,6 +64,36 @@ var canConfirmReceipt = function (demandInfo) {
demandInfo.accept_status == 2;
}
// 获取交付内容(订单发货表,后端 detail 接口挂载的 delivery 字段,未发货返回 null)
var getDelivery = function (demandInfo) {
if (!demandInfo) {
return null;
}
return demandInfo.delivery || null;
}
// 开发者待发货:需求待收货(客户已付尾款)、自己中标且尚未交付
var canDeliverGoods = function (demandInfo) {
if (!demandInfo) return false;
return demandInfo.status == 5 &&
demandInfo.isMyWin &&
demandInfo.winBidding &&
demandInfo.winBidding.bidding_status == 2 &&
demandInfo.winBidding.process_status == 2 &&
!getDelivery(demandInfo);
}
// 开发者已发货、等待客户确认收货
var isDelivered = function (demandInfo) {
if (!demandInfo) return false;
return demandInfo.status == 5 &&
demandInfo.isMyWin &&
demandInfo.winBidding &&
demandInfo.winBidding.bidding_status == 2 &&
demandInfo.winBidding.process_status == 2 &&
!!getDelivery(demandInfo);
}
// 数值拼接单位,空值时不显示单位
var withUnit = function (value, unit) {
if (value === undefined || value === null || value === '') {
@@ -81,5 +111,8 @@ module.exports = {
canCompleteWork: canCompleteWork,
canAcceptPassed: canAcceptPassed,
canConfirmReceipt: canConfirmReceipt,
getDelivery: getDelivery,
canDeliverGoods: canDeliverGoods,
isDelivered: isDelivered,
withUnit: withUnit,
};
@@ -68,6 +68,40 @@ page {
color: var(--text-tertiary);
}
/* 交付内容 */
.delivery-section {
padding-bottom: 8rpx;
}
.delivery-title {
margin: 16rpx 0 12rpx;
font-size: 26rpx;
font-weight: 500;
color: var(--text-primary);
}
.delivery-images {
display: flex;
flex-wrap: wrap;
margin-right: -16rpx;
}
.delivery-image {
width: 160rpx;
height: 160rpx;
margin: 0 16rpx 16rpx 0;
border-radius: var(--radius-md, 12rpx);
background: var(--bg-grey);
}
.delivery-remark {
font-size: 26rpx;
line-height: 40rpx;
color: var(--text-tertiary);
white-space: pre-wrap;
word-break: break-all;
}
.button-submit {
margin: 32rpx;
}