Commit 996fe370 by 姜雷

Merge branch 'develop' into test

parents 2c6eebb1 876a0654
...@@ -62,29 +62,35 @@ function findMaxIndex(list, key) { ...@@ -62,29 +62,35 @@ function findMaxIndex(list, key) {
} }
Component({ Component({
lifetimes: { // lifetimes: {
attached() { // attached() {
const query = wx.createSelectorQuery().in(this); // const query = wx.createSelectorQuery().in(this);
query // query
.select('#PlatformFeeChart') // .select('#PlatformFeeChart')
.boundingClientRect(res => { // .boundingClientRect(res => {
// res.top; // 这个组件内 #the-id 节点的上边界坐标 // // res.top; // 这个组件内 #the-id 节点的上边界坐标
console.log(res); // console.log(res);
this.setData({ // this.setData({
x: res.left, // x: res.left,
y: res.top, // y: res.top,
}); // });
}) // })
.exec(); // .exec();
}, // },
}, // },
properties: { properties: {
dataList: { dataList: {
type: Array, type: Array,
value: [], value: [],
observer(newVal) { observer(newVal) {
platforFeeChart && platforFeeChart.changeData(newVal); if (platforFeeChart) {
platforFeeChart.changeData(newVal);
} else {
setTimeout(() => {
platforFeeChart.changeData(newVal);
}, 1000);
}
if (platforFeeChart) { if (platforFeeChart) {
let index = findMaxIndex(newVal, 'totalMoney'); let index = findMaxIndex(newVal, 'totalMoney');
if (index !== -1) { if (index !== -1) {
...@@ -107,14 +113,18 @@ Component({ ...@@ -107,14 +113,18 @@ Component({
opts: { opts: {
onInit: initChart, onInit: initChart,
}, },
x: 0,
y: 0,
}, },
methods: { methods: {
clickHandle(e) { clickHandle(e) {
console.log(e.detail); console.log(e);
let x = e.detail.x - this.data.x; const { touches } = e.detail;
let y = e.detail.y - this.data.y;
let x = 0;
let y = 0;
if (touches && touches.length) {
x = touches[0].x;
y = touches[0].y;
}
const objArr = platforFeeChart.getSnapRecords({ x, y }); const objArr = platforFeeChart.getSnapRecords({ x, y });
if (objArr.length) this.triggerEvent('selectedData', objArr[0]._origin); if (objArr.length) this.triggerEvent('selectedData', objArr[0]._origin);
}, },
......
<!-- pages/components/PlatformFeeChart/PlatformFeeChart.wxml --> <!-- pages/components/PlatformFeeChart/PlatformFeeChart.wxml -->
<ff-canvas id="PlatformFeeChart" canvas-id="PlatformFeeChart" opts="{{ opts }}" bind:tap="clickHandle" /> <ff-canvas id="PlatformFeeChart" canvas-id="PlatformFeeChart" opts="{{ opts }}" bindcanvastouch="clickHandle" />
\ No newline at end of file \ No newline at end of file
/* pages/components/PlatformFeeChart/PlatformFeeChart.wxss */ /* pages/components/PlatformFeeChart/PlatformFeeChart.wxss */
\ No newline at end of file .PlatformFeeChart {
width: 660rpx;
height: 350rpx;
}
...@@ -3,6 +3,7 @@ import { IMyApp } from '../../../app'; ...@@ -3,6 +3,7 @@ import { IMyApp } from '../../../app';
const app = getApp<IMyApp>(); const app = getApp<IMyApp>();
let timer = null; let timer = null;
let payTimer = null;
let fetchedPlatform = false; let fetchedPlatform = false;
// pages/components/PlatformFeeDialog/PlatformFeeDialog.js // pages/components/PlatformFeeDialog/PlatformFeeDialog.js
Component({ Component({
...@@ -177,6 +178,8 @@ Component({ ...@@ -177,6 +178,8 @@ Component({
}); });
if (this.data.type === 2) { if (this.data.type === 2) {
this.fetchRechargeOrderQRcode(); this.fetchRechargeOrderQRcode();
} else {
payTimer && clearInterval(payTimer);
} }
}, },
fetchRechargeOrderQRcode() { fetchRechargeOrderQRcode() {
...@@ -210,7 +213,7 @@ Component({ ...@@ -210,7 +213,7 @@ Component({
}) })
.then(res => { .then(res => {
wx.hideLoading(); wx.hideLoading();
const { payQrUrl } = res; const { payQrUrl, orderNum } = res;
this.setData({ this.setData({
payQrUrl, payQrUrl,
}); });
...@@ -233,6 +236,30 @@ Component({ ...@@ -233,6 +236,30 @@ Component({
}); });
} }
}, 1000); }, 1000);
payTimer = setInterval(() => {
console.log('in setInterval');
operatorFetch({
url: '/operateBalance/rechage/sure',
method: 'POST',
data: { orderNum: orderNum },
})
.then(res => {
const { rechargeState } = res;
if (rechargeState === '1') {
wx.showToast({
title: res.msg || '',
icon: 'success',
});
clearInterval(payTimer);
this.setData({
showDialog: false,
});
}
})
.catch(err => {
console.log(err);
});
}, 3000);
}) })
.catch(err => { .catch(err => {
wx.hideLoading(); wx.hideLoading();
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<view class="platformFee-title-text">共计{{areaCount}}个校区</view> <view class="platformFee-title-text">共计{{areaCount}}个校区</view>
</view> </view>
<view class="platformFee-canvas"> <view class="platformFee-canvas">
<!-- <canvas class="platformFee-canvas" canvas-id="platformFee-canvas" bindtouchstart="selectedData" /> -->
<platform-fee-chart dataList="{{dataList}}" bind:selectedData="selectedData" /> <platform-fee-chart dataList="{{dataList}}" bind:selectedData="selectedData" />
</view> </view>
</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