1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
| <template>
| <el-dialog
| title="确认删除"
| :close-on-click-modal="false"
| :visible.sync="visible">
| <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
| </el-form>
| <span slot="footer" class="dialog-footer">
| <el-button @click="visible = false">取消</el-button>
| <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
| </span>
| </el-dialog>
| </template>
|
| <script>
| import { isEmail, isMobile } from '@/utils/validate'
| import { Debounce } from '@/utils/debounce'
| import { encrypt } from '@/utils/crypto'
| export default {
| data () {
| var validatePassword = (rule, value, callback) => {
| if (!this.dataForm.id && !/\S/.test(value)) {
| callback(new Error('密码不能为空'))
| } else {
| callback()
| }
| }
| var validateEmail = (rule, value, callback) => {
| if (!isEmail(value)) {
| callback(new Error('邮箱格式错误'))
| } else {
| callback()
| }
| }
| var validateMobile = (rule, value, callback) => {
| if (!isMobile(value)) {
| callback(new Error('手机号格式错误'))
| } else {
| callback()
| }
| }
| return {
| visible: false,
| roleList: {},
| id:'',
| dataForm: {
| loginSafeword:'',
| },
| dataRule: {
| // email: [
| // { required: true, message: '邮箱不能为空', trigger: 'blur' },
| // { validator: validateEmail, trigger: 'blur' }
| // ],
| // mobile: [
| // { required: true, message: '手机号不能为空', trigger: 'blur' },
| // { validator: validateMobile, trigger: 'blur' }
| // ]
| }
| }
| },
| methods: {
| init (id) {
| this.resClear()
| this.id = id || ''
| this.visible = true
| this.$nextTick(() => {
| //this.$refs.dataForm.resetFields()
| })
| },
| resClear(){
| this.dataForm = {
| loginSafeword:'',
| }
| },
| // 表单提交
| dataFormSubmit: Debounce(function () {
| this.$refs['dataForm'].validate((valid) => {
| if (valid) {
| this.$http({
| url: this.$http.adornUrl(`/paymentMethodConfig/delete`), //修改
| method: 'post',
| data: this.$http.adornData({
| 'id':this.id,
| 'loginSafeword':encrypt(this.dataForm.loginSafeword)
| })
| }).then(({data}) => {
| if(data.code == 0){
| this.$message({
| message: '删除成功',
| type: 'success',
| duration: 1500,
| onClose: () => {
| this.resClear()
| this.visible = false
| this.$emit('refreshDataListThree')
| }
| })
| }else{
| this.$message({
| message: data.msg,
| type: 'error',
| })
| }
|
| })
| }
| })
| })
| }
| }
| </script>
|
|