Commit d64c1b88 by 前端

fixed

1 parent eb6a4ab0
/* login/index/components/LoginBox.wxss */
.wx {
height: 62vh;
height: 63vh;
.title {
font-weight: 600;
font-size: 60rpx;
color: #333333;
padding: 15vh 0 24rpx;
padding: 13vh 0 24rpx;
}
.subtitle {
......
import ActivityApi from '~/api/activityApi/index'
let thisPage;
Component({
/**
* 组件的属性列表
*/
properties: {
entranceType: {
type: Number,
observer: function (val) {
console.log(val, 'index')
console.log(Date.now())
this.initLocal(val)
}
}
/**
* 组件的属性列表
*/
properties: {
entranceType: {
type: Number,
observer: function (val) {
console.log(val, 'index')
console.log(Date.now())
this.initLocal(val)
}
}
},
/**
* 组件的初始数据
*/
data: {
minDate: new Date(2020, 0, 1).getTime(),
maxDate: new Date().getTime(),
outputView: {
outputValue: [{
label: '总报价量',
name: 'totalQuotationCount'
}, {
label: '总成交量',
name: 'totalSuccessCount',
unit: ''
}, {
label: '总产值',
name: 'totalOutputValue',
_unit: '¥'
}, {
label: '当月报价量',
name: 'monthQuotationCount',
_unit: '¥'
}, {
label: '当月成交量',
name: 'monthSuccessCount',
unit: ''
}, {
label: '当月产值',
name: 'monthOutputValue',
_unit: '¥'
}, {
label: '单价',
name: 'avgPrice',
_unit: '¥'
}, {
label: '升级率',
name: 'conversionRate',
unit_: '%',
multiple: 100,
}, {
label: '平均车险报价',
name: 'avgQuotationPrice',
_unit: '¥'
}],
boutiqueOutputValue: [{
label: '发券量(总)/张',
name: 'sendCouponCountTotal',
unit: ''
}, {
label: '升级订单/单',
name: 'upgradeCountTotal',
unit: ''
}, {
label: '营业额(总)/元',
name: 'orderMoneyTotal',
_unit: '¥'
}, {
label: '客单价/元',
name: 'averagePrice',
_unit: '¥'
}, {
label: '转化率',
name: 'upgradeRatio',
unit_: '%'
}],
todayOutiqueOutputValue: [{
label: '发券量/张',
name: 'sendCouponCountToday',
unit: ''
}, {
label: '升级订单/单',
name: 'upgradeCountToday',
unit: ''
}, {
label: '营业额(总)/元',
name: 'orderMoneyTotalToday',
unit: ''
}],
todayOutputValue: [{
label: '报价量',
name: 'quotationCount',
unit: ''
}, {
label: '成交量',
name: 'successCount',
unit: ''
}, {
label: '产值',
name: 'outputValue',
unit: ''
}],
},
/**
* 组件的初始数据
*/
data: {
minDate: new Date(2020, 0, 1).getTime(),
maxDate: new Date().getTime(),
outputView: {
outputValue: [{
label: '总报价量',
name: 'totalQuotationCount'
}, {
label: '总成交量',
name: 'totalSuccessCount',
unit: ''
}, {
label: '总产值',
name: 'totalOutputValue',
_unit: '¥'
}, {
label: '当月报价量',
name: 'monthQuotationCount',
_unit: '¥'
}, {
label: '当月成交量',
name: 'monthSuccessCount',
unit: ''
}, {
label: '当月产值',
name: 'monthOutputValue',
_unit: '¥'
}, {
label: '单价',
name: 'avgPrice',
_unit: '¥'
}, {
label: '升级率',
name: 'conversionRate',
unit_: '%',
multiple: 100,
listData: [],
chartData: [],
activeTrigger: false,
activePageNum: 1,
activeTotal: 0,
pageNum: 1,
total: 0,
pageSize: 10,
noResult: false,
isShow: false,
opts: {
keys: ['abscissaValue', 'ordinateValue'],
color: '#69C9FF',
lineColr: '#6ED0BE',
tickCount: 8,
lineList: [],
barList: [],
},
},
/**
* 组件的方法列表
*/
methods: {
// 初始化
initLocal(val) {
this.setData({
type: val,
activeTrigger: false,
noResult: false,
outputData: {},
sfaffList: [],
tabelTh: []
}, () => {
thisPage = wx.$router.getPageInstance()
this.getActivityInfo()
})
},
getActivityInfo() {
console.log(Date.now())
this.initSearch()
this.getOutput()
this.getStaffOutput()
this.merchantsOutputToday()
this.getHistogram()
this.getTrend()
},
initSearch() {
let {
type,
opts
} = this.data
const obj = {
1: {
lineList: [{
title: '营业额',
type: 1
}, {
label: '平均车险报价',
name: 'avgQuotationPrice',
_unit: '¥'
title: '到店量',
type: 2
}],
boutiqueOutputValue: [{
label: '发券量(总)/张',
name: 'sendCouponCountTotal',
unit: ''
}, {
label: '升级订单/单',
name: 'upgradeCountTotal',
unit: ''
barList: [{
title: '发券量',
type: 3
}, {
label: '营业额(总)/元',
name: 'orderMoneyTotal',
_unit: '¥'
title: '营业额',
type: 1
}]
},
2: {
lineList: [{
title: '报价量',
type: 1
}, {
label: '客单价/元',
name: 'averagePrice',
_unit: '¥'
title: '成交量',
type: 2
}, {
label: '转化率',
name: 'upgradeRatio',
unit_: '%'
title: '产值',
type: 3
}],
todayOutiqueOutputValue: [{
label: '发券量/张',
name: 'sendCouponCountToday',
unit: ''
barList: [{
title: '报价量',
type: 1
}, {
label: '升级订单/单',
name: 'upgradeCountToday',
unit: ''
title: '成交量',
type: 2
}, {
label: '营业额(总)/元',
name: 'orderMoneyTotalToday',
unit: ''
}],
todayOutputValue: [{
label: '报价量',
name: 'quotationCount',
unit: ''
}, {
label: '成交量',
name: 'successCount',
unit: ''
}, {
label: '产值',
name: 'outputValue',
unit: ''
}],
title: '产值',
type: 3
}]
}
},
listData: [],
chartData: [],
activeTrigger: false,
activePageNum: 1,
activeTotal: 0,
pageNum: 1,
total: 0,
pageSize: 10,
noResult: false,
isShow: false,
lineList = obj[type].lineList,
barList = obj[type].barList
const barObj = this.selectComponent('#bar')
const lineObj = this.selectComponent('#line')
this.setData({
opts: {
keys: ['abscissaValue', 'ordinateValue'],
color: '#69C9FF',
lineColr: '#6ED0BE',
tickCount: 8,
lineList: [],
barList: [],
},
...opts,
lineList,
barList
}
})
lineObj.setData({
startTime: '',
endTime: '',
dataType: 1,
timePeriod: 1
})
barObj.setData({
dataType: type == 1 ? 3 : 1
})
},
// 看产值-产值总览
getOutput() {
const {
type,
} = this.data
let apiName = 'boutiquecouponOutputValue'
let params = {
merchantId: thisPage.data.merchantId
}
if ([2].includes(type)) {
apiName = 'merchantsOutput'
params = {
merchantIds: [thisPage.data.merchantId]
}
}
ActivityApi[apiName](params).then(res => {
thisPage.setData({loading:false})
this.setData({
outputData: {
triggered: false,
...this.data.outputData,
...res
}
})
})
},
merchantsOutputToday() {
const {
type,
} = this.data
if (type != 2) return
ActivityApi.merchantsOutputToday({
merchantIds: [thisPage.data.merchantId]
}).then(res => {
this.setData({
outputData: {
...this.data.outputData,
...res
}
})
})
},
selectEvent() {
this.getTrend()
},
selectBarEvent() {
this.getHistogram()
},
selectTime() {
this.setData({
isShow: true
})
},
onClose() {
this.setData({
isShow: false
});
},
/**
* 组件的方法列表
*/
methods: {
// 初始化
initLocal(val) {
this.setData({
type: val,
activeTrigger: false,
noResult: false,
outputData: {},
sfaffList: [],
tabelTh: []
})
thisPage = wx.$router.getPageInstance()
this.getActivityInfo()
onConfirm(event) {
const [start, end] = event.detail;
const lineObj = this.selectComponent('#line')
this.setData({
isShow: false
});
lineObj.setData({
startTime: this.formatDate(start),
endTime: this.formatDate(end),
timePeriod: ''
})
this.getTrend()
},
formatDate(date) {
date = new Date(date);
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, 0)}-${(date.getDate()).toString().padStart(2, 0)}`;
},
/**柱状图 */
getHistogram() {
const barObj = this.selectComponent('#bar')
let {
dataType
} = barObj.data
const methods = {
1: 'boutiquecouponQueryCouponCountAndOrderMoney',
2: 'merchantsHistogram'
}
const params = {
merchantId: thisPage.data.merchantId,
dataType //数据类型:1报价量/ 2成交量 /3产值
// timePeriod: 1, //时间类型 1本周 / 2本月 /3全年
// startTime: '',
// endTime: ''
}
ActivityApi[methods[this.data.type]](params).then(res => {
this.setData({
chartData: res
})
})
},
/**折线图 */
getTrend() {
const lineObj = this.selectComponent('#line')
},
getActivityInfo() {
console.log(Date.now())
this.initSearch()
this.getOutput()
this.getStaffOutput()
this.merchantsOutputToday()
this.getHistogram()
this.getTrend()
},
initSearch() {
let {
type,
opts
} = this.data
const obj = {
1: {
lineList: [{
title: '营业额',
type: 1
}, {
title: '到店量',
type: 2
}],
barList: [{
title: '发券量',
type: 3
}, {
title: '营业额',
type: 1
}]
},
2: {
lineList: [{
title: '报价量',
type: 1
}, {
title: '成交量',
type: 2
}, {
title: '产值',
type: 3
}],
barList: [{
title: '报价量',
type: 1
}, {
title: '成交量',
type: 2
}, {
title: '产值',
type: 3
}]
}
let {
dataType,
timePeriod,
startTime,
endTime
} = lineObj.data
const methods = {
1: 'boutiquecouponQueryOrderMoneyTotalAndToShopCount',
2: 'merchantsTrend'
}
const params = {
merchantId: thisPage.data.merchantId,
dataType, //数据类型:1报价量/ 2成交量 /3产值
}
this.data.type == 1 ? params.dateDimension = timePeriod : params.timePeriod = timePeriod
if (startTime) this.data.type == 1 ? params.startDate = startTime : params.startTime = startTime + ' 00:00:00'
if (endTime) this.data.type == 1 ? params.endDate = endTime : params.endTime = endTime + ' 23:59:59'
ActivityApi[methods[this.data.type]](params).then(res => {
// res.forEach(item=>{
// item.abscissaValue = item.abscissaValue.substring(5)
// })
this.setData({
lineData: res
})
})
},
getOutputReport() {
ActivityApi.merchantsOutputReport
},
/**员工排行 */
getStaffOutput() {
const {
type
} = this.data
let apiName, params, tabelTh;
const dataT = {
1: () => {
apiName = 'boutiquecouponQueryEmployeeRankList',
params = {
merchantId: thisPage.data.merchantId
},
lineList = obj[type].lineList,
barList = obj[type].barList
const barObj = this.selectComponent('#bar')
const lineObj = this.selectComponent('#line')
this.setData({
opts: {
...opts,
lineList,
barList
}
})
lineObj.setData({
startTime: '',
endTime: '',
dataType: 1,
timePeriod: 1
})
barObj.setData({
dataType: type == 1 ? 3 : 1
})
},
// 看产值-产值总览
getOutput() {
const {
type,
} = this.data
let apiName = 'boutiquecouponOutputValue'
let params = {
merchantId: thisPage.data.merchantId
tabelTh = {
employeeName: '员工',
orderMoneyTotal: '产值(营业额)',
upgradeCountTotal: '单量',
averagePrice: '客单价',
upgradeRatio: '转化率'
}
if ([2].includes(type)) {
apiName = 'merchantsOutput'
params = {
merchantIds: [thisPage.data.merchantId]
}
}
ActivityApi[apiName](params).then(res => {
thisPage.setData({ loading: false })
this.setData({
outputData: {
triggered: false,
...this.data.outputData,
...res
}
})
})
},
merchantsOutputToday() {
const {
type,
} = this.data
if (type != 2) return
ActivityApi.merchantsOutputToday({
merchantIds: [thisPage.data.merchantId]
}).then(res => {
this.setData({
outputData: {
...this.data.outputData,
...res
}
})
})
},
selectEvent() {
this.getTrend()
},
selectBarEvent() {
this.getHistogram()
},
selectTime() {
this.setData({
isShow: true
})
},
onClose() {
this.setData({
isShow: false
});
},
onConfirm(event) {
const [start, end] = event.detail;
const lineObj = this.selectComponent('#line')
this.setData({
isShow: false
});
lineObj.setData({
startTime: this.formatDate(start),
endTime: this.formatDate(end),
timePeriod: ''
})
this.getTrend()
},
formatDate(date) {
date = new Date(date);
return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, 0)}-${(date.getDate()).toString().padStart(2, 0)}`;
},
/**柱状图 */
getHistogram() {
const barObj = this.selectComponent('#bar')
let {
dataType
} = barObj.data
const methods = {
1: 'boutiquecouponQueryCouponCountAndOrderMoney',
2: 'merchantsHistogram'
2: () => {
apiName = 'merchantsStaffOutput',
params = {
merchantIds: [thisPage.data.merchantId]
}
const params = {
merchantId: thisPage.data.merchantId,
dataType //数据类型:1报价量/ 2成交量 /3产值
// timePeriod: 1, //时间类型 1本周 / 2本月 /3全年
// startTime: '',
// endTime: ''
}
ActivityApi[methods[this.data.type]](params).then(res => {
this.setData({
chartData: res
})
})
},
/**折线图 */
getTrend() {
const lineObj = this.selectComponent('#line')
let {
dataType,
timePeriod,
startTime,
endTime
} = lineObj.data
const methods = {
1: 'boutiquecouponQueryOrderMoneyTotalAndToShopCount',
2: 'merchantsTrend'
}
const params = {
merchantId: thisPage.data.merchantId,
dataType, //数据类型:1报价量/ 2成交量 /3产值
}
this.data.type == 1 ? params.dateDimension = timePeriod : params.timePeriod = timePeriod
if (startTime) this.data.type == 1 ? params.startDate = startTime : params.startTime = startTime + ' 00:00:00'
if (endTime) this.data.type == 1 ? params.endDate = endTime : params.endTime = endTime + ' 23:59:59'
ActivityApi[methods[this.data.type]](params).then(res => {
// res.forEach(item=>{
// item.abscissaValue = item.abscissaValue.substring(5)
// })
this.setData({
lineData: res
})
})
},
getOutputReport() {
ActivityApi.merchantsOutputReport
},
/**员工排行 */
getStaffOutput() {
const {
type
} = this.data
let apiName, params, tabelTh;
const dataT = {
1: () => {
apiName = 'boutiquecouponQueryEmployeeRankList',
params = {
merchantId: thisPage.data.merchantId
},
tabelTh = {
employeeName: '员工',
orderMoneyTotal: '产值(营业额)',
upgradeCountTotal: '单量',
averagePrice: '客单价',
upgradeRatio: '转化率'
}
},
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({
triggered: false,
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) {
this.getActivityInfo()
},
jumpReport(e) {
const {
time
} = e.target.dataset
const {
entranceType
} = this.data
wx.navigateTo({
url: `/packagesList/packageOutput/pages/monthReport/monthReport?time=${time}&type=${entranceType}&merchantId=${thisPage.data.merchantId}&merchantName=${thisPage.data.merchantName}`,
})
tabelTh = {
transferName: "员工",
outputValue: "产值",
successCount: "成交量",
quotationCount: "报价量",
conversionRate: "转化率",
}
}
}
dataT[type]()
ActivityApi[apiName](params).then(res => {
const sfaffList = res.list || res || []
this.setData({
triggered: false,
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) {
this.getActivityInfo()
},
// lifetimes: {
// attached() {
// if(this.control)return
// this.control = true
// this.initLocal(this.data.entranceType)
// }
// },
jumpReport(e) {
const {
time
} = e.target.dataset
const {
entranceType
} = this.data
wx.navigateTo({
url: `/packagesList/packageOutput/pages/monthReport/monthReport?time=${time}&type=${entranceType}&merchantId=${thisPage.data.merchantId}&merchantName=${thisPage.data.merchantName}`,
})
}
},
// lifetimes: {
// attached() {
// if(this.control)return
// this.control = true
// this.initLocal(this.data.entranceType)
// }
// },
})
\ 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!