Commit 8296f540 by 姜雷

Merge branch 'develop' into test

parents a186d644 8a6b4fdb
......@@ -11,7 +11,7 @@ function initChart(canvas, width, height, F2) {
});
platforFeeChart.source(data, {
days: {
month: {
min: 1,
max: 12,
},
......@@ -26,7 +26,7 @@ function initChart(canvas, width, height, F2) {
onShow(ev) {
const { items } = ev;
items[0].name = '';
items[0].value = month + '-' + items[0].title;
items[0].value = items[0].title + '月';
items[1].name = '';
items[1].value = items[1].value + '元';
},
......@@ -62,18 +62,37 @@ function findMaxIndex(list, key) {
}
Component({
lifetimes: {
attached() {
const query = wx.createSelectorQuery().in(this);
query
.select('#PlatformFeeChart')
.boundingClientRect(res => {
// res.top; // 这个组件内 #the-id 节点的上边界坐标
console.log(res);
this.setData({
x: res.left,
y: res.top,
});
})
.exec();
},
},
properties: {
dataList: {
type: Array,
value: [],
observer(newVal) {
platforFeeChart && platforFeeChart.changeData(newVal);
if (platforFeeChart) {
let index = findMaxIndex(newVal, 'totalMoney');
if (index !== -1) {
let item = newVal[index];
const point = platforFeeChart.getPosition(item);
platforFeeChart.showTooltip(point);
}
}
},
},
month: {
......@@ -88,13 +107,16 @@ Component({
opts: {
onInit: initChart,
},
x: 0,
y: 0,
},
methods: {
clickHandle(e) {
console.log(e);
// let
const obj = platforFeeChart.getRecord(e.detail);
this.triggerEvent('selectedData', obj);
console.log(e.detail);
let x = e.detail.x - this.data.x;
let y = e.detail.y - this.data.y;
const objArr = platforFeeChart.getSnapRecords({ x, y });
if (objArr.length) this.triggerEvent('selectedData', objArr[0]._origin);
},
},
});
......@@ -204,7 +204,7 @@ Component({
type: 2,
};
operatorFetch({
url: '/operateBalance/rechage/order',
url: '/operateBalance/rechage/order/forcodeimg',
method: 'POST',
data: entity,
})
......
......@@ -48,13 +48,27 @@ Page({
})
.then(res => {
const { areaCount, platformFees } = res;
let datalist = new Array(12)
.fill({
totalMoney: 0,
})
.map((v, idx) => ({ ...v, month: idx + 1 }));
for (let index = 0; index < platformFees.length; index++) {
const element = platformFees[index];
let dataIndex = element.month - 1;
datalist[dataIndex] = {
...datalist[dataIndex],
...element,
};
}
this.setData!({
areaCount,
dataList: platformFees,
dataList: datalist,
});
if (platformFees && platformFees.length) {
let index = findMaxIndex(platformFees, 'totalMoney');
let item = platformFees[index];
if (datalist && datalist.length) {
let index = findMaxIndex(datalist, 'totalMoney');
let item = datalist[index];
this.setData!({
selected: item,
});
......@@ -77,8 +91,9 @@ Page({
});
},
selectedData(e) {
console.log(e)
const data = e.detail;
this.setData({
this.setData!({
selected: data,
});
},
......
......@@ -15,7 +15,7 @@
<platform-fee-chart dataList="{{dataList}}" bind:selectedData="selectedData" />
</view>
</view>
<view class="platformFee-block" wx:if="{{selected.areaId}}">
<view class="platformFee-block" wx:if="{{selected.month}}">
<view class="platformFee-title">
<view class="platformFee-title-color user"></view>
<view class="platformFee-title-text">各校区服务费({{selected.month}}月)</view>
......@@ -23,7 +23,7 @@
</view>
<view class="platformFee-areaList">
<view class="platformFee-areaItem" wx:for="{{selected.areaPlatformFees}}">
<view class="platformFee-areaItem-index">{{index}}</view>
<view class="platformFee-areaItem-index">{{index + 1}}</view>
<view class="platformFee-areaItem-name">{{item.areaName}}</view>
<view class="platformFee-areaItem-price">{{item.totalMoney}}</view>
</view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment