Compare commits
2 Commits
f9958cca91
...
8fc66be6a1
Author | SHA1 | Date | |
---|---|---|---|
8fc66be6a1 | |||
8a3a6dde23 |
|
@ -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'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 关闭弹窗
|
||||
|
|
|
@ -8,10 +8,18 @@ Page({
|
|||
*/
|
||||
data: {
|
||||
pid: 0, // 项目id
|
||||
pname: '', // 项目名称
|
||||
picurl: '', // 项目图片
|
||||
projectSettlementList: [], // 项目结算列表
|
||||
projectDetailName: '', // 项目明细名称
|
||||
settlementQuantity: 0, // 结算数量
|
||||
settlementRevenue: 0, // 结算收益
|
||||
workTime: '', // 作业收益
|
||||
settlementTime: '', // 结算时间
|
||||
revenueSource: false, // 收益来源(true抽成,false为推广码)
|
||||
},
|
||||
|
||||
// 获取项目明细列表
|
||||
// 获取项目结算明细列表
|
||||
getProjectSettlementList() {
|
||||
const pid = this.data.pid
|
||||
wx.request({
|
||||
|
@ -26,7 +34,13 @@ Page({
|
|||
success: res =>{
|
||||
console.log('---->',res.data);
|
||||
if (res.data.code === 1) {
|
||||
|
||||
this.setData({
|
||||
projectSettlementList: res.data.data
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '服务错误',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -36,32 +50,11 @@ Page({
|
|||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
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);
|
||||
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
|
||||
});
|
||||
}
|
||||
this.getProjectSettlementList();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<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 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 flex-1">
|
||||
<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>
|
||||
<text class="font text_3 ml-21">业务员:陈新知</text>
|
||||
<text class="font text_3 ml-21">业务员:{{ item.salespersonName }}</text>
|
||||
</view>
|
||||
<view class="flex-col section">
|
||||
<view class="flex-row justify-between">
|
||||
|
@ -20,20 +20,20 @@
|
|||
</view>
|
||||
<view class="flex-col justify-start group_2 mt-10">
|
||||
<view class="flex-row justify-center items-center relative section_2">
|
||||
<text class="font_3 text_6 pos">{{ projectSettlementList.settlementQuantity }}元购买券</text>
|
||||
<text class="font_4">{{ projectSettlementList.settlementQuantity }}</text>
|
||||
<text class="font_5 pos_2">¥{{ projectSettlementList.settlementRevenue.toFixed(2) }}</text>
|
||||
<text class="font_3 text_6 pos">{{ item.projectDetailName }}</text>
|
||||
<text class="font_4">{{ item.settlementQuantity }}</text>
|
||||
<text class="font_5 pos_2">¥{{ item.settlementRevenue }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row group_1">
|
||||
<view class="group_3">
|
||||
<text class="font_6 text_7">作业时间:</text>
|
||||
<text class="font_5">{{ projectSettlementList.workTime || '暂无' }}</text>
|
||||
<text class="font_5">{{ item.workTime || '暂无' }}</text>
|
||||
</view>
|
||||
<view class="group_4 ml-47">
|
||||
<text class="font_6">结算时间:</text>
|
||||
<text class="font_5">{{ projectSettlementList.settlementTime || '暂无' }}</text>
|
||||
<text class="font_5">{{ item.settlementTime || '暂无' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -22,9 +22,11 @@ Page({
|
|||
gotoSubSettlement(e) {
|
||||
|
||||
const projectId = e.currentTarget.dataset.id;
|
||||
const url = e.currentTarget.dataset.url;
|
||||
const name = e.currentTarget.dataset.name;
|
||||
|
||||
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')
|
||||
},
|
||||
success: res => {
|
||||
// console.log(res.data);
|
||||
console.log('项目列表---->',res.data);
|
||||
if(res.data.code === 1) {
|
||||
this.setData({
|
||||
userProjectList: res.data.data
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
/>
|
||||
<text class="ml-4 font_3">推广码</text>
|
||||
</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
|
||||
class="shrink-0 image_4"
|
||||
src="./images/jsmx.png"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
export const local='http://localhost:3456';
|
||||
export const ip = 'http://1.94.237.210:3457';
|
||||
export const local='http://localhost:9091';
|
||||
export const ip = 'http://27.30.77.229:9091';
|
||||
export const baseUrl = local;
|
||||
|
||||
export const globalImgUrl = baseUrl + '/file/download/'
|
Loading…
Reference in New Issue
Block a user