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({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
sfaffList: { sfaffList: {
type: Object, type: Object,
observer(val) { observer(val) {
this.getDetail(val) console.log(val, 'sfaffList')
this.filterStaff = val this.getDetail(val)
this.setData({selectValue:1}) this.filterStaff = val
} this.setData({
selectValue: 1
})
}
}, },
tabelTh: { tabelTh: {
type: Object, type: Object,
value: [] value: []
}, },
downType: { downType: {
type: String, type: String,
value: 'boutique' value: 'boutique'
} }
}, },
...@@ -28,51 +34,51 @@ Component({ ...@@ -28,51 +34,51 @@ Component({
*/ */
data: { data: {
dataType: { dataType: {
crowType: [{ crowType: [{
label: '产值', label: '产值',
value: 1 value: 1
},{ }, {
label: '转发次数', label: '转发次数',
value: 2 value: 2
}, { }, {
label: '访客总数', label: '访客总数',
value: 3 value: 3
}, { }, {
label: '浏览总数', label: '浏览总数',
value: 4 value: 4
}, { }, {
label: '成交单量', label: '成交单量',
value: 5 value: 5
}, { }, {
label: '转化率', label: '转化率',
value: 6 value: 6
}], }],
boutique: [{ boutique: [{
label: '产值', label: '产值',
value: 1 value: 1
},{ }, {
label: '单量', label: '单量',
value: 2 value: 2
}, { }, {
label: '客单量', label: '客单量',
value: 3 value: 3
}, { }, {
label: '转化率', label: '转化率',
value: 4 value: 4
}], }],
equity: [{ equity: [{
label: '产值', label: '产值',
value: 1 value: 1
},{ }, {
label: '成交量', label: '成交量',
value: 2 value: 2
}, { }, {
label: '报价量', label: '报价量',
value: 3 value: 3
}, { }, {
label: '转化率', label: '转化率',
value: 4 value: 4
}] }]
}, },
empName: '', empName: '',
show: true, show: true,
...@@ -85,66 +91,114 @@ Component({ ...@@ -85,66 +91,114 @@ Component({
*/ */
methods: { methods: {
showUp() { showUp() {
this.setData({show:false}) this.setData({
show: false
})
}, },
//选择排序 //选择排序
selectType(e) { selectType(e) {
const {value,label} = e.target.dataset const {
this.setData({ value,
selectValue: value, label
show:true, } = e.target.dataset
selectTxt: label this.setData({
}) selectValue: value,
this.getDetail(this.filterStaff) show: true,
selectTxt: label
})
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)
}, },
//格式化数组 //格式化数组
formatArr(arr, fn) { formatArr(arr, fn) {
let res = {} let res = {}
for (let v of arr) { for (let v of arr) {
const val = Object.keys(v) const val = Object.keys(v)
for (let i of val) { for (let i of val) {
if (res[i]) { if (res[i]) {
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,
sortKey = i selectValue,
} downType
} = this.data, sortKey
for (let i in tabelTh) {
if (tabelTh[i] == dataType[downType][selectValue - 1].label) {
sortKey = i
} }
const tableData = Util.deepClone(val).sort((a,b)=>{ }
return (b[sortKey]||0)-(a[sortKey]||0) const tableData = Util.deepClone(val).sort((a, b) => {
}) return (b[sortKey] || 0) - (a[sortKey] || 0)
const sfaffList = this.formatArr(tableData, (item) => { })
const result = []
const obj_keys = Object.keys(tabelTh) const sfaffList = this.formatArr(tableData, (item) => {
for (let k of obj_keys) { const result = []
result.push({ const obj_keys = Object.keys(tabelTh);
name: tabelTh[k], const handleParams = (k)=> {
val: k, let obj= {
list: item [k]: (item, k) => {
return item[k]
},
transferName: (item) => {
let arr = []
item.avatar.forEach((val, index) => {
arr.push({
avatarUrl: val,
transferName: item.transferName[index]
}) })
} })
return result return arr
}) },
this.setData({ sfaff:sfaffList }) 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) {
result.push({
name: tabelTh[k],
val: k,
list:handleParams(k)[k](item, k)
})
}
return result
})
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!