Commit a348f8de by 前端

Merge branch 'kuangyq_v2.8.0' into 'v2.8.0'

Kuangyq v2.8.0

See merge request !24
2 parents 68041259 9fe65b58
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<div></div> <div></div>
<el-form-item label="主营品牌" prop="brand"> <el-form-item label="主营品牌" prop="brand">
<el-input <el-input
class="limitLen"
v-model="ruleForm.brand" v-model="ruleForm.brand"
placeholder="请输入商户主营品牌" placeholder="请输入商户主营品牌"
maxlength="50" maxlength="50"
...@@ -44,6 +45,7 @@ ...@@ -44,6 +45,7 @@
</el-form-item> </el-form-item>
<el-form-item label="商户地址" prop="address"> <el-form-item label="商户地址" prop="address">
<el-input <el-input
class="limitLen"
v-model="ruleForm.address" v-model="ruleForm.address"
placeholder="请输入商户地址" placeholder="请输入商户地址"
maxlength="100" maxlength="100"
...@@ -52,6 +54,7 @@ ...@@ -52,6 +54,7 @@
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remarks"> <el-form-item label="备注" prop="remarks">
<el-input <el-input
class="limitLen"
type="textarea" type="textarea"
v-model="ruleForm.remarks" v-model="ruleForm.remarks"
placeholder="请输入备注内容" placeholder="请输入备注内容"
...@@ -110,7 +113,7 @@ ...@@ -110,7 +113,7 @@
</span> </span>
</template> </template>
<template v-if="uploadStatus == 'fail'"> <template v-if="uploadStatus == 'fail'">
<span>数据导入失败,{{uploadErrorMsg}},请重试!</span> <span>数据导入失败,{{ uploadErrorMsg }},请重试!</span>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button plain type="primary" @click="dialogVisible = false" <el-button plain type="primary" @click="dialogVisible = false"
>取消</el-button >取消</el-button
...@@ -121,7 +124,6 @@ ...@@ -121,7 +124,6 @@
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { addNamelistApi } from '@/api/addNamelist' import { addNamelistApi } from '@/api/addNamelist'
import { customerApi } from '@/api/customer' import { customerApi } from '@/api/customer'
...@@ -129,7 +131,6 @@ import { uploadApi } from '@/api/upload' ...@@ -129,7 +131,6 @@ import { uploadApi } from '@/api/upload'
export default { export default {
data() { data() {
return { return {
fullscreenLoading: false,
uploadSuccessMsg: '', uploadSuccessMsg: '',
uploadErrorMsg: '', uploadErrorMsg: '',
marchantNameCopy: '', //存放搜索的商户名 marchantNameCopy: '', //存放搜索的商户名
...@@ -157,12 +158,14 @@ export default { ...@@ -157,12 +158,14 @@ export default {
remarks: '' remarks: ''
}, },
rules: { rules: {
merchant: [{ required: true, message: '请选择商户', trigger: 'blur' }], merchant: [
{ required: true, message: '请选择商户', trigger: 'change' }
],
brand: [ brand: [
{ required: true, message: '请输入商户主营品牌', trigger: 'blur' } { required: true, message: '请输入商户主营品牌', trigger: 'change' }
], ],
address: [ address: [
{ required: true, message: '请输入商户地址', trigger: 'blur' } { required: true, message: '请输入商户地址', trigger: 'change' }
], ],
remarks: [{ required: false, trigger: 'blur' }] remarks: [{ required: false, trigger: 'blur' }]
} }
...@@ -270,21 +273,26 @@ export default { ...@@ -270,21 +273,26 @@ export default {
return el.merchantName == label return el.merchantName == label
}) })
this.merchantId = obj[0] && obj[0].merchantId this.merchantId = obj[0] && obj[0].merchantId
// this.merchantId = 44209941
await addNamelistApi await addNamelistApi
.findMerchantDetailByMerchantNo({ merchantId: this.merchantId }) .findMerchantDetailByMerchantNo({ merchantId: this.merchantId })
.then(res => { .then(res => {
console.log(res)
let brandTreeList = res.data.data && res.data.data.brandTreeList let brandTreeList = res.data.data && res.data.data.brandTreeList
let brandTreeListName = let brandTreeListName =
brandTreeList && brandTreeList.map(item => item.name) brandTreeList && brandTreeList.map(item => item.name)
this.$set( let brandNamStr = brandTreeListName && brandTreeListName.toString()
this.ruleForm, if (brandNamStr && brandNamStr.length > 50) {
'brand', this.$set(this.ruleForm, 'brand', brandNamStr.slice(0, 50))
brandTreeListName && brandTreeListName.toString() } else {
) this.$set(this.ruleForm, 'brand', brandNamStr)
}
}) })
this.$set(this.ruleForm, 'address', obj[0] && obj[0].merchantAddress) // 地址设置
let merchantAddressStr = obj[0] && obj[0].merchantAddress
if (merchantAddressStr && merchantAddressStr.length > 100) {
this.$set(this.ruleForm, 'address', merchantAddressStr.slice(0, 100))
} else {
this.$set(this.ruleForm, 'address', merchantAddressStr)
}
} }
}, },
submitForm() { submitForm() {
...@@ -307,25 +315,39 @@ export default { ...@@ -307,25 +315,39 @@ export default {
merchantId: this.merchantId, merchantId: this.merchantId,
file: this.fileBaseUrl file: this.fileBaseUrl
} }
customerApi.addCustomerList(params).then(res => { customerApi.addCustomerList(params).then(
const loading = this.$loading({ res => {
lock: true, let loading = this.$loading({
text: 'Loading', lock: true,
spinner: 'el-icon-loading', text: 'Loading',
background: 'rgba(0, 0, 0, 0.7)' spinner: 'el-icon-loading',
}) background: 'rgba(0, 0, 0, 0.7)'
if (res.code == '0') { })
loading.close() if (res.code == '0') {
this.dialogVisible = true loading.close()
this.uploadStatus = 'success' this.dialogVisible = true
this.uploadSuccessMsg = res.data this.uploadStatus = 'success'
} else { this.uploadSuccessMsg = res.data
} else {
loading.close()
this.dialogVisible = true
this.uploadStatus = 'fail'
this.uploadErrorMsg = res.message
}
},
err => {
let loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
loading.close() loading.close()
this.dialogVisible = true this.dialogVisible = true
this.uploadStatus = 'fail' this.uploadStatus = 'fail'
this.uploadErrorMsg = res.message this.uploadErrorMsg = err
} }
}) )
} else { } else {
return false return false
} }
...@@ -334,38 +356,51 @@ export default { ...@@ -334,38 +356,51 @@ export default {
uploadFile(e) { uploadFile(e) {
const file = e.srcElement.files[0] const file = e.srcElement.files[0]
let AllImgExt = '.xls|.xlsx' let AllImgExt = '.xls|.xlsx'
let extName = file.name if (file) {
.substring(file.name.lastIndexOf('.')) let extName = file.name
.toLowerCase() .substring(file.name.lastIndexOf('.'))
if (AllImgExt.indexOf(extName) === -1) { .toLowerCase()
this.$message.error('上传格式不正确') if (AllImgExt.indexOf(extName) === -1) {
return false this.$message.error('上传格式不正确')
} return false
const size = file.size / 1024 / 1024 }
if (size > 5) { const size = file.size / 1024 / 1024
this.$message.error('单文件体积需小于5M') if (size > 5) {
return this.$message.error('单文件体积需小于5M')
} return
this.downloadStatus = true }
this.setInter = setInterval(this.addProcess, 100) this.downloadStatus = true
const reader = new FileReader() this.setInter = setInterval(this.addProcess, 100)
reader.readAsDataURL(file) const reader = new FileReader()
reader.onload = event => { reader.readAsDataURL(file)
this.fileName = file.name reader.onload = event => {
const imgFile = event.target.result this.fileName = file.name
const arrBase64 = imgFile.split(',') const imgFile = event.target.result
const splitStr = file.name.split('.') const arrBase64 = imgFile.split(',')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1] const splitStr = file.name.split('.')
let fileList = [{ file: fileUrl, fileType: 'doc' }] const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
uploadApi.multipleUpload({ fileList }).then(res => { let fileList = [{ file: fileUrl, fileType: 'doc' }]
if (res) { uploadApi.multipleUpload({ fileList }).then(
this.fileBaseUrl = res.data.data[0] res => {
} if (res) {
}) if (res.code == '0') {
this.fileBaseUrl = res.data[0]
} else {
this.fileName = ''
this.$message.error('文件上传失败')
}
}
},
err => {
this.fileName = ''
this.$message.error('文件上传失败')
}
)
}
} }
}, },
back() { back() {
this.$root.to(['UBI续保', '续保', '保险渠道管理', '客户名单管理']) window.history.go(-1)
this.dialogVisible = false this.dialogVisible = false
if (this.uploadStatus == 'success') { if (this.uploadStatus == 'success') {
this.ruleForm = {} this.ruleForm = {}
...@@ -375,7 +410,6 @@ export default { ...@@ -375,7 +410,6 @@ export default {
} }
} }
</script> </script>
<style scoped> <style scoped>
.biasicInfo { .biasicInfo {
width: 500px; width: 500px;
...@@ -442,4 +476,7 @@ export default { ...@@ -442,4 +476,7 @@ export default {
.el-form-item { .el-form-item {
margin-bottom: 20px; margin-bottom: 20px;
} }
.limitLen {
padding-right: 60px;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!