需求列表状态刷新优化

This commit is contained in:
Dev
2026-10-14 15:46:49 +08:00
parent a0149f5f93
commit 8eb253784a
7 changed files with 111 additions and 15 deletions
@@ -1,5 +1,6 @@
import { fetchDemandContractDetail, demandOperate } from '../../../services/demand/fetchDemand';
import { fetchPlatformCommissionRatio, calcActualAccount } from '../../../services/home/home';
// pages/demand/contract/index.js
Page({
@@ -9,6 +10,8 @@ Page({
data: {
demandId: 0,
actualAccount: 0,
commissionRatio: 0.1, // 平台服务费比例,来自 common/getMiniConfig
commissionPercent: 10, // 平台服务费百分比,用于提示文案
contract: null,
agreementUrl: '', // 签约条款URL
phoneError: '', // 个人联系电话错误提示
@@ -61,6 +64,17 @@ Page({
agreementUrl
});
this.getContractDetail();
this.loadCommissionRatio();
},
// 拉取平台服务费比例,并按新比例重算预计到手金额
async loadCommissionRatio() {
const ratio = await fetchPlatformCommissionRatio();
this.setData({
commissionRatio: ratio,
commissionPercent: Math.round(ratio * 10000) / 100,
actualAccount: calcActualAccount(this.data.formData?.totalCost, ratio)
});
},
/**
@@ -191,10 +205,9 @@ Page({
},
onTotalCostChange(e) {
const number = Number(e.detail.value * 0.9);
this.setData({
'formData.totalCost': e.detail.value,
'actualAccount': Math.round(e.detail.value * 0.9)
actualAccount: calcActualAccount(e.detail.value, this.data.commissionRatio)
});
},
@@ -518,6 +531,7 @@ Page({
'formData.taskContent': resData.task_content,
'formData.needDays': resData.need_days,
'formData.totalCost': resData.total_amount,
actualAccount: calcActualAccount(resData.total_amount, this.data.commissionRatio),
});
// 客户签约时,附件展示开发者签约时上传的附件,仅可预览,不可删除和上传