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/crm/receivable/components/ReceivableList.vue |  164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 164 insertions(+), 0 deletions(-)

diff --git a/src/views/crm/receivable/components/ReceivableList.vue b/src/views/crm/receivable/components/ReceivableList.vue
new file mode 100644
index 0000000..67287ea
--- /dev/null
+++ b/src/views/crm/receivable/components/ReceivableList.vue
@@ -0,0 +1,164 @@
+<template>
+  <!-- 鎿嶄綔鏍� -->
+  <el-row justify="end">
+    <el-button @click="openForm('create')">
+      <Icon class="mr-5px" icon="icon-park:income-one" />
+      鍒涘缓鍥炴
+    </el-button>
+  </el-row>
+
+  <!-- 鍒楄〃 -->
+  <ContentWrap class="mt-10px">
+    <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
+      <el-table-column align="center" label="鍥炴缂栧彿" prop="no" />
+      <el-table-column align="center" label="瀹㈡埛" prop="customerName" />
+      <el-table-column align="center" label="鍚堝悓" prop="contract.no" />
+      <el-table-column
+        :formatter="dateFormatter2"
+        align="center"
+        label="鍥炴鏃ユ湡"
+        prop="returnTime"
+        width="150px"
+      />
+      <el-table-column align="center" label="鍥炴鏂瑰紡" prop="returnType" width="130px">
+        <template #default="scope">
+          <dict-tag :type="DICT_TYPE.CRM_RECEIVABLE_RETURN_TYPE" :value="scope.row.returnType" />
+        </template>
+      </el-table-column>
+      <el-table-column
+        align="center"
+        label="鍥炴閲戦(鍏�)"
+        prop="price"
+        :formatter="erpPriceTableColumnFormatter"
+      />
+      <el-table-column align="center" label="璐熻矗浜�" prop="ownerUserName" />
+      <el-table-column align="center" label="澶囨敞" prop="remark" />
+      <el-table-column align="center" fixed="right" label="鎿嶄綔" width="130px">
+        <template #default="scope">
+          <el-button
+            v-hasPermi="['crm:receivable:update']"
+            link
+            type="primary"
+            @click="openForm('update', scope.row.id)"
+          >
+            缂栬緫
+          </el-button>
+          <el-button
+            v-hasPermi="['crm:receivable:delete']"
+            link
+            type="danger"
+            @click="handleDelete(scope.row.id)"
+          >
+            鍒犻櫎
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 鍒嗛〉 -->
+    <Pagination
+      v-model:limit="queryParams.pageSize"
+      v-model:page="queryParams.pageNo"
+      :total="total"
+      @pagination="getList"
+    />
+  </ContentWrap>
+
+  <!-- 琛ㄥ崟寮圭獥锛氭坊鍔� -->
+  <ReceivableForm ref="formRef" @success="getList" />
+</template>
+<script lang="ts" setup>
+import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
+import * as ReceivableApi from '@/api/crm/receivable'
+import ReceivableForm from './../ReceivableForm.vue'
+import { dateFormatter2 } from '@/utils/formatTime'
+import { DICT_TYPE } from '@/utils/dict'
+import { erpPriceTableColumnFormatter } from '@/utils'
+
+defineOptions({ name: 'CrmReceivableList' })
+const props = defineProps<{
+  customerId?: number // 瀹㈡埛缂栧彿
+  contractId?: number // 鍚堝悓缂栧彿
+}>()
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  customerId: undefined as unknown, // 鍏佽 undefined + number
+  contractId: undefined as unknown // 鍏佽 undefined + number
+})
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+  loading.value = true
+  try {
+    if (props.customerId && !props.contractId) {
+      queryParams.customerId = props.customerId
+    } else if (props.customerId && props.contractId) {
+      // 濡傛灉鏄悎鍚岀殑璇濆鎴风紪鍙蜂篃闇�瑕佸甫涓婂洜涓烘潈闄愬熀浜庡鎴�
+      queryParams.customerId = props.customerId
+      queryParams.contractId = props.contractId
+    }
+    const data = await ReceivableApi.getReceivablePageByCustomer(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  // 缃┖鍙傛暟
+  queryParams.customerId = undefined
+  queryParams.contractId = undefined
+  getList()
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+  formRef.value.open(type, id, {
+    customerId: props.customerId,
+    contractId: props.contractId
+  })
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (id: number) => {
+  try {
+    // 鍒犻櫎鐨勪簩娆$‘璁�
+    await message.delConfirm()
+    // 鍙戣捣鍒犻櫎
+    await ReceivableApi.deleteReceivable(id)
+    message.success(t('common.delSuccess'))
+    // 鍒锋柊鍒楄〃
+    await getList()
+  } catch {}
+}
+
+/** 浠庡洖娆捐鍒掑垱寤哄洖娆� */
+const createReceivable = (planData: any) => {
+  const data = planData as unknown as ReceivablePlanApi.ReceivablePlanVO
+  formRef.value.open('create', undefined, data)
+}
+defineExpose({ createReceivable })
+
+/** 鐩戝惉鎵撳紑鐨� customerId + contractId锛屼粠鑰屽姞杞芥渶鏂扮殑鍒楄〃 */
+watch(
+  () => [props.customerId, props.contractId],
+  (newVal) => {
+    // 淇濊瘉鑷冲皯瀹㈡埛缂栧彿鏈夊��
+    if (!newVal[0]) {
+      return
+    }
+    handleQuery()
+  },
+  { immediate: true, deep: true }
+)
+</script>

--
Gitblit v1.8.0