commission--yt-commit

This commit is contained in:
2025-06-05 11:21:05 +08:00
parent 175c052e97
commit e2182c8248
6 changed files with 88 additions and 32 deletions

View File

@ -37,6 +37,10 @@ Component({
maxCommissionRate: { // 最大抽佣比例
type: Number,
value: 0
},
isSub: {
type: Boolean,
value: false
}
},
@ -57,7 +61,10 @@ Component({
const id = this.data.detailId;
const Rate = this.data.commissionRate;
const maxRate = this.data.maxCommissionRate;
// console.log('maxRate---->', maxRate);
const isSub = this.data.isSub;
console.log('id---->', id);
console.log('Rate--->',Rate);
console.log('isSub---->',isSub);
if (Rate > maxRate || Rate < 0) {
wx.showModal({
title: '抽佣比率错误',
@ -71,29 +78,56 @@ Component({
mask: true
})
// 发送请求
wx.request({
url: baseUrl + '/projectCommission/update/rate',
method: 'POST',
header: {
Authorization: wx.getStorageSync('token'),
},
data: {
id: id,
currentCommissionRate: Rate
},
success: res => {
console.log('后端结果---->',res.data);
if (res.data.code === 1) {
wx.hideLoading() // 加载框关闭
this.triggerEvent('confirm', {});
} else {
wx.showToast({
title: '服务异常',
icon: 'error'
})
if (isSub) {
wx.request({
url: baseUrl + '/projectCommission/update/sub/rate',
method: 'POST',
header: {
Authorization: wx.getStorageSync('token'),
},
data: {
id: id,
currentCommissionRate: Rate
},
success: res=> {
console.log('用户抽用户----->',res.data);
if ( res.data.code === 1 ) {
wx.hideLoading() // 加载框关闭
this.triggerEvent('confirm', {});
} else {
wx.showToast({
title: '服务异常',
icon: 'error'
})
}
}
}
})
})
} else {
wx.request({
url: baseUrl + '/projectCommission/update/rate',
method: 'POST',
header: {
Authorization: wx.getStorageSync('token'),
},
data: {
id: id,
currentCommissionRate: Rate
},
success: res => {
console.log('项目抽佣结果---->',res.data);
if (res.data.code === 1) {
wx.hideLoading() // 加载框关闭
this.triggerEvent('confirm', {});
} else {
wx.showToast({
title: '服务异常',
icon: 'error'
})
}
}
})
}
this.resetStatus();
},