| | |
| | | <template> |
| | | <view class="sales-account"> |
| | | <!-- 使用通用页面头部组件 --> |
| | | <PageHeader title="客户往来" @back="goBack" /> |
| | | |
| | | <!-- 搜索区域 --> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <up-input |
| | | class="search-text" |
| | | placeholder="请输入客户名称" |
| | | v-model="searchForm.customerName" |
| | | @change="handleQuery" |
| | | clearable |
| | | /> |
| | | </view> |
| | | <view class="search-button" @click="handleQuery"> |
| | | <up-icon name="search" size="24" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 客户列表 --> |
| | | <view class="customer-list-container"> |
| | | <view class="customer-list" v-if="tableData.length > 0"> |
| | | <view |
| | | v-for="(item, index) in tableData" |
| | | :key="item.id" |
| | | class="customer-item" |
| | | @click="rowClickMethod(item)" |
| | | > |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="customer-icon"> |
| | | <up-icon name="file-text" size="16" color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="customer-name">{{ item.customerName }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <up-icon name="arrow-right" size="16" color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">开票金额(元)</text> |
| | | <text class="detail-value">{{ formattedNumber(item.invoiceTotal) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">回款金额(元)</text> |
| | | <text class="detail-value">{{ formattedNumber(item.receiptPaymentAmount) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">应收金额(元)</text> |
| | | <text class="detail-value highlight danger">{{ formattedNumber(item.unReceiptPaymentAmount) }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else class="no-data"> |
| | | <text>暂无客户数据</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="sales-account"> |
| | | <!-- 使用通用页面头部组件 --> |
| | | <PageHeader title="客户往来" |
| | | @back="goBack" /> |
| | | <!-- 搜索区域 --> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <up-input class="search-text" |
| | | placeholder="请输入客户名称" |
| | | v-model="searchForm.searchText" |
| | | @change="searchChange" |
| | | clearable /> |
| | | </view> |
| | | <view class="search-button" |
| | | @click="handleQuery"> |
| | | <up-icon name="search" |
| | | size="24" |
| | | color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 客户列表 --> |
| | | <view class="customer-list-container"> |
| | | <view class="customer-list" |
| | | v-if="tableData.length > 0"> |
| | | <view v-for="(item, index) in tableData" |
| | | :key="item.id" |
| | | class="customer-item" |
| | | @click="rowClickMethod(item)"> |
| | | <view class="item-header"> |
| | | <view class="item-left"> |
| | | <view class="customer-icon"> |
| | | <up-icon name="file-text" |
| | | size="16" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="customer-name">{{ item.customerName }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <up-icon name="arrow-right" |
| | | size="16" |
| | | color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">开票金额(元)</text> |
| | | <text class="detail-value">{{ formattedNumber(item.invoiceTotal) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">回款金额(元)</text> |
| | | <text class="detail-value">{{ formattedNumber(item.receiptPaymentAmount) }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">应收金额(元)</text> |
| | | <text class="detail-value highlight danger">{{ formattedNumber(item.unReceiptPaymentAmount) }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view v-else |
| | | class="no-data"> |
| | | <text>暂无客户数据</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, toRefs } from "vue"; |
| | | import { onShow } from '@dcloudio/uni-app'; |
| | | import { invoiceLedgerSalesAccount } from "@/api/salesManagement/invoiceLedger"; |
| | | import { onMounted, ref, reactive, toRefs } from "vue"; |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import { invoiceLedgerSalesAccount } from "@/api/salesManagement/invoiceLedger"; |
| | | |
| | | const tableData = ref([]); |
| | | |
| | | const tableData = ref([]); |
| | | const page = reactive({ |
| | | current: -1, |
| | | size: -1, |
| | | }); |
| | | |
| | | const page = reactive({ |
| | | current: -1, |
| | | size: -1, |
| | | }); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | searchText: "", |
| | | invoiceDate: "", |
| | | }, |
| | | }); |
| | | |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | // 返回上一页 |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | // 搜索框变化时触发 |
| | | const searchChange = val => { |
| | | searchForm.value.searchText = val; |
| | | getList(); |
| | | }; |
| | | // 查询列表 |
| | | const handleQuery = () => { |
| | | getList(); |
| | | }; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: "", |
| | | invoiceDate: "", |
| | | }, |
| | | }); |
| | | const getList = () => { |
| | | showLoadingToast("加载中..."); |
| | | invoiceLedgerSalesAccount({ ...searchForm.value, ...page }) |
| | | .then(res => { |
| | | tableData.value = res.data.records; |
| | | closeToast(); |
| | | }) |
| | | .catch(() => { |
| | | closeToast(); |
| | | uni.showToast({ |
| | | title: "查询失败", |
| | | icon: "error", |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const { searchForm } = toRefs(data); |
| | | const formattedNumber = value => { |
| | | return parseFloat(value || 0).toFixed(2); |
| | | }; |
| | | |
| | | // 返回上一页 |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | // 显示加载提示 |
| | | const showLoadingToast = message => { |
| | | uni.showLoading({ |
| | | title: message, |
| | | mask: true, |
| | | }); |
| | | }; |
| | | |
| | | // 查询列表 |
| | | const handleQuery = () => { |
| | | getList(); |
| | | }; |
| | | // 关闭提示 |
| | | const closeToast = () => { |
| | | uni.hideLoading(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | showLoadingToast('加载中...') |
| | | invoiceLedgerSalesAccount({ ...searchForm.value, ...page }).then((res) => { |
| | | tableData.value = res.data.records; |
| | | closeToast() |
| | | }).catch(() => { |
| | | closeToast() |
| | | uni.showToast({ |
| | | title: '查询失败', |
| | | icon: 'error' |
| | | }); |
| | | }); |
| | | }; |
| | | const rowClickMethod = row => { |
| | | // 使用 uni.setStorageSync 存储客户信息 |
| | | uni.setStorageSync("customerId", row.id); |
| | | // 跳转到回款记录明细页面 |
| | | uni.navigateTo({ |
| | | url: "/pages/sales/receiptPaymentLedger/detail", |
| | | }); |
| | | }; |
| | | |
| | | const formattedNumber = (value) => { |
| | | return parseFloat(value || 0).toFixed(2); |
| | | }; |
| | | onShow(() => { |
| | | // 页面显示时刷新列表 |
| | | getList(); |
| | | }); |
| | | |
| | | // 显示加载提示 |
| | | const showLoadingToast = (message) => { |
| | | uni.showLoading({ |
| | | title: message, |
| | | mask: true |
| | | }); |
| | | }; |
| | | |
| | | // 关闭提示 |
| | | const closeToast = () => { |
| | | uni.hideLoading(); |
| | | }; |
| | | |
| | | const rowClickMethod = (row) => { |
| | | // 使用 uni.setStorageSync 存储客户信息 |
| | | uni.setStorageSync('customerId', row.id); |
| | | // 跳转到回款记录明细页面 |
| | | uni.navigateTo({ |
| | | url: '/pages/sales/receiptPaymentLedger/detail' |
| | | }); |
| | | }; |
| | | |
| | | onShow(() => { |
| | | // 页面显示时刷新列表 |
| | | getList(); |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import '@/styles/sales-common.scss'; |
| | | @import "@/styles/sales-common.scss"; |
| | | |
| | | // 客户往来特有样式 |
| | | .detail-value.danger { |
| | | color: #ff4757; // 与公共样式中的 #ee0a24 不同 |
| | | font-weight: 500; |
| | | } |
| | | // 客户往来特有样式 |
| | | .detail-value.danger { |
| | | color: #ff4757; // 与公共样式中的 #ee0a24 不同 |
| | | font-weight: 500; |
| | | } |
| | | </style> |