Commit dc2d39b3 by 王志慧

经营数据页面修改

1 parent 7aa2b9e1
// tabOperating/pages/index.js
import mixins from './index_mixins'
import api from '../../api.js'
import { getYQInfo } from '~/store/index'
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
...mixins.data,
bottomLift: 0,
statusBarHeight: app.globalData.statusBarHeight + 43,
activeTab: 0,
tabList: [
{
name: '营业概况',
active: true,
componentsName: 'businessCell',
recordId: 12
},
{
name: '员工业绩',
active: false,
componentsName: 'staffCell',
recordId: 13
},
{
name: '今日战果',
active: false,
componentsName: 'conquestCell',
recordId: 14
}
],
dateObj: {
beforeDay: '',
today: '',
nextDay: '',
maxDate: '',
todayShow: ''
},
todayData: {
totalOrderMoney: 0,
totalAdd: 0
},
refresh: false,
showPicker: false
},
// 混入跳转方法
...mixins.methods,
showStorePicker() {
let { merchantRange } = this.data
merchantRange.length > 1 &&
this.setData({
showPicker: true
})
webUrl: ''
},
getStoreList(e) {
console.log(e)
let { value } = e.detail
getYQInfo(this.data.userInfo)
.then(result => {
// console.log(result)
let { merchantRange } = result
if (value) {
merchantRange = merchantRange.filter(item => item.merchantName.includes(value))
}
this.setData({
merchantRange
})
})
.catch(err => {})
},
changePicker(e) {
console.log('changePicker')
let { value } = e.detail
// 修改对应下标显示
app.globalData.yqdInfo.subIndex = value
let { merchantId } = this.data.merchantRange[value]
let obj = {}
if (merchantId) obj.merchantId = merchantId
wx.$util.showLoading('加载中...')
api.swtichSubLoginInfo(obj).then(res => {
// console.log(res)
let { code, data, message } = res
if (code == 0) {
// debugger
wx.$util.setUserInfo(data)
this.refresh(data)
} else {
this.showToast(message)
}
})
this.tapPicker()
},
init(userInfo) {
// app.
getYQInfo(userInfo)
.then(result => {
console.log(result)
this.setData({
...result,
canRemark: result.merchantRange.length == 1
})
})
.catch(err => {})
},
refresh(data) {
// console.log('refresh')
this.getOrderNum()
this.init(data)
let { activeTab } = this.data
this.setData({
activeTab: -1
})
setTimeout(() => {
this.setData({
activeTab,
refresh: true
})
}, 100)
},
// 切换园区
tapPicker() {
this.setData({
moveArrow: !this.data.moveArrow
})
},
/**设置日期 */
setTimeList(dateNum) {
// console.log('time')
......@@ -156,168 +39,53 @@ Page({
// 获取统计
this.getOrderNum()
},
remarkConfirm(e) {
let value = e.detail
console.log(value)
if (value) {
// this.closePop()
this.components = this.selectComponent('#businessCell')
this.components.remarkConfirm(e)
} else {
wx.$util.showToast('请输入内容!')
}
},
// date 代表指定的日期,格式:2018-09-27
// day 传-1表始前一天,传1表始后一天
getNextDate(date, day) {
var dd = new Date(date)
dd.setDate(dd.getDate() + day)
var y = dd.getFullYear()
var m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1
var d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate()
return y + '-' + m + '-' + d
},
getGoodsTypeList() {
api.getGoodsTypeList().then(res => {
let { code, data, message } = res
console.log(res)
let list = [
{
name: '全部',
active: true,
value: []
}
]
if (code == 0) {
data.map(e => {
list.push({
name: e.goodsTypeName,
value: [e.goodsType]
})
})
} else {
wx.$util.showToast(message)
}
this.setData({
['form.inviteType.data']: list
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getUserInfo()
this.init()
// this.setTimeList()
dateChange(e) {
// console.log(e.)
// console.log(type)
let { type } = e.currentTarget.dataset
console.log(type)
let { dateObj } = this.data
this.calendar = this.selectComponent('#calender')
if (type == 'before') {
this.setTimeList(dateObj.beforeDay)
} else {
this.setTimeList(dateObj.nextDay)
}
wx.$util.pointRecord(type == 'before' ? 16 : 17)
this.calendar.resetData(type == 'before' ? dateObj.beforeDay : dateObj.nextDay)
},
// 获取选中天数
rangeSelect(e) {
wx.$util.pointRecord(15)
console.log(e.detail)
let { date } = e.detail
this.setTimeList(date)
},
choose(e) {
let { index, listName } = e.currentTarget.dataset
let target = this.data.form[listName].data
if (target[index].disabled) return
target.map(i => (i.active = false))
target[index].active = true
getUserInfo() {
this.setData({
[`form.${listName}.data`]: target,
isReset: false
userInfo: wx.$util.getUserInfo()
})
},
changeTabIndex(e) {
let { index } = e.currentTarget.dataset
let { tabList, activeTab } = this.data
tabList.forEach((element, itemIndex) => {
if (itemIndex == index) {
element.active = true
activeTab = itemIndex
} else {
element.active = false
}
})
init() {
let webUrl = this.data;
let index = 2;
let accountInfo = wx.getAccountInfoSync();
let systemInfo = wx.getSystemInfoSync();
let envName = accountInfo.miniProgram.envVersion;
//手动控制体验版环境的请求 true就依据下面index false就默认2
const manual = false;
const release = false;
switch (envName) {
case "develop":
break;
case "trial":
index = manual ? index : 2;
break;
case "release":
index = release ? index : 3;
break;
default:
index = 3;
break;
}
const webUrls = {
develop: `http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=`,
trial: `http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=`,
release: `http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=`,
preRelease: `http://192.168.2.111:9527/dj-scrm-wx-work-main-test/#/?phone=`,
};
const target = ["ip", "develop", "trial", "release", "preRelease"];
webUrl = webUrls[target[index]];
this.setData({
tabList,
activeTab
webUrl
})
wx.$util.pointRecord(tabList[index].recordId)
},
closePop() {
this.components = this.selectComponent('#businessCell')
this.components.closePop()
},
getOrderNum() {
let { dateObj } = this.data
wx.$util.showLoading()
api
.orderdayreport({
beginDateStr: dateObj.today,
endDateStr: dateObj.today
})
.then(result => {
wx.hideLoading()
console.log(result)
let { code, data } = result
if (code == '0') {
this.setData({
todayData: data
})
}
this.setData({
flag: true
})
})
.catch(err => {
console.log(err)
})
},
// 获取设备信息
getDeviceSize() {
return new Promise((resolve, reject) => {
wx.getSystemInfo({
success: function (res) {
// console.log(res)
const { screenHeight, safeArea } = res
const { bottom } = safeArea
const bottomLift = screenHeight - bottom
resolve({ bottomLift })
}
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log('onload')
this.setTimeList()
// this.getOrderNum()
let { bottomLift } = app.globalData
if (bottomLift >= 0) {
wx.$util.getDeviceSize().then(res => {
console.log(res, 'res')
const { bottomLift } = res
this.setData({
bottomLift
})
})
} else {
this.setData({
bottomLift
})
}
},
/**
......@@ -329,17 +97,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
// let { userInfo } = this.data
// console.log(thi)
let userInfo = wx.$util.getUserInfo()
console.log(userInfo)
// // console.log(app.globalData)
let { userInfo: newUserInfo } = this.data
// console.log(newUserInfo)
if (newUserInfo) {
let isChangeLogin = newUserInfo.subLoginUser.merchantId != userInfo.subLoginUser.merchantId
isChangeLogin && this.refresh(userInfo)
}
},
/**
......@@ -366,4 +124,4 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {}
})
})
\ No newline at end of file
<!-- tabOperating/pages/index.wxml -->
<!-- src引入filter.wxs, module给模块起名 -->
<wxs src="../index.wxs" module="filter" />
<!-- <view class="" style="height:{{statusBarHeight}}px" /> -->
<!-- 自定义的导航栏 -->
<view class="layout {{ flag?'opacity':'' }}">
<navigation-bar bindback="jump" bindnavbarReady="navbarReady" showBack="{{ true }}">
<!-- <picker range="{{merchantRange}}" value="{{subIndex}}" range-key="merchantName" bindchange="changePicker" bindtap="tapPicker" bindcancel="tapPicker" disabled="{{merchantRange.length < 2}}"> -->
经营数据
<!-- <view class="navigation-title" bindtap="showStorePicker">
<view class="navigation-title-text text-hide">{{merchantRange[subIndex].merchantName}}</view>
<view class="arrow" wx:if="{{ merchantRange.length > 1 }}">
<image src="/images/arrow-bottom.png" />
</view>
</view> -->
<!-- </picker> -->
</navigation-bar>
<view class="headerContainer" style="margin-top:{{ statusBarHeight }}px">
<view class="businessDataContainer">
<view class="turnover">
<view class="num">¥{{filter.toDecimal2(todayData.totalOrderMoney)}}</view>
<view class="lab">今日营业额/元</view>
</view>
<view class="bill">
<view class="num">{{todayData.totalUpgrade}}</view>
<!-- <view class="num">{{todayData.totalToShop}}</view> -->
<view class="lab">今日单量/单</view>
</view>
</view>
<view class="menu">
<!-- wx:for-index="index" -->
<block wx:for="{{ menu }}" wx:key="index">
<view class="item" bindtap="menuJump" data-item="{{ item }}" data-index="{{ index }}">
<image src="{{IMG_URL}}static_{{index }}.png" />
{{item.name}}
</view>
</block>
</view>
</view>
<view class="Container" style="margin-bottom: {{ !activeTab?showTips?bottomLift+41:bottomLift :bottomLift }}px">
<!-- <van-calendar show /> + 41 style="padding-bottom: {{ bottomLift + 41}}px" -->
<view class="dateContainer">
<view class="date">
<!-- <view class="" /> -->
<view class="onBeforeDay item" data-type="before" bindtap="dateChange">
<!-- <view class="arrow">{{'<'}}</view> -->
<image class="arrow" src="../../images/leftArrow.png" mode="" binderror="" bindload="" />
前一天
</view>
<!-- forceFullSucreen="{{bottomLift>0?true:false}}" -->
<calendar
id="calender"
class="calendar"
allowSameDay
shortcut
bindselect="rangeSelect"
rangeAll
dateType="single"
calenderColor="#347BFF"
vertical
minDate="2020-10-01"
maxDate="{{ dateObj.maxDate }}"
isComponents
>
<!-- dataDateStr="{{dateObj.todayShow}}" -->
<view class="item text-center dateNum">
{{dateObj.todayShow}}
<image class="solidArrow" src="../../images/solidArrow.png" />
</view>
</calendar>
<!-- -->
<view class="nextDay item {{ dateObj.maxDate==dateObj.today?'hidden':'' }}" data-type="next" bindtap="dateChange">
后一天
<image class="arrow" src="../../images/rightArrow.png" mode="" binderror="" bindload="" />
</view>
</view>
</view>
<view class="cellTab">
<view class="tabContainer">
<view
bindtap="changeTabIndex"
data-index="{{ index }}"
class="tabItem {{ item.active?'active':'' }}"
wx:for="{{ tabList }}"
wx:key="index"
>{{item.name}}</view>
</view>
</view>
<!-- wx:if="{{activeTab==0}}" wx:if="{{activeTab==1}}" wx:if="{{activeTab==2}}" -->
<!-- hidden="{{activeTab!=0}}" hidden="{{activeTab!=0}}" -->
<view class="componentContainer">
<businessCell
id="businessCell"
wx:if="{{ activeTab==0 }}"
canRemark="{{ canRemark }}"
today="{{ dateObj.maxDate }}"
dataDateStr="{{ dateObj.today }}"
/>
<staffCell id="staffCell" wx:if="{{ activeTab==1 }}" dataDateStr="{{ dateObj.today }}" />
<conquestCell id="conquestCell" wx:if="{{ activeTab==2 }}" date="{{ dateObj.today }}" />
</view>
<!-- <scroll-view class="scrollStyle" scroll-y> -->
<!-- </scroll-view> -->
<!-- <block class="componentContainer" wx:for="{{tabList}}" wx:key="index">
<block wx:if="{{item.active}}">
<template is="{{ item.componentsName}}" data="{{testData}}" />
</block>
</block> -->
<!-- <template name="businessCell">
<businessCell/>
</template>
<template name="staffCell">
<staffCell/>
</template>
<template name="conquestCell">
<conquestCell/>
</template> -->
</view>
<view wx:if="{{ !activeTab&& showTips }}" class="btn-box" style="padding-bottom: {{ bottomLift }}px">
<view class="tips">
<image class="tipsIcon" src="../../../images/tips.png" />
<view class="contentText">如数据存在不准确,可点击核准数据修改当日数据量。</view>
<image class="closeIcon" bindtap="closeTips" src="../../images/closeIcon.png" />
</view>
</view>
</view>
<!-- isFormComponent="{{true}}" bind:closePop="closePop" -->
<remark-popup
wx:if="{{ showRemark }}"
show="{{ showRemark }}"
isLimitNum="{{ remarkObj.type== 'add'?false:true }}"
title="{{ remarkObj.title }}"
btnName="{{ '确认' }}"
bind:confirm="remarkConfirm"
placeholder="{{ remarkObj.placeholder }}"
maxlength="10"
value="{{ remarkObj.type== 'add'?'':remarkObj.remarkValue }}"
/>
<tipsPopup title="字段解释" show="{{ businessTipsShow }}" bindconfirm="confirm" class="tipsShow" height="460px">
<view class="item">今日贴膜台次:当日进店贴膜且下单的车辆台次</view>
<view class="item">今日升级太阳膜台次: 当日进店贴膜且下升级工单的车辆台次</view>
<view class="item">今日贴膜升级率: 当日升级工单量与贴膜工单量的比值</view>
<view class="item">今日累计太阳膜营业额: 当日累计升级工单收入总和与贴膜工单量的均值</view>
<view class="item">今日太阳膜均客单价: 当日贴膜升级工单收入总和与贴膜工单量的均值</view>
<view class="item">累计剩余未到店贴膜台次: 累计已发券未核销的客户数量</view>
<view class="item">其他产品总营业额: 除贴膜产品收入总和外,本店当日其他类型产品的收入总和</view>
</tipsPopup>
<tipsPopup title="字段解释" show="{{ staffTipsShow }}" bindconfirm="confirm" class="tipsShow" height="290px">
<view class="item">今日接车数量:当日该员工服务进店贴膜客户且下单的车辆台次</view>
<view class="item">贴膜升级率:当日该员工的贴膜升级率</view>
<view class="item">均客单价:当日该员工创造的贴膜收入总和的均值</view>
<view class="item">累计业绩:该员工累计创造的营收数据(累计接车数量/累计总贴膜升级率/累计均客单价)</view>
</tipsPopup>
<store-picker
subIndex="{{ subIndex }}"
pickList="{{ merchantRange }}"
show="{{ showPicker }}"
bindsearch="getStoreList"
bindconfirm="changePicker"
/>
<!-- bind:close="onClose" bind:confirm="onConfirm" -->
\ No newline at end of file
<web-view src="{{webUrl}}{{userInfo.phone}}"></web-view>
\ No newline at end of file
import { env, envIndex } from '~/config'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/upgrade/'
export default {
data: {
IMG_URL,
menu: [
{
name: '累计营收',
url: 'tabOperating.operatingShow',
recordId:18
},
{
name: '门店概况',
url: 'tabOperating.4sOverview',
recordId:29
},
{
name: '趋势分析',
url: 'dj-car-revenue-analysis',
isH5: true
},
{
name: '员工排行',
url: ''
}
],
showTips: true,
canRemark: false
},
methods: {
jump() {
// console.log('back')
// let { refresh } = this.data
wx.$router.back()
// console.log(refresh)
// if (refresh) {
// wx.$router.reLaunch('tabIndex.index')
// } else {
// try {
// wx.$router.back()
// } catch (error) {
// console.log(error)
// wx.$router.reLaunch('tabIndex.index')
// }
// }
},
closeTips() {
this.setData({
showTips: false
})
},
menuJump(e) {
let { index, item } = e.currentTarget.dataset
console.log(item)
// 不是累计累计营收页面
if (!item.url) {
wx.$util.showToast({
title: '暂未上线,敬请期待',
icon: 'none'
})
} else {
if (item.isH5) {
let userInfo = wx.$util.getUserInfo()
let queryParmas = userInfo?.isSuper ? 'isAdmin=true' : `isAdmin=false&yqMerchantId=${userInfo?.merchantId}`
const systemInfo = wx.getSystemInfoSync()
let jumpLocation = ''
if (systemInfo.platform != 'devtools') { // 非开发工具本地
switch (env) {
case 'develop': // 开发环境
jumpLocation = `http://192.168.0.39:8962/${item.url}/#/?${queryParmas}`
break
case 'trial': // 测试环境
jumpLocation = `https://dj.test.glsx.com.cn/${item.url}/#/?${queryParmas}`
break
case 'preRelease': // 预发布环境
jumpLocation = ''
break
case 'release': // 线上环境
jumpLocation = `https://dj.glsx.com.cn/${item.url}/#/?${queryParmas}`
break
default:
jumpLocation = `https://dj.glsx.com.cn/${item.url}/#/?${queryParmas}`
break
}
} else {
switch(envIndex) {
case 1: // 开发
jumpLocation = `http://192.168.0.39:8962/${item.url}/#/?${queryParmas}`
break
case 2: // 测试
jumpLocation = `https://dj.test.glsx.com.cn/${item.url}/#/?${queryParmas}`
break
case 3: // 线上
jumpLocation = `https://dj.glsx.com.cn/${item.url}/#/?${queryParmas}`
break
case 4: // 预发布
jumpLocation = ``
break
default:
jumpLocation = `https://dj.glsx.com.cn/${item.url}/#/?${queryParmas}`
break
}
}
wx.$router.jumpH5(jumpLocation)
} else {
wx.$router.go(item.url)
}
console.log(item.url)
item.recordId&&wx.$util.pointRecord(item.recordId)
}
// 暂未上线,敬请期待
},
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
navBarHeight
})
setTimeout(() => {
this.setData({
flag: true
})
}, 500)
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!