From 025e46e11cb2962fd7692adfa401333758cc779b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 02 九月 2025 14:00:34 +0800
Subject: [PATCH] 修改组件

---
 src/pages/sales/invoiceLedger/index.vue |  153 +++++++++++++++++++++++++++------------------------
 1 files changed, 81 insertions(+), 72 deletions(-)

diff --git a/src/pages/sales/invoiceLedger/index.vue b/src/pages/sales/invoiceLedger/index.vue
index 60a3533..fa48fda 100644
--- a/src/pages/sales/invoiceLedger/index.vue
+++ b/src/pages/sales/invoiceLedger/index.vue
@@ -1,14 +1,7 @@
 <template>
 	<view class="sales-account">
-		<!-- 椤甸潰澶撮儴 -->
-		<van-nav-bar
-			title="寮�绁ㄥ彴璐�"
-			left-text="杩斿洖"
-			left-arrow
-			@click-left="goBack"
-			fixed
-			placeholder
-		/>
+		<!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
+		<PageHeader title="寮�绁ㄥ彴璐�" @back="goBack" />
 
 		<!-- 鎼滅储鍜岀瓫閫夊尯鍩燂紙淇濇寔涓庨攢鍞彴璐﹂鏍间竴鑷达級 -->
 		<view class="search-filter-section">
@@ -91,7 +84,7 @@
 						</view>
 					</view>
 					<view class="action-buttons">
-						<van-button
+						<up-button
 							type="primary"
 							size="small"
 							class="action-btn"
@@ -99,36 +92,36 @@
 							@click="openEdit(item)"
 						>
 							缂栬緫
-						</van-button>
-						<van-button
-							type="danger"
+						</up-button>
+						<up-button
+							type="error"
 							size="small"
+							plain
 							class="action-btn"
 							:disabled="item.invoicePerson !== userStore.nickName"
 							@click="handleDelete(item)"
 						>
 							鍒犻櫎
-						</van-button>
-						<van-button
-							type="default"
+						</up-button>
+						<up-button
 							size="small"
+							plain
 							class="action-btn"
 							v-if="item.invoiceFileName"
 							@click="openFileActions(item.commonFiles || [])"
 						>
 							鏌ョ湅闄勪欢
-						</van-button>
-						<van-button
+						</up-button>
+						<up-button
 							type="primary"
 							size="small"
-							plain
 							class="action-btn"
 							v-else
 							:disabled="item.invoicePerson !== userStore.nickName"
 							@click="openUpload(item)"
 						>
 							涓婁紶
-						</van-button>
+						</up-button>
 					</view>
 				</view>
 			</view>
@@ -138,90 +131,114 @@
 		</view>
 
 		<!-- 绛涢�夊脊绐� -->
-		<van-popup v-model:show="showFilter" position="bottom" round>
+		<up-popup v-model="showFilter" mode="bottom" round><up-transition>
 			<view class="filter-popup">
-				<van-cell-group title="绛涢�夋潯浠�" inset>
-					<van-field
+				<up-cell-group title="绛涢�夋潯浠�" inset>
+					<up-input
 						label="寮�绁ㄦ棩鏈�"
 						readonly
+						placeholder="璇烽�夋嫨鏃ユ湡鑼冨洿"
 						@click="showInvoiceRange = true"
-						:placeholder="invoiceRangeLabel || '璇烽�夋嫨鏃ユ湡鑼冨洿'"
+						v-model="invoiceRangeLabel"
 					/>
-					<van-field
+					<up-input
 						label="褰曞叆鏃ユ湡"
 						readonly
 						@click="showCreateDatePicker = true"
-						:placeholder="searchForm.createTimeStart || '璇烽�夋嫨褰曞叆鏃ユ湡'"
+						v-model="searchForm.createTimeStart"
 					/>
 					<view class="switch-row">
 						<text class="switch-label">涓嶆樉绀烘湁鍙戠エ琛�</text>
-						<van-switch v-model="searchForm.status" size="20" />
+						<up-switch v-model="searchForm.status" size="20" />
 					</view>
-				</van-cell-group>
+				</up-cell-group>
 				<view class="filter-actions">
-					<van-button @click="resetFilter">閲嶇疆</van-button>
-					<van-button type="primary" @click="confirmFilter">纭畾</van-button>
+					<up-button @click="resetFilter">閲嶇疆</up-button>
+					<up-button type="primary" @click="confirmFilter">纭畾</up-button>
 				</view>
 			</view>
