From 8df05b861c710698dc80a611dc1beceb19a3499e Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 26 一月 2026 13:19:33 +0800
Subject: [PATCH] 汇款流水隐藏编辑,增加删除功能
---
src/pages/sales/receiptPaymentHistory/index.vue | 453 ++++++++++++++++++++++++++++++-------------------------
1 files changed, 246 insertions(+), 207 deletions(-)
diff --git a/src/pages/sales/receiptPaymentHistory/index.vue b/src/pages/sales/receiptPaymentHistory/index.vue
index a25e98d..1242c2b 100644
--- a/src/pages/sales/receiptPaymentHistory/index.vue
+++ b/src/pages/sales/receiptPaymentHistory/index.vue
@@ -1,87 +1,94 @@
<template>
- <view class="receipt-payment-history">
- <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
- <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="getList"
- clearable
- />
- </view>
- <view class="search-button" @click="getList">
- <up-icon name="search" size="24" color="#999"></up-icon>
- </view>
- </view>
- </view>
- <!-- 缁熻淇℃伅 -->
- <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>
- </view>
- <view class="summary-item">
- <text class="summary-label">鎬婚噾棰�</text>
- <text class="summary-value highlight">{{ formatAmount(totalAmount) }}</text>
- </view>
- </view>
- <!-- 鍥炴鍘嗗彶鍒楄〃 -->
- <view class="history-list" v-if="tableData.length > 0">
- <view v-for="(item, index) in tableData" :key="index">
- <view class="history-item">
- <view class="item-header">
- <view class="item-left">
- <view class="document-icon">
- <up-icon name="file-text" size="16" color="#ffffff"></up-icon>
- </view>
- <text class="item-id">{{ item.salesContractNo }}</text>
- </view>
- <view class="item-tag" :class="getTagClass(item.receiptPaymentType)">
- <text class="tag-text">{{ formatReceiptType(item.receiptPaymentType) }}</text>
- </view>
- </view>
- <up-divider></up-divider>
- <view class="item-details">
- <view class="detail-row">
- <text class="detail-label">瀹㈡埛鍚堝悓鍙�</text>
- <text class="detail-value">{{ item.customerContractNo }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">瀹㈡埛鍚嶇О</text>
- <text class="detail-value">{{ item.customerName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">椤圭洰鍚嶇О</text>
- <text class="detail-value">{{ item.projectName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鍥炴鏃ユ湡</text>
- <text class="detail-value">{{ item.receiptPaymentDate }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鍥炴閲戦(鍏�)</text>
- <text class="detail-value highlight">{{ formatAmount(item.receiptPaymentAmount) }}</text>
- </view>
- <up-divider></up-divider>
- <view class="detail-info">
- <view class="detail-row">
- <text class="detail-label">鐧昏浜�</text>
- <text class="detail-value">{{ item.registrant }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鐧昏鏃ユ湡</text>
- <text class="detail-value">{{ item.createTime }}</text>
- </view>
- </view>
- <!-- 鎿嶄綔鎸夐挳 -->
- <view class="action-buttons">
- <u-button
+ <view class="receipt-payment-history">
+ <!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+ <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="getList"
+ clearable />
+ </view>
+ <view class="search-button"
+ @click="getList">
+ <up-icon name="search"
+ size="24"
+ color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+ <!-- 缁熻淇℃伅 -->
+ <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>
+ </view>
+ <view class="summary-item">
+ <text class="summary-label">鎬婚噾棰�</text>
+ <text class="summary-value highlight">{{ formatAmount(totalAmount) }}</text>
+ </view>
+ </view>
+ <!-- 鍥炴鍘嗗彶鍒楄〃 -->
+ <view class="history-list"
+ v-if="tableData.length > 0">
+ <view v-for="(item, index) in tableData"
+ :key="index">
+ <view class="history-item">
+ <view class="item-header">
+ <view class="item-left">
+ <view class="document-icon">
+ <up-icon name="file-text"
+ size="16"
+ color="#ffffff"></up-icon>
+ </view>
+ <text class="item-id">{{ item.salesContractNo }}</text>
+ </view>
+ <view class="item-tag"
+ :class="getTagClass(item.receiptPaymentType)">
+ <text class="tag-text">{{ formatReceiptType(item.receiptPaymentType) }}</text>
+ </view>
+ </view>
+ <up-divider></up-divider>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">瀹㈡埛鍚堝悓鍙�</text>
+ <text class="detail-value">{{ item.customerContractNo }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹㈡埛鍚嶇О</text>
+ <text class="detail-value">{{ item.customerName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰鍚嶇О</text>
+ <text class="detail-value">{{ item.projectName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍥炴鏃ユ湡</text>
+ <text class="detail-value">{{ item.receiptPaymentDate }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍥炴閲戦(鍏�)</text>
+ <text class="detail-value highlight">{{ formatAmount(item.receiptPaymentAmount) }}</text>
+ </view>
+ <up-divider></up-divider>
+ <view class="detail-info">
+ <view class="detail-row">
+ <text class="detail-label">鐧昏浜�</text>
+ <text class="detail-value">{{ item.registrant }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鐧昏鏃ユ湡</text>
+ <text class="detail-value">{{ item.createTime }}</text>
+ </view>
+ </view>
+ <!-- 鎿嶄綔鎸夐挳 -->
+ <view class="action-buttons">
+ <!-- <u-button
type="primary"
size="small"
class="action-btn"
@@ -89,152 +96,184 @@
@click="openForm(item)"
>
缂栬緫鍥炴
- </u-button>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-else class="no-data">
- <text>鏆傛棤鍥炴鍘嗗彶鏁版嵁</text>
- </view>
- </view>
+ </u-button> -->
+ <u-button type="error"
+ size="small"
+ class="action-btn"
+ :disabled="item.registrant !== userStore.nickName"
+ @click="delitem(item)">
+ 鍒犻櫎
+ </u-button>
+ </view>
+ </view>
+ </view>
+ </view>
+ </view>
+ <view v-else
+ class="no-data">
+ <text>鏆傛棤鍥炴鍘嗗彶鏁版嵁</text>
+ </view>
+ </view>
</template>
<script setup>
-import { ref, computed } from 'vue';
-import { onShow } from '@dcloudio/uni-app';
-import { receiptPaymentHistoryListPage } from "@/api/salesManagement/receiptPayment.js";
-import useUserStore from "@/store/modules/user";
-const userStore = useUserStore()
+ import { ref, computed } from "vue";
+ import { onShow } from "@dcloudio/uni-app";
+ import {
+ receiptPaymentHistoryListPage,
+ receiptPaymentDel,
+ } from "@/api/salesManagement/receiptPayment.js";
+ import useUserStore from "@/store/modules/user";
+ const userStore = useUserStore();
-// 鎼滅储琛ㄥ崟
-const searchForm = ref({
- searchText: '',
-});
+ // 鎼滅储琛ㄥ崟
+ const searchForm = ref({
+ searchText: "",
+ });
-// 琛ㄦ牸鏁版嵁
-const tableData = ref([]);
+ // 琛ㄦ牸鏁版嵁
+ const tableData = ref([]);
-// 鍒嗛〉鍙傛暟
-const page = ref({
- current: -1,
- size: -1,
-});
+ // 鍒嗛〉鍙傛暟
+ const page = ref({
+ current: -1,
+ size: -1,
+ });
-const totalAmount = computed(() => {
- return tableData.value.reduce((sum, item) => {
- return sum + (parseFloat(item.receiptPaymentAmount) || 0);
- }, 0);
-});
+ const totalAmount = computed(() => {
+ return tableData.value.reduce((sum, item) => {
+ return sum + (parseFloat(item.receiptPaymentAmount) || 0);
+ }, 0);
+ });
-// 杩斿洖涓婁竴椤�
-const goBack = () => {
- uni.navigateBack();
-};
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+ const delitem = item => {
+ uni.showModal({
+ title: "纭鍒犻櫎",
+ content: `纭畾鍒犻櫎璇ュ洖娆捐褰曞悧锛焋,
+ success: res => {
+ if (res.confirm) {
+ // 璋冪敤鍒犻櫎鎺ュ彛
+ receiptPaymentDel([item.id]).then(() => {
+ uni.showToast({
+ title: "鍒犻櫎鎴愬姛",
+ icon: "success",
+ });
+ // 鍒锋柊鍒楄〃
+ getList();
+ });
+ }
+ },
+ });
+ };
-// 鏌ヨ鍒楄〃
-const getList = () => {
- showLoadingToast('鍔犺浇涓�...')
- const params = {
- ...searchForm.value,
- ...page.value
- };
- receiptPaymentHistoryListPage(params).then((res) => {
- tableData.value = res.records;
- closeToast()
- }).catch(() => {
- closeToast()
- uni.showToast({
- title: '鏌ヨ澶辫触',
- icon: 'error'
- });
- });
-};
+ // 鏌ヨ鍒楄〃
+ const getList = () => {
+ showLoadingToast("鍔犺浇涓�...");
+ const params = {
+ ...searchForm.value,
+ ...page.value,
+ };
+ receiptPaymentHistoryListPage(params)
+ .then(res => {
+ tableData.value = res.records;
+ closeToast();
+ })
+ .catch(() => {
+ closeToast();
+ uni.showToast({
+ title: "鏌ヨ澶辫触",
+ icon: "error",
+ });
+ });
+ };
-// 鏄剧ず鍔犺浇鎻愮ず
-const showLoadingToast = (message) => {
- uni.showLoading({
- title: message,
- mask: true
- });
-};
+ // 鏄剧ず鍔犺浇鎻愮ず
+ const showLoadingToast = message => {
+ uni.showLoading({
+ title: message,
+ mask: true,
+ });
+ };
-// 鍏抽棴鎻愮ず
-const closeToast = () => {
- uni.hideLoading();
-};
+ // 鍏抽棴鎻愮ず
+ const closeToast = () => {
+ uni.hideLoading();
+ };
-// 鏍煎紡鍖栧洖娆炬柟寮�
-const formatReceiptType = (type) => {
- if (type == 0) {
- return "鐢垫眹";
- } else if (type == 1) {
- return "鎵垮厬";
- } else {
- return "鏈煡";
- }
-};
+ // 鏍煎紡鍖栧洖娆炬柟寮�
+ const formatReceiptType = type => {
+ if (type == 0) {
+ return "鐢垫眹";
+ } else if (type == 1) {
+ return "鎵垮厬";
+ } else {
+ return "鏈煡";
+ }
+ };
-// 鑾峰彇鏍囩鏍峰紡绫�
-const getTagClass = (type) => {
- if (type == 0) {
- return "tag-electric";
- } else if (type == 1) {
- return "tag-acceptance";
- } else {
- return "tag-unknown";
- }
-};
+ // 鑾峰彇鏍囩鏍峰紡绫�
+ const getTagClass = type => {
+ if (type == 0) {
+ return "tag-electric";
+ } else if (type == 1) {
+ return "tag-acceptance";
+ } else {
+ return "tag-unknown";
+ }
+ };
-// 鏍煎紡鍖栭噾棰�
-const formatAmount = (amount) => {
- return amount ? parseFloat(amount).toFixed(2) : '0.00';
-};
-// 鎵撳紑缂栬緫琛ㄥ崟
-const openForm = (item) => {
- uni.setStorageSync('invoiceLedgerEditRow', JSON.stringify(item))
- uni.navigateTo({ url: '/pages/sales/receiptPayment/edit' })
-}
-onShow(() => {
- // 椤甸潰鏄剧ず鏃跺埛鏂板垪琛�
- getList();
-});
+ // 鏍煎紡鍖栭噾棰�
+ const formatAmount = amount => {
+ return amount ? parseFloat(amount).toFixed(2) : "0.00";
+ };
+ // 鎵撳紑缂栬緫琛ㄥ崟
+ const openForm = item => {
+ uni.setStorageSync("invoiceLedgerEditRow", JSON.stringify(item));
+ uni.navigateTo({ url: "/pages/sales/receiptPayment/edit" });
+ };
+ onShow(() => {
+ // 椤甸潰鏄剧ず鏃跺埛鏂板垪琛�
+ getList();
+ });
</script>
<style scoped lang="scss">
-@import '@/styles/sales-common.scss';
+ @import "@/styles/sales-common.scss";
-// 鍥炴娴佹按鐗规湁鏍峰紡
-.receipt-payment-history {
- min-height: 100vh;
- background: #f8f9fa;
- position: relative;
-}
+ // 鍥炴娴佹按鐗规湁鏍峰紡
+ .receipt-payment-history {
+ min-height: 100vh;
+ background: #f8f9fa;
+ position: relative;
+ }
-.action-buttons {
- padding: 12px 0 0 0; // 涓庡叕鍏辨牱寮忎腑鐨� 0 0 16px 0 涓嶅悓
-}
+ .action-buttons {
+ padding: 12px 0 0 0; // 涓庡叕鍏辨牱寮忎腑鐨� 0 0 16px 0 涓嶅悓
+ }
-.item-tag {
- padding: 2px 8px; // 涓庡叕鍏辨牱寮忎腑鐨� 2px 4px 涓嶅悓
-}
+ .item-tag {
+ padding: 2px 8px; // 涓庡叕鍏辨牱寮忎腑鐨� 2px 4px 涓嶅悓
+ }
-.tag-electric {
- background: #4caf50;
-}
+ .tag-electric {
+ background: #4caf50;
+ }
-.tag-acceptance {
- background: #ff9800;
-}
+ .tag-acceptance {
+ background: #ff9800;
+ }
-.tag-unknown {
- background: #9e9e9e;
-}
+ .tag-unknown {
+ background: #9e9e9e;
+ }
-.tag-text {
- font-size: 14px; // 涓庡叕鍏辨牱寮忎腑鐨� 11px 涓嶅悓
- color: #ffffff;
- font-weight: 500;
-}
+ .tag-text {
+ font-size: 14px; // 涓庡叕鍏辨牱寮忎腑鐨� 11px 涓嶅悓
+ color: #ffffff;
+ font-weight: 500;
+ }
</style>
\ No newline at end of file
--
Gitblit v1.9.3