Commit b0fccb57 by 王志慧

commit

1 parent 4c2eba07
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
} }
.opacity-view { .opacity-view {
// animation: opacity-view .5s forwards; // animation: opacity-view .5s forwards;
} }
.box { .box {
......
// packageOutput/components/staff/staff.js // packageOutput/components/staff/staff.js
import Util from '~/utils/util' import Util from '~/utils/util'
import {
accMul
} from '~/utils/format'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -8,9 +11,12 @@ Component({ ...@@ -8,9 +11,12 @@ Component({
sfaffList: { sfaffList: {
type: Object, type: Object,
observer(val) { observer(val) {
console.log(val, 'sfaffList')
this.getDetail(val) this.getDetail(val)
this.filterStaff = val this.filterStaff = val
this.setData({selectValue:1}) this.setData({
selectValue: 1
})
} }
}, },
tabelTh: { tabelTh: {
...@@ -31,7 +37,7 @@ Component({ ...@@ -31,7 +37,7 @@ Component({
crowType: [{ crowType: [{
label: '产值', label: '产值',
value: 1 value: 1
},{ }, {
label: '转发次数', label: '转发次数',
value: 2 value: 2
}, { }, {
...@@ -50,7 +56,7 @@ Component({ ...@@ -50,7 +56,7 @@ Component({
boutique: [{ boutique: [{
label: '产值', label: '产值',
value: 1 value: 1
},{ }, {
label: '单量', label: '单量',
value: 2 value: 2
}, { }, {
...@@ -63,7 +69,7 @@ Component({ ...@@ -63,7 +69,7 @@ Component({
equity: [{ equity: [{
label: '产值', label: '产值',
value: 1 value: 1
},{ }, {
label: '成交量', label: '成交量',
value: 2 value: 2
}, { }, {
...@@ -85,23 +91,28 @@ Component({ ...@@ -85,23 +91,28 @@ Component({
*/ */
methods: { methods: {
showUp() { showUp() {
this.setData({show:false}) this.setData({
show: false
})
}, },
//选择排序 //选择排序
selectType(e) { selectType(e) {
const {value,label} = e.target.dataset const {
value,
label
} = e.target.dataset
this.setData({ this.setData({
selectValue: value, selectValue: value,
show:true, show: true,
selectTxt: label selectTxt: label
}) })
this.getDetail(this.filterStaff) this.getDetail(this.filterStaff)
}, },
hanldBlur(e) { hanldBlur(e) {
const empName = e.detail.value; const empName = e.detail.value;
const sfaffList= this.data.sfaffList.filter(item=>{ const sfaffList = this.data.sfaffList.filter(item => {
const employeeName = item.transferName || item.employeeName const employeeName = item.transferName || item.employeeName
return employeeName?employeeName.includes(empName):item return employeeName ? employeeName.includes(empName) : item
}) })
this.filterStaff = sfaffList this.filterStaff = sfaffList
this.getDetail(sfaffList) this.getDetail(sfaffList)
...@@ -116,35 +127,78 @@ Component({ ...@@ -116,35 +127,78 @@ Component({
res[i].push(v[i]) res[i].push(v[i])
continue continue
} }
res[i] = [v[i]] res[i] = [v[i]]
} }
} }
return fn(res) return fn(res)
}, },
// 生成对应的表格数据 // 生成对应的表格数据
getDetail(val) { getDetail(val) {
let {tabelTh,dataType,selectValue,downType} = this.data,sortKey let {
for(let i in tabelTh) { tabelTh,
if(tabelTh[i] == dataType[downType][selectValue-1].label) { dataType,
selectValue,
downType
} = this.data, sortKey
for (let i in tabelTh) {
if (tabelTh[i] == dataType[downType][selectValue - 1].label) {
sortKey = i sortKey = i
} }
} }
const tableData = Util.deepClone(val).sort((a,b)=>{ const tableData = Util.deepClone(val).sort((a, b) => {
return (b[sortKey]||0)-(a[sortKey]||0) return (b[sortKey] || 0) - (a[sortKey] || 0)
}) })
const sfaffList = this.formatArr(tableData, (item) => { const sfaffList = this.formatArr(tableData, (item) => {
const result = [] const result = []
const obj_keys = Object.keys(tabelTh) const obj_keys = Object.keys(tabelTh);
const handleParams = (k)=> {
let obj= {
[k]: (item, k) => {
return item[k]
},
transferName: (item) => {
let arr = []
item.avatar.forEach((val, index) => {
arr.push({
avatarUrl: val,
transferName: item.transferName[index]
})
})
return arr
},
employeeName: (item) => {
let arr = []
item.avatarUrl.forEach((val, index) => {
arr.push({
avatarUrl: val,
transferName: item.employeeName[index]
})
})
return arr
},
conversionRate: (item, k) => {
const arr = this.data.downType == 'equity' ? item[k].map(item => accMul(item, 100)) : item[k]
return arr
},
}
return obj
}
for (let k of obj_keys) { for (let k of obj_keys) {
result.push({ result.push({
name: tabelTh[k], name: tabelTh[k],
val: k, val: k,
list: item list:handleParams(k)[k](item, k)
}) })
} }
return result return result
}) })
this.setData({ sfaff:sfaffList }) this.setData({
sfaff: sfaffList
})
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -22,15 +22,16 @@ ...@@ -22,15 +22,16 @@
<!-- 左侧固定 --> <!-- 左侧固定 -->
<view class='table_left_column'> <view class='table_left_column'>
<view class='left_col_item'>排名</view> <view class='left_col_item'>排名</view>
<view class='left_col_item' wx:for="{{sfaff[0].list[sfaff[0].val]}}" wx:for-index="index" wx:key="index">{{index+1}}</view> <view class='left_col_item' wx:for="{{sfaff[0].list}}" wx:for-index="index" wx:key="index">{{index+1}}</view>
</view> </view>
<!-- 右侧表格滚动 --> <!-- 右侧表格滚动 -->
<view class="table_right_scroll_box"> <view class="table_right_scroll_box">
<view class="flex_direction_column_item" wx:for="{{sfaff}}" wx:for-index="index" wx:key="index"> <view class="flex_direction_column_item" wx:for="{{sfaff}}" wx:for-index="index" wx:key="index">
<view class='item_name'>{{item.name}}</view> <view class='item_name'>{{item.name}}</view>
<view wx:for="{{item.list[item.val]}}" wx:for-item="litem" wx:for-index="lindex" wx:key="lindex" class='item_name item_desc'> <view wx:for="{{item.list}}" wx:for-item="litem" wx:for-index="lindex" wx:key="lindex" class='item_name item_desc'>
<image wx:if="{{item.name == '员工'}}" src="{{item.list['avatarUrl'][lindex] || item.list['shareImageUrl'][lindex]}}"></image> <image wx:if="{{item.name == '员工'&& litem.avatarUrl}}" src="{{ litem.avatarUrl? litem.avatarUrl:''}}"></image>
<block wx:if="{{item.name == '转化率'}}">{{litem?(downType == 'equity'?litem*100:litem)+'%': '--'}}</block> <block wx:if="{{item.name == '转化率'}}">{{litem?litem+'%': '--'}}</block>
<block wx:elif="{{item.name == '员工'}}">{{litem.transferName?litem.transferName:'--'}}</block>
<block wx:else>{{litem||'--'}}</block> <block wx:else>{{litem||'--'}}</block>
</view> </view>
</view> </view>
......
...@@ -28,13 +28,15 @@ ...@@ -28,13 +28,15 @@
margin-top: 24rpx; margin-top: 24rpx;
display: flex; display: flex;
align-items: center; align-items: center;
z-index: 9999;
position: static;
.time { .time {
padding: 6rpx 30rpx; padding: 6rpx 30rpx;
border: 2rpx solid #EBEBEB; border: 2rpx solid #EBEBEB;
border-radius: 32rpx; border-radius: 32rpx;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 20rpx;
color: #A6A6A6; color: #A6A6A6;
} }
...@@ -52,14 +54,15 @@ ...@@ -52,14 +54,15 @@
display: flex; display: flex;
align-items: center; align-items: center;
position: absolute; position: absolute;
right:30rpx; right: 30rpx;
.time-icon { .time-icon {
width: 28rpx; width: 25.6rpx;
height: 26rpx; height: 24.6rpx;
} }
.temporal { .temporal {
font-size: 26rpx; font-size: 24rpx;
color: #A6A6A6; color: #A6A6A6;
margin: 0 8rpx; margin: 0 8rpx;
} }
......
...@@ -331,7 +331,7 @@ Component({ ...@@ -331,7 +331,7 @@ Component({
dataType, //数据类型:1报价量/ 2成交量 /3产值 dataType, //数据类型:1报价量/ 2成交量 /3产值
} }
this.data.type == 1 ? params.dateDimension = timePeriod : params.timePeriod = timePeriod this.data.type == 1 ? params.dateDimension = timePeriod : params.timePeriod = timePeriod
if (startTime) this.data.type == 1 ? params.startDate = startTime : params.startTime = startTime + ' 00:00:00 ' if (startTime) this.data.type == 1 ? params.startDate = startTime : params.startTime = startTime + ' 00:00:00'
if (endTime) this.data.type == 1 ? params.endDate = endTime : params.endTime = endTime + ' 23:59:59' if (endTime) this.data.type == 1 ? params.endDate = endTime : params.endTime = endTime + ' 23:59:59'
ActivityApi[methods[this.data.type]](params).then(res => { ActivityApi[methods[this.data.type]](params).then(res => {
this.setData({ this.setData({
...@@ -368,7 +368,7 @@ Component({ ...@@ -368,7 +368,7 @@ Component({
merchantIds: [thisPage.data.merchantId] merchantIds: [thisPage.data.merchantId]
} }
tabelTh = { tabelTh = {
transferName: "员工姓名", transferName: "员工",
outputValue: "产值", outputValue: "产值",
successCount: "成交量", successCount: "成交量",
quotationCount: "报价量", quotationCount: "报价量",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!