后台接口对接

This commit is contained in:
donqi 2022-06-01 23:58:02 +08:00
parent 357996f87e
commit 3a8baa3d81
2 changed files with 86 additions and 32 deletions

View File

@ -6,8 +6,8 @@ export default {
uni.addInterceptor('request', { uni.addInterceptor('request', {
invoke(args) { invoke(args) {
// request 触发前拼接 url // request 触发前拼接 url
// args.url = 'https://www.opsoul.com' + args.url; args.url = 'https://www.opsoul.com' + args.url;
args.url = 'http://10.45.137.214:80' + args.url; // args.url = 'http://10.45.137.214:80' + args.url;
// args.url = 'http://127.0.0.1:80' + args.url; // args.url = 'http://127.0.0.1:80' + args.url;
if (args.data) { if (args.data) {
args.data.deptId = globalData.deptId; args.data.deptId = globalData.deptId;
@ -344,5 +344,21 @@ export default {
data: params data: params
}) })
return res[1].data.data; return res[1].data.data;
},
async qryFinancialCount(params = {}) {
let res = await uni.request({
url: '/financial/detail/count',
method: 'POST',
data: params
})
return res[1].data;
},
async qryFinancialDetail(params = {}) {
let res = await uni.request({
url: '/financial/detail/list',
method: 'POST',
data: params
})
return res[1].data;
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<view> <view class="margin-bottom-lg">
<!-- 顶部操作条 --> <!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true"> <cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block> <block slot="backText">返回</block>
@ -9,7 +9,8 @@
<view class="padding-tb-lg padding-lr bg-gradual-color light"> <view class="padding-tb-lg padding-lr bg-gradual-color light">
<view>账户余额</view> <view>账户余额</view>
<view class="flex justify-between margin-top-sm"> <view class="flex justify-between margin-top-sm">
<view class="text-xxl">{{myMoneyBag.balance}}</view> <!-- <view class="text-xxl">{{myMoneyBag.balance}}</view> -->
<view class="text-xxl">--</view>
</view> </view>
<view v-if="bindBankCard && bindBankCard.bankNum" class="flex justify-end margin-top-sm align-center"> <view v-if="bindBankCard && bindBankCard.bankNum" class="flex justify-end margin-top-sm align-center">
<view class="margin-lr-sm text-lg">{{bindBankCard.encodeBankNum}}</view> <view class="margin-lr-sm text-lg">{{bindBankCard.encodeBankNum}}</view>
@ -20,32 +21,30 @@
</view> </view>
</view> </view>
</view> </view>
<view class="margin-bottom-lg"> <uni-collapse v-model="openStatusArr[index]" ref="collapse" v-for="(billItem, index) in bill">
<view v-for="(billItem, index) in myMoneyBag.bill"> <uni-collapse-item>
<uni-collapse v-model="openStatusArr[index]"> <template v-slot:title>
<uni-collapse-item> <view class="padding bg-white" :data-index="index" @click="showStatement">
<template v-slot:title> <view class="margin-bottom-xs">{{billItem.createTime}}</view>
<view class="padding bg-white">
<view class="margin-bottom-xs">{{billItem.duration}}</view>
<view>
<text class="margin-right"><text>支出</text><text class="text-price text-black">{{billItem.outgoings}}</text></text>
<text><text>收入</text><text class="text-price text-black">{{billItem.income}}</text></text>
</view>
</view>
</template>
<view> <view>
<view v-for="(item, index1) in billItem.statement" class="bg-white padding flex justify-between align-center" @click="showDetail"> <text class="margin-right"><text>支出</text><text class="text-price text-black">{{billItem.payCount}}</text></text>
<view> <text><text>收入</text><text class="text-price text-black">{{billItem.incomeCount}}</text></text>
<view class="margin-bottom-xs">{{item.name}}</view>
<view>{{item.createTime}}</view>
</view>
<view class="text-price text-black">{{item.inOutMoney}}</view>
</view>
</view> </view>
</uni-collapse-item> </view>
</uni-collapse> </template>
</view> <view>
</view> <view v-for="(item, index1) in billItem.statement" class="bg-white padding flex justify-between align-center" @click="showDetail">
<view>
<view class="margin-bottom-xs" v-if="item.financialDetailType == 1">师傅转派</view>
<view class="margin-bottom-xs" v-else-if="item.financialDetailType == 2">多级分销</view>
<view class="margin-bottom-xs" v-else-if="item.financialDetailType == 3">平台抽成</view>
<view>{{item.createTime}}</view>
</view>
<view class="text-price text-black">{{item.payMoney}}</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</view> </view>
</template> </template>
@ -53,10 +52,11 @@
export default { export default {
data() { data() {
return { return {
openStatusArr: [['0']], //01 openStatusArr: [], //01
myMoneyBag: {}, myMoneyBag: {},
curUserInfo: {}, curUserInfo: {},
bindBankCard: null bindBankCard: null,
bill: []
} }
}, },
onLoad() { onLoad() {
@ -68,8 +68,11 @@
methods: { methods: {
async loadData() { async loadData() {
this.myMoneyBag = await this.$api.data('myMoneyBag'); this.myMoneyBag = await this.$api.data('myMoneyBag');
for(let i = 0; i < this.myMoneyBag.bill.length - 1; i++) { //
this.openStatusArr.concat(['1']); let billRes = await this.$request.qryFinancialCount();
this.bill = billRes.data;
for (let i = 0; i < this.bill.length; i++) {
this.openStatusArr.push('1');
} }
this.curUserInfo = this.$request.getCurUserInfo(); this.curUserInfo = this.$request.getCurUserInfo();
this.loadBindBankCard(); this.loadBindBankCard();
@ -84,6 +87,41 @@
this.bindBankCard = res.data; this.bindBankCard = res.data;
this.bindBankCard.encodeBankNum = '****' + this.bindBankCard.bankNum.substring(this.bindBankCard.bankNum.length - 4); this.bindBankCard.encodeBankNum = '****' + this.bindBankCard.bankNum.substring(this.bindBankCard.bankNum.length - 4);
}, },
async showStatement(e) {
let curIndex = e.currentTarget.dataset.index;
// 10
if (this.openStatusArr[curIndex] == '1' && !this.bill[curIndex].statement) {
let createTime = new Date(new Date(this.bill[curIndex].createTime).setHours(0));
let createMonth = createTime.getMonth() + 1;
let createYear = createTime.getFullYear();
let finishYear = createMonth === 12 ? createYear + 1 : createYear;
let finishMonth = createMonth === 12 ? 1 : createMonth + 1;
let createTimeStr = createYear + '-' + createMonth + '-1 00:00:00';
let finishTimeStr = finishYear + '-' + finishMonth + '-1 00:00:00';
uni.showLoading({
mask: true,
title: '加载中'
})
let res = await this.$request.qryFinancialDetail({
beginTime: createTimeStr,
endTime: finishTimeStr
});
// let newStatements = this.statements.concat();
// newStatements[curIndex] = res.rows;
// this.statements = newStatements;
let newBill = this.bill.concat();
newBill[curIndex].statement = res.rows;
this.bill = newBill;
// #ifdef MP
this.$nextTick(() => {
this.$refs.collapse[curIndex].resize();
uni.hideLoading();
})
// #endif
}
},
showDetail() { showDetail() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/my/statement-desc' url: '/pages/my/statement-desc'