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