Files
BMS/bms-front/src/views/customersuppliermanagement/customerinfo/index.vue
T
2026-09-17 09:00:26 +08:00

341 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="客户编码" prop="customerCode">
<el-input
v-model="queryParams.customerCode"
placeholder="请输入客户编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input
v-model="queryParams.customerName"
placeholder="请输入客户名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="对外代码" prop="customerCodeDw">
<el-input
v-model="queryParams.customerCodeDw"
placeholder="请输入对外代码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="isEnable">
<el-select
v-model="queryParams.isEnable"
placeholder="请选择启用状态"
clearable
@change="handleQuery"
>
<el-option
label="正常"
:value="0"
/>
<el-option
label="停用"
:value="1"
/>
</el-select>
</el-form-item>
<el-form-item label="业务员" prop="salesUserId">
<user-select v-model="queryParams.salesUserId" placeholder="请选择业务员" @change="handleQuery" />
</el-form-item>
<el-form-item label="结算员" prop="settlementUserId">
<user-select v-model="queryParams.settlementUserId" placeholder="请选择结算员" @change="handleQuery" />
</el-form-item>
<el-form-item label="客服" prop="serviceUserId">
<user-select v-model="queryParams.serviceUserId" placeholder="请选择客服" @change="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['customersupplier:customerinfo:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['customersupplier:customerinfo:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleCustomerMoney"
>客户余额</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['customersupplier:customerinfo:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['customersupplier:customerinfo:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="客户ID" align="center" prop="customerId" />-->
<el-table-column label="客户编码" align="center" prop="customerCode" />
<el-table-column label="客户名称" align="center" prop="customerName" />
<el-table-column label="对外代码" align="center" prop="customerCodeDw" />
<el-table-column label="统一社会信用代码" align="center" prop="creditCode" />
<el-table-column label="业务类型" align="center" prop="customerType">
<template #default="scope">
<dict-tag :options="customer_type" :value="scope.row.customerType" />
</template>
</el-table-column>
<el-table-column label="启用状态" align="center" prop="isEnable">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.isEnable" />
</template>
</el-table-column>
<el-table-column label="业务员" align="center" prop="salesUserId">
<template #default="scope"><user-name :user-id="scope.row.salesUserId" /></template>
</el-table-column>
<el-table-column label="资金额度" align="center" prop="ed" />
<el-table-column label="回款账期" align="center" prop="zq" />
<el-table-column label="结算员" align="center" prop="settlementUserId">
<template #default="scope"><user-name :user-id="scope.row.settlementUserId" /></template>
</el-table-column>
<el-table-column label="客服" align="center" prop="serviceUserId">
<template #default="scope"><user-name :user-id="scope.row.serviceUserId" /></template>
</el-table-column>
<el-table-column label="结算方式" align="center" prop="settlementType">
<template #default="scope">
<dict-tag :options="settlement_type" :value="scope.row.settlementType" />
</template>
</el-table-column>
<el-table-column label="临时额度" align="center" prop="tempEd" />
<el-table-column label="账户余额(CNY)" align="center" prop="accountBalance" width="130">
<template #default="scope">{{ formatBalance(scope.row.accountBalance) }}</template>
</el-table-column>
<el-table-column label="重量阈值" align="center" prop="weightThreshold" />
<el-table-column label="抛比" align="center" prop="throwRatio" />
<el-table-column label="信用额度" align="center" prop="creditEd" />
<el-table-column label="绑定产品" align="center" prop="productIds" min-width="180">
<template #default="scope">
<span v-if="productNames(scope.row.productIds)" :title="productNames(scope.row.productIds)">
{{ productNames(scope.row.productIds) }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="备注说明" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['customersupplier:customerinfo:edit']">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['customersupplier:customerinfo:remove']">删除</el-button>
<el-button link type="primary" icon="Wallet" @click="handleCustomerMoney(scope.row)">客户余额</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script setup name="Customer">
import { listCustomer, delCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
import { useProducts, parseProductIds } from '@/components/ProductSelect/useProducts'
const { proxy } = getCurrentInstance()
const customerList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const ids = ref([])
const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const { sys_normal_disable, settlement_type, customer_type } = useDict("sys_normal_disable", "settlement_type", "customer_type")
/** 绑定产品ID串 -> 产品名称展示(产品代码+名称;查不到的产品回显原ID) */
const { ensureProducts, getProductLabel } = useProducts()
function productNames(productIds) {
return parseProductIds(productIds).map(id => getProductLabel(id)).join(',')
}
ensureProducts()
/** 格式化余额(数据源 customer_account 余额表) */
function formatBalance(val) {
const num = Number(val)
return isNaN(num) ? '0.00' : num.toFixed(2)
}
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
customerCode: undefined,
customerName: undefined,
customerCodeDw: undefined,
creditCode: undefined,
customerType: undefined,
isEnable: undefined,
salesUserId: undefined,
salesUser: undefined,
ed: undefined,
zq: undefined,
settlementUserId: undefined,
settlementUser: undefined,
serviceUserId: undefined,
serviceUser: undefined,
settlementType: undefined,
tempEd: undefined,
accountBalance: undefined,
foreignCurrencyBalance: undefined,
weightThreshold: undefined,
throwRatio: undefined,
creditEd: undefined,
productIds: undefined,
}
})
const { queryParams } = toRefs(data)
/** 查询客户主列表 */
function getList() {
loading.value = true
listCustomer(queryParams.value).then(response => {
customerList.value = response.rows
total.value = response.total
loading.value = false
})
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef")
handleQuery()
}
/** 多选框选中数据 */
const selectedRows = ref([])
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.customerId)
selectedRows.value = selection
single.value = selection.length != 1
multiple.value = !selection.length
}
/** 新增:跳转客户编辑页(页签式,无 customerId) */
function handleAdd() {
proxy.$router.push({ path: '/customersupplier/customer-edit/index' })
}
/** 修改:跳转客户编辑页(操作列传 row;工具栏按钮取勾选行) */
function handleUpdate(row) {
const target = (row && row.customerId) ? row : selectedRows.value[0]
if (!target || !target.customerId) {
proxy.$modal.msgWarning("请先勾选一个客户")
return
}
proxy.$router.push({
path: '/customersupplier/customer-edit/index',
query: {
customerId: target.customerId,
customerName: target.customerName,
customerCode: target.customerCode
}
})
}
/** 删除按钮操作 */
function handleDelete(row) {
const _customerIds = row.customerId || ids.value
proxy.$modal.confirm('是否确认删除客户编号为"' + _customerIds + '"的数据项?').then(function() {
return delCustomer(_customerIds)
}).then(() => {
getList()
proxy.$modal.msgSuccess("删除成功")
}).catch(() => {})
}
/** 跳转客户余额页面(操作列传 row;工具栏按钮不传参时取勾选行) */
function handleCustomerMoney(row) {
const target = (row && row.customerId) ? row : selectedRows.value[0]
if (!target || !target.customerId) {
proxy.$modal.msgWarning("请先勾选一个客户")
return
}
proxy.$router.push({
path: '/customersupplier/customer-money/index',
query: {
customerId: target.customerId,
customerName: target.customerName,
customerCode: target.customerCode
}
})
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('/customersupplier/customerinfo/export', {
...queryParams.value
}, `customer_${new Date().getTime()}.xlsx`)
}
getList()
</script>