Commit 9d0d4e53 by 前端

fixed

1 parent e31818cb
...@@ -310,6 +310,12 @@ class ActivityApi { ...@@ -310,6 +310,12 @@ class ActivityApi {
...data ...data
}) })
} }
activityStaffRank(data) {
return api.post({
method: `scrm.api.assistant.activity.staff.rank `,
...data
})
}
} }
......
// packageOutput/components/staff/staff.js // packageOutput/components/staff/staff.js
import Util from '~/utils/util'
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -7,8 +8,18 @@ Component({ ...@@ -7,8 +8,18 @@ Component({
sfaffList: { sfaffList: {
type: Object, type: Object,
observer(val) { 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({ ...@@ -42,8 +53,19 @@ Component({
}, { }, {
label: '转化率', label: '转化率',
value: 3 value: 3
}],
equity: [{
label: '成交量',
value: 1
}, {
label: '报价量',
value: 2
}, {
label: '转化率',
value: 3
}] }]
}, },
empName: '',
show: true, show: true,
selectTxt: '单量', selectTxt: '单量',
selectValue: 1, selectValue: 1,
...@@ -58,12 +80,77 @@ Component({ ...@@ -58,12 +80,77 @@ Component({
}, },
selectType(e) { selectType(e) {
const {value,label} = e.target.dataset const {value,label} = e.target.dataset
console.log(label)
this.setData({ this.setData({
selectValue: value, selectValue: value,
show:true, show:true,
selectTxt: label 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 @@ ...@@ -20,7 +20,16 @@
text-align: center; text-align: center;
.staff-type { .staff-type {
width: 108rpx; width: 128rpx;
text {
display: inline-block;
width: 100rpx;
}
.up-icon {
width: 14rpx;
height: 8rpx;
vertical-align: middle;
}
} }
.up-box { .up-box {
position: absolute; position: absolute;
......
...@@ -3,30 +3,33 @@ ...@@ -3,30 +3,33 @@
<view class="box-title"> <view class="box-title">
<text>员工排行榜</text> <text>员工排行榜</text>
<view class="select-up"> <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-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}} {{item.label}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="staff-input"> <view class="staff-input">
<input placeholder="输入员工名称" /> <input placeholder="输入员工名称" value="{{empName}}" bind:blur="hanldBlur"/>
<icon class="icon-small" type="search" size="14"></icon> <icon class="icon-small" type="search" size="14"></icon>
</view> </view>
<view class='table'> <view class='table'>
<!-- 左侧固定 --> <!-- 左侧固定 -->
<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="{{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>
<!-- 右侧表格滚动 --> <!-- 右侧表格滚动 -->
<view class="table_right_scroll_box"> <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 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[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> </view>
</view> </view>
......
// packageOutput/pages/crowdDetail/crowdDetail.js // packageOutput/pages/crowdDetail/crowdDetail.js
import ActivityApi from '~/api/activityApi/index'
Page({ Page({
/** /**
...@@ -52,7 +53,8 @@ Page({ ...@@ -52,7 +53,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.getDetail() const {activityId} = options
this.getDetail(activityId)
}, },
formatArr(arr, fn) { formatArr(arr, fn) {
let res = {} let res = {}
...@@ -68,7 +70,8 @@ Page({ ...@@ -68,7 +70,8 @@ Page({
} }
return fn(res) return fn(res)
}, },
getDetail() { getDetail(activityId) {
ActivityApi.activityStaffRank({activityId})
const d = [{ employeeName: '张三', avatarUrl: '33' }] const d = [{ employeeName: '张三', avatarUrl: '33' }]
let obj = { let obj = {
employeeName: '员工姓名', employeeName: '员工姓名',
...@@ -80,7 +83,7 @@ Page({ ...@@ -80,7 +83,7 @@ Page({
obj = { obj = {
employeeName: '员工姓名', employeeName: '员工姓名',
orderMoneyTotal: '产值(营业额)', orderMoneyTotal: '产值(营业额)',
upgradeCountTotal: '转发字数', upgradeCountTotal: '转发次数',
averagePrice: '访客总数', averagePrice: '访客总数',
upgradeRatio: '浏览总数', upgradeRatio: '浏览总数',
upgradeRatio: '成交单量', upgradeRatio: '成交单量',
......
.container {
height: 100vh;
overflow: hidden;
}
.layout { .layout {
position: relative; position: relative;
......
...@@ -80,8 +80,7 @@ Page({ ...@@ -80,8 +80,7 @@ Page({
//查看报表 //查看报表
getReport() { getReport() {
const { type, timeType, merchantId,timeValue } = this.data const { type, timeType, merchantId,timeValue } = this.data
let apiName let apiName,params
let params;
const dataT = { const dataT = {
1: { 1: {
day: () => { day: () => {
......
...@@ -114,7 +114,7 @@ Component({ ...@@ -114,7 +114,7 @@ Component({
opts: { opts: {
keys: ['abscissaValue', 'ordinateValue'], keys: ['abscissaValue', 'ordinateValue'],
color: '#69C9FF', color: '#69C9FF',
lineColr:'#6ED0BE', lineColr: '#6ED0BE',
tickCount: 8, tickCount: 8,
tabList: [{ tabList: [{
title: '营业额', title: '营业额',
...@@ -156,7 +156,7 @@ Component({ ...@@ -156,7 +156,7 @@ Component({
sales: 38 sales: 38
}, },
], ],
lineData:[] lineData: []
}, },
}, },
...@@ -177,7 +177,7 @@ Component({ ...@@ -177,7 +177,7 @@ Component({
pageSize: 10, pageSize: 10,
noResult: false noResult: false
}, () => { }, () => {
thisPage = wx.$router.getPageInstance()
this.getActivityInfo() this.getActivityInfo()
}) })
}, },
...@@ -194,12 +194,12 @@ Component({ ...@@ -194,12 +194,12 @@ Component({
} = this.data } = this.data
let apiName = 'boutiquecouponOutputValue' let apiName = 'boutiquecouponOutputValue'
let params = { let params = {
merchantId: 44211765 merchantId: thisPage.data.merchantId
} }
if ([2].includes(type)) { if ([2].includes(type)) {
apiName = 'merchantsOutput' apiName = 'merchantsOutput'
params = { params = {
merchantIds: [44211765] merchantIds: [thisPage.data.merchantId]
} }
} }
ActivityApi[apiName](params).then(res => { ActivityApi[apiName](params).then(res => {
...@@ -208,13 +208,13 @@ Component({ ...@@ -208,13 +208,13 @@ Component({
}) })
}) })
}, },
selectEvent(){ selectEvent() {
this.getTrend() this.getTrend()
}, },
/**柱状图 */ /**柱状图 */
getHistogram() { getHistogram() {
const params = { const params = {
merchantId: 44211765, merchantId: thisPage.data.merchantId,
dataType: 1, //数据类型:1报价量/ 2成交量 /3产值 dataType: 1, //数据类型:1报价量/ 2成交量 /3产值
timePeriod: 1, //时间类型 1本周 / 2本月 /3全年 timePeriod: 1, //时间类型 1本周 / 2本月 /3全年
startTime: '', startTime: '',
...@@ -227,17 +227,17 @@ Component({ ...@@ -227,17 +227,17 @@ Component({
/**折线图 */ /**折线图 */
getTrend() { getTrend() {
const lineObj = this.selectComponent('#line') const lineObj = this.selectComponent('#line')
let {dataType,timePeriod,startTime,endTime} = lineObj.data let { dataType, timePeriod, startTime, endTime } = lineObj.data
const params = { const params = {
merchantId: 44211765, merchantId: thisPage.data.merchantId,
dataType, //数据类型:1报价量/ 2成交量 /3产值 dataType, //数据类型:1报价量/ 2成交量 /3产值
dateDimension:timePeriod, //时间类型 1本周 / 2本月 /3全年 dateDimension: timePeriod, //时间类型 1本周 / 2本月 /3全年
startDate:startTime, startDate: startTime,
endDate:endTime endDate: endTime
} }
ActivityApi.boutiquecouponQueryOrderMoneyTotalAndToShopCount(params).then(res => { ActivityApi.boutiquecouponQueryOrderMoneyTotalAndToShopCount(params).then(res => {
this.setData({ this.setData({
'opts.lineData':res 'opts.lineData': res
}) })
console.log(this.data.opts.lineData) console.log(this.data.opts.lineData)
}) })
...@@ -247,15 +247,55 @@ Component({ ...@@ -247,15 +247,55 @@ Component({
}, },
/**员工排行 */ /**员工排行 */
getStaffOutput() { getStaffOutput() {
const params = { const {
merchantIds: [44211765], type
transferName: '', } = this.data
orderBy: 1, //排序:1-产值,2-成交量,3-报价量,4-转化率 let apiName, params, tabelTh;
const dataT = {
1: () => {
apiName = 'boutiquecouponQueryEmployeeRankList',
params = { merchantId: thisPage.data.merchantId },
tabelTh = {
employeeName: '员工姓名',
orderMoneyTotal: '产值(营业额)',
upgradeCountTotal: '单量',
averagePrice: '客单价',
upgradeRatio: '转化率'
} }
ActivityApi.merchantsStaffOutput(params).then(res => { },
console.log(res) 2: () => {
apiName = 'merchantsStaffOutput',
params = { merchantIds: [thisPage.data.merchantId] }
tabelTh = {
transferName: "员工姓名",
outputValue: "产值",
successCount: "成交量",
quotationCount: "报价量",
conversionRate: "转化率",
}
}
}
dataT[type]()
ActivityApi[apiName](params).then(res => {
const sfaffList = res.list || res || []
this.setData({ sfaffList ,tabelTh})
}) })
}, },
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)
},
// 下拉刷新 // 下拉刷新
activityRefresh(e) { activityRefresh(e) {
this.getActivityInfo() this.getActivityInfo()
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"activity-ing":"../activitying/index", "activity-ing":"../activitying/index",
"activity-end":"../activityend/index", "activity-end":"../activityend/index",
"output-bar": "./components/OutputBar/OutputBar", "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 \ No newline at end of file
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
box-shadow: 0 2rpx 20rpx 0 #b4bacc52; box-shadow: 0 2rpx 20rpx 0 #b4bacc52;
border-radius: 20rpx; border-radius: 20rpx;
margin: 24rpx auto 0rpx; margin: 24rpx auto 0rpx;
height: 300rpx;
} }
.table-box { .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-box">
<view class="output-title">产值总览</view> <view class="output-title">产值总览</view>
<view class="output-value"> <view class="output-value">
...@@ -21,9 +21,7 @@ ...@@ -21,9 +21,7 @@
<view class="bar-box"> <view class="bar-box">
<output-bar opts="{{opts}}"></output-bar> <output-bar opts="{{opts}}"></output-bar>
</view> </view>
<view class="staf-box"> <staff sfaffList="{{sfaffList}}" tabelTh="{{tabelTh}}" downType="{{type ==2?'equity':'boutique'}}"/>
555
</view>
<view class="table-box"> <view class="table-box">
<view class="btn-box day-btn" bindtap="jumpReport" data-time="day">查看日报表</view> <view class="btn-box day-btn" bindtap="jumpReport" data-time="day">查看日报表</view>
<view class="btn-box month-btn" bindtap="jumpReport" data-time="month">查看月报表</view> <view class="btn-box month-btn" bindtap="jumpReport" data-time="month">查看月报表</view>
......
...@@ -53,48 +53,18 @@ Component({ ...@@ -53,48 +53,18 @@ Component({
count:0, count:0,
serviceType: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', logo:'sgjy_icon',
active:'sgjy_icon_active', active:'sgjy_icon_active',
title:'续保膨胀金', title:'精品升级',
count:0, count:0,
serviceType:1 serviceType:1
},{ },{
logo:'db_icon', logo:'db_icon',
active:'db_icon_active', active:'db_icon_active',
title:'定保招揽', title:'会员权益/升级',
count:0, count:0,
serviceType:2 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=>{ tabs.forEach(item=>{
data.forEach(el=>{ data.forEach(el=>{
if(item.serviceType==el.serviceType){ if(item.serviceType==el.serviceType){
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="wrapper"> <view class="wrapper">
<view class="title">工作台</view> <view class="title">工作台</view>
<block wx:for="{{menus}}" wx:key="index"> <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> <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 class="label">{{item.title}}</view>
<view wx:if="{{totals&&item.serviceType==0}}" class="num_pannel">{{totals}}</view> <view wx:if="{{totals&&item.serviceType==0}}" class="num_pannel">{{totals}}</view>
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
<scroll-view class="tab-scroll" scroll-into-view="{{to}}" enhanced="{{true}}" show-scrollbar="{{false}}" scroll-x="{{true}}" scroll-with-animation> <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"> <block wx:for="{{tab}}" wx:key="index">
<view id="{{tab.length<3?'':'to-'+index}}" class="tab_element" bindtap="click" data-index="{{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}} {{item.serviceTypeName}}
<block wx:if="{{item.serviceType == 0&&totals_zc}}">({{totals_zc|| 0}})</block> <block wx:if="{{item.serviceType == 0&&totals_zc}}">({{totals_zc|| 0}})</block>
</view> </view>
<view wx:if="{{index == tabIndex}}" class="line"></view> <view wx:if="{{currentServiceType == item.serviceType}}" class="line"></view>
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
...@@ -46,4 +46,4 @@ ...@@ -46,4 +46,4 @@
</view> </view>
</block> </block>
<!-- 菜单信息 --> <!-- 菜单信息 -->
<menu bind:currentMenu="getCurrentMenu" tabs="{{tab}}" totals="{{totals_zc}}" tabIndex="{{tabIndex}}" show="{{showMenu}}"></menu>
\ No newline at end of file \ 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 \ No newline at end of file
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
}, },
{ {
"name": "", "name": "",
"pathName": "pages/tab/output/output", "pathName": "packageOutput/pages/crowdDetail/crowdDetail",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!