From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/erp/finance/payment/components/FinancePaymentItemForm.vue | 182 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 182 insertions(+), 0 deletions(-)
diff --git a/src/views/erp/finance/payment/components/FinancePaymentItemForm.vue b/src/views/erp/finance/payment/components/FinancePaymentItemForm.vue
new file mode 100644
index 0000000..ea0e085
--- /dev/null
+++ b/src/views/erp/finance/payment/components/FinancePaymentItemForm.vue
@@ -0,0 +1,182 @@
+<template>
+ <el-form
+ ref="formRef"
+ :model="formData"
+ :rules="formRules"
+ v-loading="formLoading"
+ label-width="0px"
+ :inline-message="true"
+ :disabled="disabled"
+ >
+ <el-table :data="formData" show-summary :summary-method="getSummaries" class="-mt-10px">
+ <el-table-column label="搴忓彿" type="index" align="center" width="60" />
+ <el-table-column label="閲囪喘鍗曟嵁缂栧彿" min-width="200">
+ <template #default="{ row }">
+ <el-form-item class="mb-0px!">
+ <el-input disabled v-model="row.bizNo" />
+ </el-form-item>
+ </template>
+ </el-table-column>
+ <el-table-column label="搴斾粯閲戦" prop="totalPrice" fixed="right" min-width="100">
+ <template #default="{ row }">
+ <el-form-item class="mb-0px!">
+ <el-input disabled v-model="row.totalPrice" :formatter="erpPriceInputFormatter" />
+ </el-form-item>
+ </template>
+ </el-table-column>
+ <el-table-column label="宸蹭粯閲戦" prop="paidPrice" fixed="right" min-width="100">
+ <template #default="{ row }">
+ <el-form-item class="mb-0px!">
+ <el-input disabled v-model="row.paidPrice" :formatter="erpPriceInputFormatter" />
+ </el-form-item>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏈浠樻" prop="paymentPrice" fixed="right" min-width="115">
+ <template #default="{ row, $index }">
+ <el-form-item :prop="`${$index}.paymentPrice`" class="mb-0px!">
+ <el-input-number
+ v-model="row.paymentPrice"
+ controls-position="right"
+ :precision="2"
+ class="!w-100%"
+ />
+ </el-form-item>
+ </template>
+ </el-table-column>
+ <el-table-column label="澶囨敞" min-width="150">
+ <template #default="{ row, $index }">
+ <el-form-item :prop="`${$index}.remark`" class="mb-0px!">
+ <el-input v-model="row.remark" placeholder="璇疯緭鍏ュ娉�" />
+ </el-form-item>
+ </template>
+ </el-table-column>
+ <el-table-column align="center" fixed="right" label="鎿嶄綔" width="60">
+ <template #default="{ $index }">
+ <el-button @click="handleDelete($index)" link>鈥�</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-form>
+ <el-row justify="center" class="mt-3" v-if="!disabled">
+ <el-button @click="handleOpenPurchaseIn" round>+ 娣诲姞閲囪喘鍏ュ簱鍗�</el-button>
+ <el-button @click="handleOpenPurchaseReturn" round>+ 娣诲姞閲囪喘閫�璐у崟</el-button>
+ </el-row>
+
+ <!-- 鍙粯娆剧殑銆愰噰璐叆搴撳崟銆戝垪琛� -->
+ <PurchaseInPaymentEnableList
+ ref="purchaseInPaymentEnableListRef"
+ @success="handleAddPurchaseIn"
+ />
+ <!-- 鍙粯娆剧殑銆愰噰璐叆搴撳崟銆戝垪琛� -->
+ <PurchaseReturnRefundEnableList
+ ref="purchaseReturnRefundEnableListRef"
+ @success="handleAddPurchaseReturn"
+ />
+</template>
+<script setup lang="ts">
+import { ProductVO } from '@/api/erp/product/product'
+import { erpPriceInputFormatter, getSumValue } from '@/utils'
+import PurchaseInPaymentEnableList from '@/views/erp/purchase/in/components/PurchaseInPaymentEnableList.vue'
+import PurchaseReturnRefundEnableList from '@/views/erp/purchase/return/components/PurchaseReturnRefundEnableList.vue'
+import { PurchaseInVO } from '@/api/erp/purchase/in'
+import { ErpBizType } from '@/utils/constants'
+import { PurchaseReturnVO } from '@/api/erp/purchase/return'
+
+const props = defineProps<{
+ items: undefined
+ supplierId: undefined
+ disabled: false
+}>()
+const message = useMessage()
+
+const formLoading = ref(false) // 琛ㄥ崟鐨勫姞杞戒腑
+const formData = ref([])
+const formRules = reactive({
+ paymentPrice: [{ required: true, message: '鏈浠樻涓嶈兘涓虹┖', trigger: 'blur' }]
+})
+const formRef = ref([]) // 琛ㄥ崟 Ref
+const productList = ref<ProductVO[]>([]) // 浜у搧鍒楄〃
+
+/** 鍒濆鍖栬缃叆搴撻」 */
+watch(
+ () => props.items,
+ async (val) => {
+ formData.value = val
+ },
+ { immediate: true }
+)
+
+/** 鍚堣 */
+const getSummaries = (param: SummaryMethodProps) => {
+ const { columns, data } = param
+ const sums: string[] = []
+ columns.forEach((column, index: number) => {
+ if (index === 0) {
+ sums[index] = '鍚堣'
+ return
+ }
+ if (['totalPrice', 'paidPrice', 'paymentPrice'].includes(column.property)) {
+ const sum = getSumValue(data.map((item) => Number(item[column.property])))
+ sums[index] = erpPriceInputFormatter(sum)
+ } else {
+ sums[index] = ''
+ }
+ })
+ return sums
+}
+
+/** 鏂板銆愰噰璐叆搴撱�戞寜閽搷浣� */
+const purchaseInPaymentEnableListRef = ref()
+const handleOpenPurchaseIn = () => {
+ if (!props.supplierId) {
+ message.error('璇烽�夋嫨渚涘簲鍟�')
+ return
+ }
+ purchaseInPaymentEnableListRef.value.open(props.supplierId)
+}
+const handleAddPurchaseIn = (rows: PurchaseInVO[]) => {
+ rows.forEach((row) => {
+ formData.value.push({
+ bizId: row.id,
+ bizType: ErpBizType.PURCHASE_IN,
+ bizNo: row.no,
+ totalPrice: row.totalPrice,
+ paidPrice: row.paymentPrice,
+ paymentPrice: row.totalPrice - row.paymentPrice
+ })
+ })
+}
+
+/** 鏂板銆愰噰璐��璐с�戞寜閽搷浣� */
+const purchaseReturnRefundEnableListRef = ref()
+const handleOpenPurchaseReturn = () => {
+ if (!props.supplierId) {
+ message.error('璇烽�夋嫨渚涘簲鍟�')
+ return
+ }
+ purchaseReturnRefundEnableListRef.value.open(props.supplierId)
+}
+const handleAddPurchaseReturn = (rows: PurchaseReturnVO[]) => {
+ rows.forEach((row) => {
+ formData.value.push({
+ bizId: row.id,
+ bizType: ErpBizType.PURCHASE_RETURN,
+ bizNo: row.no,
+ totalPrice: -row.totalPrice,
+ paidPrice: -row.refundPrice,
+ paymentPrice: -row.totalPrice + row.refundPrice
+ })
+ })
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = (index: number) => {
+ formData.value.splice(index, 1)
+}
+
+/** 琛ㄥ崟鏍¢獙 */
+const validate = () => {
+ return formRef.value.validate()
+}
+defineExpose({ validate })
+</script>
--
Gitblit v1.8.0