Commit 9d0d4e53 by 前端

fixed

1 parent e31818cb
......@@ -310,6 +310,12 @@ class ActivityApi {
...data
})
}
activityStaffRank(data) {
return api.post({
method: `scrm.api.assistant.activity.staff.rank `,
...data
})
}
}
......
// packageOutput/components/staff/staff.js
import Util from '~/utils/util'
Component({
/**
* 组件的属性列表
......@@ -7,8 +8,18 @@ Component({
sfaffList: {
type: Object,
observer(val) {
this.getDetail(val)
this.filterStaff = val
this.setData({selectValue:1})
}
},
tabelTh: {
type: Object,
value: []
},
downType: {
type: String,
value: 'boutique'
}
},
......@@ -42,8 +53,19 @@ Component({
}, {
label: '转化率',
value: 3
}],
equity: [{
label: '成交量',
value: 1
}, {
label: '报价量',
value: 2
}, {
label: '转化率',
value: 3
}]
},
empName: '',
show: true,
selectTxt: '单量',
selectValue: 1,
......@@ -58,12 +80,77 @@ Component({
},
selectType(e) {
const {value,label} = e.target.dataset
console.log(label)
this.setData({
selectValue: value,
show:true,
selectTxt: label
})
this.getDetail(this.filterStaff)
},
hanldBlur(e) {
const empName = e.detail.value;
const sfaffList= this.data.sfaffList.filter(item=>{
const employeeName = item.transferName || item.employeeName
return employeeName?employeeName.includes(empName):item
})
this.filterStaff = sfaffList
this.getDetail(sfaffList)
},
//格式化数组
formatArr(arr, fn) {
let res = {}
for (let v of arr) {
const val = Object.keys(v)
for (let i of val) {
if (res[i]) {
res[i].push(v[i])
continue
}
res[i] = [v[i]]
}
}
return fn(res)
},
// 生成对应的表格数据
getDetail(val) {
let {tabelTh,dataType,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)
})
// let obj = {
// employeeName: '员工姓名',
// orderMoneyTotal: '产值(营业额)',
// upgradeCountTotal: '单量',
// averagePrice: '客单价',
// upgradeRatio: '转化率'
// }
// obj = {
// employeeName: '员工姓名',
// orderMoneyTotal: '产值(营业额)',
// upgradeCountTotal: '转发次数',
// averagePrice: '访客总数',
// upgradeRatio: '浏览总数',
// upgradeRatio: '成交单量',
// upgradeRatio: '转化率',
// }
const sfaffList = this.formatArr(tableData, (item) => {
const result = []
const obj_keys = Object.keys(tabelTh)
for (let k of obj_keys) {
result.push({
name: tabelTh[k],
val: k,
list: item
})
}
return result
})
this.setData({ sfaff:sfaffList })
}
}
})
......@@ -20,7 +20,16 @@
text-align: center;
.staff-type {
width: 108rpx;
width: 128rpx;
text {
display: inline-block;
width: 100rpx;
}
.up-icon {
width: 14rpx;
height: 8rpx;
vertical-align: middle;
}
}
.up-box {
position: absolute;
......
......@@ -3,30 +3,33 @@
<view class="box-title">
<text>员工排行榜</text>
<view class="select-up">
<view bindtap="showUp" class="staff-type">{{selectTxt}}</view>
<view bindtap="showUp" class="staff-type">
<text>{{dataType[downType][selectValue-1].label}}</text>
<glsx-image webp custom-class="up-icon" src="store-assistant-assemble/output/arrow.png"></glsx-image>
</view>
<view class="up-box" hidden="{{show}}">
<view class="up-item {{selectValue == item.value? 'checked':''}}" wx:for="{{dataType}}" wx:key="{{index}}" data-label="{{item.label}}" data-value="{{item.value}}" catchtap="selectType">
<view class="up-item {{selectValue == item.value? 'checked':''}}" wx:for="{{dataType[downType]}}" wx:key="{{index}}" data-label="{{item.label}}" data-value="{{item.value}}" catchtap="selectType">
{{item.label}}
</view>
</view>
</view>
</view>
<view class="staff-input">
<input placeholder="输入员工名称" />
<input placeholder="输入员工名称" value="{{empName}}" bind:blur="hanldBlur"/>
<icon class="icon-small" type="search" size="14"></icon>
</view>
<view class='table'>
<!-- 左侧固定 -->
<view class='table_left_column'>
<view class='left_col_item'>排名</view>
<view class='left_col_item' wx:for="{{sfaffList[0].list[sfaffList[0].val]}}" wx:for-index="index" wx:key="index">{{index+1}}</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>
<!-- 右侧表格滚动 -->
<view class="table_right_scroll_box">
<view class="flex_direction_column_item" wx:for="{{sfaffList}}" 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 wx:for="{{item.list[item.val]}}" wx:for-item="litem" wx:for-index="lindex" wx:key="lindex" class='item_name item_desc'>
<block>{{litem}}</block>
<block>{{litem||'--'}}</block>
</view>
</view>
</view>
......
// packageOutput/pages/crowdDetail/crowdDetail.js
import ActivityApi from '~/api/activityApi/index'
Page({
/**
......@@ -52,7 +53,8 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getDetail()
const {activityId} = options
this.getDetail(activityId)
},
formatArr(arr, fn) {
let res = {}
......@@ -68,7 +70,8 @@ Page({
}
return fn(res)
},
getDetail() {
getDetail(activityId) {
ActivityApi.activityStaffRank({activityId})
const d = [{ employeeName: '张三', avatarUrl: '33' }]
let obj = {
employeeName: '员工姓名',
......@@ -80,7 +83,7 @@ Page({
obj = {
employeeName: '员工姓名',
orderMoneyTotal: '产值(营业额)',
upgradeCountTotal: '转发字数',
upgradeCountTotal: '转发次数',
averagePrice: '访客总数',
upgradeRatio: '浏览总数',
upgradeRatio: '成交单量',
......
.container {
height: 100vh;
overflow: hidden;
}
.layout {
position: relative;
......
......@@ -80,8 +80,7 @@ Page({
//查看报表
getReport() {
const { type, timeType, merchantId,timeValue } = this.data
let apiName
let params;
let apiName,params
const dataT = {
1: {
day: () => {
......
......@@ -5,6 +5,7 @@
"activity-ing":"../activitying/index",
"activity-end":"../activityend/index",
"output-bar": "./components/OutputBar/OutputBar",
"output-line": "./components/OutputLine/OutputLine"
"output-line": "./components/OutputLine/OutputLine",
"staff": "../../../../packageOutput/components/staff/staff"
}
}
\ No newline at end of file
......@@ -67,6 +67,7 @@
box-shadow: 0 2rpx 20rpx 0 #b4bacc52;
border-radius: 20rpx;
margin: 24rpx auto 0rpx;
height: 300rpx;
}
.table-box {
......
<scroll-view scroll-y class="content" class="content" refresher-triggered="{{triggered}}" refresher-enabled bindrefresherrefresh="activityRefresh" bindscroll="scrollIng" style="{{'height: calc(100% - 22rpx);'}}">
<scroll-view scroll-y class="content" class="content" refresher-triggered="{{triggered}}" refresher-enabled bindrefresherrefresh="activityRefresh" style="{{'height: calc(100% - 22rpx);'}}">
<view class="output-box">
<view class="output-title">产值总览</view>
<view class="output-value">
......@@ -21,9 +21,7 @@
<view class="bar-box">
<output-bar opts="{{opts}}"></output-bar>
</view>
<view class="staf-box">
555
</view>
<staff sfaffList="{{sfaffList}}" tabelTh="{{tabelTh}}" downType="{{type ==2?'equity':'boutique'}}"/>
<view class="table-box">
<view class="btn-box day-btn" bindtap="jumpReport" data-time="day">查看日报表</view>
<view class="btn-box month-btn" bindtap="jumpReport" data-time="month">查看月报表</view>
......
......@@ -53,48 +53,18 @@ Component({
count:0,
serviceType:0
},{
logo:'syyhdyy_icon',
active:'syyhdyy_icon_active',
title:'私域用户代运营',
count:1,
serviceType:3
},{
logo:'pzj_icon',
active:'pzj_icon_active',
title:'膨胀金活动',
count:0,
serviceType:-1
},{
logo:'sgjy_icon',
active:'sgjy_icon_active',
title:'续保膨胀金',
title:'精品升级',
count:0,
serviceType:1
},{
logo:'db_icon',
active:'db_icon_active',
title:'定保招揽',
title:'会员权益/升级',
count:0,
serviceType:2
},{
logo:'jplq_icon',
active:'jplq_icon_active',
title:'精品礼券',
count:0,
serviceType:4
},{
logo:'xubao_icon',
active:'xubao_icon_active',
title:'续保招揽',
count:0,
serviceType:5
},{
logo:'holiday_icon',
active:'holiday_icon_active',
title:'节假日关怀',
count:0,
serviceType:6
},]
}]
tabs.forEach(item=>{
data.forEach(el=>{
if(item.serviceType==el.serviceType){
......
......@@ -2,7 +2,7 @@
<view class="wrapper">
<view class="title">工作台</view>
<block wx:for="{{menus}}" wx:key="index">
<view catch:tap="selectMenu" data-index="{{index}}" class="element {{index==current?'active':''}}">
<view catch:tap="selectMenu" data-index="{{item.serviceType}}" class="element {{item.serviceType==current?'active':''}}">
<glsx-image class="logo" webp src="store-assistant/menu/{{current==index?item.active:item.logo}}.png"></glsx-image>
<view class="label">{{item.title}}</view>
<view wx:if="{{totals&&item.serviceType==0}}" class="num_pannel">{{totals}}</view>
......
......@@ -19,11 +19,11 @@
<scroll-view class="tab-scroll" scroll-into-view="{{to}}" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-x="{{true}}" scroll-with-animation>
<block wx:for="{{tab}}" wx:key="index">
<view id="{{tab.length<3?'':'to-'+index}}" class="tab_element" bindtap="click" data-index="{{index}}">
<view class="inner {{index == tabIndex? 'active' : '' }}">
<view class="inner {{currentServiceType == item.serviceType? 'active' : '' }}">
{{item.serviceTypeName}}
<block wx:if="{{item.serviceType == 0&&totals_zc}}">({{totals_zc|| 0}})</block>
</view>
<view wx:if="{{index == tabIndex}}" class="line"></view>
<view wx:if="{{currentServiceType == item.serviceType}}" class="line"></view>
</view>
</block>
</scroll-view>
......@@ -46,4 +46,4 @@
</view>
</block>
<!-- 菜单信息 -->
<menu bind:currentMenu="getCurrentMenu" tabs="{{tab}}" totals="{{totals_zc}}" tabIndex="{{tabIndex}}" show="{{showMenu}}"></menu>
\ No newline at end of file
<menu bind:currentMenu="getCurrentMenu" tabs="{{tab}}" totals="{{totals_zc}}" tabIndex="{{currentServiceType}}" show="{{showMenu}}"></menu>
\ No newline at end of file
......@@ -111,7 +111,7 @@
},
{
"name": "",
"pathName": "pages/tab/output/output",
"pathName": "packageOutput/pages/crowdDetail/crowdDetail",
"query": "",
"launchMode": "default",
"scene": null
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!