Browse Source

feat(market): 添加业绩页面功能

- 新增 performance 方法获取业绩数据
- 实现业绩页面的数据展示和图表绘制
- 添加数据处理和计算逻辑,包括完成度和各部分占比的计算
- 优化页面样式,动态显示目标金额和完成金额
master
liutong 12 months ago
parent
commit
2fd8e8d024
  1. 9
      api/market.js
  2. 67
      pages/market/data/index.vue

9
api/market.js

@ -108,6 +108,15 @@ export default {
}) })
}, },
//数据页面
performance(data = {}) {
let url = '/member/performance'
return http.get(url, data).then(res => {
return res;
})
},

67
pages/market/data/index.vue

@ -21,11 +21,11 @@
<view class="right"> <view class="right">
<view class="title">目标金额</view> <view class="title">目标金额</view>
<view class="content"> <view class="content">
<text class="strong">100000</text> <text class="strong">{{infoData.goal}}</text>
</view> </view>
<view class="title">完成金额</view> <view class="title">完成金额</view>
<view class="content"> <view class="content">
<text class="strong">100000</text> <text class="strong">{{infoData.wx_performance}}</text>
<text>较上月</text> <text>较上月</text>
</view> </view>
@ -146,7 +146,7 @@
<script> <script>
// import user from '@/api/user.js'; import marketApi from '@/api/market.js';
import AQTabber from "@/components/AQ/AQTabber.vue" import AQTabber from "@/components/AQ/AQTabber.vue"
@ -157,6 +157,8 @@ export default {
data() { data() {
return { return {
infoData:{},//
// //
chartData: {}, chartData: {},
opts: { opts: {
@ -181,7 +183,7 @@ export default {
color: "#666666" // color: "#666666" //
}, },
subtitle: { subtitle: {
name: "40%", // name: "0%", //
fontSize: 18, // fontSize: 18, //
color: "#7cb5ec" // color: "#7cb5ec" //
}, },
@ -243,36 +245,76 @@ export default {
} }
} }
}, },
onLoad() { onLoad() {},
onShow() {
this.init() this.init()
}, },
methods: { methods: {
async init(){ async init(){
this.getPerformance()
},
async getPerformance(){
let res= await marketApi.performance({})
if (res.code != 1) {
uni.showToast({
title: res.msg,
icon: 'none'
});
return
}
console.log('xx',res)
this.infoData = res.data
//
let mb = this.infoData.wx_performance//
let xp =this.infoData.new_performance//
let xf =this.infoData.renew_performance//
// 000
let xp_percent = mb != 0 ? parseInt((xp / mb) * 100) : 0;
let xf_percent = mb != 0 ? parseInt((xf / mb) * 100) : 0;
let wwc_percent = 100 - xp_percent - xf_percent >= 0 ? '0' : 100 - xp_percent - xf_percent//
wwc_percent = parseInt(wwc_percent)
let w_c_d = ((xp + xf) - mb) * -1 * 100 //
w_c_d = w_c_d >= 0 ? 0 : w_c_d
w_c_d = 100 - w_c_d
let w_c_d_rounded = Math.round(w_c_d * 10) / 10;
console.log('zzz',[xp_percent,xf_percent,wwc_percent,w_c_d_rounded])
// //
let chartData_1 = { let chartData_1 = {
series: [ series: [
{ {
data: [ data: [
{ {
"name": "新签", "name": "未完成",
"value": 50, "value": wwc_percent,
"labelShow": false "labelShow": false
}, },
{ {
"name": "续费", "name": "续费",
"value": 30, "value": xf_percent,
"labelShow": false "labelShow": false
}, },
{ {
"name": "未完成", "name": "新签",
"value": 20, "value": xp_percent,
"labelShow": false "labelShow": false
} },
] ]
} }
] ]
}; };
this.chartData = JSON.parse(JSON.stringify(chartData_1)); this.chartData = JSON.parse(JSON.stringify(chartData_1));
this.opts.subtitle = {
name: `${w_c_d_rounded}%`, //
fontSize: 18, //
color: "#7cb5ec" //
}
// //
let chartDataB = { let chartDataB = {
@ -308,8 +350,11 @@ export default {
] ]
}; };
this.chartData_2 = JSON.parse(JSON.stringify(chartDataB)); this.chartData_2 = JSON.parse(JSON.stringify(chartDataB));
}, },
//tag //tag
changeTag(type){ changeTag(type){
this.tagType = type this.tagType = type

Loading…
Cancel
Save