2025-06-03 16:18:25 +00:00
|
|
|
import { baseUrl } from "../../../request";
|
|
|
|
|
2025-05-28 10:53:41 +00:00
|
|
|
// pages/personCenter/commissionSetting/commissionSetting.js
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
2025-06-03 16:18:25 +00:00
|
|
|
projectList: [], // 项目列表
|
2025-05-28 10:53:41 +00:00
|
|
|
items_1: [null, null, null],
|
|
|
|
items: [null, null],
|
2025-06-01 02:43:37 +00:00
|
|
|
showPopup: false, // 控制弹窗显隐
|
|
|
|
showCommissionRatePop: false,
|
|
|
|
},
|
2025-06-03 16:18:25 +00:00
|
|
|
|
|
|
|
getProjectList() {
|
|
|
|
wx.request({
|
|
|
|
url: baseUrl + '/projectCommission/query/commission',
|
|
|
|
method: 'POST',
|
|
|
|
header: {
|
|
|
|
Authorization: wx.getStorageSync('token'),
|
|
|
|
},
|
|
|
|
success: res => {
|
|
|
|
if (res.data.code === 1) {
|
|
|
|
console.log('项目列表---->',res.data.data);
|
|
|
|
this.setData({
|
|
|
|
projectList: res.data.data
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2025-06-01 02:43:37 +00:00
|
|
|
// 显示弹窗
|
|
|
|
showPopup() {
|
|
|
|
this.setData({
|
|
|
|
showPopup: true
|
|
|
|
});
|
|
|
|
},
|
2025-06-03 16:18:25 +00:00
|
|
|
|
2025-06-01 02:43:37 +00:00
|
|
|
// 关闭弹窗
|
|
|
|
closePopup() {
|
|
|
|
this.setData({
|
|
|
|
showPopup: false
|
|
|
|
});
|
|
|
|
},
|
2025-06-03 16:18:25 +00:00
|
|
|
|
2025-06-01 02:43:37 +00:00
|
|
|
// 处理抽佣比例提交
|
|
|
|
handleCommissionSubmit(e) {
|
|
|
|
const { commissionRate } = e.detail;
|
|
|
|
console.log(`设置的抽佣比例是:${commissionRate}%`);
|
|
|
|
// 你可以在这里保存提交的数据,或者执行其他操作
|
2025-06-03 16:18:25 +00:00
|
|
|
wx.request({
|
|
|
|
url: baseUrl + '/projectCommission/update/unite/rate',
|
|
|
|
method: 'POST',
|
|
|
|
header: {
|
|
|
|
Authorization: wx.getStorageSync('token'),
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
uniteCommissionRate: commissionRate
|
|
|
|
},
|
|
|
|
success: res => {
|
|
|
|
console.log('一键设置下级抽成比例结果---->',res.data);
|
|
|
|
if (res.data.code === 1) {
|
|
|
|
wx.showToast({
|
|
|
|
title: '设置成功',
|
|
|
|
icon: 'success',
|
|
|
|
duration: 1500
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2025-06-01 02:43:37 +00:00
|
|
|
this.closePopup(); // 确认后关闭弹窗
|
|
|
|
},
|
2025-06-03 16:18:25 +00:00
|
|
|
|
2025-06-01 02:43:37 +00:00
|
|
|
// 点击“设价”按钮,显示弹窗
|
|
|
|
showCommissionRatePop() {
|
|
|
|
this.setData({ showCommissionRatePop: true });
|
2025-05-29 13:29:32 +00:00
|
|
|
},
|
|
|
|
|
2025-06-01 02:43:37 +00:00
|
|
|
// 关闭弹窗(包括遮罩点击和取消按钮)
|
|
|
|
closeCommissionRatePop() {
|
|
|
|
this.setData({ showCommissionRatePop: false });
|
2025-05-29 13:29:32 +00:00
|
|
|
},
|
|
|
|
|
2025-06-01 02:43:37 +00:00
|
|
|
// 确认按钮回调
|
|
|
|
handleCommissionRateConfirm(e) {
|
|
|
|
const { agentPrice, commissionRate, pricingMethod } = e.detail;
|
|
|
|
console.log('设置数据:', agentPrice, commissionRate, pricingMethod);
|
|
|
|
this.closeCommissionRatePop();
|
|
|
|
},
|
2025-05-28 16:47:08 +00:00
|
|
|
gotoSubCommission() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/personCenter/subCommissionSetting/subCommissionSetting',
|
|
|
|
})
|
|
|
|
},
|
2025-05-28 10:53:41 +00:00
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
2025-06-03 16:18:25 +00:00
|
|
|
this.getProjectList()
|
2025-05-28 10:53:41 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|