Commit d64c1b88 by 前端

fixed

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