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

147 lines
4.3 KiB
Vue
Raw Normal View History

2022-05-26 20:24:33 +08:00
<template>
2022-06-01 23:58:02 +08:00
<view class="margin-bottom-lg">
2022-05-26 20:24:33 +08:00
<!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">我的钱包</block>
</cu-custom>
2023-03-05 23:50:28 +08:00
<view class="padding-tb bg-white solid-bottom">
<view class="flex justify-between align-center margin-top-xs padding-left">
<my-uni-combox class="flex-sub margin-right-xs" :candidates="billingStateList"
:showField="'name'" placeholder="筛选账单状态" v-model="billingStateObj"
@input="chooseBillingState($event)"></my-uni-combox>
<view class="text-xl text-bold">
<text class="cuIcon-search margin-right-sm" @click="searchBills"></text>
</view>
</view>
</view>
2022-06-01 23:58:02 +08:00
<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>
2022-05-26 20:24:33 +08:00
<view>
2022-06-01 23:58:02 +08:00
<text><text>收入</text><text class="text-price text-black">{{billItem.incomeCount}}</text></text>
2022-05-26 20:24:33 +08:00
</view>
2022-06-01 23:58:02 +08:00
</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])">
2022-06-01 23:58:02 +08:00
<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>
2022-06-01 23:58:02 +08:00
</view>
<view class="text-price text-black">{{item.payMoney}}</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
2022-05-26 20:24:33 +08:00
</view>
</template>
<script>
2023-03-05 23:50:28 +08:00
import myUniCombox from '@/components/uni-combox/my-uni-combox.vue';
2022-05-26 20:24:33 +08:00
export default {
2023-03-05 23:50:28 +08:00
components: {
myUniCombox
},
2022-05-26 20:24:33 +08:00
data() {
return {
2022-06-01 23:58:02 +08:00
openStatusArr: [], //0打开1收起
bill: [],
2023-03-05 23:50:28 +08:00
curUserInfo: {},
billingStateList: [{
code: 1,
name: '待到帐'
},{
code: 6,
name: '已取消'
},{
code: 5,
name: '已到帐'
}],
billingStateObj: null
2022-05-26 20:24:33 +08:00
}
},
onLoad() {
this.loadData();
},
methods: {
async loadData() {
this.curUserInfo = this.$request.getCurUserInfo();
2023-03-05 23:50:28 +08:00
// 查询账单
this.qryBills();
},
async qryBills(params = {}) {
let billRes = await this.$request.qryFinancialCount({
financialDetailTypes: [3],
2023-03-05 23:50:28 +08:00
workerId: this.curUserInfo.customerId,
...params
});
2022-06-27 21:26:15 +08:00
this.bill = billRes.data;
2023-03-05 23:50:28 +08:00
this.openStatusArr = [];
2022-06-27 21:26:15 +08:00
for (let i = 0; i < this.bill.length; i++) {
this.openStatusArr.push('1');
}
2022-05-26 20:24:33 +08:00
},
2022-06-01 23:58:02 +08:00
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
2022-06-01 23:58:02 +08:00
});
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
}
},
2022-06-06 22:09:43 +08:00
showDetail(item) {
2022-05-26 20:24:33 +08:00
uni.navigateTo({
2022-06-06 22:09:43 +08:00
url: '/pages/my/statement-desc?statementDesc=' + encodeURIComponent(JSON.stringify(item))
2022-05-26 20:24:33 +08:00
})
2023-03-05 23:50:28 +08:00
},
chooseBillingState(e) {
this.billingStateObj = e;
},
searchBills() {
this.qryBills({
billingState: this.billingStateObj ? this.billingStateObj.code : null
});
2022-05-26 20:24:33 +08:00
}
},
}
</script>
<style>
</style>