dingdong-mall/pages/my/my-money-bag.vue

108 lines
3.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="margin-bottom-lg">
<!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">我的钱包</block>
</cu-custom>
<uni-collapse v-model="openStatusArr[index]" ref="collapse" v-for="(billItem, index) in bill">
<uni-collapse-item>
<template v-slot:title>
<view class="padding bg-white" :data-index="index" @click="showStatement">
<view class="margin-bottom-xs">{{billItem.createTime}}</view>
<view>
<text><text>收入:</text><text class="text-price text-black">{{billItem.incomeCount}}</text></text>
</view>
</view>
</template>
<view>
<view v-for="(item, index1) in billItem.statement"
class="bg-white padding flex justify-between align-center solid-bottom" @click="showDetail(bill[index].statement[index1])">
<view>
<view class="flex">
<view class="margin-right-sm">提现单号:{{item.code}}</view>
<view class="text-gray">
<view class="margin-bottom-xs" v-if="item.financialDetailType == 3">分销金额</view>
</view>
</view>
<view class="text-gray">{{item.createTime}}</view>
</view>
<view class="text-price text-black">{{item.payMoney}}</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
export default {
data() {
return {
openStatusArr: [], //0打开1收起
bill: [],
curUserInfo: {}
}
},
onLoad() {
this.loadData();
},
methods: {
async loadData() {
// 查询账单
this.curUserInfo = this.$request.getCurUserInfo();
let billRes = await this.$request.qryFinancialCount({
financialDetailTypes: [3],
workerId: this.curUserInfo.customerId
});
this.bill = billRes.data;
for (let i = 0; i < this.bill.length; i++) {
this.openStatusArr.push('1');
}
},
async showStatement(e) {
let curIndex = e.currentTarget.dataset.index;
// 1为缩起状态0为展开状态
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,
financialDetailTypes: [3],
payeeId: this.curUserInfo.customerId
});
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(item) {
uni.navigateTo({
url: '/pages/my/statement-desc?statementDesc=' + encodeURIComponent(JSON.stringify(item))
})
}
},
}
</script>
<style>
</style>