Commit bf331da5 by 姜雷

修改支付

parent 6f537cca
......@@ -50,6 +50,17 @@ function initChart(canvas, width, height, F2) {
return platforFeeChart;
}
function findMaxIndex(list, key) {
if (!list.length) return -1;
let max = list[0][key];
let maxIndex = 0;
for (let index = 0; index < list.length; index++) {
const element = list[index];
if (element >= max) maxIndex = index;
}
return maxIndex;
}
Component({
properties: {
dataList: {
......@@ -57,6 +68,12 @@ Component({
value: [],
observer(newVal) {
platforFeeChart && platforFeeChart.changeData(newVal);
let index = findMaxIndex(newVal, 'totalMoney');
if (index !== -1) {
let item = newVal[index];
const point = platforFeeChart.getPosition(item);
platforFeeChart.showTooltip(point);
}
},
},
month: {
......@@ -72,4 +89,12 @@ Component({
onInit: initChart,
},
},
methods: {
clickHandle(e) {
console.log(e);
// let
const obj = platforFeeChart.getRecord(e.detail);
this.triggerEvent('selectedData', obj);
},
},
});
<!-- pages/components/PlatformFeeChart/PlatformFeeChart.wxml -->
<ff-canvas id="PlatformFeeChart" canvas-id="PlatformFeeChart" opts="{{ opts }}" />
\ No newline at end of file
<ff-canvas id="PlatformFeeChart" canvas-id="PlatformFeeChart" opts="{{ opts }}" bind:tap="clickHandle" />
\ No newline at end of file
......@@ -3,6 +3,7 @@ import { IMyApp } from '../../../app';
const app = getApp<IMyApp>();
let timer = null;
let fetchedPlatform = false;
// pages/components/PlatformFeeDialog/PlatformFeeDialog.js
Component({
lifetimes: {
......@@ -11,7 +12,9 @@ Component({
this.setData!({
userInfo: app.globalData.userInfo,
});
this.data.eventType === 'slef' && this.fetchPlatformFee();
this.data.eventType === 'slef' &&
!fetchedPlatform &&
this.fetchPlatformFee();
},
},
/**
......@@ -60,6 +63,7 @@ Component({
payTimeLimit,
showDialog: rechargeBalance > 0 ? true : false,
});
fetchedPlatform = true;
})
.catch(err => {
console.log(err);
......@@ -72,6 +76,77 @@ Component({
},
fetchRechargeInfo() {
console.log('in fetchRechargeInfo');
wx.showLoading({
title: '',
});
wx.login({
success: res => {
if (res.code) {
const entity = {
billType: this.data.billType,
isAgree: 1,
jsCode: res.code,
operateId: this.data.userInfo.operateId,
operateName: this.data.userInfo.operateName,
rechargeType: '2',
type: 2,
};
operatorFetch({
url: '/operateBalance/rechage/order/formini',
method: 'POST',
data: entity,
})
.then(res => {
console.log(res);
const { payInfo } = res;
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr: payInfo.nonceStr,
package: payInfo.package,
signType: payInfo.signType,
paySign: payInfo.paySign,
success: res => {
console.log(res);
wx.showToast({
title: '支付成功!',
});
this.setData({
showDialog: false,
});
},
fail(res) {
console.log(res);
wx.showToast({
title: '支付失败!',
icon: 'none',
});
},
});
})
.catch(err => {
console.log(err);
wx.hideLoading();
wx.showToast({
title: err.msg || '请求失败',
icon: 'none',
});
});
} else {
wx.hideLoading();
wx.showToast({
title: res.errMsg || '请求失败',
icon: 'none',
});
}
},
fail(res) {
wx.hideLoading();
wx.showToast({
title: res.errMsg || '请求失败',
icon: 'none',
});
},
});
},
goRecordsPage() {
wx.navigateTo({
......@@ -104,49 +179,74 @@ Component({
wx.showLoading({
title: '',
});
const entity = {
billType: this.data.billType,
isAgree: 1,
jsCode: 'string',
operateId: this.data.userInfo.operateId,
operateName: this.data.userInfo.operateName,
rechargeType: '2',
type: 2,
};
operatorFetch({
url: '/operateBalance/rechage/order/formini',
method: 'POST',
data: entity,
})
.then(res => {
wx.hideLoading();
const { payQrUrl } = res;
this.setData({
payQrUrl,
});
timer = setInterval(() => {
let count = this.data.countDown;
if (count === 0) {
clearInterval(timer);
} else {
let newCount = count - 1;
let countString =
Math.floor(newCount / 60) + '分' + (newCount % 60) + '秒';
this.setData({
countDown: newCount,
countDownString: countString,
wx.login({
success: res => {
if (res.code) {
const entity = {
billType: this.data.billType,
isAgree: 1,
jsCode: 'string',
operateId: this.data.userInfo.operateId,
operateName: this.data.userInfo.operateName,
rechargeType: '2',
type: 2,
};
operatorFetch({
url: '/operateBalance/rechage/order/formini',
method: 'POST',
data: entity,
})
.then(res => {
wx.hideLoading();
const { payQrUrl } = res;
this.setData({
payQrUrl,
});
timer = setInterval(() => {
let count = this.data.countDown;
if (count === 0) {
clearInterval(timer);
this.setData({
payQrUrl: '',
countDown: 600,
countDownString: '0秒',
});
} else {
let newCount = count - 1;
let countString =
Math.floor(newCount / 60) + '分' + (newCount % 60) + '秒';
this.setData({
countDown: newCount,
countDownString: countString,
});
}
}, 1000);
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: err.msg || '请求失败',
icon: 'none',
});
console.log(err);
});
}
}, 1000);
})
.catch(err => {
} else {
wx.hideLoading();
wx.showToast({
title: res.errMsg || '请求失败',
icon: 'none',
});
}
},
fail(res) {
console.log(res);
wx.hideLoading();
wx.showToast({
title: err.msg || '请求失败',
title: res.errMsg || '请求失败',
icon: 'none',
});
console.log(err);
});
},
});
},
},
});
......@@ -172,5 +172,20 @@ Component({
console.log(err);
});
},
requestSubMsg() {
console.log('in requestSubMsg');
wx.requestSubscribeMessage({
tmplIds: ['WU2yMHKM_yNPLGHRsstggsDYnZhKoHIg4heM2fZkD5I'],
success(res) {
console.log('in success', res);
},
fail(res) {
console.log('in fail', res);
},
complete(res) {
console.log('in complete', res);
},
});
},
},
});
<!-- miniprogram/pages/home.wxml -->
<view class="container home">
<!-- <button bind:tap="requestSubMsg">订阅</button> -->
<view class="home-title">
<view class="home-title-text">盈收数据</view>
<view class="home-title-type">
......@@ -34,6 +35,5 @@
<price-and-count tag-data="{{refundData}}" />
<price-and-count tag-data="{{refundCount}}" />
</view>
<view class="home-box">您有平台服务费需要结算,请到缴纳页面及时处理</view>
<platform-dialog />
</view>
\ No newline at end of file
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fetch_1 = require("../../api/fetch");
function findMaxIndex(list, key) {
if (!list.length)
return -1;
var max = list[0][key];
var maxIndex = 0;
for (var index = 0; index < list.length; index++) {
var element = list[index];
if (element >= max)
maxIndex = index;
}
return maxIndex;
}
Page({
data: {
areaCount: 0,
year: '',
dataList: [],
selected: {
areaId: undefined,
areaName: '',
month: '',
totalMoney: 0,
},
},
onLoad: function (options) {
var year = new Date().getFullYear();
......@@ -29,6 +47,13 @@ Page({
areaCount: areaCount,
dataList: platformFees,
});
if (platformFees && platformFees.length) {
var index = findMaxIndex(platformFees, 'totalMoney');
var item = platformFees[index];
_this.setData({
selected: item,
});
}
})
.catch(function (err) {
console.log(err);
......@@ -46,5 +71,11 @@ Page({
url: '/pages/platformFeeRecord/platformFeeRecord',
});
},
selectedData: function (e) {
var data = e.detail;
this.setData({
selected: data,
});
},
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGxhdGZvcm1GZWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJwbGF0Zm9ybUZlZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUFrRDtBQUdsRCxJQUFJLENBQUM7SUFJSCxJQUFJLEVBQUU7UUFDSixTQUFTLEVBQUUsQ0FBQztRQUNaLElBQUksRUFBRSxFQUFFO1FBQ1IsUUFBUSxFQUFFLEVBQUU7S0FDYjtJQUtELE1BQU0sRUFBRSxVQUFTLE9BQU87UUFDdEIsSUFBSSxJQUFJLEdBQUcsSUFBSSxJQUFJLEVBQUUsQ0FBQyxXQUFXLEVBQUUsQ0FBQztRQUNwQyxPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ2xCLElBQUksQ0FBQyxTQUFTLENBQUM7WUFDYixJQUFJLE1BQUE7U0FDTCxDQUFDLENBQUM7UUFDSCxJQUFJLENBQUMsT0FBUSxDQUFDO1lBQ1osSUFBSSxNQUFBO1NBQ0wsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQUNELFNBQVMsWUFBQyxNQUFNO1FBQWhCLGlCQWVDO1FBZEMsTUFBTSxDQUFDLHVCQUFlLENBQUM7WUFDckIsR0FBRyxFQUFFLHlDQUF5QztZQUM5QyxJQUFJLEVBQUUsTUFBT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FMaXN0OiBwbGF0Zm9ybUZlZXMsXG4gICAgICAgIH0pO1xuICAgICAgICBpZiAocGxhdGZvcm1GZWVzICYmIHBsYXRmb3JtRmVlcy5sZW5ndGgpIHtcbiAgICAgICAgICBsZXQgaW5kZXggPSBmaW5kTWF4SW5kZXgocGxhdGZvcm1GZWVzLCAndG90YWxNb25leScpO1xuICAgICAgICAgIGxldCBpdGVtID0gcGxhdGZvcm1GZWVzW2luZGV4XTtcbiAgICAgICAgICB0aGlzLnNldERhdGEhKHtcbiAgICAgICAgICAgIHNlbGVjdGVkOiBpdGVtLFxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9KVxuICAgICAgLmNhdGNoKGVyciA9PiB7XG4gICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICB9KTtcbiAgfSxcbiAgeWVhckNoYW5nZUhhbmRsZShlKSB7XG4gICAgY29uc29sZS5sb2coZSk7XG4gICAgY29uc3QgeyB2YWx1ZSB9ID0gZS5kZXRhaWw7XG4gICAgdGhpcy5mZXRjaExpc3Qoe1xuICAgICAgeWVhcjogdmFsdWUsXG4gICAgfSk7XG4gIH0sXG4gIGdvUmVjb3JkUGFnZSgpIHtcbiAgICB3eC5uYXZpZ2F0ZVRvKHtcbiAgICAgIHVybDogJy9wYWdlcy9wbGF0Zm9ybUZlZVJlY29yZC9wbGF0Zm9ybUZlZVJlY29yZCcsXG4gICAgfSk7XG4gIH0sXG4gIHNlbGVjdGVkRGF0YShlKSB7XG4gICAgY29uc3QgZGF0YSA9IGUuZGV0YWlsO1xuICAgIHRoaXMuc2V0RGF0YSh7XG4gICAgICBzZWxlY3RlZDogZGF0YSxcbiAgICB9KTtcbiAgfSxcbn0pO1xuIl19
\ No newline at end of file
import { statisticsFetch } from '../../api/fetch';
function findMaxIndex(list, key) {
if (!list.length) return -1;
let max = list[0][key];
let maxIndex = 0;
for (let index = 0; index < list.length; index++) {
const element = list[index];
if (element >= max) maxIndex = index;
}
return maxIndex;
}
// miniprogram/pages/platformFee/platformFee.js
Page({
/**
......@@ -9,6 +20,12 @@ Page({
areaCount: 0,
year: '',
dataList: [],
selected: {
areaId: undefined,
areaName: '',
month: '',
totalMoney: 0,
},
},
/**
......@@ -35,6 +52,13 @@ Page({
areaCount,
dataList: platformFees,
});
if (platformFees && platformFees.length) {
let index = findMaxIndex(platformFees, 'totalMoney');
let item = platformFees[index];
this.setData!({
selected: item,
});
}
})
.catch(err => {
console.log(err);
......@@ -52,4 +76,10 @@ Page({
url: '/pages/platformFeeRecord/platformFeeRecord',
});
},
selectedData(e) {
const data = e.detail;
this.setData({
selected: data,
});
},
});
......@@ -12,26 +12,26 @@
<view class="platformFee-title-text">共计{{areaCount}}个校区</view>
</view>
<view class="platformFee-canvas">
<platform-fee-chart dataList="{{dataList}}" />
<platform-fee-chart dataList="{{dataList}}" bind:selectedData="selectedData" />
</view>
</view>
<view class="platformFee-block">
<view class="platformFee-block" wx:if="{{selected.areaId}}">
<view class="platformFee-title">
<view class="platformFee-title-color user"></view>
<view class="platformFee-title-text">各校区服务费(9月)</view>
<view class="platformFee-title-sum">合计:1,800.00</view>
<view class="platformFee-title-text">各校区服务费({{selected.month}}月)</view>
<view class="platformFee-title-sum">合计:{{selected.totalMoney}}</view>
</view>
<view class="platformFee-areaList">
<view class="platformFee-areaItem">
<view class="platformFee-areaItem-index">1</view>
<view class="platformFee-areaItem-name">多彩温江</view>
<view class="platformFee-areaItem-price">1,000.00</view>
<view class="platformFee-areaItem" wx:for="{{selected.areaPlatformFees}}">
<view class="platformFee-areaItem-index">{{index}}</view>
<view class="platformFee-areaItem-name">{{item.areaName}}</view>
<view class="platformFee-areaItem-price">{{item.totalMoney}}</view>
</view>
<view class="platformFee-areaItem">
<!-- <view class="platformFee-areaItem">
<view class="platformFee-areaItem-index">2</view>
<view class="platformFee-areaItem-name">多彩温江</view>
<view class="platformFee-areaItem-price">1,000.00</view>
</view>
</view> -->
</view>
</view>
</view>
\ No newline at end of file
<!-- miniprogram/pages/platformFeeRecord/platformFeeRecord.wxml -->
<view class="platformFeeRecord">
<scroll-view class="platformFeeRecord-list" scroll-y bindscrolltolower="getMoreListItem">
<scroll-view wx:if="{{dataList.length}}" class="platformFeeRecord-list" scroll-y bindscrolltolower="getMoreListItem">
<view class="platformFeeRecord-item" wx:for="{{dataList}}" wx:key="{{item.id}}">
<view class="platformFeeRecord-itemTitle">
<view class="platformFeeRecord-itemTitle-text">
......@@ -18,6 +18,7 @@
</view>
</view>
</scroll-view>
<view wx:else class="noData">暂无数据</view>
<!-- <view class="platformFeeRecord-item">
<view class="platformFeeRecord-itemTitle">
<view class="platformFeeRecord-itemTitle-text">微信缴费-专用发票</view>
......
......@@ -33,3 +33,7 @@ page,
.platformFeeRecord-col:last-child {
margin-bottom: 0;
}
.noData{
padding: 50rpx;
text-align: center;
}
\ No newline at end of file
......@@ -38,7 +38,7 @@
<view class="report-header-bottom"></view>
</view>
<view class="report-nav">
<nav-item wx:for="{{itemList}}" wx:key="{{index}}" nav-data="{{item}}"></nav-item>
<nav-item wx:for="{{itemList}}" wx:key="index" nav-data="{{item}}"></nav-item>
</view>
<platform-dialog id="platformDialog" eventType="parents" />
</view>
\ No newline at end of file
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