-		</van-popup>
+		</up-transition></up-popup>
 
 		<!-- 鏃ュ巻锛氬紑绁ㄦ棩鏈熻寖鍥� -->
-		<van-popup v-model:show="showInvoiceRange" position="bottom">
-			<van-calendar
-				title="閫夋嫨寮�绁ㄦ棩鏈熻寖鍥�"
+		<up-popup v-model="showInvoiceRange" mode="bottom"><up-transition>
+			<up-datetime-picker
+				mode="date"
 				type="range"
-				color="#2979ff"
+				title="閫夋嫨寮�绁ㄦ棩鏈熻寖鍥�"
 				@confirm="onInvoiceRangeConfirm"
 				@cancel="showInvoiceRange = false"
 			/>
-		</van-popup>
+		</up-transition></up-popup>
 
 		<!-- 鏃ユ湡锛氬綍鍏ユ棩鏈� -->
-		<van-popup v-model:show="showCreateDatePicker" position="bottom">
-			<van-date-picker
+		<up-popup v-model="showCreateDatePicker" mode="bottom"><up-transition>
+			<up-datetime-picker
+				mode="date"
+				type="selector"
 				v-model="currentCreateDate"
 				title="閫夋嫨褰曞叆鏃ユ湡"
 				@confirm="onCreateDateConfirm"
 				@cancel="showCreateDatePicker = false"
 			/>
-		</van-popup>
+		</up-transition></up-popup>
 
 		
 
 		<!-- 鍗曡涓婁紶寮圭獥锛堟棤琛ㄥ崟锛� -->
-		<van-popup v-model:show="showUpload" position="bottom" round>
+		<up-popup v-model="showUpload" mode="bottom" round><up-transition>
 			<view class="upload-container">
-				<van-cell-group title="涓婁紶闄勪欢锛堜粎鏀寔 pdf锛屾渶澶�10MB锛屾渶澶�10涓級" inset>
-					<van-uploader
-						accept="*"
+				<up-cell-group title="涓婁紶闄勪欢锛堜粎鏀寔 pdf锛屾渶澶�10MB锛屾渶澶�10涓級" inset>
+					<up-upload
+						accept="pdf"
 						multiple
-						:max-count="10"
-						:after-read="afterReadRowUpload"
-						:before-read="beforeReadPdf"
-					/>
+						:maxCount="10"
+						:afterRead="afterReadRowUpload"
+						:beforeRead="beforeReadPdf"
+					>
+						<up-button type="primary">鐐瑰嚮涓婁紶</up-button>
+					</up-upload>
 					<view class="uploaded-list" v-if="fileList.length">
 						<view class="uploaded-item" v-for="(f, idx) in fileList" :key="idx">
 							<text class="file-name">{{ f.name || getFileNameFromUrl(f.url) }}</text>
-							<van-button size="mini" type="danger" plain @click="removeUploaded(idx)">绉婚櫎</van-button>
+							<up-button size="mini" type="error" plain @click="removeUploaded(idx)">绉婚櫎</up-button>
 						</view>
 					</view>
-				</van-cell-group>
+				</up-cell-group>
 				<view class="filter-actions">
-					<van-button @click="showUpload = false">鍙栨秷</van-button>
-					<van-button type="primary" @click="confirmUpload">纭</van-button>
+					<up-button @click="showUpload = false">鍙栨秷</up-button>
+					<up-button type="primary" @click="confirmUpload">纭</up-button>
 				</view>
 			</view>
-		</van-popup>
+		</up-transition></up-popup>
 
 		<!-- 闄勪欢鍒楄〃閫夋嫨 -->
-		<van-action-sheet v-model:show="showFileSheet" :actions="fileActions" cancel-text="鍙栨秷" close-on-click-action @select="onSelectFile" />
+		<up-action-sheet v-model="showFileSheet" :actions="fileActions" cancel-text="鍙栨秷" close-on-click-action @select="onSelectFile">
+			<view class="up-action-sheet__cancel" @click="showFileSheet = false">
+				鍙栨秷
+			</view>
+		</up-action-sheet>
 	</view>
 </template>
 
 <script setup>
 import { ref, reactive, onMounted } from 'vue'
 import dayjs from 'dayjs'
