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

179 lines
5.9 KiB
Vue
Raw Permalink Normal View History

2022-06-01 23:58:24 +08:00
<template>
<view class="margin-bottom-lg">
<!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block>
2022-11-28 01:28:39 +08:00
<block slot="content">交易明细</block>
2022-06-01 23:58:24 +08:00
</cu-custom>
<!-- <view class="margin-sm shadow-warp">
2022-06-01 23:58:24 +08:00
<view class="padding-tb-lg padding-lr bg-gradual-color light">
<view>账户余额</view>
<view class="flex justify-between margin-top-sm">
2022-06-01 23:58:24 +08:00
<view class="text-xxl">--</view>
<view class="cu-btn bg-white radius">充值</view>
</view>
</view>
<view class="padding bg-white flex justify-between">
2022-06-01 23:58:24 +08:00
<view>可提现金额<text class="text-price text-black">--</text></view>
<view>
<text>提现</text>
<text class="cuIcon-right"></text>
</view>
</view>
</view> -->
<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>
<uni-collapse ref="collapse">
2024-03-04 10:04:10 +08:00
<uni-collapse-item ref="collapseItem" :showArrow="false" v-for="(billItem, index) in bill" :key="index" :open="openStatusArr[index] === '0' ? true : false" >
2022-06-01 23:58:24 +08:00
<template v-slot:title>
<view class="padding bg-white" :data-index="index" @click="showStatement">
<view class="margin-bottom-xs">{{billItem.createTime}}</view>
<view>
<text class="margin-right"><text>支出</text><text
class="text-price text-black">{{billItem.payCount}}</text></text>
<text><text>收入</text><text
class="text-price text-black">{{billItem.incomeCount}}</text></text>
</view>
</view>
</template>
<view class="content">
2024-03-04 10:04:10 +08:00
<view v-for="(item, index1) in billItem.statement"
:key="index1"
2022-11-28 01:28:39 +08:00
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.orderDetailCode}}</view>
<view class="text-gray">
<view class="margin-bottom-xs" v-if="item.financialDetailType == 0">结单金额</view>
<view class="margin-bottom-xs" v-else-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>
</view>
<view class="text-gray">{{item.createTime}}</view>
2022-06-01 23:58:24 +08:00
</view>
<view class="text-price text-black">{{item.payMoney}}</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
import myUniCombox from '@/components/uni-combox/my-uni-combox.vue';
export default {
components: {
myUniCombox
},
2022-06-01 23:58:24 +08:00
data() {
return {
openStatusArr: [], //0打开1收起
2022-11-28 01:28:39 +08:00
bill: [],
curUserInfo: {},
billingStateList: [{
code: '1',
name: '待到帐'
},{
code: '6',
name: '已取消'
},{
code: '5',
name: '已到帐'
}],
billingStateObj: null
2022-06-01 23:58:24 +08:00
}
},
onLoad() {
this.loadData();
},
methods: {
2022-11-28 01:28:39 +08:00
async loadData() {
this.curUserInfo = this.$request.getCurUserInfo();
2022-06-01 23:58:24 +08:00
// 查询账单
this.qryBills();
},
async qryBills(params = {}) {
2022-11-28 01:28:39 +08:00
let billRes = await this.$request.qryFinancialCount({
financialDetailTypes: [0,1],
...params
});
this.bill = billRes.data;
this.openStatusArr = [];
for (let i = 0; i < this.bill.length; i++) {
this.openStatusArr.push('1');
this.$nextTick(() => {
this.$refs.collapseItem[i].onClick(false, 'init');
})
}
this.$nextTick(() => {
this.$refs.collapse.resize();
})
2022-06-01 23:58:24 +08:00
},
async showStatement(e) {
let curIndex = e.currentTarget.dataset.index;
// 1为缩起状态0为展开状态
if (this.openStatusArr[curIndex] == '1' && (!this.bill[curIndex].statement || this.bill[curIndex].statement.length === 0)) {
2022-06-01 23:58:24 +08:00
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,
2022-11-28 01:28:39 +08:00
endTime: finishTimeStr,
financialDetailTypes: [0,1],
payeeId: this.curUserInfo.workerId,
billingState: this.billingStateObj ? this.billingStateObj.code : null
2022-06-01 23:58:24 +08:00
});
// 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.resize();
2022-06-01 23:58:24 +08:00
uni.hideLoading();
})
// #endif
}
2022-06-06 22:10:06 +08:00
},
showDetail(item) {
uni.navigateTo({
url: '/pages/my/statement-desc?statementDesc=' + encodeURIComponent(JSON.stringify(item))
})
},
chooseBillingState(e) {
this.billingStateObj = e;
},
searchBills() {
this.qryBills({
billingState: this.billingStateObj ? this.billingStateObj.code : null
});
}
2022-06-01 23:58:24 +08:00
},
}
</script>
<style>
2022-05-19 22:12:16 +08:00
</style>