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/index.vue | 335 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 335 insertions(+), 0 deletions(-)
diff --git a/src/views/crm/receivable/index.vue b/src/views/crm/receivable/index.vue
new file mode 100644
index 0000000..6928942
--- /dev/null
+++ b/src/views/crm/receivable/index.vue
@@ -0,0 +1,335 @@
+<template>
+ <doc-alert title="銆愬洖娆俱�戝洖娆剧鐞嗐�佸洖娆捐鍒�" url="https://doc.iocoder.cn/crm/receivable/" />
+ <doc-alert title="銆愰�氱敤銆戞暟鎹潈闄�" url="https://doc.iocoder.cn/crm/permission/" />
+
+ <ContentWrap>
+ <!-- 鎼滅储宸ヤ綔鏍� -->
+ <el-form
+ ref="queryFormRef"
+ :inline="true"
+ :model="queryParams"
+ class="-mb-15px"
+ label-width="68px"
+ >
+ <el-form-item label="鍥炴缂栧彿" prop="no">
+ <el-input
+ v-model="queryParams.no"
+ class="!w-240px"
+ clearable
+ placeholder="璇疯緭鍏ュ洖娆剧紪鍙�"
+ @keyup.enter="handleQuery"
+ />
+ </el-form-item>
+ <el-form-item label="瀹㈡埛鍚嶇О" prop="customerId">
+ <el-select
+ v-model="queryParams.customerId"
+ class="!w-240px"
+ placeholder="璇烽�夋嫨瀹㈡埛"
+ @keyup.enter="handleQuery"
+ >
+ <el-option
+ v-for="item in customerList"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button @click="handleQuery">
+ <Icon class="mr-5px" icon="ep:search" />
+ 鎼滅储
+ </el-button>
+ <el-button @click="resetQuery">
+ <Icon class="mr-5px" icon="ep:refresh" />
+ 閲嶇疆
+ </el-button>
+ <el-button
+ v-hasPermi="['crm:receivable:create']"
+ plain
+ type="primary"
+ @click="openForm('create')"
+ >
+ <Icon class="mr-5px" icon="ep:plus" />
+ 鏂板
+ </el-button>
+ <el-button
+ v-hasPermi="['crm:receivable:export']"
+ :loading="exportLoading"
+ plain
+ type="success"
+ @click="handleExport"
+ >
+ <Icon class="mr-5px" icon="ep:download" />
+ 瀵煎嚭
+ </el-button>
+ </el-form-item>
+ </el-form>
+ </ContentWrap>
+
+ <!-- 鍒楄〃 -->
+ <ContentWrap>
+ <el-tabs v-model="activeName" @tab-click="handleTabClick">
+ <el-tab-pane label="鎴戣礋璐g殑" name="1" />
+ <el-tab-pane label="鎴戝弬涓庣殑" name="2" />
+ <el-tab-pane label="涓嬪睘璐熻矗鐨�" name="3" />
+ </el-tabs>
+ <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
+ <el-table-column align="center" fixed="left" label="鍥炴缂栧彿" prop="no" width="180">
+ <template #default="scope">
+ <el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
+ {{ scope.row.no }}
+ </el-link>
+ </template>
+ </el-table-column>
+ <el-table-column align="center" label="瀹㈡埛鍚嶇О" prop="customerName" width="120">
+ <template #default="scope">
+ <el-link
+ :underline="false"
+ type="primary"
+ @click="openCustomerDetail(scope.row.customerId)"
+ >
+ {{ scope.row.customerName }}
+ </el-link>
+ </template>
+ </el-table-column>
+ <el-table-column align="center" label="鍚堝悓缂栧彿" prop="contractNo" width="180">
+ <template #default="scope">
+ <el-link
+ :underline="false"
+ type="primary"
+ @click="openContractDetail(scope.row.contractId)"
+ >
+ {{ scope.row.contract.no }}
+ </el-link>
+ </template>
+ </el-table-column>
+ <el-table-column
+ :formatter="dateFormatter2"
+ align="center"
+ label="鍥炴鏃ユ湡"
+ prop="returnTime"
+ width="150px"
+ />
+ <el-table-column
+ align="center"
+ label="鍥炴閲戦(鍏�)"
+ prop="price"
+ width="140"
+ :formatter="erpPriceTableColumnFormatter"
+ />
+ <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="remark" width="200" />
+ <el-table-column
+ align="center"
+ label="鍚堝悓閲戦锛堝厓锛�"
+ prop="contract.totalPrice"
+ width="140"
+ :formatter="erpPriceTableColumnFormatter"
+ />
+ <el-table-column align="center" label="璐熻矗浜�" prop="ownerUserName" width="120" />
+ <el-table-column align="center" label="鎵�灞為儴闂�" prop="ownerUserDeptName" width="100px" />
+ <el-table-column
+ :formatter="dateFormatter"
+ align="center"
+ label="鏇存柊鏃堕棿"
+ prop="updateTime"
+ width="180px"
+ />
+ <el-table-column
+ :formatter="dateFormatter"
+ align="center"
+ label="鍒涘缓鏃堕棿"
+ prop="createTime"
+ width="180px"
+ />
+ <el-table-column align="center" label="鍒涘缓浜�" prop="creatorName" width="120" />
+ <el-table-column align="center" fixed="right" label="鍥炴鐘舵��" prop="auditStatus" width="120">
+ <template #default="scope">
+ <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
+ </template>
+ </el-table-column>
+ <el-table-column align="center" fixed="right" label="鎿嶄綔" width="180px">
+ <template #default="scope">
+ <el-button
+ v-hasPermi="['crm:receivable:update']"
+ link
+ type="primary"
+ @click="openForm('update', scope.row.id)"
+ >
+ 缂栬緫
+ </el-button>
+ <el-button
+ v-if="scope.row.auditStatus === 0"
+ v-hasPermi="['crm:receivable:update']"
+ link
+ type="primary"
+ @click="handleSubmit(scope.row)"
+ >
+ 鎻愪氦瀹℃牳
+ </el-button>
+ <el-button
+ v-else
+ v-hasPermi="['crm:receivable:update']"
+ link
+ type="primary"
+ @click="handleProcessDetail(scope.row)"
+ >
+ 鏌ョ湅瀹℃壒
+ </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 { DICT_TYPE } from '@/utils/dict'
+import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
+import download from '@/utils/download'
+import * as ReceivableApi from '@/api/crm/receivable'
+import ReceivableForm from './ReceivableForm.vue'
+import * as CustomerApi from '@/api/crm/customer'
+import { TabsPaneContext } from 'element-plus'
+import { erpPriceTableColumnFormatter } from '@/utils'
+
+defineOptions({ name: 'Receivable' })
+
+const message = useMessage() // 娑堟伅寮圭獥
+const { t } = useI18n() // 鍥介檯鍖�
+const loading = ref(true) // 鍒楄〃鐨勫姞杞戒腑
+const total = ref(0) // 鍒楄〃鐨勬�婚〉鏁�
+const list = ref([]) // 鍒楄〃鐨勬暟鎹�
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 10,
+ sceneType: '1', // 榛樿鍜� activeName 鐩哥瓑
+ no: undefined,
+ customerId: undefined
+})
+const queryFormRef = ref() // 鎼滅储鐨勮〃鍗�
+const exportLoading = ref(false) // 瀵煎嚭鐨勫姞杞戒腑
+const activeName = ref('1') // 鍒楄〃 tab
+const customerList = ref<CustomerApi.CustomerVO[]>([]) // 瀹㈡埛鍒楄〃
+
+/** tab 鍒囨崲 */
+const handleTabClick = (tab: TabsPaneContext) => {
+ queryParams.sceneType = tab.paneName
+ handleQuery()
+}
+
+/** 鏌ヨ鍒楄〃 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await ReceivableApi.getReceivablePage(queryParams)
+ list.value = data.list
+ total.value = data.total
+ } finally {
+ loading.value = false
+ }
+}
+
+/** 鎼滅储鎸夐挳鎿嶄綔 */
+const handleQuery = () => {
+ queryParams.pageNo = 1
+ getList()
+}
+
+/** 閲嶇疆鎸夐挳鎿嶄綔 */
+const resetQuery = () => {
+ queryFormRef.value.resetFields()
+ handleQuery()
+}
+
+/** 娣诲姞/淇敼鎿嶄綔 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+ formRef.value.open(type, id)
+}
+
+/** 鍒犻櫎鎸夐挳鎿嶄綔 */
+const handleDelete = async (id: number) => {
+ try {
+ // 鍒犻櫎鐨勪簩娆$‘璁�
+ await message.delConfirm()
+ // 鍙戣捣鍒犻櫎
+ await ReceivableApi.deleteReceivable(id)
+ message.success(t('common.delSuccess'))
+ // 鍒锋柊鍒楄〃
+ await getList()
+ } catch {}
+}
+
+/** 鎻愪氦瀹℃牳 **/
+const handleSubmit = async (row: ReceivableApi.ReceivableVO) => {
+ await message.confirm(`鎮ㄧ‘瀹氭彁浜ょ紪鍙蜂负銆�${row.no}銆戠殑鍥炴瀹℃牳鍚楋紵`)
+ await ReceivableApi.submitReceivable(row.id)
+ message.success('鎻愪氦瀹℃牳鎴愬姛锛�')
+ await getList()
+}
+
+/** 鏌ョ湅瀹℃壒 */
+const handleProcessDetail = (row: ReceivableApi.ReceivableVO) => {
+ push({ name: 'BpmProcessInstanceDetail', query: { id: row.processInstanceId } })
+}
+
+/** 鎵撳紑鍥炴璇︽儏 */
+const { push } = useRouter()
+const openDetail = (id: number) => {
+ push({ name: 'CrmReceivableDetail', params: { id } })
+}
+
+/** 鎵撳紑瀹㈡埛璇︽儏 */
+const openCustomerDetail = (id: number) => {
+ push({ name: 'CrmCustomerDetail', params: { id } })
+}
+
+/** 鎵撳紑鍚堝悓璇︽儏 */
+const openContractDetail = (id: number) => {
+ push({ name: 'CrmContractDetail', params: { id } })
+}
+
+/** 瀵煎嚭鎸夐挳鎿嶄綔 */
+const handleExport = async () => {
+ try {
+ // 瀵煎嚭鐨勪簩娆$‘璁�
+ await message.exportConfirm()
+ // 鍙戣捣瀵煎嚭
+ exportLoading.value = true
+ const data = await ReceivableApi.exportReceivable(queryParams)
+ download.excel(data, '鍥炴.xls')
+ } catch {
+ } finally {
+ exportLoading.value = false
+ }
+}
+
+/** 鍒濆鍖� **/
+onMounted(async () => {
+ await getList()
+ // 鑾峰緱瀹㈡埛鍒楄〃
+ customerList.value = await CustomerApi.getCustomerSimpleList()
+})
+</script>
--
Gitblit v1.8.0