Commit 303a7e16 by zhouzy

快速点击提交存在的问题

1 parent 786eaa28
<!--客服管理--> <!--客服管理-->
<template> <template>
<div class="ctn"> <div class="ctn">
<div <!-- 客服列表 -->
class="addCustomer" <div class="tableCtn">
@click="addCustomer" <d2-table
ref="recordTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
> >
点击添加客服 <span
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
>
<el-button
type="text"
@click="mod(scope.scope)"
>修改</el-button>
<el-button
type="text"
@click="del(scope.scope)"
>删除</el-button>
</span>
</d2-table>
</div> </div>
<!-- 添加客服弹窗 --> <!-- 添加客服弹窗 -->
<el-dialog <el-dialog
title="添加客服" title="添加客服"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%" width="610px"
:before-close="handleClose" >
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item
label="客服名称:"
prop="customerService"
>
<el-input v-model="ruleForm.customerService"></el-input>
</el-form-item>
<el-form-item
label="联系电话:"
prop="radio"
>
<el-radio-group v-model="ruleForm.radio">
<el-radio :label="3">手机号</el-radio>
<el-radio :label="6">座机号</el-radio>
<el-radio :label="9">不填</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label="手机号码:"
prop="telNumber"
>
<el-input v-model="ruleForm.telNumber"></el-input>
</el-form-item>
<el-form-item
label="验证码:"
prop="code"
> >
<span>添加客服</span> <div class="lineCtn">
<el-input v-model="ruleForm.code"></el-input>
<div class="buttonCtn">
<el-button type="primary">获取验证码</el-button>
</div>
</div>
</el-form-item>
<el-form-item
label="客服二维码:"
prop=""
>
<el-upload
class="avatar-uploader"
action="https://jsonplaceholder.typicode.com/posts/"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img
v-if="imageUrl"
:src="imageUrl"
class="avatar"
>
<i
v-else
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
<div>建议尺寸750*500px,JPG</div>
</el-form-item>
</el-form>
<span <span
slot="footer" slot="footer"
class="dialog-footer" class="dialog-footer"
> >
<el-button @click="dialogVisible = false">取 消</el-button> <el-button @click="resetForm('ruleForm')">取 消</el-button>
<el-button <el-button
type="primary" type="primary"
@click="dialogVisible = false" @click="submitForm('ruleForm')"
>确 定</el-button> >确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
...@@ -30,22 +110,107 @@ ...@@ -30,22 +110,107 @@
</template> </template>
<script> <script>
import { equityApi } from '@/api/api'
export default { export default {
data() { data() {
return { return {
dialogVisible: false imageUrl: '',
dialogVisible: false,
ruleForm: {
customerService: '',
phoneStyle: '',
telNumber: '',
code: '',
radio: ''
},
//客户服务管理列表
getListApi: equityApi.getEquityCardList,
// getListApi: none,
searchForm: {
merchantName: ''
},
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '客服编号',
prop: 'cardClassName'
// minWidth: '200'
},
{
label: '客服名称',
prop: 'merchantName',
minWidth: '200',
},
{
label: '手机号码',
prop: 'recipientCount'
},
{
label: '手机二维码',
prop: 'status',
},
]
},
rules: {
customerService: [
{ required: true, message: '请输入客服名称', trigger: 'change' },
],
radio: [
{ required: true, message: '请选择联系方式', trigger: 'change' },
],
telNumber: [
{ required: true, message: '请输入手机号码', trigger: 'change' },
],
code: [
{ required: true, message: '请输入验证码', trigger: 'change' },
],
}
}; };
}, },
methods: { methods: {
handleClose(done) { //修改客户
this.$confirm('确认关闭?') mod() {
.then(_ => { this.dialogVisible = true
done(); },
}) //删除客户
.catch(_ => { }); del() { },
//上传二维码
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpg';
const isPNG = file.type === 'image/png';
const isLt2M = file.size / 1024 / 1024 < 0.4882813;
if (!isJPG && !isPNG) {
this.$message.error('上传头像图片只能是jpg,png格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 500KB!');
}
return isJPG && isLt2M;
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
this.dialogVisible = false
this.$refs[formName].resetFields();
} else {
console.log('error submit!!');
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.dialogVisible = false
}, },
// 打开客服弹窗 // 打开客服弹窗
addCustomer(){ addCustomer() {
this.dialogVisible = true this.dialogVisible = true
} }
} }
...@@ -57,4 +222,64 @@ export default { ...@@ -57,4 +222,64 @@ export default {
margin: 0; margin: 0;
border: 0; border: 0;
} }
.lineCtn {
display: flex;
flex-direction: row;
}
.buttonCtn {
margin-left: 20px;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
.tableCtn {
margin-top: 20px;
margin-left: 20px;
margin-right: 20px;
}
/* .el-icon {
font-family: element-icons!important;
font-style: normal;
font-weight: 400;
font-variant: normal;
text-transform: none;
line-height: 178px;
vertical-align: baseline;
display: inline-block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
} */
.el-icon-{
font-family: element-icons !important;
font-style: normal;
font-weight: 400;
font-variant: normal;
text-transform: none;
line-height: 178px;
vertical-align: baseline;
display: inline-block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style> </style>
...@@ -210,6 +210,7 @@ ...@@ -210,6 +210,7 @@
<div class="buttonCtn"> <div class="buttonCtn">
<el-form-item> <el-form-item>
<el-button <el-button
:disabled="submitBtn"
type="primary" type="primary"
@click="submitForm('ruleForm')" @click="submitForm('ruleForm')"
>提交</el-button> >提交</el-button>
...@@ -238,7 +239,8 @@ import { equityApi } from '@/api/api' ...@@ -238,7 +239,8 @@ import { equityApi } from '@/api/api'
export default { export default {
data() { data() {
return { return {
disableInputNumber:false, submitBtn:false,
disableInputNumber: false,
disableSelect: false, disableSelect: false,
//分页查询下拉框 //分页查询下拉框
options: [], options: [],
...@@ -474,6 +476,7 @@ export default { ...@@ -474,6 +476,7 @@ export default {
// console.log(this.isAdd) // console.log(this.isAdd)
// console.log(row) // console.log(row)
this.ruleForm = row this.ruleForm = row
this.submitBtn =false
// this.changeStore() // this.changeStore()
this.dialogVisible = true this.dialogVisible = true
console.log(this.ruleForm.effectiveType) console.log(this.ruleForm.effectiveType)
...@@ -495,6 +498,7 @@ export default { ...@@ -495,6 +498,7 @@ export default {
}, },
//复制 //复制
copy(row) { copy(row) {
this.submitBtn =false
this.disableSelect = false this.disableSelect = false
this.isAdd = true this.isAdd = true
console.log(this.isAdd) console.log(this.isAdd)
...@@ -506,6 +510,7 @@ export default { ...@@ -506,6 +510,7 @@ export default {
} }
}, },
addCard(cd) { addCard(cd) {
this.submitBtn = false
this.generateOptions = [] this.generateOptions = []
this.dialogVisible = true this.dialogVisible = true
this.isAdd = cd this.isAdd = cd
...@@ -559,14 +564,14 @@ export default { ...@@ -559,14 +564,14 @@ export default {
//判断是否是从新建按钮进来的 //判断是否是从新建按钮进来的
var apiName = this.isAdd ? 'newEquityCard' : 'editEquityCard' var apiName = this.isAdd ? 'newEquityCard' : 'editEquityCard'
console.log(apiName) console.log(apiName)
this.submitBtn =true
equityApi[apiName](this.ruleForm).then((res) => { equityApi[apiName](this.ruleForm).then((res) => {
console.log(res) console.log(res)
console.log(apiName) console.log(apiName)
//请求是否成功 //请求是否成功
if (res.code == 0) { if (res.code == 0) {
this.effectiveNum = ''
this.ruleForm = {}
this.dialogVisible = false this.dialogVisible = false
this.effectiveNum = ''
this.isAdd = false this.isAdd = false
this.$message({ this.$message({
message: "操作成功", message: "操作成功",
...@@ -596,12 +601,11 @@ export default { ...@@ -596,12 +601,11 @@ export default {
}); });
}, },
resetForm(formName) { resetForm(formName) {
this.dialogVisible = false
this.effectiveNum = '' this.effectiveNum = ''
this.isAdd = false this.isAdd = false
this.inputSwitch = true this.inputSwitch = true
this.dialogVisible = false
console.log(this.isAdd) console.log(this.isAdd)
this.clearStyle()
this.disableSelect = false this.disableSelect = false
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!