代币优化
This commit is contained in:
@@ -11,8 +11,10 @@ Page({
|
||||
quotedPrice: '',
|
||||
needDays: '',
|
||||
remark: '',
|
||||
androidAccount: 0,
|
||||
iosAccount: 0,
|
||||
actualAccount: 0,
|
||||
payPlatform: 'android', // 客户发布需求时的手机系统
|
||||
platformName: '安卓',
|
||||
payFeePercent: 1,
|
||||
commissionRatio: 0.1, // 平台服务费比例,来自 common/getMiniConfig
|
||||
commissionPercent: 10,
|
||||
androidPayFeeRate: 0.01,
|
||||
@@ -41,7 +43,7 @@ Page({
|
||||
const demandInfo = res.data;
|
||||
this.setData({
|
||||
demandInfo,
|
||||
...this.incomePreview(this.getQuoteAmount(demandInfo))
|
||||
...this.incomePreview(this.getQuoteAmount(demandInfo), { payPlatform: demandInfo.pay_platform })
|
||||
}, () => resolve()); // setData 回调:页面已重新渲染
|
||||
},
|
||||
() => {
|
||||
@@ -55,14 +57,19 @@ Page({
|
||||
getQuoteAmount(demandInfo) {
|
||||
return demandInfo?.myBidding?.quoted_price || demandInfo?.demand_contracts?.total_amount || this.data.quotedPrice || 0;
|
||||
},
|
||||
// 按当前报价计算安卓、iOS 两种预计到手
|
||||
// 按客户发布需求时的手机系统计算预计到手
|
||||
incomePreview(amount, rates) {
|
||||
const commissionRatio = rates ? rates.commissionRatio : this.data.commissionRatio;
|
||||
const androidPayFeeRate = rates ? rates.androidPayFeeRate : this.data.androidPayFeeRate;
|
||||
const iosPayFeeRate = rates ? rates.iosPayFeeRate : this.data.iosPayFeeRate;
|
||||
const commissionRatio = rates && rates.commissionRatio !== undefined ? rates.commissionRatio : this.data.commissionRatio;
|
||||
const androidPayFeeRate = rates && rates.androidPayFeeRate !== undefined ? rates.androidPayFeeRate : this.data.androidPayFeeRate;
|
||||
const iosPayFeeRate = rates && rates.iosPayFeeRate !== undefined ? rates.iosPayFeeRate : this.data.iosPayFeeRate;
|
||||
const rawPlatform = rates && rates.payPlatform !== undefined ? rates.payPlatform : this.data.payPlatform;
|
||||
const payPlatform = rawPlatform === 'ios' ? 'ios' : 'android';
|
||||
const payFeeRate = payPlatform === 'ios' ? iosPayFeeRate : androidPayFeeRate;
|
||||
return {
|
||||
androidAccount: calcActualAccount(amount, commissionRatio, androidPayFeeRate),
|
||||
iosAccount: calcActualAccount(amount, commissionRatio, iosPayFeeRate),
|
||||
actualAccount: calcActualAccount(amount, commissionRatio, payFeeRate),
|
||||
payPlatform,
|
||||
payFeePercent: toPercent(payFeeRate),
|
||||
platformName: payPlatform === 'ios' ? 'iOS' : '安卓',
|
||||
};
|
||||
},
|
||||
// 拉取平台服务费和支付费率,并重算预计到手金额
|
||||
@@ -75,7 +82,10 @@ Page({
|
||||
iosPayFeeRate: rates.iosPayFeeRate,
|
||||
androidFeePercent: toPercent(rates.androidPayFeeRate),
|
||||
iosFeePercent: toPercent(rates.iosPayFeeRate),
|
||||
...this.incomePreview(this.getQuoteAmount(this.data.demandInfo), rates),
|
||||
...this.incomePreview(this.getQuoteAmount(this.data.demandInfo), {
|
||||
...rates,
|
||||
payPlatform: (this.data.demandInfo && this.data.demandInfo.pay_platform) || this.data.payPlatform,
|
||||
}),
|
||||
});
|
||||
},
|
||||
// 取文件扩展名对应的 openDocument 类型(默认 pdf)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</t-collapse-panel>
|
||||
<t-collapse-panel 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' && androidAccount > 0 ? '预计到手 安卓' + androidAccount + '元 / iOS' + iosAccount + '元,已扣平台服务费' + commissionPercent + '%和支付费率' + androidFeePercent + '%/' + iosFeePercent + '%' : ''}}" data-field="quotedPrice" bindchange="onInputChange">
|
||||
<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>
|
||||
</t-input>
|
||||
<t-input placeholder="填写预计工期" suffix="天" align="right" disabled="{{opType=='quote' && (!demandInfo.myBidding && !demandInfo.demand_contracts) ? false : true}}" type="number" value="{{opType=='quote' ? demandInfo.myBidding.need_days || demandInfo.demand_contracts.need_days || needDays : demandInfo.winBidding.need_days}}" data-field="needDays" bindchange="onInputChange">
|
||||
|
||||
Reference in New Issue
Block a user