commission--yt-commit
This commit is contained in:
@ -18,6 +18,7 @@ Page({
|
||||
nowAgentUnitPrice: 0, // 现在的‘代理单价’,用于传给弹窗
|
||||
nowProjectDetailName: '', // 现在的‘项目详细名称’,用于传给弹窗
|
||||
isSub: false, // 用于区分是项目抽佣页面还是单个用户抽佣页面
|
||||
fixedRate: 0, // 固定抽佣——一键设置
|
||||
},
|
||||
|
||||
// 获取项目列表
|
||||
@ -55,30 +56,29 @@ Page({
|
||||
|
||||
// 处理抽佣比例提交
|
||||
handleCommissionSubmit(e) {
|
||||
const { commissionRate } = e.detail;
|
||||
console.log(`设置的抽佣比例是:${commissionRate}%`);
|
||||
// 你可以在这里保存提交的数据,或者执行其他操作
|
||||
this.getProjectList()
|
||||
this.getFixedRate()
|
||||
this.closePopup(); // 确认后关闭弹窗
|
||||
},
|
||||
|
||||
// 获取一键抽佣比例
|
||||
getFixedRate() {
|
||||
wx.request({
|
||||
url: baseUrl + '/projectCommission/update/unite/rate',
|
||||
method: 'POST',
|
||||
url: baseUrl + '/userInfo/get/main/jwt',
|
||||
method: 'GET',
|
||||
header: {
|
||||
Authorization: wx.getStorageSync('token'),
|
||||
},
|
||||
data: {
|
||||
uniteCommissionRate: commissionRate
|
||||
Authorization: wx.getStorageSync('token')
|
||||
},
|
||||
success: res => {
|
||||
console.log('一键设置下级抽成比例结果---->',res.data);
|
||||
if (res.data.code === 1) {
|
||||
wx.showToast({
|
||||
title: '设置成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
console.log('一键抽佣--->',res.data);
|
||||
if ( res.data.code === 1 ) {
|
||||
this.setData({
|
||||
fixedRate: res.data.data.uniteRate,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
this.closePopup(); // 确认后关闭弹窗
|
||||
},
|
||||
|
||||
// 点击“设价”按钮,显示弹窗
|
||||
@ -121,6 +121,7 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.getProjectList()
|
||||
this.getFixedRate()
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@
|
||||
/>
|
||||
<view class="group ml-5">
|
||||
<text class="font text">一键设置下级抽成比例:</text>
|
||||
<text class="font text_2">1.36%</text>
|
||||
<text class="font text_2">{{ fixedRate }}%</text>
|
||||
</view>
|
||||
</view>
|
||||
<image
|
||||
|
@ -1,4 +1,5 @@
|
||||
Component({
|
||||
|
||||
import { baseUrl } from "../../../../request";Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
@ -31,7 +32,6 @@ Component({
|
||||
// 提交设置
|
||||
submit() {
|
||||
const rate = parseFloat(this.data.commissionRate);
|
||||
|
||||
if (isNaN(rate) || rate <= 0 || rate > 5) {
|
||||
wx.showToast({
|
||||
title: `请输入有效的比例,最大为 5%`,
|
||||
@ -39,14 +39,42 @@ Component({
|
||||
});
|
||||
return;
|
||||
}
|
||||
wx.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
|
||||
// 触发父组件的事件,将设置的比例传递出去
|
||||
this.triggerEvent('submit', {
|
||||
commissionRate: rate,
|
||||
});
|
||||
|
||||
// 关闭弹窗
|
||||
this.triggerEvent('close');
|
||||
// 一键设置抽佣
|
||||
wx.request({
|
||||
url: baseUrl + '/projectCommission/update/unite/rate',
|
||||
method: 'POST',
|
||||
header: {
|
||||
Authorization: wx.getStorageSync('token'),
|
||||
},
|
||||
data: {
|
||||
uniteCommissionRate: rate
|
||||
},
|
||||
success: res => {
|
||||
console.log('一键设置下级抽成比例结果---->',res.data);
|
||||
if (res.data.code === 1) {
|
||||
wx.hideLoading()
|
||||
wx.showToast({
|
||||
title: '设置成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
// 触发父组件的事件,将设置的比例传递出去
|
||||
this.triggerEvent('submit', {});
|
||||
// 关闭弹窗
|
||||
this.triggerEvent('close');
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '服务错误',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 关闭弹窗
|
||||
|
Reference in New Issue
Block a user