Commit b1a15a8a by xuyl

更新客户名单管理代码

1 parent 9b8745a2
......@@ -14,12 +14,17 @@
>
<el-form-item label="所属商户" prop="merchant">
<el-select
clearable
filterable
remote
:remote-method="remoteMethod"
v-el-select-loadmore="loadmore"
v-model="ruleForm.merchant"
placeholder="请选择商户"
@change="selectChange"
>
<el-option
v-for="(x, i) in merchants"
v-for="(x, i) in dataItems"
:key="i"
:label="x.merchantName"
:value="x.merchantName"
......@@ -96,8 +101,7 @@
</div>
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
<template v-if="uploadStatus == 'success'">
<span>数据导入成功!</span>
<p>成功导入{{ upLoadNum }}条客户记录</p>
<div>{{ uploadSuccessMsg }}</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="back">确 定</el-button>
</span>
......@@ -118,9 +122,18 @@
<script>
import { addNamelistApi } from '@/api/addNamelist'
import { customerApi } from '@/api/customer'
import { uploadApi } from '@/api/upload'
export default {
data() {
return {
uploadSuccessMsg: '',
marchantNameCopy: '', //存放搜索的商户名
dataItems: [], //下拉框显示的数据
pageData: {
//懒加载相关参数,这里代表从第一条数据开始加载,一次加载40项
pageNum: 1,
pageSize: 40,
},
merchants: [],
upLoadNum: '',
dialogVisible: false,
......@@ -130,6 +143,7 @@ export default {
fileName: '',
hasFileName: false,
fileBaseUrl: '',
merchantId: '', //商户号
ruleForm: {
merchant: '',
brand: '',
......@@ -148,8 +162,25 @@ export default {
},
}
},
async mounted() {
await this.merchantList()
mounted() {
this.merchantList(this.pageData)
},
directives: {
/** 下拉框懒加载 */
'el-select-loadmore': {
bind(el, binding) {
const SELECTWRAP_DOM = el.querySelector(
'.el-select-dropdown .el-select-dropdown__wrap'
)
SELECTWRAP_DOM.addEventListener('scroll', function () {
const condition =
this.scrollHeight - this.scrollTop <= this.clientHeight
if (condition) {
binding.value()
}
})
},
},
},
watch: {
fileName(val) {
......@@ -157,30 +188,93 @@ export default {
this.hasFile = false
}
},
marchantNameCopy(oldVal, newVal) {
if (oldVal !== newVal) {
this.dataItems = []
}
},
'ruleForm.merchant': {
handler(val) {
if (!val) {
this.dataItems = []
this.merchantList(
{
pageNum: 1,
pageSize: 40,
}
)
}
},
},
},
methods: {
// 获取商户列表
merchantList() {
const params = {
accountType: 1,
loadmore() {
this.pageData.pageNum++
if (this.marchantNameCopy) {
this.merchantList(this.pageData, this.marchantNameCopy)
} else {
this.merchantList(this.pageData) //类似于分页查询
}
addNamelistApi.getMerchantsList(params).then((res) => {
this.merchants = res.data.data.map((val) => {
return {
merchantName: val.merchantName,
merchantBrandCars: val.merchantBrandCars,
merchantAddress: val.merchantAddress,
}
},
// 获取商户列表
merchantList(val, searchVal = '') {
let accounttypeId = [2]
addNamelistApi
.getMerchantsListByPages({
accounttypeId,
merchantName: searchVal,
...val,
})
.then((res) => {
let arr = res.data.data.data.map((val) => {
return {
merchantName: val.merchantName,
merchantBrandCars: val.merchantBrandCars,
merchantAddress: val.merchantAddress,
merchantId: val.merchantNo,
}
})
this.dataItems = [...this.dataItems, ...arr]
})
})
},
// 远程搜索
async remoteMethod(searchVal) {
console.log(searchVal)
if (searchVal !== '') {
this.marchantNameCopy = searchVal
this.merchantList(this.pageData, searchVal)
} else {
this.dataItems = []
this.merchantList(
{
pageNum: 1,
pageSize: 40,
}
)
}
},
// 根据所选商户获取品牌和地址
selectChange(label) {
let obj = this.merchants.filter((el) => {
return el.merchantName == label
})
this.$set(this.ruleForm, 'address', obj[0].merchantAddress)
this.$set(this.ruleForm, 'brand', obj[0].merchantBrandCars)
async selectChange(label) {
if (label) {
let obj = this.dataItems.filter((el) => {
return el.merchantName == label
})
this.merchantId = obj[0] && obj[0].merchantId
// this.merchantId = 44209941
await addNamelistApi
.findMerchantDetailByMerchantNo({ merchantId: this.merchantId })
.then((res) => {
let brandTreeList = res.data.data && res.data.data.brandTreeList
let brandTreeListName =
brandTreeList && brandTreeList.map((item) => item.name)
this.$set(
this.ruleForm,
'brand',
brandTreeListName && brandTreeListName.toString()
)
})
this.$set(this.ruleForm, 'address', obj[0] && obj[0].merchantAddress)
}
},
submitForm() {
if (this.fileName == '') {
......@@ -188,7 +282,7 @@ export default {
}
this.$refs.ruleForm.validate((valid) => {
if (!this.hasFile && valid) {
let{
let {
address: merchantAddr,
merchant: merchantName,
brand: mainBrandName,
......@@ -196,19 +290,21 @@ export default {
} = this.ruleForm
let params = {
merchantAddr,
merchantName,
mainBrandName,
remark,
merchantName,
mainBrandName,
remark,
merchantId: this.merchantId,
file: this.fileBaseUrl,
}
console.log(params)
customerApi.addCustomerList(params).then((res) => {
this.dialogVisible =true
this.uploadStatus = 'success'
console.log(res)
},err =>{
this.dialogVisible =true
this.uploadStatus = 'fail'
if (res.data.code == '0') {
this.dialogVisible = true
this.uploadStatus = 'success'
this.uploadSuccessMsg = res.data.data
} else {
this.dialogVisible = true
this.uploadStatus = 'fail'
}
})
} else {
return false
......@@ -235,24 +331,22 @@ export default {
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = (event) => {
this.fileName = file.name
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
this.fileBaseUrl = fileUrl
this.fileName = file.name
// this.$apis.common.pictureUpload({ file: fileUrl }).then(res => {
// if (res) {
// this.importName = file.name
// this.exportUrl = res
// this.handleSaveImport()
// }
// this.$refs.file.value = ''
// })
let fileList = [{ file: fileUrl, fileType: 'doc' }]
uploadApi.multipleUpload({ fileList }).then((res) => {
if (res) {
this.fileBaseUrl = res.data.data[0]
}
})
}
},
back() {
this.$root.to(['ubi续保', '续保', '保险渠道管理', '客户名单管理'])
this.dialogVisible = false
},
},
}
......
<template>
<div>
<div>
<div>
<div>
<div class="mainTitle">基本信息</div>
<div class="infoBox">
<p class="rowline">
<span class="title">所属商户:</span>
<span>*************</span>
</p>
<p class="rowline">
<span class="title">主营品牌:</span><span>*************</span>
</p>
<p class="rowline">
<span class="title">商户地址:</span>
<span>*************</span>
</p>
<p class="rowline">
<span class="title">备注:</span>
<span>*************</span>
</p>
<div>
<div class="mainTitle">基本信息</div>
<div class="infoBox">
<p class="rowline">
<span class="title">所属商户:</span>
<span>{{ merchantBaseInfo.merchantName }}</span>
</p>
<p class="rowline">
<span class="title">主营品牌:</span
><span>{{ merchantBaseInfo.mainBrandName }}</span>
</p>
<p class="rowline">
<span class="title">商户地址:</span>
<span>{{ merchantBaseInfo.merchantAddress }}</span>
</p>
<p class="rowline">
<span class="title">备注:</span>
<span>{{ merchantBaseInfo.remark }}</span>
</p>
</div>
</div>
<div>
<div class="mainTitle">客户信息</div>
<d2-table
ref="customerDetail"
:hasNum="false"
:tableParams="customerDetailTableParams"
:searchForm="customerDetailSearchForm"
:getListApi="getListApi"
:pageConf="pageConf"
>
<!-- customerStatus -->
<div slot="customerStatus" slot-scope="scope">
<div>
{{
scope.scope.customerStatus == 0
? '完全流失'
: scope.scope.customerStatus == 1
? '在修不在保'
: ''
}}
</div>
</div>
</d2-table>
</div>
</div>
<div>
<div class="mainTitle">客户信息</div>
<d2-table
ref="customerDetail"
:hasNum="false"
:tableParams="customerDetailTableParams"
:searchForm="customerDetailSearchForm"
:getListApi="getListApi"
:pageConf="pageConf"
>
</d2-table>
<div class="footerBut">
<el-button @click="back">返回</el-button>
</div>
</div>
<div class="footerBut">
<el-button @click="back">返回</el-button>
</div>
</div>
</template>
<script>
......@@ -45,148 +58,157 @@ import { customerApi } from '@/api/customer'
export default {
data() {
return {
customerDetailForm: {
enableStatus: '',
merchantId: '',
merchantBaseInfo: {
merchantName: '',
mainBrandName: '',
merchantAddress: '',
remark: '',
},
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'data.count',
totalCount: 'data.total',
},
tableData: [
{
id: 1,
dictName: 'dsfd',
},
],
// getListApi: dictApi.findDictType,
customerDetailSearchForm: {
id: '',
},
getListApi: customerApi.detailsCustomerList,
customerDetailTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'data.data',
listName: 'data.list',
tableColumns: [
{
label: '投保人名称',
prop: 'id',
width:'120px'
prop: 'policyHolderName',
width: '120px',
},
{
label: '投保人身份证号',
prop: 'dictName',
width:'170px'
prop: 'policyHolderIdCard',
width: '170px',
},
{
label: '常用电话',
prop: 'dictType',
prop: 'policyHolderPhone',
width: '170px',
},
{
label: '备用电话',
prop: 'remark',
prop: 'sparePhone',
width: '170px',
},
{
label: '其他电话',
prop: 'enableStatus',
addHtml: 'status',
prop: 'otherPhone',
width: '170px',
},
{
label: '车牌号',
prop: 'createdDate',
prop: 'plateNo',
},
{
label: '车架号',
prop: 'enableStatus',
addHtml: 'status',
prop: 'carVin',
width: '170px',
},
{
label: '发动机号',
prop: 'createdDate',
prop: 'engine',
},
{
label: '车辆初登日期',
prop: 'createdDate',
width:'170px'
prop: 'registerDateStr',
width: '170px',
},
{
label: '最新保单日期',
prop: 'enableStatus',
addHtml: 'status',
width:'170px'
prop: 'policyDateStr',
width: '170px',
},
{
label: '公共型号',
prop: 'createdDate',
prop: 'publicModel',
},
{
label: '车辆价值',
prop: 'createdDate',
prop: 'vehicleValue',
},
{
label: '厂家型号',
prop: 'enableStatus',
addHtml: 'status',
prop: 'brandModel',
},
{
label: '车主',
prop: 'createdDate',
prop: 'vehicleOwner',
},
{
label: '车主证件号码',
prop: 'createdDate',
width:'170px'
prop: 'vehicleOwnerIdNo',
width: '170px',
},
{
label: '最新保单商业险保单号',
prop: 'enableStatus',
addHtml: 'status',
width:'170px'
prop: 'businessPolicyNo',
width: '170px',
},
{
label: '最新保单交强险保单号',
prop: 'createdDate',
width:'170px'
prop: 'compulsoryPolicyNo',
width: '170px',
},
{
label: '最新保单下的商业险出险次数',
prop: 'createdDate',
width:'220px'
prop: 'businessAccidentsNum',
width: '220px',
},
{
label: '最新保单下的交强险出险次数',
prop: 'enableStatus',
width:'220px'
prop: 'compulsoryAccidentsNum',
width: '220px',
},
{
label: '备注',
prop: 'createdDate',
prop: 'remark',
},
{
label: '年化里程',
prop: 'createdDate',
prop: 'annualMileage',
},
{
label: '车龄',
prop: 'enableStatus',
addHtml: 'status',
prop: 'vehicleAge',
},
{
label: '客户状态',
prop: 'createdDate',
prop: 'customerStatus',
addHtml: 'customerStatus',
},
],
},
}
},
methods:{
mounted() {
this.$root.eventBus.$on('params', (params) => {
let merchantId = params.merchantId
this.customerDetailSearchForm.id = merchantId
this.getcustomerInfo(merchantId)
this.$nextTick(() => {
this.$refs.customerDetail.refreshTable()
})
})
},
methods: {
back() {
this.$root.to(['ubi续保', '续保', '保险渠道管理', '客户名单管理'])
},
// 客户名单查看-导入门店信息
getcustomerInfo(){
let params = {}
customerApi.infoCustomerList(params).then(res =>{
console.log(res)
getcustomerInfo(merchantId) {
customerApi.infoCustomerList({ id: `${merchantId}` }).then((res) => {
this.merchantBaseInfo = res.data
})
}
}
},
},
}
</script>
......@@ -200,7 +222,7 @@ export default {
align-items: center;
padding-left: 16px;
}
.infoBox{
.infoBox {
padding: 24px 0px 24px 100px;
color: #333333;
font-size: 14px;
......@@ -210,7 +232,7 @@ export default {
align-items: center;
width: 560px;
}
.title{
.title {
text-align: right;
width: 80px;
}
......
<template>
<div>
<el-button class="addList" type="primary" @click="gotoNamelist">
<el-button size="mini" class="addList" type="primary" @click="gotoNamelist">
<i class="el-icon-plus"></i>添加名单</el-button
>
<el-button type="text" @click="gotoDetail">查看</el-button>
<el-form
inline="true"
size="mini"
inline
ref="merchantForm"
:model="merchantSearchForm"
label-width="80px"
......@@ -48,13 +48,46 @@
:getListApi="getListApi"
:pageConf="pageConf"
>
<!-- <div class="table-btns" slot="optionBtns" slot-scope="scope">
<el-button type="text" @click="handle('cogradient', scope.scope)"
<div slot="status" slot-scope="scope">
<div>
{{
scope.scope.status == 0
? '未同步'
: scope.scope.status == 1
? '同步中'
: scope.scope.status == 2
? '同步成功'
: '同步失败'
}}
</div>
</div>
<div class="table-btns" slot="optionBtns" slot-scope="scope">
<!-- 同步:仅状态=未同步、同步失败的名单可进行同步操作
查看:仅状态=未同步、已同步、同步失败的名单可进行查看操作
删除:仅状态=未同步、同步失败的名单可进行删除操作 -->
<el-button
v-if="scope.scope.status == '0' || scope.scope.status == '3'"
type="text"
@click="handle('cogradient', scope.scope.id)"
>同步</el-button
>
<el-button type="text" @click="gotoDetail">查看</el-button>
<el-button type="text" @click="handle('delete')">删除</el-button>
</div> -->
<el-button
v-if="
scope.scope.status == '0' ||
scope.scope.status == '2' ||
scope.scope.status == '3'
"
type="text"
@click="gotoDetail(scope.scope.id)"
>查看</el-button
>
<el-button
v-if="scope.scope.status == '0' || scope.scope.status == '3'"
type="text"
@click="handle('delete', scope.scope.id)"
>删除</el-button
>
</div>
</d2-table>
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
<span>{{ dialogVisibleText }}</span>
......@@ -73,27 +106,17 @@ import { customerApi } from '@/api/customer'
export default {
data() {
return {
optionsId: '',
dialogVisible: false,
dialogStatus: '',
dialogVisibleText:
'确定同步后,客户名单会自动发送给对应的保险合作渠道。是否确认同步?',
dialogVisibleText:'',
merchantSearchForm: {
merchantName: '',
merchantId: '',
status: '',
},
// DICTSTATUS: this.$Constants.DICT_STATUS,
pageConf: {
pageSize: 'pageSize',
pageNum: 'pageNum',
totalCount: 'data.total',
},
// tableData: [
// {
// id: 1,
// dictName: 'list',
// },
// ],
getListApi: customerApi.searchCustomerList,
merchantTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
......@@ -122,22 +145,22 @@ export default {
{
label: '状态',
prop: 'status',
addHtml: 'status',
},
{
label: '创建人',
prop: 'createdBy',
},
{
label: '创建时间',
prop: 'createdDate',
prop: 'createdDateStr',
},
{
label: '操作',
prop: 'optionBtns',
addHtml: 'optionBtns',
fixed: 'right',
},
// {
// label: '操作',
// prop: 'optionBtns',
// addHtml: 'optionBtns',
// fixed: 'right',
// },
],
},
}
......@@ -153,47 +176,57 @@ export default {
])
},
gotoDetail() {
this.$root.to([
'ubi续保',
'续保',
'保险渠道管理',
'客户名单管理',
'*查看客户名单',
])
gotoDetail(id) {
this.$root.to(
['ubi续保', '续保', '保险渠道管理', '客户名单管理', '*查看客户名单'],
{ merchantId: id }
)
},
reset() {
this.merchantSearchForm = {}
Object.keys(this.merchantSearchForm).forEach((key) => {
this.merchantSearchForm[key] = ''
})
this.$nextTick(() => {
this.$refs.merchantTable.refreshTable()
})
},
handle(type,scope) {
handle(type, id) {
this.dialogVisible = true
this.dialogStatus = type
this.optionsId = id
if (type == 'delete') {
this.dialogVisibleText = '删除后不可恢复,是否确认删除?'
}else{
this.dialogVisibleText = '确定同步后,客户名单会自动发送给对应的保险合作渠道。是否确认同步?'
}
},
comfirmDialog(type) {
if (type == 'cogradient') {
// 合并
customerApi.synchroCustomerList({ id: scope.id }).then(
customerApi.synchroCustomerList({ id: this.optionsId }).then(
(res) => {
this.$message.success('合并成功')
console.log(res)
this.$message.success('同步成功')
},
(err) => {
this.$message.error('合并失败')
this.$message.error('同步失败')
}
)
this.dialogVisible = false
}
// 删除
if (type == 'delete') {
customerApi.deleteCustomerList({ id: scope.id }).then(
customerApi.deleteCustomerList({ id: this.optionsId }).then(
(res) => {
console.log(res)
this.$message.success('删除成功')
this.$refs.merchantTable.refreshTable()
},
(err) => {
this.$message.error('删除失败')
}
)
this.dialogVisible = false
}
},
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!