Compare commits

...

2 Commits

Author SHA1 Message Date
8fc66be6a1 Merge branch 'feture-subcommission' into dev 2025-06-05 22:28:40 +08:00
8a3a6dde23 commission--yt-commit 2025-06-05 22:27:57 +08:00
8 changed files with 92 additions and 66 deletions

View File

@ -18,6 +18,7 @@ Page({
nowAgentUnitPrice: 0, // 现在的‘代理单价’,用于传给弹窗 nowAgentUnitPrice: 0, // 现在的‘代理单价’,用于传给弹窗
nowProjectDetailName: '', // 现在的‘项目详细名称’,用于传给弹窗 nowProjectDetailName: '', // 现在的‘项目详细名称’,用于传给弹窗
isSub: false, // 用于区分是项目抽佣页面还是单个用户抽佣页面 isSub: false, // 用于区分是项目抽佣页面还是单个用户抽佣页面
fixedRate: 0, // 固定抽佣——一键设置
}, },
// 获取项目列表 // 获取项目列表
@ -55,30 +56,29 @@ Page({
// 处理抽佣比例提交 // 处理抽佣比例提交
handleCommissionSubmit(e) { handleCommissionSubmit(e) {
const { commissionRate } = e.detail;
console.log(`设置的抽佣比例是:${commissionRate}%`);
// 你可以在这里保存提交的数据,或者执行其他操作 // 你可以在这里保存提交的数据,或者执行其他操作
this.getProjectList()
this.getFixedRate()
this.closePopup(); // 确认后关闭弹窗
},
// 获取一键抽佣比例
getFixedRate() {
wx.request({ wx.request({
url: baseUrl + '/projectCommission/update/unite/rate', url: baseUrl + '/userInfo/get/main/jwt',
method: 'POST', method: 'GET',
header: { header: {
Authorization: wx.getStorageSync('token'), Authorization: wx.getStorageSync('token')
},
data: {
uniteCommissionRate: commissionRate
}, },
success: res => { success: res => {
console.log('一键设置下级抽成比例结果---->',res.data); console.log('一键抽佣--->',res.data);
if (res.data.code === 1) { if ( res.data.code === 1 ) {
wx.showToast({ this.setData({
title: '设置成功', fixedRate: res.data.data.uniteRate,
icon: 'success',
duration: 1500
}) })
} }
} }
}) })
this.closePopup(); // 确认后关闭弹窗
}, },
// 点击“设价”按钮,显示弹窗 // 点击“设价”按钮,显示弹窗
@ -121,6 +121,7 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
this.getProjectList() this.getProjectList()
this.getFixedRate()
}, },
/** /**

View File

@ -7,7 +7,7 @@
/> />
<view class="group ml-5"> <view class="group ml-5">
<text class="font text">一键设置下级抽成比例:</text> <text class="font text">一键设置下级抽成比例:</text>
<text class="font text_2">1.36%</text> <text class="font text_2">{{ fixedRate }}%</text>
</view> </view>
</view> </view>
<image <image

View File

@ -1,4 +1,5 @@
Component({
import { baseUrl } from "../../../../request";Component({
/** /**
* 组件的属性列表 * 组件的属性列表
@ -31,7 +32,6 @@ Component({
// 提交设置 // 提交设置
submit() { submit() {
const rate = parseFloat(this.data.commissionRate); const rate = parseFloat(this.data.commissionRate);
if (isNaN(rate) || rate <= 0 || rate > 5) { if (isNaN(rate) || rate <= 0 || rate > 5) {
wx.showToast({ wx.showToast({
title: `请输入有效的比例,最大为 5%`, title: `请输入有效的比例,最大为 5%`,
@ -39,14 +39,42 @@ Component({
}); });
return; return;
} }
wx.showLoading({
title: '加载中',
mask: true
})
// 触发父组件的事件,将设置的比例传递出去 // 一键设置抽佣
this.triggerEvent('submit', { wx.request({
commissionRate: rate, url: baseUrl + '/projectCommission/update/unite/rate',
}); method: 'POST',
header: {
// 关闭弹窗 Authorization: wx.getStorageSync('token'),
this.triggerEvent('close'); },
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'
})
}
}
})
}, },
// 关闭弹窗 // 关闭弹窗

View File

@ -8,10 +8,18 @@ Page({
*/ */
data: { data: {
pid: 0, // 项目id pid: 0, // 项目id
pname: '', // 项目名称
picurl: '', // 项目图片
projectSettlementList: [], // 项目结算列表 projectSettlementList: [], // 项目结算列表
projectDetailName: '', // 项目明细名称
settlementQuantity: 0, // 结算数量
settlementRevenue: 0, // 结算收益
workTime: '', // 作业收益
settlementTime: '', // 结算时间
revenueSource: false, // 收益来源(true抽成false为推广码)
}, },
// 获取项目明细列表 // 获取项目结算明细列表
getProjectSettlementList() { getProjectSettlementList() {
const pid = this.data.pid const pid = this.data.pid
wx.request({ wx.request({
@ -26,7 +34,13 @@ Page({
success: res =>{ success: res =>{
console.log('---->',res.data); console.log('---->',res.data);
if (res.data.code === 1) { if (res.data.code === 1) {
this.setData({
projectSettlementList: res.data.data
})
} else {
wx.showToast({
title: '服务错误',
})
} }
} }
}) })
@ -36,32 +50,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.setData({ pid: options.id }) this.setData({ pid: options.id });
this.setData({ pname: options.name })
this.setData({ picurl: options.picurl })
console.log('项目id--->',options.id); console.log('项目id--->',options.id);
this.getProjectSettlementList() this.getProjectSettlementList();
// 模拟后端响应数据
const response = {
code: 0,
data: [
{
id: 1,
projectDetailName: "新用户完成首单",
settlementQuantity: 2,
settlementRevenue: 2.34,
workTime: "2025-05-20", // 示例作业时间
settlementTime: "2025-05-22", // 示例结算时间
revenueSource: false
}
],
message: ""
};
if (response.code === 0) {
// 将后端返回的数据赋值给 projectSettlementList
this.setData({
projectSettlementList: response.data
});
}
}, },
/** /**

View File

@ -1,16 +1,16 @@
<view class="flex-col page"> <view class="flex-col page">
<view class="flex-col justify-start items-start text-wrapper"><text class="text">项目:饿了么-超吃卡</text></view> <view class="flex-col justify-start items-start text-wrapper"><text class="text">项目:{{ pname }}</text></view>
<view class="flex-col mt-11"> <view class="flex-col mt-11">
<view class="flex-col list-item mt-20" wx:for="{{ projectSettlementList }}" wx:for-item="item" wx:for-index="index" wx:key="index"> <view class="flex-col list-item mt-20" wx:for="{{ projectSettlementList }}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="flex-row items-center group"> <view class="flex-row items-center group">
<view class="flex-row items-center flex-1"> <view class="flex-row items-center flex-1">
<image <image
class="shrink-0 image" class="shrink-0 image"
src="https://ide.code.fun/api/image?token=68368d354ae84d001230f4d1&name=1ca23eeec01596125d5539fcda13702d.png" src="{{ picurl }}"
/> />
<text class="font text_2 ml-14">{{ projectSettlementList.projectDetailName}}</text> <text class="font text_2 ml-14">{{ item.projectDetailName}}</text>
</view> </view>
<text class="font text_3 ml-21">业务员:陈新知</text> <text class="font text_3 ml-21">业务员:{{ item.salespersonName }}</text>
</view> </view>
<view class="flex-col section"> <view class="flex-col section">
<view class="flex-row justify-between"> <view class="flex-row justify-between">
@ -20,20 +20,20 @@
</view> </view>
<view class="flex-col justify-start group_2 mt-10"> <view class="flex-col justify-start group_2 mt-10">
<view class="flex-row justify-center items-center relative section_2"> <view class="flex-row justify-center items-center relative section_2">
<text class="font_3 text_6 pos">{{ projectSettlementList.settlementQuantity }}元购买券</text> <text class="font_3 text_6 pos">{{ item.projectDetailName }}</text>
<text class="font_4">{{ projectSettlementList.settlementQuantity }}</text> <text class="font_4">{{ item.settlementQuantity }}</text>
<text class="font_5 pos_2">¥{{ projectSettlementList.settlementRevenue.toFixed(2) }}</text> <text class="font_5 pos_2">¥{{ item.settlementRevenue }}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="flex-row group_1"> <view class="flex-row group_1">
<view class="group_3"> <view class="group_3">
<text class="font_6 text_7">作业时间:</text> <text class="font_6 text_7">作业时间:</text>
<text class="font_5">{{ projectSettlementList.workTime || '暂无' }}</text> <text class="font_5">{{ item.workTime || '暂无' }}</text>
</view> </view>
<view class="group_4 ml-47"> <view class="group_4 ml-47">
<text class="font_6">结算时间:</text> <text class="font_6">结算时间:</text>
<text class="font_5">{{ projectSettlementList.settlementTime || '暂无' }}</text> <text class="font_5">{{ item.settlementTime || '暂无' }}</text>
</view> </view>
</view> </view>
</view> </view>

View File

@ -22,9 +22,11 @@ Page({
gotoSubSettlement(e) { gotoSubSettlement(e) {
const projectId = e.currentTarget.dataset.id; const projectId = e.currentTarget.dataset.id;
const url = e.currentTarget.dataset.url;
const name = e.currentTarget.dataset.name;
wx.navigateTo({ wx.navigateTo({
url: `/pages/projectModule/settlement/settlement?id=${projectId}`, url: `/pages/projectModule/settlement/settlement?id=${projectId}&picurl=${url}&name=${name}`,
}) })
}, },
@ -37,7 +39,7 @@ Page({
Authorization: wx.getStorageSync('token') Authorization: wx.getStorageSync('token')
}, },
success: res => { success: res => {
// console.log(res.data); console.log('项目列表---->',res.data);
if(res.data.code === 1) { if(res.data.code === 1) {
this.setData({ this.setData({
userProjectList: res.data.data userProjectList: res.data.data

View File

@ -25,7 +25,7 @@
/> />
<text class="ml-4 font_3">推广码</text> <text class="ml-4 font_3">推广码</text>
</view> </view>
<view class="ml-14 flex-row items-center section equal-division-item_2" bind:tap="gotoSubSettlement" data-id="{{ item.projectId }}"> <view class="ml-14 flex-row items-center section equal-division-item_2" bind:tap="gotoSubSettlement" data-id="{{ item.projectId }}" data-url="{{ item.projectImage }}" data-name="{{ item.projectName }}">
<image <image
class="shrink-0 image_4" class="shrink-0 image_4"
src="./images/jsmx.png" src="./images/jsmx.png"

View File

@ -1,3 +1,5 @@
export const local='http://localhost:3456'; export const local='http://localhost:9091';
export const ip = 'http://1.94.237.210:3457'; export const ip = 'http://27.30.77.229:9091';
export const baseUrl = local; export const baseUrl = local;
export const globalImgUrl = baseUrl + '/file/download/'