-import { showToast, showLoadingToast, closeToast } from 'vant'
+import PageHeader from '@/components/PageHeader.vue'
+const showToast = (message) => {
+	uni.showToast({
+		title: message,
+		icon: 'none'
+	})
+}
+const showLoadingToast = (message) => {
+	uni.showLoading({
+		title: message,
+		mask: true
+	})
+}
+const closeToast = () => {
+	uni.hideLoading()
+}
 import useUserStore from '@/store/modules/user'
 import { getToken } from '@/utils/auth'
 import config from '@/config.js'
@@ -230,6 +247,7 @@
 	commitFile,
 	delInvoiceLedgerByRegProductId
 } from '@/api/salesManagement/invoiceLedger.js'
+import {onShow} from "@dcloudio/uni-app";
 
 const userStore = useUserStore()
 
@@ -282,7 +300,7 @@
 
 const getList = async () => {
 	try {
-		showLoadingToast({ message: '鍔犺浇涓�...' })
+		showLoadingToast('鍔犺浇涓�...')
 		const { invoiceDate, ...rest } = searchForm
 		const res = await registrationProductPage({ ...rest, ...page })
 		// 鍏煎涓嶅悓杩斿洖缁撴瀯
@@ -313,19 +331,10 @@
 	showFilter.value = false
 	getList()
 }
-const onInvoiceRangeConfirm = (e) => {
-	// e 涓� [start, end] 鐨� Date 瀵硅薄鎴栧瓧绗︿覆锛寀ni-app 涓� Vant Calendar 杩斿洖鏃堕棿鎴虫暟缁�
+const onInvoiceRangeConfirm = ({ selectedValues }) => {
 	try {
-		let start, end
-		if (Array.isArray(e)) {
-			const [s, ed] = e
-			start = dayjs(s).format('YYYY-MM-DD')
-			end = dayjs(ed).format('YYYY-MM-DD')
-		} else if (e && e.detail && Array.isArray(e.detail)) {
-			const [s, ed] = e.detail
-			start = dayjs(s).format('YYYY-MM-DD')
-			end = dayjs(ed).format('YYYY-MM-DD')
-		}
+		const start = dayjs(selectedValues[0]).format('YYYY-MM-DD')
+		const end = dayjs(selectedValues[1]).format('YYYY-MM-DD')
 		searchForm.invoiceDateStart = start
 		searchForm.invoiceDateEnd = end
 		invoiceRangeLabel.value = `${start} 鑷� ${end}`
@@ -362,7 +371,7 @@
 		success: async (res) => {
 			if (res.confirm) {
 				try {
-					showLoadingToast({ message: '澶勭悊涓�...' })
+					showLoadingToast('澶勭悊涓�...')
 					await delInvoiceLedgerByRegProductId(row.id)
 					closeToast()
 					showToast('鍒犻櫎鎴愬姛')
@@ -385,7 +394,7 @@
 const confirmUpload = async () => {
 	try {
 		const payload = { fileList: fileList.value, id: currentId.value }
-		showLoadingToast({ message: '鎻愪氦涓�...' })
+		showLoadingToast('鎻愪氦涓�...')
 		await commitFile(payload)
 		closeToast()
 		showToast('鎻愪氦鎴愬姛')
@@ -420,7 +429,7 @@
 
 const uploadSingleFile = async (fileObj) => {
 	return new Promise((resolve, reject) => {
-		showLoadingToast({ message: '姝e湪涓婁紶...' })
+		showLoadingToast('姝e湪涓婁紶...')
 		uni.uploadFile({
 			url: config.baseUrl + '/invoiceLedger/uploadFile',
 			filePath: fileObj.url || fileObj.file?.path || fileObj.tempFilePath,
@@ -496,7 +505,7 @@
 	try {
 		const item = currentFilesToOpen[action.index]
 		if (!item || !item.url) return
-		showLoadingToast({ message: '涓嬭浇涓�...' })
+		showLoadingToast('涓嬭浇涓�...')
 		uni.downloadFile({
 			url: item.url,
 			success: (res) => {
@@ -518,7 +527,7 @@
 	}
 }
 
-onMounted(() => {
+onShow(() => {
 	getList()
 })
 </script>

--
Gitblit v1.9.3