Commit 4dcd568f by chenwq

联调;我的员工

1 parent 50d2e58b
// pages/tab/output/components/StaffSort/StaffSort.js
import { scenceList } from '~/pages/tab/index/constant/data'
const busiOptSceneCode = ['-1', 'SC002', 'SC001']
import mineApi from '~/api/mineApi/index'
import { getNowMonth } from '~/utils/format'
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
busiOptSceneCode,
formData: {
// 0:全部-1;1:精品升级SC002;2:会员权益/升级SC001
busiIdx: 0,
sceneCode: '-1',
yqMerchantName: '全部服务中心',
timeIdx: 0
},
// 服务中心
popupShow: false,
serviceList: [],
// 筛选项折叠
isFold: false,
baseData: {
busiList: [],
timeList: [{
label: '今日指标',
name: 'todayTime'
}, {
label: '本月指标',
name: 'monthTime'
}, {
label: '累计指标',
name: 'defaultTime'
}]
}
},
lifetimes: {
attached() {
this.initTime()
this.dealBusiList()
this.getSeviceCenter()
}
},
/**
* 组件的方法列表
*/
methods: {
handleInput(e) {
let { attr } = e.currentTarget.dataset
let { value } = e.detail
this.setData({
['formData.' + attr]: value
})
},
changeFold() {
let { isFold } = this.data
this.setData({
isFold: !this.data.isFold
})
},
handleInputFocus() {
this.changeFold()
},
handleInputBlur() {
this.changeFold()
},
// 获取服务中心数据
getSeviceCenter() {
mineApi.getServiceCenterListAPI({}).then(res => {
let data = res || []
let serviceIds = data.map(val => { return val.yqMerchantId })
this.setData({
serviceList: res || [],
allServiceIds: serviceIds
})
})
},
// 筛选服务中心
filterTypeFn() {
this.setData({
popupShow: !this.data.popupShow
})
},
// 获取员工列表
getStaffList(e) {
wx.$api.hideLoading()
console.log(e, '切换----')
let { formData } = this.data
this.setData({
formData: {
...formData,
yqMerchantId: e.detail.yqMerchantId,
yqMerchantName: e.detail.yqMerchantName
}
})
},
// 格式化时间
initTime() {
let date = new Date()
let today = date.getDate()
let month = getNowMonth()
const todayTime = {
startTime: `${month}-${today} 00:00:00`,
endTime: `${month}-${today} 23:59:59`
}
const monthTime = {
startTime: `${month}-01 00:00:00`,
endTime: `${month}-${today} 23:59:59`
}
const defaultTime = {
startTime: '',
endTime: `${month}-${today} 23:59:59`
}
this.setData({
dataObj: {
todayTime,
monthTime,
defaultTime
}
})
},
handleTimeChange() {
let { baseData: { timeList } } = this.data
wx.showActionSheet({
itemList: timeList.map(item => item.label),
success: res => {
this.setData({
['formData.timeIdx']: res.tapIndex
})
// this.handleBusiSearch()
}
})
},
dealBusiList() {
let list = [{
name: '全部业务',
sceneCode: '-1'
}]
busiOptSceneCode.forEach(item => {
let _target = scenceList.find(k => k.sceneCode == item)
if (_target) {
list.push({
name: _target.name,
sceneCode: _target.sceneCode
})
}
})
this.setData({
['baseData.busiList']: list
})
},
handleClickTab(e) {
let { baseData: { busiList } } = this.data
console.log('???')
// 筛选
wx.showActionSheet({
itemList: busiList.map(item => item.name),
success: res => {
// this.resetBusiSearch()
this.setData({
['formData.busiIdx']: res.tapIndex,
['formData.sceneCode']: busiOptSceneCode[res.tapIndex]
})
// this.handleBusiSearch()
}
})
},
}
})
{
"component": true,
"usingComponents": {
"select-service-popup": "../selectServicePopup/selectServicePopup"
}
}
\ No newline at end of file
/* pages/tab/output/components/StaffSort/StaffSort.wxss */
.total-tab {
box-sizing: border-box;
background: #FFFFFF;
display: flex;
justify-content: space-between;
height: 92rpx;
padding: 16rpx;
.tabs-box {
display: flex;
width: calc(100% - 138rpx);
}
.tab {
box-sizing: border-box;
display: inline-block;
width: auto;
height: 60rpx;
background: #F2F3F7;
border-radius: 32rpx;
padding: 13rpx 18rpx;
font-size: 24rpx;
color: #8A8C90;
margin-right: 16rpx;
flex-shrink: 0;
}
.tab.active {
background: #3666fe1a;
color: #3666FE;
}
.tab:last-child {
margin-right: 0;
}
.icon {
width: 32rpx;
height: 32rpx;
}
.right-box {
display: flex;
box-sizing: border-box;
height: 60rpx;
color: #8A8C90;
}
.input {
box-sizing: border-box;
width: 128rpx;
height: 60rpx;
background: #F8F9FC;
border-radius: 38rpx;
padding-left: 20rpx;
margin-left: 10rpx;
transition: width 0.2s ease-out;
}
.long-input {
width: calc(100vw - 180rpx);
}
.input-placeholder {
font-size: 28rpx;
color: #858A94;
}
}
\ No newline at end of file
<!--pages/tab/output/components/StaffSort/StaffSort.wxml-->
<view class="total-tab">
<view wx:if="{{isFold}}" class="tab {{(formData.busiIdx != '0' || formData.yqMerchantId || formData.timeIdx != '0') ? 'active' : ''}}">筛选
<glsx-image src="{{(formData.busiIdx != '0' || formData.yqMerchantId || formData.timeIdx != '0') ? 'output/icon-arrow-act.png' : 'output/icon-arrow.png'}}" class="icon" />
</view>
<scroll-view wx:else scroll-x="{{true}}">
<view class="tabs-box">
<view class="tab {{formData.busiIdx != '0' ? 'active' : ''}}" bindtap="handleClickTab">
{{baseData.busiList[formData.busiIdx || 0].name}}
<glsx-image src="{{formData.busiIdx != '0' ? 'output/icon-arrow-act.png' : 'output/icon-arrow.png'}}" class="icon" />
</view>
<view class="tab {{formData.yqMerchantId ? 'active' : ''}}" data-attr="tabActive" data-val="store" bindtap="filterTypeFn">
{{ formData.yqMerchantName }}
<glsx-image src="{{formData.yqMerchantId ? 'output/icon-arrow-act.png' : 'output/icon-arrow.png'}}" class="icon" />
</view>
<view class="tab {{formData.timeIdx != '0' ? 'active' : ''}}" bindtap="handleTimeChange">
{{baseData.timeList[formData.timeIdx || 0].label}}
<glsx-image src="{{formData.timeIdx != '0' ? 'output/icon-arrow-act.png' : 'output/icon-arrow.png'}}" class="icon" />
</view>
</view>
</scroll-view>
<view class="right-box">
<input type="text" placeholder="{{isFold ? '请输入员工姓名搜索' : '姓名'}}" maxlength="10" class="input {{ isFold ? 'long-input' : '' }}" value="{{formData.userName}}" placeholder-class="input-placeholder" data-attr="userName" confirm-type="search" bindinput="handleInput" bindfocus="handleInputFocus" bindblur="handleInputBlur" />
</view>
</view>
<select-service-popup wx:if="{{popupShow}}" bind:hidePopup="filterTypeFn" bind:getStaffList="getStaffList" selectInfo="{{formData}}" popShow="{{popupShow}}" serviceRange="{{serviceList}}" />
\ No newline at end of file
// pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.js
import { IMG_URL } from '~/utils/constantData.js'
Component({
options: {
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
popShow: {
type: Boolean,
value: false,
observer: function (n) {
if (n) {
let { serviceRange, selectInfo } = this.data
let activeIndex = serviceRange.findIndex(v => v.yqMerchantId == selectInfo.yqMerchantId)
if (serviceRange.length) serviceRange.unshift({yqMerchantId: '', yqMerchantName: '全部'})
serviceRange.forEach((item, ind) => {
item.show = true
if (activeIndex == (ind - 1)) {
item.act = true
} else {
item.act = false
}
this.setData({
serviceRange
})
})
this.setData({
searchKeyword: ''
})
}
}
},
serviceRange: Object,
selectInfo: Object
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
serviceList: [],
searchKeyword: ''
},
observers: {
serviceRange: function (e) {
this.setData({
serviceList: e || []
})
}
},
/**
* 组件的方法列表
*/
methods: {
hidePopup() {
this.triggerEvent('hidePopup')
},
confirm() {
let { serviceRange, subIndex } = this.data
let actObj = serviceRange.find((item, index) => {
if (item.act) {
subIndex = index
}
return item.act
})
if (!actObj) {
return wx.$api.showToast({
title: '请选择服务中心',
icon: 'error'
})
} else {
if (actObj.yqMerchantId == '' && actObj.yqMerchantName == '全部') actObj.yqMerchantName = '全部服务中心'
this.changePicker(actObj)
}
},
changePicker(actObj) {
// 修改对应下标显示
wx.$api.showLoading('加载中...')
this.triggerEvent('getStaffList', {...actObj})
this.hidePopup()
},
select(e) {
let { index } = e.currentTarget.dataset
let { serviceRange } = this.data
serviceRange.forEach((item, ind) => {
if (index == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
serviceRange
})
})
},
search(e) {
let { serviceRange } = this.data
let { value } = e.currentTarget.dataset && Object.keys(e.currentTarget.dataset).length ? e.currentTarget.dataset : e.detail
serviceRange.forEach(item => {
item.act = false
item.show = item.yqMerchantName?.includes(value)
})
this.setData({
serviceRange
})
},
input(e) {
let { value } = e.detail
this.setData({
searchKeyword: value
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* packagesList/mineDetail/components/selectService/selectService.wxss */
.search-box {
width: 100%;
height: 104rpx;
padding-left: 32rpx;
display: flex;
align-items: center;
background-color: #fff;
position: sticky;
top: 0;
left: 0;
z-index: 9;
box-sizing: border-box;
.search {
width: 144rpx;
height: 100%;
color: #666;
box-sizing: border-box;
padding: 0 24rpx;
.text-center {
font-size: 24rpx;
border-radius: 12rpx;
width: 100%;
font-size: 32rpx;
color: #858A94;
.search-filter {
margin-left: 6rpx;
width: 24rpx;
height: 24rpx;
}
}
}
.search-input {
background: #F7F8FA;
border-radius: 38rpx;
width: 606rpx;
height: 72rpx;
display: flex;
align-items: center;
padding-left: 26rpx;
.input-placeholder {
color: rgba(200, 201, 204, .89);
}
.search-icon {
width: 28rpx;
height: 28rpx;
}
.search-clear {
width: 36rpx;
height: 36rpx;
margin: 0 26rpx 0 10rpx;
}
.input {
font-size: 28rpx;
width: calc(100% - 136rpx);
margin-left: 10rpx;
}
}
}
.list {
height: calc(100% - 100rpx) !important;
}
.itemCon {
box-sizing: border-box;
width: 100%;
height: 80rpx;
color: #323436;
line-height: 80rpx;
padding: 0 32rpx;
}
.active {
background: #F0F7FF;
font-size: 28rpx;
color: #3666FE;
}
\ No newline at end of file
<!--packagesList/mineDetail/components/selectService/selectService.wxml-->
<popup
show="{{popShow}}"
bind:hidePopup="hidePopup"
bindconfirm="confirm"
height="60%">
<view class="search-box">
<view class="search-input">
<glsx-image src="output/searchIcon.png" class="search-icon" />
<input
type="text"
placeholder="请搜索服务中心"
class="input"
value="{{keyword}}"
placeholder-class="input-placeholder"
bindinput="input"
bindconfirm="search" />
<block wx:if="{{keyword}}">
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search text-center" bindtap="search" data-value="{{searchKeyword}}">
<view class="text-center">搜索</view>
</view>
</view>
<scroll-view
scroll-y
enable-back-to-top
refresher-enabled="{{true}}"
bindrefresherrefresh="refreshList"
refresher-threshold="104"
scroll-top="{{scrollTop}}"
class="list"
style="height:100%;"
data-type="message"
refresher-triggered="{{triggered}}">
<block wx:for="{{serviceList}}" wx:key="index">
<view
class="itemCon text-hide {{item.act?'active':''}}"
data-index="{{index}}"
hidden="{{!item.show}}"
bindtap="select">
{{item.yqMerchantName}}
</view>
</block>
</scroll-view>
</popup>
......@@ -10,7 +10,7 @@ Component({
* 组件的初始数据
*/
data: {
expectImg: `${IMG_URL}/output/expect.png`
},
/**
......
{
"component": true,
"usingComponents": {}
"usingComponents": {
"staff-sort": "../StaffSort/StaffSort"
}
}
\ No newline at end of file
/* pages/tab/output/components/staff/staff.wxss */
.staffCon {
box-sizing: border-box;
display: flex;
flex-direction: column;
// justify-content: center;
align-items: center;
padding-top: 88rpx;
background-color: #fff;
height: 100%;
.img {
width: 512rpx;
height: 512rpx;
}
.label {
margin-top: -50rpx;
}
}
\ No newline at end of file
<!-- pages/tab/output/components/staff/staff.wxml -->
<view class="staffCon">
<image class="img" src="{{expectImg}}" />
<view class="label">程序员在通宵建设中…</view>
</view>
<staff-sort></staff-sort>
</view>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!