Commit 559b3fd7 by 前端

Merge branch 'v3.5.1' into 'master'

V3.5.1

See merge request !27
2 parents e0f3954a baf819ce
import { http } from '@/main'
const defaultPath = 'scrm.api.equity.service.'
const url = 'rop-scrm-equity/router'
const getcodeList = params => {
params.method = `${defaultPath}claims.code.list`
return http({
url,
method: 'POST',
data: params
})
}
const uploadCodeFile = params => {
params.method = `${defaultPath}claims.code.batchGenerateCodeByExcel`
return http({
url,
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file']
})
}
const exportInvalidClaimsCodeApi = params => {
params.method =`${defaultPath}claims.code.exportInvalidClaimsCode`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const createCode = params => {
params.method =`${defaultPath}claims.code.batchGenerateCodeByHand`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
getcodeList,
uploadCodeFile,
exportInvalidClaimsCodeApi,
createCode
}
\ No newline at end of file
......@@ -106,6 +106,12 @@ const staticRoutes = Object.freeze([
path: '/claims/ghOrder/:id',
component: resolve => require([`@/views/claims/ghOrder.vue`], resolve),
meta: {}
},
{
name: 'addCode',
path: '/addCode/index',
component: resolve => require([`@/views/addCode/index.vue`], resolve),
meta: {}
}
])
export default staticRoutes
<template>
<div class="container">
<GLCombiForm ref="searchRef" :rowNumber="1" :formObj="searchForm" :formData="searchFormData" @handleOk="handleOk" @handleRest="handleRest"></GLCombiForm>
<el-button type="primary" :size="size" style="float:right;margin-bottom:10px;" @click="createCode">生成核销码</el-button>
<GLTable :pageSizes="pageSizes" ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi"></GLTable>
<GLDialog class="dialog_wrap" title="生成核销码" mode="mid" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose" @onOk="onOk"
@onCancel="handleClose" :close-on-click-modal="false">
<div>
<label class="label_class" for="">合同号:</label>
<el-radio-group @change="changeAddMethod" v-model="addType">
<el-radio :label="1">手动输入</el-radio>
<el-radio :label="2">导入</el-radio>
</el-radio-group>
</div>
<div class="manual" v-if="addType == 1">
<el-input type="textarea" class="contract_input" v-model="contractNoStr" placeholder="请输入合同号"></el-input>
<p class="textarea_tip" :style="{color: contractNoList.length > 20 ? 'red': '#999999'}">{{contractNoList.length > 20 ? '最多输入20个合同号':'多个合同号换行输入,最多20个合同号'}}</p>
<p class="textarea_tip" v-if="requestTip">以下红色标记为合同号不存在,判断为无效合同</p>
<div class="contract_area">
<div :class="['contract_item', {valid: item.valid}]" v-for="(item, index) in contractNoList" :key="index">
<span class="contract_no">{{ item.val }}</span>
<i style="cursor:pointer" class="el-icon-close" @click="delContractNo(item.val)"></i>
</div>
</div>
</div>
<div class="import" v-else>
<div class="upload_wrap">
<div class="upload_btn">
<el-button icon="el-icon-plus" :size="size" @click="upload">
上传文件
<input type="file" style="opacity: 0;width: 0;height: 0;" ref="file" accept="*" @change="uploadFile" />
</el-button>
<div class="preview">
<el-popover
placement="right-start"
width="160"
trigger="hover"
>
<!-- <img style="width: 100%;" :src="require('@/assets/example.png')"> -->
<el-image
style="width: 100px;"
:src="exampleImg"
:preview-src-list="[exampleImg]">
</el-image>
<span slot="reference">模版预览</span>
</el-popover>
</div>
</div>
<div class="file_name" v-if="fileData && fileData.name">{{fileData.name}}</div>
</div>
<div class="file_info">
<div class="file_num">
<div class="num_wrap">
<span class="num valid">{{errorFileInfo.effectiveSize || 0}}</span>
<span class="title">有效数量</span>
</div>
<div class="num_wrap">
<span class="num invalid">{{errorFileInfo.invalidSize || 0}}</span>
<span class="title">
无效数量
<span class="download" v-if="errorFileInfo.invalidSize" @click="handleExport">下载</span>
</span>
</div>
</div>
<div class="tip_txt">
<p class="tip_title">数据异常的可能原因:</p>
<p>1. 合同号格式不正确</p>
<p>2. 合同号不存在</p>
</div>
</div>
</div>
</GLDialog>
</div>
</template>
<script>
import util from '@/util/util'
import exampleImg from '@/assets/example.png'
import { ConcatSource } from 'webpack-sources'
export default {
name: 'index',
data() {
return {
size: 'small',
exampleImg,
uploaded: false,
isVisible: false,
requestTip: false,
contractNoStr: '',
addType: 1,
contractNoList: [],
errorNoList: [],
errorFileInfo:{},
fileData: {},
getListApi: this.$apis.addCode.getcodeList,
pageConf: { pageSize: 'pageSize', pageNum: 'pageCount', totalCount: 'total' },
pageSizes: [5, 10, 20, 30, 40],
tableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '核销码',
prop: 'writeOffCode'
},
{
label: '客户姓名',
prop: 'customerName'
},
{
label: '合同号',
prop: 'contractNo'
},
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '报案时间',
formatter: cell => {
return util.dateFormat(cell.createdDate, 'YYYY-MM-DD HH:mm:ss')
}
}
]
},
searchForm: {
writeOffCode: '',
contractNo: '',
merchantName: '',
reportDate: ''
},
searchFormData: [
{
label: '核销码',
name: 'writeOffCode',
type: 'input',
isClear: true
},
{
label: '合同号',
name: 'contractNo',
type: 'input',
isClear: true
},
{
label: '门店名称',
name: 'merchantName',
type: 'input',
isClear: true
},
{
label: '报案时间',
name: 'reportDate',
type: 'datePicker',
isClear: true
}
]
}
},
methods: {
upload() {
this.$refs.file.click()
},
//查询表格
handleOk() {
this.$refs.tableRef.refreshTable()
},
// 重置表格
handleRest() {
this.searchForm = {
writeOffCode: '',
contractNo: '',
merchantName: '',
reportDate: ''
}
this.handleOk()
},
getParams() {
let params = { ...this.searchForm }
if (params.reportDate) {
params.beginCreateTime = new Date(this.searchForm.reportDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endCreateTime = new Date(this.searchForm.reportDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.getParams()
resolve()
})
},
//解析合同号,
formatContractNo() {
let contractNoList = this.contractNoStr.split('\n').filter(item => !!item?.trim()) || []
this.contractNoList = contractNoList.map(item =>{
return {val: item, valid: this.errorNoList?.includes(item)}
})
// 给点一个值判断是否有效
const target = this.contractNoList.find(item => item.valid)
!target && (this.requestTip = false)
},
// 删除合同号,同时删除多余的空格换行
delContractNo(val){
let contractNo = '\n' + this.contractNoStr + '\n'
contractNo = contractNo.replace(/[\n]/g, '\n\n')
contractNo = contractNo.replace(new RegExp('[\n]' + val + '[\n]'), '\n')
contractNo = contractNo.replace(/[\n]+/g, '\n')
contractNo = contractNo.replace(/^[\n]+/, '')
this.contractNoStr = contractNo
this.formatContractNo()
},
// 上传excel
uploadFile(e) {
const file = e.srcElement.files[0]
let AllImgExt = '.xlsx' //文件格式判断
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (AllImgExt !== extName) {
this.$message.error('文件格式不正确')
this.$refs.file.value = ''
return false
}
this.uploaded = false
this.fileData = file
},
handleUploadFile(){
if(!this.fileData.size) return this.$message({
message:'请上传文件',
type: 'error',
customClass: 'msgHierarchy'
});
if(this.uploaded){
if(this.errorFileInfo.effectiveSize<=0){
this.$message({
message:'有效合同号为0',
type: 'error',
customClass: 'msgHierarchy'
})
this.fileData = {}
}else{
this.clearData()
}
this.uploaded = false
return false
}
const file = this.fileData
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileName = file.name.split('.')
//fileUrl: 文件名 + @ + base64拼接
const fileUrl = fileName.pop() + '@' + arrBase64[1]
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)'
})
this.$apis.addCode.uploadCodeFile({ file: fileUrl }).then(res => {
loading.close()
if(res?.batchNo) {
this.$message({
message:'生成核销码成功',
type: 'success',
customClass: 'msgHierarchy'
})
this.errorFileInfo = res
this.uploaded = true
}
this.$refs.file.value = ''
}).catch(err =>{
loading.close()
})
}
},
// 下载错误的合同号
handleExport() {
const params = {
batchNo: this.errorFileInfo.batchNo,
codeStatus: 0
}
this.$apis.addCode.exportInvalidClaimsCodeApi(params).then(res => {
// window.open(res)
let tempaa = util.getExplorer()
if (tempaa == 'QQ') {
window.open(res)
} else {
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = res
document.body.appendChild(iframe)
}
})
},
createCode() {
this.uploaded = false
this.isVisible = true
},
onOk(){
if(this.addType==1){
this.formatContractNo()
if(this?.contractNoList?.length>20){
return this.$message({
message:'最多输入20个合同号',
type: 'error',
customClass: 'msgHierarchy'
})
}
const params = {
contractNoList: this.contractNoList.map(item => item.val)
}
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)'
})
this.$apis.addCode.createCode(params).then(res => {
loading.close()
if(res?.batchNo){
if(res?.invalidList?.length){
this.$message({
message:'存在无效合同',
type: 'error',
customClass: 'msgHierarchy'
})
this.errorNoList = res?.invalidList || []
this.contractNoList.map(item =>{
if(res?.invalidList?.includes(item.val)){
item.valid = true
}
return item
})
this.requestTip = true
}else{
this.clearData()
this.$message.success('操作成功')
}
}
}).catch(err =>{
loading.close()
})
}else{
this.handleUploadFile()
}
},
clearData(){
this.isVisible = false
this.requestTip = false
this.contractNoStr = ''
this.addType = 1
this.contractNoList = [],
this.errorNoList = []
this.errorFileInfo = {}
this.fileData = {}
this.handleRest()
},
handleClose() {
if(this.addType==1){
this.clearData()
}else{
this.$confirm('确定关闭弹窗吗', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.clearData()
}
}
})
}
},
changeAddMethod(type) {
this.addType = type
}
}
}
</script>
<style lang="scss" scoped>
.container {
background-color: #fff;
padding: 20px;
.dialog_wrap {
.label_class {
display: inline-block;
width: 154px;
text-align: right;
&::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
}
.manual {
margin-top: 10px;
.contract_input {
margin-left: 154px;
width: 432px;
/deep/ .el-textarea__inner {
width: 432px;
height: 79px;
border: 1px solid #e5e5e5;
border-radius: 4px;
font-family: unset;
}
}
.textarea_tip{
margin-left: 154px;
font-weight: 400;
font-size: 12px;
color: red;
margin-top: 10px;
}
.contract_area{
margin-top: 10px;
width: 600px;
max-height: 340px;
overflow-y: auto;
margin-left: 60px;
.contract_item{
height: 26px;
width: 280px;
white-space: nowrap;
display: inline-flex;
justify-content: space-between;
align-items: center;
padding: 0 8px;
background: #fafbfe;
border: 1px solid #E8E8EA;
border-radius: 4px;
color: #666666;
margin: 0 10px 8px 0;
box-sizing: border-box;
}
.valid {
background: #fff1f0;
border: 1px solid #ffa39e;
color: #ff4d4f;
}
}
}
.import {
.upload_wrap {
// display: flex;
margin-left: 154px;
margin-top: 10px;
.upload_btn {
display: flex;
.preview {
margin-left: 8px;
position: relative;
.example{
width: 160px;
height: 64px;
}
span {
line-height: 32px;
height: 32px;
color: #5850ff;
cursor: pointer;
}
}
}
.file_name {
width: 320px;
height: 26px;
line-height: 26px;
background: #f5f7fa;
border-radius: 4px;
margin-top: 8px;
padding: 0 12px;
}
}
.file_info {
border: 1px solid #e5e5e5;
border-radius: 4px;
padding: 20px 0;
margin-top: 32px;
display: flex;
flex-direction: column;
align-items: center;
.file_num {
display: flex;
width: 100%;
.num_wrap {
flex: 1;
text-align: center;
&:first-child{
border-right: 1px solid #e5e5e5;
}
.num {
display: block;
height: 32px;
font-family: Helvetica-Bold;
font-weight: 700;
font-size: 26px;
color: #2cca74;
text-align: center;
line-height: 32px;
}
.title {
margin-top: 4px;
display: block;
height: 20px;
line-height: 20px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14px;
color: #333333;
}
.invalid {
color: #eb4e4e;
}
.download {
margin-left: 4px;
color: #5850ff;
cursor: pointer;
}
}
}
.tip_txt{
width: 536px;
margin-top: 16px;
font-size: 14px;
color: #333333;
line-height: 20px;
background: #F5F7FA;
padding: 8px 16px;
.tip_title{
color: #666666;
}
}
}
}
}
.cno_input {
width: 200px;
}
.edit,
.del {
cursor: pointer;
margin-left: 4px;
}
}
</style>
\ No newline at end of file
......@@ -1122,29 +1122,51 @@ export default {
// 获取产品的数据
toGetProductData(arr) {
arr.forEach(item => {
if (item.packageName.includes('整车全损')) {
item.idName = 'car'
} else if (item.packageName.includes('轮胎')) {
item.idName = 'tire'
} else if (item.packageName.includes('碰撞')) {
item.idName = 'crash'
this.productModal[item.idName]['planId'] = item.planId
this.productModal['vip']['planId'] = item.planId
this.getCase(item.planId)
} else if (item.packageName.includes('盗抢')) {
item.idName = 'stolen'
} else if (item.packageName.includes('尊享版')) {
item.idName = 'vip'
} else if (item.packageName.includes('舒享版')) {
item.idName = 'vip'
} else if (item.packageName.includes('优享版')) {
item.idName = 'vip'
} else if (item.packageType == 1) {
// if (item.packageName.includes('整车全损')) {
// item.idName = 'car'
// } else if (item.packageName.includes('轮胎')) {
// item.idName = 'tire'
// } else if (item.packageName.includes('碰撞')) {
// item.idName = 'crash'
// this.productModal[item.idName]['planId'] = item.planId
// this.productModal['vip']['planId'] = item.planId
// this.getCase(item.planId)
// } else if (item.packageName.includes('盗抢')) {
// item.idName = 'stolen'
// } else if (item.packageName.includes('尊享版')) {
// item.idName = 'vip'
// } else if (item.packageName.includes('舒享版')) {
// item.idName = 'vip'
// } else if (item.packageName.includes('优享版')) {
// item.idName = 'vip'
// } else if (item.packageType == 1) {
// item.idName = 'vip'
// } else if (item.packageName.includes('玻璃')) {
// this.vailGlassName = item.packageName // 备用
// this.vailGlassCode = item.packageCode
// item.idName = 'glass'
// }
if (item.packageType == 1) {
//定制权益
item.idName = 'vip'
} else if (item.packageName.includes('玻璃')) {
this.vailGlassName = item.packageName // 备用
this.vailGlassCode = item.packageCode
item.idName = 'glass'
} else {
// 自选权益
if (item.packageName.includes('整车全损')) {
item.idName = 'car'
} else if (item.packageName.includes('轮胎')) {
item.idName = 'tire'
} else if (item.packageName.includes('碰撞')) {
item.idName = 'crash'
this.productModal[item.idName]['planId'] = item.planId
this.productModal['vip']['planId'] = item.planId
this.getCase(item.planId)
} else if (item.packageName.includes('盗抢')) {
item.idName = 'stolen'
} else if (item.packageName.includes('玻璃')) {
this.vailGlassName = item.packageName // 备用
this.vailGlassCode = item.packageCode
item.idName = 'glass'
}
}
item.disabled = false
item.serviceItems = item.serviceItemsList.length ? item.serviceItemsList.map(k => k.serviceName).join(',') : ''
......
......@@ -224,6 +224,14 @@ export default {
{
label: '车架号',
name: 'vin'
},
{
label: '设备号',
name: 'sn'
},
{
label: '卡号',
name: 'cardSeqNo'
}
],
handleSelectChange: value => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!