修复了功能(对项目明细设置抽佣比例)
This commit is contained in:
parent
6df2f37187
commit
dfd14fe576
|
@ -5,9 +5,8 @@
|
|||
padding: 77.27rpx 45.8rpx 372.14rpx 45.8rpx;
|
||||
background-color: #ffffff;
|
||||
width: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
height: 100%;
|
||||
overflow-y: hidden;
|
||||
height: 100vh;
|
||||
}
|
||||
.font_2 {
|
||||
font-size: 30.53rpx;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<wxs module="filters" src="../../../utils/addmul.wxs"></wxs>
|
||||
<view class="flex-col page">
|
||||
<view class="flex-row justify-between items-center section" bindtap="showPopup">
|
||||
<view class="flex-row items-center">
|
||||
|
@ -7,7 +8,7 @@
|
|||
/>
|
||||
<view class="group ml-5">
|
||||
<text class="font text">一键设置下级抽成比例:</text>
|
||||
<text class="font text_2">{{ fixedRate }}%</text>
|
||||
<text class="font text_2">{{ filters.toFix2(fixedRate) }}%</text>
|
||||
</view>
|
||||
</view>
|
||||
<image
|
||||
|
@ -53,7 +54,7 @@
|
|||
wx:key="index"
|
||||
>
|
||||
<text class="font_6 text_6 pos">{{ CommissionList.projectDetailName }}</text>
|
||||
<text class="font_7 text_9">{{ CommissionList.myUnitPrice }}/{{ CommissionList.agentUnitPrice }}/{{ CommissionList.currentCommissionRate }}%</text>
|
||||
<text class="font_7 text_9">{{ filters.toFix2(CommissionList.myUnitPrice) }}/{{ filters.toFix2(CommissionList.agentUnitPrice) }}/{{ filters.toFix2(CommissionList.currentCommissionRate) }}%</text>
|
||||
<view class="flex-row group_5 pos_2" bindtap="showCommissionRatePop" data-nowMyUnitPrice="{{ CommissionList.myUnitPrice }} " data-currentCommissionRate="{{ CommissionList.currentCommissionRate }}" data-agentUnitPrice="{{ CommissionList.agentUnitPrice }}" data-projectDetailName="{{ CommissionList.projectDetailName }}" data-detailid="{{ CommissionList.id }}" data-maxCommissionRate="{{ CommissionList.maxCommissionRate }}">
|
||||
<image
|
||||
class="image_4 image_6"
|
||||
|
|
|
@ -3,7 +3,7 @@ Component({
|
|||
|
||||
data: {
|
||||
pgencyPriceAble: true, // 代理单价input启用/禁用
|
||||
commissionRateAble: true, // 抽成比例input启用/禁用
|
||||
commissionRateAble: false, // 抽成比例input启用/禁用
|
||||
LodingHidden: false, // 遮罩禁用启用
|
||||
},
|
||||
/**
|
||||
|
@ -151,7 +151,7 @@ Component({
|
|||
resetStatus() {
|
||||
this.setData({
|
||||
pgencyPriceAble: true,
|
||||
commissionRateAble: true,
|
||||
commissionRateAble: false,
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -167,27 +167,28 @@ Component({
|
|||
|
||||
// 计算单价——当输入抽成比率失焦时自动计算
|
||||
calculateUnitPrice() {
|
||||
const tempCommissionRate = this.data.commissionRate/100; // 暂存抽成比率
|
||||
const tempCommissionRate = this.data.commissionRate / 100; // 暂存抽成比率
|
||||
const tempMyUnitPrice = this.data.myUnitPrice; // 暂存我的单价
|
||||
let res = parseFloat( (tempMyUnitPrice * (1- tempCommissionRate)).toPrecision(2) ) ;
|
||||
let res = parseFloat((tempMyUnitPrice * (1 - tempCommissionRate)).toFixed(2)) ;
|
||||
console.log(tempCommissionRate, tempMyUnitPrice, res)
|
||||
// 计算单价 (避免精度丢失问题)
|
||||
this.setData({
|
||||
pgencyPrice : res
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
// 计算比率——当输入代理单价失焦时自动计算
|
||||
calculateRatio() {
|
||||
const tempPgencyPrice = this.data.pgencyPrice; // 暂存代理单价
|
||||
const tempMyUnitPrice = this.data.myUnitPrice; // 暂存我的单价
|
||||
if (tempPgencyPrice == tempMyUnitPrice) {
|
||||
this.setData({ commissionRate: 100 })
|
||||
} else {
|
||||
let res = (tempMyUnitPrice - tempPgencyPrice) / tempMyUnitPrice;
|
||||
const res = parseFloat(((1 - tempPgencyPrice / tempMyUnitPrice) * 100).toFixed(2))
|
||||
console.log(tempPgencyPrice, tempMyUnitPrice, res)
|
||||
this.setData({
|
||||
commissionRate: parseFloat((res*100).toPrecision(2))
|
||||
commissionRate: res
|
||||
})
|
||||
}
|
||||
console.log('抽佣比率------>',this.data.commissionRate);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<wxs module="filters" src="../../../../utils/addmul.wxs"></wxs>
|
||||
<view wx:if="{{show}}" class="popup-wrapper">
|
||||
<view class="promo-mask" bindtap="close"></view>
|
||||
<view class="flex-col section popup-content">
|
||||
<text class="self-center font text">代理价设置</text>
|
||||
<view class="flex-col self-stretch mt-24">
|
||||
<view class="flex-col">
|
||||
<text class="self-start font_2 text_2">我的价格{{ myUnitPrice }},我的抽成{{ (myUnitPrice*100 - pgencyPrice*100)/100 }}元</text>
|
||||
<text class="self-start font_2 text_2">我的价格{{ filters.toFix2(myUnitPrice) }},我的抽成{{ filters.toFix2((myUnitPrice*100 - pgencyPrice*100)/100) }}元</text>
|
||||
<view class="flex-col self-stretch section_2 mt-13">
|
||||
<view class="flex-row justify-between items-center">
|
||||
<text class="font_2 text_4">结算标准</text>
|
||||
|
@ -16,7 +17,7 @@
|
|||
<input
|
||||
class="text_8 font"
|
||||
type="digit"
|
||||
placeholder="请输入代理单价"
|
||||
placeholder="请输入"
|
||||
data-field="pgencyPrice"
|
||||
value="{{ pgencyPrice }}"
|
||||
disabled="{{ pgencyPriceAble }}"
|
||||
|
@ -31,7 +32,7 @@
|
|||
<image class="input-icon" src="./images/baifenbi.png"></image>
|
||||
<input
|
||||
class="text_8 font"
|
||||
placeholder="请输入抽成比例"
|
||||
placeholder="请输入"
|
||||
type="digit"
|
||||
data-field="commissionRate"
|
||||
value="{{ commissionRate }}"
|
||||
|
@ -50,7 +51,7 @@
|
|||
<text class="font_2 text_9 ml-7">代理价</text>
|
||||
</view>
|
||||
<view class="flex-row items-center mt-14">
|
||||
<radio class="radio_1" color="#FF8D1A" value="抽成比例"></radio>
|
||||
<radio class="radio_1" color="#FF8D1A" value="抽成比例" checked></radio>
|
||||
<text class="font_2 text_11 ml-7">抽成比例</text>
|
||||
</view>
|
||||
</radio-group>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<wxs module="filters" src="../../../utils/addmul.wxs"></wxs>
|
||||
<view class="flex-col page">
|
||||
<view class="flex-row justify-between items-center">
|
||||
<text class="font text">代理列表</text>
|
||||
|
@ -27,7 +28,7 @@
|
|||
wx:key="index"
|
||||
>
|
||||
<text class="font_5 text_5">{{ DetailCommission.projectDetailName }}</text>
|
||||
<text class="shrink-0 font_2 text_8">{{ DetailCommission.agentUnitPrice }}/{{ DetailCommission.currentCommissionRate }}%</text>
|
||||
<text class="shrink-0 font_2 text_8">{{ filters.toFix2(DetailCommission.agentUnitPrice) }}/{{ filters.toFix2(DetailCommission.currentCommissionRate) }}%</text>
|
||||
<view class="flex-row shrink-0 group_2" bindtap="showCommissionRatePop" data-nowMyUnitPrice="{{ DetailCommission.myUnitPrice }} " data-currentCommissionRate="{{ DetailCommission.currentCommissionRate }}" data-agentUnitPrice="{{ DetailCommission.agentUnitPrice }}" data-projectDetailName="{{ DetailCommission.projectDetailName }}" data-detailid="{{ DetailCommission.id }}" data-maxCommissionRate="{{ DetailCommission.maxCommissionRate }}">
|
||||
<image
|
||||
class="image_2"
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
line-height: 25.54rpx;
|
||||
}
|
||||
.group_2 {
|
||||
margin-left: 149.81rpx;
|
||||
margin-left: 135.81rpx;
|
||||
width: 75.75rpx;
|
||||
}
|
||||
.image_2 {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export const local='http://localhost:9091';
|
||||
export const ip = 'http://27.30.77.229:9091';
|
||||
export const baseUrl = local;
|
||||
export const test = 'http://27.30.77.229:9092';
|
||||
export const baseUrl = ip;
|
||||
|
||||
export const globalImgUrl = baseUrl + '/file/download/'
|
16
utils/addmul.wxs
Normal file
16
utils/addmul.wxs
Normal file
|
@ -0,0 +1,16 @@
|
|||
var filters = {
|
||||
toFix2: function (value) {
|
||||
return parseFloat(value).toFixed(2)//此处2为保留两位小数
|
||||
},
|
||||
toFix1: function (value) {
|
||||
return parseFloat(value).toFixed(1)//此处1为保留一位小数
|
||||
},
|
||||
toFix: function (value) {
|
||||
return parseFloat(value).toFixed(0)//此处0为取整数
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
toFix2: filters.toFix2,
|
||||
toFix1: filters.toFix1,
|
||||
toFix: filters.toFix
|
||||
}
|
Loading…
Reference in New Issue
Block a user