emis-frontend/src/views/emis/emisCreditCustomer/index.vue
2025-03-13 08:02:14 +08:00

512 lines
16 KiB
Vue

<template>
<XdPageContainer class="app-container">
<SearchForm slot="pageHeader" :model="queryParams" ref="queryForm" size="small" :maxShow="20" label-width="100px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
<el-form-item label="月结客户" prop="customerCode">
<EmisMonthpayAccountPicker v-model="queryParams.customerCode" ></EmisMonthpayAccountPicker>
</el-form-item>
<el-form-item label="运输方式" prop="transType">
<el-select v-model="queryParams.transType" placeholder="运输方式" clearable filterable>
<el-option
v-for="item in dict.type.emis_biz_shipping_method"
v-bind:key="item.value"
v-bind:label="item.label"
v-bind:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="剩余余额" prop="curMoney">
<NumberRangePicker style="width:200px" v-model="queryParams.params.curMoneyRange"> </NumberRangePicker>
</el-form-item>
<el-form-item label="启用状态" prop="blOpen">
<el-select v-model="queryParams.blOpen" filterable placeholder="启用状态" @change="handleQuery">
<el-option key="1" label="启用" :value="1" />
<el-option key="0" label="停用" :value="0" />
</el-select>
</el-form-item>
<el-form-item label="剩余比率(%)" prop="curMoneyRate">
<NumberRangePicker style="width:200px" v-model="queryParams.params.curMoneyRateRange"> </NumberRangePicker>
</el-form-item>
<el-form-item :label="$t('回款联系人')" prop="payee">
<PayeePicker :placeholder="$t('回款联系人')" v-model="queryParams.params.payee" ></PayeePicker>
</el-form-item>
<el-form-item :label="$t('销售联系人')" prop="salesmen">
<SalemanPicker :placeholder="$t('销售联系人')" v-model="queryParams.params.salesmen" ></SalemanPicker>
</el-form-item>
</SearchForm>
<XdTable
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
ref="refTable"
storageName="emisCreditCustomerList_main_250309"
v-loading="loading"
border stripe
size="small"
:data="emisCreditCustomerList"
:showSearch.sync="showSearch"
:queryParams="queryParams"
:total="total"
@queryTable="getList"
@selection-change="handleSelectionChange"
@sort-change="handleSortChange"
@row-dblclick="handleShowBillList"
>
<div slot="toolbar">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增额度</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
</el-row>
</div>
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('额度编号')" align="center" prop="accCode" min-width="150" />
<el-table-column :label="$t('月结客户')" align="center" prop="customerName" min-width="170" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('固定额度')" align="center" prop="creditMoney" min-width="100" />
<el-table-column :label="$t('运输方式')" align="center" prop="transType" min-width="200" :show-overflow-tooltip="true">
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_biz_shipping_method" :value="scope.row.transType"/>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="blOpen" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.blOpen"
active-value="1"
inactive-value="0"
@change="switchChange(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column :label="$t('剩余额度')" align="center" prop="curMoney" min-width="100" >
<template slot-scope="scope">
{{ scope.row.creditMoney - scope.row.useMoney }}
</template>
</el-table-column>
<el-table-column :label="$t('已使用额度')" align="center" prop="useMoney" min-width="100" >
<template slot-scope="scope">
{{ scope.row.useMoney }}
</template>
</el-table-column>
<el-table-column :label="$t('剩余比例(%)')" align="center" prop="curMoneyRate" min-width="100" >
<template slot-scope="scope">
{{ ( ((scope.row.creditMoney - scope.row.useMoney)/scope.row.creditMoney)*100 ).toFixed(2) }}
</template>
</el-table-column>
<el-table-column :label="$t('开始日期')" align="center" prop="startDate" min-width="170" />
<el-table-column :label="$t('结束日期')" align="center" prop="endDate" min-width="170" />
<el-table-column :label="$t('备注')" align="center" prop="remark" min-width="100" />
<el-table-column label="创建人" align="center" prop="createByName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建网点" align="center" prop="createSiteName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
<el-table-column label="修改人" align="center" prop="updateByName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="修改网点" align="center" prop="updateSiteName" width="80" :show-overflow-tooltip="true"/>
<el-table-column label="修改时间" align="center" prop="updateTime" width="170"/>
</XdTable>
<el-dialog :title="titleForm" :visible.sync="openForm" width="50%" :destroy-on-close="true" v-dialogDrag append-to-body>
<emisCreditCustomerForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisCreditCustomerForm>
</el-dialog>
</XdPageContainer>
</template>
<script>
import { listEmisCreditCustomer, getEmisCreditCustomer, delEmisCreditCustomer, addEmisCreditCustomer, updateEmisCreditCustomer } from "@/api/emis/emisCreditCustomer";
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
// import emisCreditCustomerView from '@/views/emis/emisCreditCustomer/emisCreditCustomerView';
import emisCreditCustomerForm from '@/views/emis/emisCreditCustomer/emisCreditCustomerForm';
import EmisMonthpayAccountPicker from '@/views/emis/EmisBaseTools/EmisMonthpayAccountPicker.vue';
import NumberRangePicker from '@/components/NumberRange/NumberRangePicker';
import PayeePicker from '@/views/emis/EmisBaseTools/PayeePicker.vue';
import SalemanPicker from '@/views/emis/EmisBaseTools/SalemanPicker.vue';
import { formatSearchStr,deepClone } from '@/utils/index'
export default {
name: "EmisCreditCustomer",
components: {
elDateSimplePicker,
emisCreditCustomerForm,
EmisMonthpayAccountPicker,
NumberRangePicker,
PayeePicker,
SalemanPicker
},
dicts: ['emis_biz_shipping_method'
],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 创建时间搜索
dateTimeRange:[],
// 总条数
total: 0,
// 客户信用额度表表格数据
emisCreditCustomerList: [],
currentId:null,
openForm: false,
titleForm: "",
// 弹出展示层
id:null,
titleView:"",
openView: false,
selectionList:null,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
customerCode: null,
curMoney: null,
curMoneyRate: null,
creditMoney: null,
currency: null,
transType: null,
startDate: null,
endDate: null,
blOpen: null,
remark: null,
delFlag: null,
params:{
curMoneyRange:null,
curMoneyRateRange:null,
salesmen:null,
payee:null
}
},
};
},
created() {
this.getList();
},
methods: {
/** 查询客户信用额度表列表 */
getList() {
this.loading = true;
let qParam = {...this.queryParams}
console.log("===>===1111==>",qParam)
if(qParam.params.curMoneyRange&&qParam.params.curMoneyRange.length>0){
qParam=this.addDateRange(qParam, qParam.params.curMoneyRange,'CurMoney')
}
if(qParam.params.curMoneyRateRange&&qParam.params.curMoneyRateRange.length>0){
qParam=this.addDateRange(qParam, qParam.params.curMoneyRateRange,'CurMoneyRate')
}
console.log("====>listEmisCreditCustomer==>",qParam);
listEmisCreditCustomer(qParam).then(response => {
this.emisCreditCustomerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
switchChange(row){
let form={id:row.id,blOpen:row.blOpen}
updateEmisCreditCustomer(form).then(response => {
this.$modal.msgSuccess("已保存");
});
},
handleShowBillList(row){
let item0=row;
this.$router.push(
{
path: '/d24/waybillManagement/SendWaybillList',
query: {
action: "queryByCredit",
custNo: item0.monthlyPayCode,
startDate: item0.startDate,
endDate: item0.endDate,
'_t':(new Date()).getTime()
}
}
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.single = selection.length!==1;
this.multiple = !selection.length;
this.selectionList=selection;
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.currentId=null;
this.openForm= true;
this.titleForm = "新增";
},
handleShowMoreInput(){
this.moreInputVisible = !this.moreInputVisible;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.currentId= row.id||this.ids[0];
this.openForm = true;
this.titleForm = "修改";
},
handleView(row) {
this.id=row.id;
this.titleView="查看";
this.openView=true;
// this.router.push({ path: '/emis/emisCreditCustomer/viewDetail', query: { id: row.id }})
},
handleFormChanged(){
this.openForm = false;
this.getList();
},
cancelForm(){
this.openForm = false;
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除').then(function() {
return delEmisCreditCustomer(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const loadingInstance = this.$loading({
text: '正在导出...'
})
if(this.selectionList&&this.selectionList.length>0){
this.exportData(this.selectionList,loadingInstance);
}
else{
let qParam = {...this.queryParams}
if(qParam.params.curMoneyRange&&qParam.params.curMoneyRange.length>0){
qParam=this.addDateRange(this.qParam, qParam.params.curMoneyRange,'CurMoney')
}
if(qParam.params.curMoneyRateRange&&qParam.params.curMoneyRateRange.length>0){
qParam=this.addDateRange(this.qParam, qParam.params.curMoneyRateRange,'CurMoneyRate')
}
qParam.pageNum=1;
qParam.pageSize=20000;
listEmisCreditCustomer(qParam).then(response => {
if (response.code === 200) {
this.exportData(response.rows,loadingInstance);
}
});
}
},
exportData(selData,loadingInstance){
const curList =selData
import('@/vendor/Export2Excel').then(excel => {
const exportParam=this.$refs.refTable.getExportParam();
const tHeader = exportParam.header;
const filterVal = exportParam.filter;
const data = this.formatJson(filterVal, curList, selData)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '月结客户额度列表',
autoWidth: true
})
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'kjlx') {
return v['sendSiteName']+'--'+v['dispatchUnderlingSiteName'];
}
if (j === 'fjr') {
return v['sendName']+'--'+v['receiveName'];
}
if (j === 'custName') {
let paymentType=v['paymentType'];
if(paymentType==2 || paymentType==4 || paymentType==5 ){
return v['custName'];
}else{
return "";
}
}
if (j === 'sendMobile') {
return "";
}
if (j === 'paymentStatus') {
return this.selectDictLabel(this.dict.type.emis_payment_status,v[j]);
}
if (j === 'pickupMethod') {
return this.selectDictLabel(this.dict.type.emis_qujian_fangshi,v[j]);
}
if (j === 'customsEclaration') {
return this.selectDictLabel(this.dict.type.emis_declare_mode,v[j]);
}
if (j === 'customsClear') {
return this.selectDictLabel(this.dict.type.emis_customs_clear,v[j]);
}
if (j === 'packType') {
return this.selectDictLabels(this.dict.type.emis_tab_packing_type,v[j]);
}
if (j === 'dispatchMethod') {
if(v[j] == 1){
return '派送';
}else{
return '自提';
}
}
if (j === 'blUploadPic') {
if(v['goodsPics']!=null && v['goodsPics']!=''){
return '是';
}else{
return '否';
}
}
if (j === 'blMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blAcceptMessage') {
if(v[j] == 1){
return '发送';
}else{
return '不发送';
}
}
if (j === 'blSign') {
if(v[j] == 1){
return '已签收';
}else{
return '未签收';
}
}
if (j === 'paymentType') {
return this.selectDictLabel(this.dict.type.emis_payment_type,v[j]);
}
return v[j]
}))
},
/** 列索引函数 */
getIndex($index) {
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
},
/** 时间搜索响应函数 */
dateTimeChange(value){
this.dateTimeRange=value;
},
}
};
</script>
<style scoped>
.el-divider{
margin-top: 0px;
background: 0 0;
border-top: 1px solid #E6EBF5;
}
.el-divider__text {
color: #0955ee;
cursor: pointer;
}
</style>