Commit 7fb97208 by zhangxw

看产值初始化

1 parent 00324d76
Showing 35 changed files with 2505 additions and 9 deletions
......@@ -3,6 +3,7 @@
"login/loading/loading",
"pages/tab/index/index",
"pages/tab/output/output",
"pages/tab/outputValue/outputValue",
"pages/tab/mine/mine",
"pages/webView/webView",
"login/index/index",
......@@ -37,7 +38,7 @@
"selectedIconPath": "images/home_active.png"
},
{
"pagePath": "pages/tab/output/output",
"pagePath": "pages/tab/outputValue/outputValue",
"text": "看产值",
"iconPath": "images/output.png",
"selectedIconPath": "images/output_active.png"
......
// components/Calendar/Calendar.js
import Calendar from './Calendar_Function'
import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction')
Component({
/**
* 组件的属性列表
*/
properties: _component_.properties,
/**
* 组件的初始数据
*/
data: _component_.data,
/**
* 组件的方法列表
*/
methods: {
noScroll() {},
setCalenderBodyHeight() {
this[CalendarFunction].setCalenderBodyHeight()
},
showCalendar(e) {
let type = (e && e.currentTarget && e.currentTarget.dataset.type) || ''
let result = type === 'show'
if (!result) {
this.setData({
hideCalendar: true
})
setTimeout(() => {
this.setData({
show: result,
hideCalendar: false
})
}, 300)
} else {
this.setData({
show: result
})
if (!this.data.calenderBodyHeight) this[CalendarFunction].setCalenderBodyHeight()
}
this.triggerEvent('tapCalendar')
},
dateChange(e) {
let { current, source } = e.detail
// console.log(source)
// console.log(current)
/**
* 根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。
* touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制
* 只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
*/
source == 'touch' &&
this.setData({
current
})
},
bindDateChange: function (e) {
var date = e.detail.value
console.log(date)
this.setData({
date: date
})
this.post_data.year = date
this.renderHtml()
},
choose(e) {
let { dateType, minDate, maxDate } = this.data
let { data } = e.currentTarget.dataset
// console.log((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data)))
console.log(minDate && Date.parse(minDate) > Date.parse(data))
console.log(maxDate && Date.parse(maxDate) < Date.parse(data))
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e)
},
monChoose(e) {
let { data, type } = e.currentTarget.dataset
if (data.disable) return false
this[CalendarFunction][type](e)
},
done() {
let { dateType } = this.data
this[CalendarFunction].done(dateType)
},
changeDate(e) {
let { value } = e.detail
console.log(value)
this.setData({
current: value
})
},
bindYearChange(e) {
let { value } = e.detail
this.setData({
yearCurrent: value
})
},
showShortcutPicker() {
this.setData({
showShortcut: !this.data.showShortcut
})
},
showShortcutPickerYear() {
this.setData({
showShortcutYear: !this.data.showShortcutYear
})
},
chooseAll() {
this[CalendarFunction].chooseAll()
},
changeModel() {
let { dayType } = this.data
this.setData({
dayType: dayType == 0 ? 1 : 0
})
}
},
ready() {
// console.log(this)
// return
this[CalendarFunction] = new Calendar(this)
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class='calender-picker' bindtap="showCalendar" data-type='show'>
<slot />
</view>
<!-- 弹框模式 -->
<!-- 先取消 -->
<view class='calender-box' hidden='{{!show}}' catchtouchmove="noScroll">
<view class='calender-bg' bindtap="showCalendar" />
<view class='calender-view {{hasRadius}} {{hideCalendar?"hideCalendar":""}} {{(isFullSucreen&&!showConfirm)?"isFullSucreen":""}} ' style="height:{{height}};">
<!-- 按日期选择 开始 -->
<view class='calender-header'>
<view class='calender-title' wx:if='{{showTitle}}'>
<!-- <block wx:if="{{rangeAll && dateType == 'range'}}"> -->
<!-- bindtap="chooseAll" -->
<view wx:if="{{isChangeType}}" class="calender-all" style="color:{{calenderColor}};" bindtap="changeModel">
{{dateObj['tips'][dayType]}}
</view>
<!-- </block> -->
{{title||'日期选择'}}
<view class='calender-close' bindtap="showCalendar">
<image src="./images/close.png" class='calender-close-image' />
</view>
</view>
<block wx:if='{{showSubTitle}}'>
<!-- <block hidden="{{!dayType}}"> -->
<picker class='calender-subtitle' bindchange="changeDate" bindcancel='showShortcutPicker' value="{{current}}" range="{{dateList}}" wx:if='{{shortcut&&dayType}}'>
<view class='calender-subtitle-text' bindtap="showShortcutPicker">
{{dateList[current]}}
<view class='arrow {{showShortcut}}' />
</view>
</picker>
<picker class='calender-subtitle' value="{{yearCurrent}}" bindcancel='showShortcutPickerYear' range="{{monPickList}}" wx:elif='{{shortcut&&!dayType}}' bindchange="bindYearChange">
<view class='calender-subtitle-text' bindtap="showShortcutPickerYear`">
{{monPickList[yearCurrent]}}
<view class='arrow {{showShortcutYear}}' />
</view>
</picker>
<view class='calender-subtitle' wx:else>{{monPickList[current]}}</view>
<!-- </block> -->
<!-- <block hidden="{{dayType}}"> -->
<!-- </block> -->
</block>
<view class='calendar-weekdays' hidden="{{!dayType}}">
<block wx:for='{{weekdays}}' wx:key='index'>
<view class='calendar-weekday'>{{item}}</view>
</block>
</view>
</view>
<view class='calender-body' style="height:calc(100% - {{calenderBodyHeight}})">
<!-- 日期 -->
<swiper hidden="{{!dayType}}" class='calender-swiper' bindchange='dateChange' current='{{current}}' vertical='{{vertical}}'>
<block wx:for='{{monthList}}' wx:key='index'>
<swiper-item>
<view class='calender-mark box-center' wx:if="{{!hideMark}}">{{item.mark}}</view>
<view class='calender-month'>
<block wx:for='{{item.data}}' wx:for-item='i' wx:for-index='ind' wx:key='ind'>
<view class='calender-day {{ind == 0?i.week:""}} {{i.active?"active":""}} {{i.disable?"disable":""}}' style="background:{{i.active?calenderColor:''}};color:{{i.middle?calenderColor:''}}" bindtap="choose" data-index='{{index}}' data-ind='{{ind}}' data-data='{{i.data}}'>
<view class='calender-middle' style="background:{{calenderColor}};" wx:if='{{i.middle}}' />
<view class='box-center text'>
{{i.day}}
<view wx:if='{{dateType==="range"}}' class='calender-tips'>
<view wx:if='{{i.start}}'>{{rangeText.start}}</view>
<view wx:if='{{i.end}}'>{{rangeText.end}}</view>
</view>
</view>
</view>
</block>
</view>
</swiper-item>
</block>
</swiper>
<!-- 月份 wx:if="{{!dayType}}" -->
<div class='calenderMonth'>
<swiper hidden="{{dayType}}" class='calender-year ' bindchange='dateChange' current='{{yearCurrent}}' vertical='{{vertical}}'>
<block wx:for="{{yearList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<swiper-item class="calenderMonth">
<block wx:for="{{item}}" wx:for-item="monItem" wx:for-index="monIndex" wx:key="monIndex">
<view bindtap="monChoose" data-type="month" data-index="{{monIndex}}" data-yearindex="{{index}}" data-data="{{monItem}}" class="monItem {{monItem.start?'active':''}} {{monItem.select?'select':''}} {{monItem.end?'end':''}} {{monItem.disable?'disable':''}}">
<view>{{monItem.label}}</view>
<view class="text" wx:if="{{monItem.start}}">开始</view>
<view class="text" wx:if="{{monItem.end}}">结束</view>
</view>
</block>
</swiper-item>
</block>
</swiper>
</div>
</view>
<!-- 月份 结束 -->
<view class='calender-footer {{isFullSucreen?true:""}} ' wx:if='{{showConfirm}}'>
<view class='calender-btn {{dateType === "range" && !rangeDate.end ?"disable":""}} {{dateType === "multiple" && multipleDate.length < 1 ?"disable":""}}' style="background:{{calenderColor}}" bindtap="done">
{{confirmText||'确定'}}
</view>
</view>
</view>
</view>
\ No newline at end of file
/* components/Calendar/Calendar.wxss */
.calender-box {
position: fixed;
left: 0;
bottom: 0;
z-index: 99;
width: 100%;
height: 100%;
}
.calender-bg {
position: absolute;
background: rgba(0, 0, 0, .5);
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.calender-view {
position: absolute;
left: 0;
width: 100%;
background: #fff;
animation: show-calender .5s forwards;
color: #333;
}
.calender-view.true {
border-radius: 40rpx 40rpx 0 0;
}
.calender-view.isFullSucreen {
box-sizing: border-box;
padding-bottom: 34px !important;
}
@keyframes show-calender {
from {
bottom: -100%;
}
to {
bottom: 0;
}
}
.calender-view.hideCalendar {
animation: hide-calender .5s forwards;
}
@keyframes hide-calender {
from {
bottom: 0;
}
to {
bottom: -100%;
}
}
.calender-header {
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.10);
}
.calender-title,
.calender-subtitle {
width: 100%;
height: 88rpx;
text-align: center;
position: relative;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.calender-all {
position: absolute;
top: 50%;
left: 40rpx;
transform: translateY(-50%);
}
.calender-subtitle-text {
display: flex;
align-items: center;
justify-content: center;
}
.calender-subtitle {
font-size: 28rpx;
}
.calender-subtitle .arrow {
width: 14rpx;
height: 14rpx;
border-top: 2rpx solid transparent;
border-right: 2rpx solid #ccc;
border-bottom: 2rpx solid #ccc;
border-left: 2rpx solid transparent;
transform: rotate(45deg) translateY(-4rpx);
margin-left: 16rpx;
transition: all .3s;
}
.calender-subtitle .arrow.true {
transform: rotate(225deg) translateY(0) translateX(-4rpx);
}
.calender-close {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 50%;
right: 24rpx;
transform: translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
.calender-close-image {
width: 24rpx;
height: 24rpx;
}
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
font-size: 24rpx;
line-height: 60rpx;
}
.calendar-weekday {
text-align: center;
}
.calender-body {
width: 100%;
padding: 20rpx 0;
box-sizing: border-box;
}
.calender-swiper {
height: 100%;
}
.calender-mark {
color: #F2F3F5;
text-shadow: 0 4rpx 20rpx #F2F3F5;
font-size: 320rpx;
width: 100%;
text-align: center;
}
.box-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.calender-month {
height: 100%;
position: relative;
z-index: 1;
display: grid;
grid-template-rows: repeat(minmax(5, 6), 1fr);
grid-template-columns: repeat(7, 1fr);
}
.calender-day {
position: relative;
font-size: 32rpx;
display: flex;
}
.calender-day.active {
color: #fff;
border-radius: 8rpx;
}
.calender-day.disable {
opacity: .25;
}
.calender-day .calender-middle {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0.1;
}
.calender-day .text {
text-align: center;
width: 100%;
}
.calender-tips {
font-size: 14rpx;
}
.week-1 {
grid-column-start: 2;
}
.week-2 {
grid-column-start: 3;
}
.week-3 {
grid-column-start: 4;
}
.week-4 {
grid-column-start: 5;
}
.week-5 {
grid-column-start: 6;
}
.week-6 {
grid-column-start: 7;
}
.calender-year {
/* display: flex;
flex-wrap: wrap; */
width: 100%;
height: 100%;
}
.calenderMonth {
display: flex;
flex-wrap: wrap;
width: 100%;
height: 100%;
}
.monItem {
box-sizing: border-box;
width: 25%;
height: 186rpx;
font-size: 32rpx;
/* text-align: center; */
/* line-height: 186rpx; */
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex-wrap: wrap;
color: #666666;
border: 1rpx solid #fff;
}
.monItem .text {
font-size: 20rpx;
margin-top: 5rpx;
}
.monItem.select {
color: #3582EE;
/* background: #3582EE;
opacity: 0.1; */
background-color: rgba(53, 130, 238, .1);
}
.monItem.active {
color: #fff;
background: #3582EE;
border-radius: 8px 0px 0px 8px;
}
.monItem.end {
color: #fff;
background: #3582EE;
border-radius: 0px 8px 8px 0px;
}
.monItem.disable {
color: #C8C9CC;
}
.calender-footer {
position: absolute;
width: 100%;
left: 0;
bottom: 0;
padding: 14rpx 32rpx;
box-sizing: border-box;
}
.calender-footer.true {
padding-bottom: 34px !important;
}
.calender-footer .calender-btn {
width: 100%;
height: 72rpx;
font-size: 28rpx;
color: #fff;
border-radius: 999rpx;
display: flex;
justify-content: center;
align-items: center;
}
.calender-footer .calender-btn.disable {
opacity: .3;
}
\ No newline at end of file
export default {
properties: {
calenderHeight: {
// 新版本不能使用type 改用optionalTypes 属性避免提示错误
type: String,
optionalTypes: [Number]
},
title: String, // 标题名称
hasRadius: {
type: Boolean,
value: true
}, // 是否圆角
showTitle: {
type: Boolean,
value: true
}, // 是否显示标题
showSubTitle: {
type: Boolean,
value: true
}, // 是否显示副标题
confirmText: String, // 确定按钮文本
showConfirm: {
type: Boolean,
value: true
}, // 是否显示确定按钮
calenderColor: {
type: String,
value: '#00A479'
}, // 日历主题色
previous: {
type: Number,
value: 3
}, // 当前月的前几个月 ,默认3个月
next: {
type: Number,
value: 3
}, // 当前月的后几个月 , 默认3个月
vertical: Boolean, //是否纵向滑动
/** 选择类型默认单选,single单选, multiple多个日期,range日期范围 */
dateType: {
type: String,
value: 'single'
},
value: String, //单选绑定数据
shortcut: Boolean, //日期快捷切换 默认为false
/** 分隔符,默认为 "-" */
separator: {
type: String,
value: '-'
},
/** 日期范围-开始结束文本 */
rangeText: {
type: Object,
value: {
start: '开始',
end: '结束'
}
},
/**是否显示日期范围 全选 */
rangeAll: Boolean,
/** 是否允许日期范围的起止时间为同一天, 默认为false */
allowSameDay: Boolean,
/** 周起始日,默认周日 */
firstDayOfWeek: {
// 新版本不能使用type 改用optionalTypes 属性避免提示错误
type: Number,
optionalTypes: [Number],
value: 7
},
/**
* 可选最小日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致。 */
minDate: String,
/** 可选最大日期,不传则默认无限制。
* 格式yyyy-MM-dd, 需跟separator一致 */
maxDate: String,
/**隐藏水印 */
hideMark: Boolean,
isComponents: Boolean,
isChangeType: {
type: Boolean,
value: true
}, // 是否显示切换 按月份 按日期
dayType: { // 0按月份 1按日期
type: Number,
value: 1
}
},
data: {
weekdays: ['一', '二', '三', '四', '五', '六', '日'],
monthList: [],
dateList: [],
monPickList: [],
current: 0,
height: '80%',
rangeDate: {},
multipleDate: [],
date: '',
yearCurrent: 0,
yearList: [],
rangeMonth: {},
// MonthShowList: [
// {
// label: '1月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '2月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '3月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '4月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '5月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '6月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '7月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '8月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '9月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '10月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '11月',
// disable: false,
// start: false,
// end: false,
// select: false
// },
// {
// label: '12月',
// disable: false,
// start: false,
// end: false,
// select: false
// }
// ],
// dayType: 1, // 1 日期 0 月份 默认日期
dateObj: {
// switch:'按月份',
// type:'day',
tips: ['按日期', '按月份']
}
}
}
......@@ -19,12 +19,11 @@ Component({
})
}, 0.2 * 1000)
} else {
let hideTab = wx.$hideTab
// console.log(hideTab)
// let hideTab = wx.$hideTab
this.setData({
showPopup: true,
close: false,
hideTab
// hideTab
})
}
}
......@@ -37,7 +36,9 @@ Component({
only: {
type: Boolean,
value: true
}
},
hideTab: Boolean,
isTab: Boolean
},
/**
......@@ -63,9 +64,9 @@ Component({
}
},
attached() {
const { isTab } = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
this.setData({
isTab
})
// const { isTab } = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
// this.setData({
// isTab
// })
}
})
// pages/tab/output/components/ScreenBox/ScreenBox.js
import { getMerchantListApi } from '~/api/applyProd.js'
Component({
/**
* 组件的属性列表
*/
properties: {
formData: Object,
tabBarStyle: String,
isShowFilterScreen: Boolean,
tabType: Number
},
/**
* 组件的初始数据
*/
data: {
merchantList: [],
popupShow: false,
confirmShow: false
},
lifetimes: {
attached() {
// 获取服务商下4s店
this.getMerchantList()
console.log(this.data.tabType, '123123')
},
},
/**
* 组件的方法列表
*/
methods: {
// 选择门店
handleSlectMerchant() {
this.setData({
popupShow: !this.data.popupShow
})
},
// 筛选
filterTypeFn() {
this.setData({
confirmShow: !this.data.confirmShow
})
this.data.confirmShow ? wx.pro.hideTabBar() : wx.pro.showTabBar()
},
// 获取服务商下的4s店
getMerchantList() {
let { userInfo } = wx.$storage.get()
getMerchantListApi({serviceMerchantId: userInfo?.subLoginUser?.merchantId}).then(res => {
let { code, data } = res
if (code == '0') {
this.setData({
merchantList: data
})
}
})
},
handleMerchantChange(e) {
console.log('111111')
let {merchantId, merchantName} = e.detail
let { formData } = this.data
const thisPage = wx.$router.getPageInstance()
formData.shopMerchantIds = [merchantId]
formData.shopMerchantNames = merchantName
this.setData({
formData
})
thisPage.setData({
screenFormData: formData
})
thisPage.searchEvent(true)
}
}
})
{
"component": true,
"usingComponents": {
"select-merchant-popup": "../selectMerchantPopup/selectMerchantPopup",
"screen-confirm-box": "../ScreenConfirmBox/ScreenConfirmBox"
}
}
\ No newline at end of file
<!--pages/tab/output/components/ScreenBox/ScreenBox.wxml-->
<view class="content_box" hidden="{{isShowFilterScreen}}">
<view class="screen_item {{formData.shopMerchantIds.length ? 'active' : ''}}" bindtap="handleSlectMerchant">
<view class="merchant_name">{{ formData.shopMerchantNames }}</view>
<glsx-image src="{{'output/drop_down.png'}}" class="icon" />
</view>
<view class="screen_item wid_140 {{formData}}" bindtap="filterTypeFn">
筛选
<glsx-image src="{{'output/drop_down.png'}}" class="icon" />
</view>
</view>
<!-- 选择门店 -->
<select-merchant-popup wx:if="{{popupShow}}" bind:hidePopup="handleSlectMerchant" bindmerchantConfirm="handleMerchantChange" selectInfo="{{formData}}" popShow="{{popupShow}}" serviceRange="{{merchantList}}" isTab="{{true}}"/>
<!-- 筛选 -->
<screen-confirm-box wx:if="{{confirmShow}}" tabBarStyle="{{tabBarStyle}}" show="{{confirmShow}}" formData="{{formData}}" tabType="{{tabType}}"></screen-confirm-box>
\ No newline at end of file
/* pages/tab/output/components/ScreenBox/ScreenBox.wxss */
.content_box{
width: 100%;
height: 88rpx;
/* background: #ffffff; */
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 0 32rpx;
}
.screen_item{
height: 56rpx;
color: #333333;
background: #F7F7F7;
border-radius: 12rpx;
font-size: 26rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0 24rpx;
box-sizing: border-box;
}
.screen_item.active{
color: #3666FE;
background: #3666fe1a;
}
.screen_item .merchant_name{
max-width: 400rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.screen_item.wid_140{
width: 140rpx;
padding: 0;
}
.screen_item .icon{
width: 40rpx;
height: 40rpx;
}
\ No newline at end of file
// pages/tab/output/components/ScreenConfirmBox/ScreenConfirmBox.js
import USERAPI from '~/api/usersApi/index'
import outputApi from '~/api/outputApi/index'
import { setUserInfo } from '~/utils/cache/storageApi'
Component({
/**
* 组件的属性列表
*/
properties: {
tabBarStyle: String,
formData: Object,
show: {
type: Boolean,
observer: function (n, o) {
if (n) {
const thisPage = wx.$router.getPageInstance()
thisPage.setData({
isShowFilterScreen: true
})
this.setViewData()
this.updateUserInfo()
}
}
},
tabType: Number // tab值 0我的门店 1我的员工
},
/**
* 组件的初始数据
*/
data: {
userInfo: {},
isSuper: false,
servicePopupShow: false,
merchantRange: [],
subIndex: 0,
sceneList: [
{
id: '',
label: '全部',
active: true
},
{
id: '1',
label: '太阳膜'
},
{
id: '3',
label: '众筹活动'
},
{
id: '0',
label: '会员权益/升级'
}
],
staffList: []
},
/**
* 组件的方法列表
*/
methods: {
updateUserInfo() {
let { userInfo } = wx.$storage.get()
this.setData({
userInfo,
isSuper: userInfo.isSuper
})
},
setViewData() {
let { tabBarStyle } = this.data
wx.$api.getViewInfo(
'.btn-box',
res => {
this.setData({
height: tabBarStyle,
btnHeight: res[0]?.height
})
},
this
)
},
getMerchantRange() {
let { isSuper, userInfo } = this.data
// 判断是超管才需要切换账号
if (isSuper) {
USERAPI.adminSelectLogin()
.then(result => {
let { merchantList: merchantRange } = result
let subIndex = -1
merchantRange.forEach((item, index) => {
item.show = true
if (item.merchantId == userInfo.subLoginUser.merchantId) {
subIndex = index
item.act = true
}
})
this.setData({
merchantRange,
subIndex
})
})
.catch(err => { })
} else {
let merchantRange = [{ merchantId: userInfo.subLoginUser.merchantId, merchantName: userInfo.subLoginUser.merchantName }]
this.setData({
merchantRange,
subIndex: 0
})
}
},
changeMerchantRange(e) {
let { merchantRange, subIndex, formData } = this.data
let { merchantId } = e.detail
merchantRange.forEach((item, index) => {
item.show = true
if (item.merchantId == merchantId) {
subIndex = index
item.act = true
}
})
formData.partnerMerchantIds = [merchantId]
this.setData({
merchantRange,
subIndex,
formData
})
this.servicePicker()
},
// 服务商切换
servicePicker() {
this.setData({
servicePopupShow: !this.data.servicePopupShow
})
// 根据服务商请求员工数据
this.getStaffList()
},
// 月份确定
dateRangeSelect(e) {
let { start, end } = e.detail.date
let { formData } = this.data
let [year, month] = end.split('-')
let day = this.getLastDay(year, month)
formData.startTime = start + '-01' + ' 00:00:00'
formData.endTime = end + '-' + day + ' 23:59:59'
this.setData({
formData
})
},
getLastDay(year, month) {
var new_year = year //取当前的年份
var new_month = month++ //取下一个月的第一天,方便计算(最后一天不固定)
if (month > 12) {
new_month -= 12 //月份减
new_year++ //年份增
}
var new_date = new Date(new_year, new_month, 1) //取当年当月中的第一天
return new Date(new_date.getTime() - 1000 * 60 * 60 * 24).getDate() //获取当月最后一天日期
},
// 员工数据
getStaffList() {
let { partnerMerchantIds, sceneType } = this.data.formData
outputApi.getStaffList({partnerMerchantId: partnerMerchantIds[0]}).then(res => {
let _list = []
// 1-会员权益/升级;2-精品升级
let attrToNum = {
'': 'totalStat',
'1': 'vdStat',
'2': 'boutiqueStat',
'3': 'carTransformStat'
}
_list = res[attrToNum[sceneType || '']] || []
let arr = []
_list.forEach(val => {
val.list.length && val.list.forEach(subVal => {
arr.push(subVal)
})
})
if (!arr.length || arr[0]?.userName !== '全部') {
arr.unshift({
active: true,
userId: '',
userName: '全部'
})
}
this.setData({
staffList: arr
})
})
},
init() {
this.getMerchantRange()
this.getStaffList()
console.log(this.data.tabType, 'tabType')
},
choose(e) {
let { index, listName } = e.currentTarget.dataset
let { formData } = this.data
let target = this.data[listName]
switch (listName) {
case 'staffList':
if (index == 0) { // 选择全部
target.map(i => (i.active = false))
target[index].active = true
} else {
target[index].active = true
target[0].active = false
}
break
case 'sceneList':
target.map(i => (i.active = false))
target[index].active = true
formData.sceneType = target[index]?.id
this.setData({
formData
})
// 请求员工数据
this.getStaffList()
break
}
this.setData({
[`${listName}`]: target,
isReset: false
})
},
confirm() {
wx.$api.showLoading('加载中')
let { userInfo, formData, staffList, sceneList } = this.data
formData.sceneType = sceneList.filter(val => val.active)[0]?.id || ''
formData.staffUUIDs = staffList.filter(val => val.active).map(subVal => {return subVal.userId})
const thisPage = wx.$router.getPageInstance()
// 切换登录账号
console.log(formData?.partnerMerchantIds[0])
if (formData?.partnerMerchantIds[0] !== userInfo.subLoginUser.merchantId) {
USERAPI.switchSubLoginInfo({ merchantId: formData?.partnerMerchantIds[0] }).then(res => {
console.log(res)
setUserInfo(res)
wx.$api.hideLoading()
thisPage.setData({
screenFormData: formData
})
thisPage.searchEvent()
})
} else {
wx.$api.hideLoading()
thisPage.searchEvent()
thisPage.setData({
screenFormData: formData
})
}
},
reset() {
let { formData, userInfo, sceneList, staffList } = this.data
formData.partnerMerchantIds = [userInfo.subLoginUser.merchantId]
formData.startTime = ''
formData.endTime = ''
formData.sceneType = ''
formData.staffUUIDs = []
sceneList.map(val => val.active = false)
sceneList[0].active = true
staffList.map(val => val.active = false)
staffList[0].active = true
this.setData({
formData,
sceneList,
staffList
})
this.init()
}
},
attached() {
this.init()
}
})
{
"component": true,
"usingComponents": {
"switchAccountPopup": "../../components/SwitchAccountPopup/SwitchAccountPopup",
"CalendarMonth": "/components/CalendarMonth/CalendarMonth"
}
}
\ No newline at end of file
/* pages/tab/output/components/ScreenConfirmBox/ScreenConfirmBox.wxss */
.confirm-box {
position: fixed;
top: 0;
z-index: 10;
height: 100vh;
width: 100%;
box-sizing: border-box;
background-color: #fff;
animation: show-confirm-box .5s forwards;
}
@keyframes show-confirm-box {
0%{
right: -100%;
}
100%{
right: 0;
}
}
.main{
box-sizing: border-box;
}
.confirm-title {
height: 80rpx;
position: relative;
}
.confirm-title .back {
position: absolute;
left: 40rpx;
font-size: 24rpx;
border-radius: 12rpx;
background-color: #0075F9;
color: #fff;
height: 46rpx;
padding: 0 24rpx;
}
.box {
margin: 0 24rpx;
}
.box .title {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 30rpx;
font-weight: 600;
color: #323436;
padding: 24rpx 0;
background: #fff;
z-index: 2;
}
.box .title .picker_box, .box .title .picker_box .picker_box_text{
display: flex;
align-items: center;
}
.box .title .picker_box .picker_text{
font-size: 26rpx;
font-weight: 400;
color: #333333;
}
.box .title .picker_box .icon{
width: 40rpx;
height: 40rpx;
}
.box .service_name{
height: 68rpx;
line-height: 68rpx;
text-align: left;
font-size: 26rpx;
width: 100%;
box-sizing: border-box;
background: #F7F7F7;
border-radius: 8rpx;
padding: 0 32rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.box .date_box {
display: flex;
align-items: center;
justify-content: space-around;
}
.box .date_box .date_item {
width: 316rpx;
height: 68rpx;
line-height: 68rpx;
text-align: center;
background: #F7F7F7;
border-radius: 8rpx;
}
.box .list_box {
display: flex;
flex-wrap: wrap;
font-size: 26rpx;
align-items: flex-start;
gap: 24rpx;
}
.box .list_box .list_item {
width: 216rpx;
box-sizing: border-box;
text-align: center;
background: #F7F7F7;
border-radius: 8rpx;
padding: 16rpx 24rpx;
white-space: normal;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.box .list_box .list_item.active{
background: #F0F7FF;
color: #3666FE;
}
.box .list-box {
display: flex;
border-bottom: 2rpx solid rgba(195, 195, 195, .3);
flex-wrap: wrap;
padding-bottom: 20rpx;
}
.box .list-box .item {
width: 210rpx;
min-height: 64rpx;
border: 2rpx solid transparent;
box-sizing: border-box;
padding: 16rpx 33rpx;
margin-bottom: 20rpx;
flex-wrap: wrap;
font-size: 24rpx;
text-align: center;
background-color: #F7F7F7;
color: #666666;
transition: all .2s;
margin: 0 20rpx 20rpx 0;
}
.isFullSucreen {
padding-bottom: constant(safe-area-inset-bottom) !important;
padding-bottom: env(safe-area-inset-bottom) !important;
}
.btn-box {
position: fixed;
padding: 10rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
z-index: 9;
background-color: #fff;
}
.btn-box .btn {
border-radius: 12rpx;
border: 2rpx solid #0075F9;
box-sizing: border-box;
height: 80rpx;
}
.btn-box .btn.clear {
width: 336rpx;
height: 88rpx;
border: 2rpx solid #EEEEEE;
border-radius: 12rpx;
color: #8A8C90;
}
.btn-box .btn.done {
width: 336rpx;
height: 88rpx;
background: #3666FE;
border-radius: 12rpx;
color: #ffffff;
}
.text-center {
display: flex;
align-items: center;
justify-content: center;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
\ No newline at end of file
<!--pages/tab/output/components/ScreenConfirmBox/ScreenConfirmBox.wxml-->
<wxs src="./index.wxs" module="filter" />
<scroll-view scroll-y class="confirm-box" style="height:calc(100vh - {{height}}px);margin-top:{{tabBarStyle}}px;"
hidden="{{!show}}">
<view class="main" style="padding-bottom:{{btnHeight}}px;min-height: calc(100% - {{btnHeight}}px);">
<view class="box">
<view class="title">
服务商名称
<block wx:if="{{isSuper}}">
<view class="picker_box" bindtap="servicePicker">
<view class="picker_text">
切换
</view>
<glsx-image src="{{'output/drop_down.png'}}" class="icon" />
</view>
</block>
</view>
<view class="service_name">
{{ merchantRange[subIndex].merchantName||userInfo.subLoginUser.merchantName }}
</view>
</view>
<view class="box">
<view class="title">
自定义月份
<view class="picker_box">
<CalendarMonth
allowSameDay
shortcut
bindselect="dateRangeSelect"
rangeAll
dateType="range"
calenderColor="#3582EE"
vertical
minDate="2020-10-01"
maxDate="{{ dateObj.today }}"
forceFullSucreen="{{ bottomLift>0?true:false }}"
isComponents
isChangeType="{{false}}"
dayType="{{0}}"
>
<view class="picker_box_text">
<view class="picker_text">
选择日期
</view>
<glsx-image src="{{'output/drop_down.png'}}" class="icon" />
</view>
</CalendarMonth>
</view>
</view>
<view class="date_box">
<view class="date_item">{{filter.filterDate(formData.startTime)}}</view>
<view>-</view>
<view class="date_item">{{filter.filterDate(formData.endTime)}}</view>
</view>
</view>
<view class="box" wx:if="{{tabType == 0}}">
<view class="title">
场景品类
</view>
<view class="list_box">
<block wx:for="{{sceneList}}" wx:key="index">
<view class="list_item {{item.active?'active':''}}" bindtap="choose" data-index="{{index}}" data-list-name="sceneList">{{item.label}}</view>
</block>
</view>
</view>
<view class="box" wx:if="{{tabType == 1}}">
<view class="title">
员工
</view>
<view class="list_box">
<block wx:for="{{staffList}}" wx:key="index">
<view class="list_item {{item.active?'active':''}}" bindtap="choose" data-index="{{index}}" data-multiple="true" data-list-name="staffList">{{item.userName}}</view>
</block>
</view>
</view>
</view>
<view class="btn-box isFullSucreen">
<view class="btn clear text-center" bindtap="reset">重置</view>
<view class="btn done text-center" bindtap="confirm">确定</view>
</view>
</scroll-view>
<switchAccountPopup wx:if="{{servicePopupShow}}" bind:hidePopup="tapPicker" bindchangeAccount="changeMerchantRange" popShow="{{servicePopupShow}}" merchantRange="{{merchantRange}}" hideTab="{{true}}"/>
/** 具体时间截取月份 */
var filterDate = function (n) {
var year = n && n.split('-')[0]
var month = n && n.split('-')[1]
return n && year + '/' + month
}
/*
* 导出
*/
module.exports = {
filterDate: filterDate
}
// pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.js
import { IMG_URL } from '~/utils/constantData.js'
Component({
options: {
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
popShow: {
type: Boolean,
value: false
},
merchantRange: Object,
hideTab: Boolean
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
merchantList: []
},
observers: {
merchantRange: function (e) {
// console.log(e)
this.setData({
merchantList: e
})
}
},
/**
* 组件的方法列表
*/
methods: {
hidePopup() {
this.triggerEvent('hidePopup')
},
confirm() {
let { merchantRange, subIndex } = this.data
let actObj = merchantRange.find((item, index) => {
if (item.act) {
subIndex = index
}
return item.act
})
if (!actObj) {
return wx.$api.showToast({
title: '请选择服务商',
icon: 'error'
})
} else {
this.changePicker(actObj)
}
},
changePicker(actObj) {
this.triggerEvent('changeAccount', actObj)
},
select(e) {
let { index } = e.currentTarget.dataset
let { merchantRange } = this.data
merchantRange.forEach((item, ind) => {
if (index == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
merchantRange
})
})
},
input(e) {
let { merchantRange } = this.data
let { value } = e.detail
merchantRange.forEach(item => {
item.act = false
item.show = item.merchantName.includes(value)
})
this.setData({
merchantRange
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.wxss */
.search-box {
width: 100%;
height: 104rpx;
padding-left: 32rpx;
// margin-top: 20rpx;
display: flex;
align-items: center;
background-color: #fff;
position: sticky;
top: 0;
left: 0;
z-index: 9;
box-sizing: border-box;
}
.search-box .search-input {
background: #F7F8FA;
border-radius: 38rpx;
width: 606rpx;
height: 72rpx;
display: flex;
align-items: center;
}
.search-box .search-input .search-icon {
width: 28rpx;
height: 28rpx;
margin: 0 10rpx 0 26rpx;
}
.search-box .search-input .search-clear {
width: 36rpx;
height: 36rpx;
margin: 0 26rpx 0 10rpx;
}
.search-box .search-input .input {
font-size: 28rpx;
width: calc(100% - 136rpx);
}
.input-placeholder {
color: rgba(200, 201, 204, .89);
}
.search-box .search {
width: 144rpx;
height: 100%;
color: #666;
box-sizing: border-box;
padding: 0 24rpx;
}
.list {
height: calc(100% - 100rpx) !important;
}
.search-box .search .text-center {
font-size: 24rpx;
/* background-color: #f7f7f7; */
border-radius: 12rpx;
width: 100%;
font-size: 32rpx;
color: #858A94;
}
.search-box .search .text-center .search-filter {
margin-left: 6rpx;
width: 24rpx;
height: 24rpx;
}
.itemCon {
box-sizing: border-box;
width: 100%;
// background-color: #fff;
height: 80rpx;
color: #323436;
line-height: 80rpx;
padding: 0 32rpx;
}
.active {
// color: aqua;
background: #F0F7FF;
font-size: 28rpx;
color: #3666FE;
}
\ No newline at end of file
<!-- pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.wxml -->
<popup
show="{{popShow}}"
bind:hidePopup="hidePopup"
bindconfirm="confirm"
height="60%"
hideTab="{{hideTab}}">
<!-- <search-input placeholder="请搜索服务商账号名" ></search-input> -->
<view class="search-box">
<view class="search-input">
<image src="{{IMG_URL}}/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="showConfirm">
<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="{{merchantList}}" wx:key="index">
<view
class="itemCon text-hide {{item.act?'active':''}}"
hidden="{{!item.show}}"
data-index="{{index}}"
bindtap="select">
{{item.merchantName}}
</view>
</block>
</scroll-view>
</popup>
// components/Tab/Tab.js
// behaviors: [LocationBehavior],
import { imgUrlMixin } from '~/mixins/index'
Component({
behaviors: [imgUrlMixin],
options: {
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
outClassName:String,
tab: Array,
openScroll: Boolean,
tabHeight: {
type: Boolean,
value: false
},
productHeight: {
type: Boolean,
value: false
},
index: {
type: Number,
observer: function (n) {
this.setData({
count: n,
to: `to-${n}`
})
}
},
itemWidth: String,
align: {
type: String,
value: ''
},
// 是否有红点
unreadClueCount: {
type: Number,
value: 0
},
noLine: Boolean
},
/**
* 组件的初始数据
*/
data: {
count: 0,
to: ''
},
// lifetimes:{
// attached: function() {
// console.log('unreadClueCount',this.data.unreadClueCount)
// }
// },
/**
* 组件的方法列表
*/
methods: {
click(e) {
let { count } = e.currentTarget.dataset
this.setData({
count,
to: `to-${count}`,
unreadClueCount:0
})
this.triggerEvent('click', count)
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<wxs src="./Tab.wxs" module="filterUtils" />
<block>
<scroll-view class="tab-box flex" scroll-x enable-flex scroll-with-animation scroll-into-view="{{to}}" enhanced="{{true}}" show-scrollbar="{{false}}" style="{{tabHeight ? 'height: 88rpx;' : ''}}">
<block wx:for="{{tab}}" wx:key="index">
<view class="tab {{index==count?'active':''}}" style="width:{{itemWidth}}; margin-left: 32rpx" bindtap="click" data-count="{{index}}">
<view class="text text-center" style="{{tabHeight ? 'height: 88rpx;' : ''}}">{{item}}</view>
<view wx:if="{{!noLine}}" class="line" style="{{tabHeight ? 'margin-top: 6rpx;' : ''}}" />
</view>
</block>
</scroll-view>
</block>
\ No newline at end of file
var hasRedpoint = function (unreadClueCount) {
// console.log('unreadClueCount: ', unreadClueCount);
if(unreadClueCount>0){
return true
}else{
return false;
}
};
module.exports = {
hasRedpoint: hasRedpoint,
};
/* components/Tab/Tab.wxss */
.tab-box {
display: flex;
width: 100%;
height: 92rpx;
box-sizing: border-box;
}
.tab-box.left {
padding-left: 32rpx;
}
.left .tab {
padding-right: 40rpx;
}
/* .flex .tab {
flex: 1;
} */
.tab {
position: relative;
flex-shrink: 0;
}
.tab .text {
height: 84rpx;
display: flex;
align-items: center;
box-sizing: border-box;
color: #A9A9A9;
justify-content: center;
font-size: 34rpx;
}
.left .text {
justify-content: flex-start;
}
.flex .tab .text {
padding: 0;
}
/* .tab + .tab{
margin-left: 20rpx;
} */
.tab.active .text {
/* font-weight: 500; */
font-weight: 600;
/* font-size: 38rpx; */
transition: all .25s;
color: #2C2C2C;
font-family: PingFangSC-S0pxibold;
}
.tab .line {
width: 48rpx;
height: var(--borderRadius);
background: var(--btnColor);
border-radius: 2rpx;
margin: 0 auto;
transform: scale(0);
transition: all .25s;
}
.tab.active .line {
transform: scale(1);
}
.tab-box::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
.active .redpoint {
display: none;
}
.redpoint {
position: absolute;
top: 10px;
right: 5px;
/* top: 8px;
right: 10px; */
width: 10px;
height: 10px;
background: #EB4E4E;
border-radius: 50%;
}
/* 外部出进来的自定义样式 */
.project-tab {
padding-left: 20px;
padding-right: 20px;
}
.project-tab .tab {
margin-right: 28px;
}
.project-tab .tab.active .text {
font-size: 28rpx;
color: var(--btnColor);
}
.project-tab .tab .line {
width: auto;
}
\ 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.merchantId == selectInfo.shopMerchantIds[0])
if (serviceRange.length) serviceRange.unshift({merchantId: '', merchantName: '全部'})
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,
isMerchant: Boolean,
isTab: Boolean
},
/**
* 组件的初始数据
*/
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.merchantId == '' && actObj.merchantName == '全部') actObj.merchantName = '所有门店'
this.changePicker(actObj)
}
},
changePicker(actObj) {
this.triggerEvent('merchantConfirm', {...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, selectInfo } = 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.merchantName?.includes(value)
if (item.merchantId == selectInfo.shopMerchantIds[0]) item.act = true
})
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%"
isTab="{{isTab}}">
<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.merchantName}}
</view>
</block>
</scroll-view>
</popup>
// pages/tab/output/output.js
import { getSessionId, setSessionId } from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
import { IMG_URL } from '~/utils/constantData'
import { getMockData } from '~/api/api'
Page({
/**
* 页面的初始数据
*/
data: {
IMG_URL,
navStyle: 'background-color: rgba(0,0,0,0);',
loginType: 0,
agree: true,
tabIndx: 0,
// tabList: ['我的客户', '我的门店', '我的员工'],
tabList: ['我的门店', '我的员工'],
popupShow: false,
subIndex: -1,
merchantList: [],
isShowService: false,
unreadClueCount: 0,
navBarBoxStyle: "justify-content: start;align-items: stretch",
navTitleStyle: "width: 100%; padding: 0;",
screenFormData: {
partnerMerchantIds: [],
shopMerchantIds: [],
shopMerchantNames: '全部门店',
startTime: '',
endTime: '',
sceneType: '',
staffUUIDs: []
},
isShowFilterScreen: false
},
back() {
this.setData({
isShowFilterScreen: false
})
this.childEle = this.selectComponent('#screenBox')
this.childEle.filterTypeFn()
},
// 切换园区
tapPicker() {
let { isSuper } = this.data
isSuper &&
this.setData({
moveArrow: !this.data.moveArrow,
popupShow: !this.data.popupShow
})
},
navbarReady(e) {
let { height, statusBarHeight } = e.detail
this.setData({
tabBarStyle: height / 2 + statusBarHeight
})
},
changeTabIndx(e) {
console.log(e)
this.setData({
tabIndx: e.detail
})
},
init() {
this.setUserInfo()
},
// 筛选回调
searchEvent(isNoBack = false) {
if (!isNoBack) this.back()
},
setUserInfo() {
let { userInfo } = wx.$storage.get()
let { screenFormData } = this.data
screenFormData.partnerMerchantIds = [userInfo?.subLoginUser?.merchantId]
this.setData({
userInfo,
isSuper: userInfo.isSuper,
screenFormData
})
},
async getMockInfo() {
let { serviceMerchatList } = await getMockData() || { serviceMerchatList: [] }
this.setData({
isShowService: serviceMerchatList.includes(this.data.userInfo.merchantId + '')
})
},
getMerchantRange(e) {
// 重新刷新
// let { detail } = e || null
// console.log(detail)
// console.log(e)
if (e) {
this.setUserInfo()
let clientModule = this.selectComponent('#client')
// let merchantModule = this.selectComponent('#merchant')
clientModule.getClientApi && clientModule.clientRefresh()
clientModule.getBusinessData && clientModule.getBusinessData()
// merchantModule.init && merchantModule.init()
}
let { isSuper, userInfo } = this.data
console.log(isSuper)
// 判断是超管才需要切换账号
if (isSuper) {
USERAPI.adminSelectLogin()
.then(result => {
// console.log(result)
let { merchantList: merchantRange } = result
// console.log(merchantRange)
let subIndex = -1
merchantRange.forEach((item, index) => {
item.show = true
if (item.merchantId == userInfo.subLoginUser.merchantId) {
subIndex = index
item.act = true
}
})
console.log(subIndex, merchantRange)
this.setData({
merchantRange,
subIndex
})
})
.catch(err => { })
} else {
let merchantRange = [{ merchantId: userInfo.subLoginUser.merchantId, merchantName: userInfo.subLoginUser.merchantName }]
console.log('merchantRange', merchantRange)
this.setData({
merchantRange,
subIndex: 0
})
}
},
onRoute(options) {
if (!options || wx.$util.isEmptyObj(options)) return
let { page = 'client', refresh = true } = options
if (page == 'client' && refresh) {
let clientModule = this.selectComponent('#client')
clientModule.getClientApi && clientModule.clientRefresh()
clientModule.getBusinessData && clientModule.getBusinessData()
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
// console.log(getTextWidth('随后获取dom元素的clientWidth 随后获取dom元素的clientWidth随后获取dom元素的clientWidth随后获取dom元素的clientWidth', '12px'))
},
/**
* 生命周期函数--监听页面显示
*/
onShow() { },
/**
* 生命周期函数--监听页面隐藏
*/
onHide() { },
/**
* 生命周期函数--监听页面卸载
*/
onUnload() { },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() { },
/**
* 用户点击右上角分享
*/
onShareAppMessage() { }
})
{
"usingComponents": {
"navigation-bar": "../../../components/NavigationBar/NavigationBar",
"tab": "./components/Tab/Tab",
"screen-box": "./components/ScreenBox/ScreenBox"
},
"navigationStyle": "custom"
}
/* pages/tab/output/output.wxss */
@keyframes opacity-view {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.screen_box{
position: absolute;
height: 88rpx;
width: 100%;
}
.back {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 100rpx;
/* height: 34rpx; */
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.back .img {
width: 16rpx;
height: 34rpx;
}
.layout {
box-sizing: border-box;
position: relative;
// padding: 400rpx 16rpx 0;
padding-top: 400rpx;
font-size: 24rpx;
color: #8A8C90;
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
&::after {
content: '';
width: 100%;
// height: 486rpx;
height: 264rpx;
background: url('https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/output/background.png') no-repeat;
background-size: 100% 100%;
background-color: #fff;
position: absolute;
left: 0;
top: 0;
z-index: -1;
}
.tabContainer {
// height: 100rpx;
padding: 0 32rpx;
// background-color: #F2F3F7;
}
.comCom {
// flex: 1;
// height: calc(100% - 100rpx);
overflow: scroll;
// background-color: #fff;
background-color: #F2F3F7;
}
.comCom::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
}
.navigation-title {
display: flex;
align-items: center;
justify-content: center;
}
.navigation-title-text {
text-align: center;
max-width: calc(100% - 24rpx);
}
.navigation-title .arrow {
width: 26rpx;
height: 26rpx;
margin-left: 4rpx;
transform: translateY(25%);
transition: all 0.5s;
image {
width: 26rpx;
height: 26rpx;
}
}
.navigation-title .move {
transform: rotate(-180deg) translateY(0);
}
// 圆点样式
.wx-swiper-dots .wx-swiper-dot {
width: 8rpx;
height: 8rpx;
background: #CCCED1;
}
// 当前选中圆点样式
.wx-swiper-dots .wx-swiper-dot.wx-swiper-dot-active {
background: #8A8C90;
}
\ No newline at end of file
<!-- pages/tab/output/output.wxml -->
<navigation-bar navStyle="{{isShowFilterScreen ? 'background: #fff;' : navStyle}}" bindnavbarReady="navbarReady" navBarBoxStyle="{{!isShowFilterScreen ? navBarBoxStyle : 'justify-content: center;align-items: center'}}" navTitleStyle="{{navTitleStyle}}">
<block>
<tab wx:if="{{!isShowFilterScreen}}" noLine="{{true}}" tab="{{tabList}}" itemWidth="{{'136rpx'}}" index="{{tabIndx}}" tabHeight unreadClueCount="{{unreadClueCount}}" bindclick="changeTabIndx" class="tabContainer" />
<view class="screen_box">
<screen-box id="screenBox" formData="{{screenFormData}}" tabType="{{tabIndex}}" tabBarStyle="{{tabBarStyle}}" isShowFilterScreen="{{isShowFilterScreen}}" bindconfirm="screenConfirm" merchantRange="{{merchantRange}}"></screen-box>
</view>
</block>
<block wx:if="{{isShowFilterScreen}}">
<view class="back " bindtap="back">
<image class="img" src="../../../components/NavigationBar/images/icon-back.png" />
</view>
<view>筛选</view>
</block>
</navigation-bar>
<view class="layout" style="padding-top:calc({{tabBarStyle}}px + 88rpx);">
<!-- 我的客户 -->
<!-- <view class="comCom" hidden="{{tabIndx != 0}}">
<client id="client" />
</view> -->
<!-- 我的员工 -->
<!-- <view class="comCom" hidden="{{tabIndx != 1}}">
<staff id="staff" />
</view> -->
</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!