| | |
| | | <template> |
| | | <view class="receipt-payment-detail"> |
| | | <!-- 使用通用页面头部组件 --> |
| | | <PageHeader title="客户往来详情" @back="goBack" /> |
| | | |
| | | <PageHeader title="客户往来详情" |
| | | @back="goBack" /> |
| | | <!-- 统计信息 --> |
| | | <view class="summary-info" v-if="tableData.length > 0"> |
| | | <view class="summary-info" |
| | | v-if="tableData.length > 0"> |
| | | <view class="summary-item"> |
| | | <text class="summary-label">总记录数</text> |
| | | <text class="summary-value">{{ tableData.length }}</text> |
| | |
| | | <text class="summary-value danger">{{ formatAmount(unReceiptTotal) }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 回款记录明细列表 --> |
| | | <view class="detail-list" v-if="tableData.length > 0"> |
| | | <view v-for="(item, index) in tableData" :key="index" class="detail-item"> |
| | | <view class="detail-list" |
| | | v-if="tableData.length > 0"> |
| | | <view v-for="(item, index) in tableData" |
| | | :key="index" |
| | | class="detail-item"> |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="record-icon"> |
| | | <up-icon name="file-text" size="16" color="#ffffff"></up-icon> |
| | | <up-icon name="file-text" |
| | | size="16" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="item-index">{{ index + 1 }}</text> |
| | | </view> |
| | |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">开票金额(元)</text> |
| | | <text class="detail-value">{{ formatAmount(item.invoiceAmount) }}</text> |
| | | <text class="detail-value">{{ formatAmount(item.invoiceTotal) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">回款金额(元)</text> |
| | | <text class="detail-value highlight">{{ formatAmount(item.receiptAmount) }}</text> |
| | | <text class="detail-value highlight">{{ formatAmount(item.receiptPaymentAmount) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">应收金额(元)</text> |
| | | <text class="detail-value danger">{{ formatAmount(item.unReceiptAmount) }}</text> |
| | | <text class="detail-value danger">{{ formatAmount(item.unReceiptPaymentAmount) }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="no-data"> |
| | | <view v-else |
| | | class="no-data"> |
| | | <text>暂无回款记录</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, onMounted } from 'vue'; |
| | | import { onShow } from '@dcloudio/uni-app'; |
| | | import { ref, computed, onMounted } from "vue"; |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import { customerInteractions } from "@/api/salesManagement/receiptPayment.js"; |
| | | |
| | | // 客户信息 |
| | | const customerId = ref(''); |
| | | const customerId = ref(""); |
| | | |
| | | // 表格数据 |
| | | const tableData = ref([]); |
| | | |
| | | const invoiceTotal = computed(() => { |
| | | return tableData.value.reduce((sum, item) => { |
| | | return sum + (parseFloat(item.invoiceAmount) || 0); |
| | | return sum + (parseFloat(item.invoiceTotal) || 0); |
| | | }, 0); |
| | | }); |
| | | |
| | | const receiptTotal = computed(() => { |
| | | return tableData.value.reduce((sum, item) => { |
| | | return sum + (parseFloat(item.receiptAmount) || 0); |
| | | return sum + (parseFloat(item.receiptPaymentAmount) || 0); |
| | | }, 0); |
| | | }); |
| | | |
| | | const unReceiptTotal = computed(() => { |
| | | return tableData.value.reduce((sum, item) => { |
| | | return sum + (parseFloat(item.unReceiptAmount) || 0); |
| | | return sum + (parseFloat(item.unReceiptPaymentAmount) || 0); |
| | | }, 0); |
| | | }); |
| | | |
| | | // 返回上一页 |
| | | const goBack = () => { |
| | | uni.removeStorageSync('customerId') |
| | | uni.removeStorageSync("customerId"); |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | // 获取页面参数 |
| | | const getPageParams = () => { |
| | | // 从本地存储获取客户ID |
| | | const storedCustomerId = uni.getStorageSync('customerId'); |
| | | const storedCustomerId = uni.getStorageSync("customerId"); |
| | | if (storedCustomerId) { |
| | | customerId.value = storedCustomerId; |
| | | } |
| | |
| | | const getList = () => { |
| | | if (!customerId.value) { |
| | | uni.showToast({ |
| | | title: '客户信息缺失', |
| | | icon: 'error' |
| | | title: "客户信息缺失", |
| | | icon: "error", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | showLoadingToast('加载中...') |
| | | showLoadingToast("加载中..."); |
| | | const param = { |
| | | customerId: customerId.value, |
| | | current: -1, |
| | | size: -1 |
| | | size: -1, |
| | | }; |
| | | |
| | | customerInteractions(param).then((res) => { |
| | | customerInteractions(param) |
| | | .then(res => { |
| | | tableData.value = res.data; |
| | | closeToast() |
| | | }).catch(() => { |
| | | closeToast() |
| | | closeToast(); |
| | | }) |
| | | .catch(() => { |
| | | closeToast(); |
| | | uni.showToast({ |
| | | title: '查询失败', |
| | | icon: 'error' |
| | | title: "查询失败", |
| | | icon: "error", |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | // 格式化金额 |
| | | const formatAmount = (amount) => { |
| | | return amount ? parseFloat(amount).toFixed(2) : '0.00'; |
| | | const formatAmount = amount => { |
| | | return amount ? parseFloat(amount).toFixed(2) : "0.00"; |
| | | }; |
| | | |
| | | // 显示加载提示 |
| | | const showLoadingToast = (message) => { |
| | | const showLoadingToast = message => { |
| | | uni.showLoading({ |
| | | title: message, |
| | | mask: true |
| | | mask: true, |
| | | }); |
| | | }; |
| | | |