Merge branch 'feture-subcommission' into dev
This commit is contained in:
@ -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