Commit 302c7881 by 王志慧

commit

1 parent 089669a9
...@@ -7,6 +7,10 @@ Component({ ...@@ -7,6 +7,10 @@ Component({
opts: { opts: {
type: Object, type: Object,
value: {} value: {}
},
chartData:{
type: Object,
value: {}
} }
}, },
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
</view> </view>
<view class="container" style="height: 200px;"> <view class="container" style="height: 200px;">
<bar-echart class="f2-chart" keys="{{opts.keys}}" chartData="{{opts.chartData}}" color="{{opts.color}}" tickCount="{{opts.tickCount}}" /> <bar-echart class="f2-chart" keys="{{opts.keys}}" chartData="{{chartData}}" color="{{opts.color}}" tickCount="{{opts.tickCount}}" />
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -7,6 +7,10 @@ Component({ ...@@ -7,6 +7,10 @@ Component({
opts: { opts: {
type: Object, type: Object,
value: {} value: {}
},
chartData:{
type: Object,
value: {}
} }
}, },
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</view> </view>
</view> </view>
<view class="container" style="height: 180px;"> <view class="container" style="height: 180px;">
<line-echart class="f2-chart" period="{{timePeriod}}" chartData="{{opts.lineData}}" color="{{opts.lineColr}}" tickCount="{{opts.tickCount}}" keys="{{opts.keys}}"/> <line-echart class="f2-chart" period="{{timePeriod}}" chartData="{{chartData}}" color="{{opts.lineColr}}" tickCount="{{opts.tickCount}}" keys="{{opts.keys}}"/>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
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')
this.initLocal(val) this.initLocal(val)
} }
} }
},
/**
* 组件的初始数据
*/
data: {
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,
outputView: { activeTotal: 0,
outputValue: [{ pageNum: 1,
label: '总报价量', total: 0,
name: 'totalQuotationCount' pageSize: 10,
}, { noResult: false,
label: '总成交量', isShow: false,
name: 'totalSuccessCount', opts: {
unit: '' keys: ['abscissaValue', 'ordinateValue'],
}, { color: '#69C9FF',
label: '总产值', lineColr: '#6ED0BE',
name: 'totalOutputValue', tickCount: 8,
_unit: '¥' lineList: [],
}, { barList: [],
label: '当月报价量',
name: 'monthQuotationCount', },
_unit: '¥' },
}, { /**
label: '当月成交量', * 组件的方法列表
name: 'monthSuccessCount', */
unit: '' methods: {
}, { // 初始化
label: '当月产值', initLocal(val) {
name: 'monthOutputValue', this.setData({
_unit: '¥' type: val,
}, { activeTrigger: false,
label: '单价', noResult: false,
name: 'avgPrice', outputData: {},
_unit: '¥' sfaffList: [],
}, { tabelTh: []
label: '升级率', }, () => {
name: 'conversionRate', thisPage = wx.$router.getPageInstance()
unit_: '%', this.getActivityInfo()
multiple: 100, })
},
getActivityInfo() {
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: '升级订单/单', title: '营业额',
name: 'upgradeCountTotal', type: 1
unit: '' }]
},
2: {
lineList: [{
title: '报价量',
type: 1
}, { }, {
label: '营业额(总)/元', title: '成交量',
name: 'orderMoneyTotal', type: 2
_unit: '¥'
}, { }, {
label: '客单价/元', title: '产值',
name: 'averagePrice', type: 3
_unit: '¥'
}, {
label: '转化率',
name: 'upgradeRatio',
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,
activeTrigger: false, barList = obj[type].barList
activePageNum: 1, const barObj = this.selectComponent('#bar')
activeTotal: 0, const lineObj = this.selectComponent('#line')
pageNum: 1, this.setData({
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({
chartData: [], startTime: '',
lineData: [] endTime: '',
}, dataType: 1,
timePeriod: 1
})
barObj.setData({
dataType: type == 1 ? 3 : 1
})
}, },
/** // 看产值-产值总览
* 组件的方法列表 getOutput() {
*/ const {
methods: { type,
// 初始化 } = this.data
initLocal(val) { let apiName = 'boutiquecouponOutputValue'
this.setData({ let params = {
type: val, merchantId: thisPage.data.merchantId
activeTrigger: false, }
noResult: false, if ([2].includes(type)) {
outputData: {}, apiName = 'merchantsOutput'
sfaffList: [], params = {
tabelTh: [] merchantIds: [thisPage.data.merchantId]
}, () => { }
thisPage = wx.$router.getPageInstance() }
this.getActivityInfo() ActivityApi[apiName](params).then(res => {
}) this.setData({
}, outputData: {
getActivityInfo() { ...this.data.outputData,
this.initSearch() ...res
this.getOutput() }
this.getStaffOutput() })
this.merchantsOutputToday() console.log(this.data.outputData)
this.getHistogram() })
this.getTrend() },
}, merchantsOutputToday() {
initSearch() { const {
let { type,
type, } = this.data
opts if (type != 2) return
} = this.data ActivityApi.merchantsOutputToday({
const obj = { merchantIds: [thisPage.data.merchantId]
1: { }).then(res => {
lineList: [{ this.setData({
title: '营业额', outputData: {
type: 1 ...this.data.outputData,
}, { ...res
title: '到店量', }
type: 2 })
}], })
barList: [{ },
title: '发券量', selectEvent() {
type: 3 this.getTrend()
}, { },
title: '营业额', selectBarEvent() {
type: 1 this.getHistogram()
}] },
}, selectTime() {
2: { this.setData({
lineList: [{ isShow: true
title: '报价量', })
type: 1 },
}, { onClose() {
title: '成交量', this.setData({
type: 2 isShow: false
}, { });
title: '产值', },
type: 3 onConfirm(event) {
}], const [start, end] = event.detail;
barList: [{ const lineObj = this.selectComponent('#line')
title: '报价量', this.setData({
type: 1 isShow: false
}, { });
title: '成交量', lineObj.setData({
type: 2 startTime: this.formatDate(start),
}, { endTime: this.formatDate(end),
title: '产值', timePeriod: ''
type: 3 })
}] this.getTrend()
} },
}, formatDate(date) {
lineList = obj[type].lineList, date = new Date(date);
barList = obj[type].barList return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2,0)}-${(date.getDate()).toString().padStart(2,0)}`;
const barObj = this.selectComponent('#bar') },
const lineObj = this.selectComponent('#line') /**柱状图 */
this.setData({ getHistogram() {
opts: { const barObj = this.selectComponent('#bar')
...opts, let {
lineList, dataType
barList } = barObj.data
} const methods = {
}) 1: 'boutiquecouponQueryCouponCountAndOrderMoney',
lineObj.setData({ 2: 'merchantsHistogram'
startTime: '', }
endTime: '', const params = {
dataType: 1, merchantId: thisPage.data.merchantId,
timePeriod: 1 dataType //数据类型:1报价量/ 2成交量 /3产值
}) // timePeriod: 1, //时间类型 1本周 / 2本月 /3全年
barObj.setData({ // startTime: '',
dataType: type == 1 ? 3 : 1 // endTime: ''
}) }
}, ActivityApi[methods[this.data.type]](params).then(res => {
// 看产值-产值总览 this.setData({
getOutput() { chartData: res
const { })
type, })
} = this.data },
let apiName = 'boutiquecouponOutputValue' /**折线图 */
let params = { getTrend() {
merchantId: thisPage.data.merchantId const lineObj = this.selectComponent('#line')
}
if ([2].includes(type)) {
apiName = 'merchantsOutput'
params = {
merchantIds: [thisPage.data.merchantId]
}
}
ActivityApi[apiName](params).then(res => {
this.setData({
outputData: { ...this.data.outputData, ...res }
})
console.log(this.data.outputData)
})
},
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}-${date.getDate()}`;
},
/**柱状图 */
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({
'opts.chartData': res
})
})
},
/**折线图 */
getTrend() {
const lineObj = this.selectComponent('#line')
let { let {
dataType, dataType,
timePeriod, timePeriod,
startTime, startTime,
endTime endTime
} = lineObj.data } = lineObj.data
const methods = { const methods = {
1: 'boutiquecouponQueryOrderMoneyTotalAndToShopCount', 1: 'boutiquecouponQueryOrderMoneyTotalAndToShopCount',
2: 'merchantsTrend' 2: 'merchantsTrend'
} }
const params = { const params = {
merchantId: thisPage.data.merchantId, merchantId: thisPage.data.merchantId,
dataType, //数据类型:1报价量/ 2成交量 /3产值 dataType, //数据类型:1报价量/ 2成交量 /3产值
dateDimension: timePeriod, //时间类型 1本周 / 2本月 /3全年 }
startDate: startTime, this.data.type == 1 ? params.dateDimension = timePeriod : params.timePeriod = timePeriod
endDate: endTime 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'
this.data.type == 1 ? params.dateDimension = timePeriod : params.timePeriod = timePeriod ActivityApi[methods[this.data.type]](params).then(res => {
ActivityApi[methods[this.data.type]](params).then(res => { this.setData({
this.setData({ lineData: res
'opts.lineData': res })
}) })
}) },
}, getOutputReport() {
getOutputReport() { ActivityApi.merchantsOutputReport
ActivityApi.merchantsOutputReport },
}, /**员工排行 */
/**员工排行 */ getStaffOutput() {
getStaffOutput() { const {
const { type
type } = this.data
} = this.data let apiName, params, tabelTh;
let apiName, params, tabelTh; const dataT = {
const dataT = { 1: () => {
1: () => { apiName = 'boutiquecouponQueryEmployeeRankList',
apiName = 'boutiquecouponQueryEmployeeRankList', params = {
params = { merchantId: thisPage.data.merchantId
merchantId: thisPage.data.merchantId },
}, tabelTh = {
tabelTh = { employeeName: '员工',
employeeName: '员工', orderMoneyTotal: '产值(营业额)',
orderMoneyTotal: '产值(营业额)', upgradeCountTotal: '单量',
upgradeCountTotal: '单量', averagePrice: '客单价',
averagePrice: '客单价', upgradeRatio: '转化率'
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({
sfaffList,
tabelTh
})
})
}, },
formatArr(arr, fn) { 2: () => {
let res = {} apiName = 'merchantsStaffOutput',
for (let v of arr) { params = {
const val = Object.keys(v) merchantIds: [thisPage.data.merchantId]
for (let i of val) {
if (res[i]) {
res[i].push(v[i])
continue
}
res[i] = [v[i]]
}
} }
return fn(res) tabelTh = {
}, transferName: "员工姓名",
// 下拉刷新 outputValue: "产值",
activityRefresh(e) { successCount: "成交量",
this.getActivityInfo() quotationCount: "报价量",
}, conversionRate: "转化率",
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({
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
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
</view> </view>
</view> </view>
<view class="line-box"> <view class="line-box">
<output-line id="line" opts="{{opts}}" bind:selectTime="selectTime" bind:selectEvent="selectEvent"></output-line> <output-line id="line" opts="{{opts}}" chartData="{{lineData}}" bind:selectTime="selectTime" bind:selectEvent="selectEvent"></output-line>
</view> </view>
<view class="bar-box"> <view class="bar-box">
<output-bar opts="{{opts}}" id="bar" bind:selectEvent="selectBarEvent"></output-bar> <output-bar opts="{{opts}}" chartData="{{chartData}}" id="bar" bind:selectEvent="selectBarEvent"></output-bar>
</view> </view>
<staff sfaffList="{{sfaffList}}" tabelTh="{{tabelTh}}" downType="{{type ==2?'equity':'boutique'}}"/> <staff sfaffList="{{sfaffList}}" tabelTh="{{tabelTh}}" downType="{{type ==2?'equity':'boutique'}}"/>
<view class="table-box"> <view class="table-box">
...@@ -28,4 +28,4 @@ ...@@ -28,4 +28,4 @@
</view> </view>
</scroll-view > </scroll-view >
<van-calendar show="{{ isShow }}" type="range" color="#4466F0" bind:confirm="onConfirm" bind:close="onClose"/>
\ No newline at end of file \ No newline at end of file
<van-calendar max-range="{{ 30 }}" show="{{ isShow }}" type="range" color="#4466F0" bind:confirm="onConfirm" bind:close="onClose"/>
\ No newline at end of file \ No newline at end of file
...@@ -24,7 +24,7 @@ Component({ ...@@ -24,7 +24,7 @@ Component({
}, },
observers: { observers: {
'chartData': function (data) { 'chartData': function (data) {
console.log(data, '9999999999') console.log(data, '----------------')
this.initData(data) this.initData(data)
...@@ -72,7 +72,7 @@ Component({ ...@@ -72,7 +72,7 @@ Component({
type: 'solid' type: 'solid'
} }
}, },
padding: [2, 10], padding: [0, 12],
borderWidth: 2, borderWidth: 2,
borderColor: this.data.color, borderColor: this.data.color,
borderRadius: 10, borderRadius: 10,
...@@ -86,7 +86,7 @@ Component({ ...@@ -86,7 +86,7 @@ Component({
// }, // },
formatter: function (item) { formatter: function (item) {
console.log(item) console.log(item)
return `${item[0].value}` + '人' return `${item[0].value}`
} }
}, },
xAxis: { xAxis: {
......
...@@ -52,6 +52,7 @@ Component({ ...@@ -52,6 +52,7 @@ Component({
}) })
}, },
setOption(chart,xData,yData) { setOption(chart,xData,yData) {
console.log(xData)
var option = { var option = {
grid: { grid: {
left: 8, left: 8,
...@@ -68,7 +69,7 @@ Component({ ...@@ -68,7 +69,7 @@ Component({
type: 'solid' type: 'solid'
} }
}, },
padding: [2, 10], padding: [0, 12],
borderWidth: 2, borderWidth: 2,
borderColor: '#6ED0BE', borderColor: '#6ED0BE',
borderRadius: 10, borderRadius: 10,
...@@ -82,7 +83,7 @@ Component({ ...@@ -82,7 +83,7 @@ Component({
// }, // },
formatter: function (item) { formatter: function (item) {
console.log(item) console.log(item)
return `${item[0].value}` + '人' return `${item[0].value}`
} }
}, },
xAxis: { xAxis: {
...@@ -124,7 +125,7 @@ Component({ ...@@ -124,7 +125,7 @@ Component({
}, },
dataZoom: { dataZoom: {
type: "inside", type: "inside",
maxSpan: 10 maxSpan: xData.length<5?50:10
}, },
series: [{ series: [{
data: yData, data: yData,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!