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
...@@ -104,6 +104,7 @@ Component({ ...@@ -104,6 +104,7 @@ Component({
}], }],
}, },
listData: [], listData: [],
chartData: [],
activeTrigger: false, activeTrigger: false,
activePageNum: 1, activePageNum: 1,
activeTotal: 0, activeTotal: 0,
...@@ -119,8 +120,7 @@ Component({ ...@@ -119,8 +120,7 @@ Component({
tickCount: 8, tickCount: 8,
lineList: [], lineList: [],
barList: [], barList: [],
chartData: [],
lineData: []
}, },
}, },
/** /**
...@@ -232,7 +232,10 @@ Component({ ...@@ -232,7 +232,10 @@ Component({
} }
ActivityApi[apiName](params).then(res => { ActivityApi[apiName](params).then(res => {
this.setData({ this.setData({
outputData: { ...this.data.outputData, ...res } outputData: {
...this.data.outputData,
...res
}
}) })
console.log(this.data.outputData) console.log(this.data.outputData)
}) })
...@@ -242,9 +245,14 @@ Component({ ...@@ -242,9 +245,14 @@ Component({
type, type,
} = this.data } = this.data
if (type != 2) return if (type != 2) return
ActivityApi.merchantsOutputToday({ merchantIds: [thisPage.data.merchantId] }).then(res => { ActivityApi.merchantsOutputToday({
merchantIds: [thisPage.data.merchantId]
}).then(res => {
this.setData({ this.setData({
outputData: { ...this.data.outputData, ...res } outputData: {
...this.data.outputData,
...res
}
}) })
}) })
}, },
...@@ -279,7 +287,7 @@ Component({ ...@@ -279,7 +287,7 @@ Component({
}, },
formatDate(date) { formatDate(date) {
date = new Date(date); date = new Date(date);
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`; return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2,0)}-${(date.getDate()).toString().padStart(2,0)}`;
}, },
/**柱状图 */ /**柱状图 */
getHistogram() { getHistogram() {
...@@ -300,7 +308,7 @@ Component({ ...@@ -300,7 +308,7 @@ Component({
} }
ActivityApi[methods[this.data.type]](params).then(res => { ActivityApi[methods[this.data.type]](params).then(res => {
this.setData({ this.setData({
'opts.chartData': res chartData: res
}) })
}) })
}, },
...@@ -321,14 +329,13 @@ Component({ ...@@ -321,14 +329,13 @@ Component({
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,
endDate: endTime
} }
this.data.type == 1 ? params.dateDimension = timePeriod : params.timePeriod = timePeriod 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 => { ActivityApi[methods[this.data.type]](params).then(res => {
this.setData({ this.setData({
'opts.lineData': res lineData: res
}) })
}) })
}, },
......
...@@ -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!