wdsfForm.vue
3.23 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
<el-dialog
v-model="show" :title="title" width="500px" append-to-body :close-on-click-modal="false"
destroy-on-close
>
<el-form label-width="120">
<el-form-item required :label="item.realName" v-for="item in list">
<el-input :disabled="item.checked"
v-model="item.wdsfMin" placeholder="输入WDSF会员号"
>
<template #append>
<view @click="checkCode(item)" class="checkbb">
<el-icon v-if="item.checked" color="#13ce66" size="24"><CircleCheck /></el-icon>
<text class="text-primary" v-else>验证</text>
</view>
</template>
</el-input>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer text-center">
<el-button type="primary" @click="submitForm">保 存</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { reactive, ref, toRefs, watch } from 'vue'
import { getCurrentInstance, nextTick, onMounted } from '@vue/runtime-core'
import * as match from '@/apiPc/match'
import { SuccessFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { useRoute } from 'vue-router'
const { proxy } = getCurrentInstance()
const emit = defineEmits(['submitForm'])
const uploadUrl = ref('/upload/upLoadToFileServer')
const route = useRoute()
import {useStorage} from "@vueuse/core/index";
const language= useStorage('language',0)
const data = reactive({
form: {},
show: false,
list: [],
title: '',
groupId: '0'
})
const { form, show, countryList, list, title, groupId } = toRefs(data)
let extraId = 0
let personId
let matchId
const open = (params) => {
console.log(params)
show.value = true
title.value = params.title
matchId = params.matchId
list.value = params.list
init()
}
defineExpose({ open })
watch(show, (value) => {
if (!value) {
form.value = {}
list.value = []
}
})
function init() {
for (let n of list.value){
if (n.wdsfMin) {
n.checked = true
} else {
n.checked = false
}
}
}
function checkCode(item) {
if (!item.wdsfMin) {
if (language.value == 0) {
ElMessage.error('请填写WDSF卡号')
} else {
ElMessage.error('Please fill in your WDSF code')
}
return
}
match.checkWdsf({card: item.wdsfMin}).then(res => {
if(res.data.wdsfFlag=='0'){
if (language.value == 0) {
ElMessage.error('验证失败,卡号不存在')
} else {
ElMessage.error('Verification failed, card number does not exist')
}
return
}
if(res.data.wdsfFlag=='1'){
item.checked = true
}
})
}
function submitForm() {
//list.value
show.value = false
emit('submitForm')
}
function cancel() {
show.value = false
}
</script>
<style lang="scss">
.threeFour {
width: 100%;
:deep(.el-upload--picture-card) {
width: 120px;
height: 160px;
}
:deep(.el-upload-list--picture-card .el-upload-list__item) {
width: 120px;
height: 160px;
}
}
.tip {
font-size: 13px;
color: #999;
margin: 10px 0;
i {
color: red;
margin: 0 4px 0 0;
}
}
.red {
color: #f56c6c;
}
.checkbb{width: 30px;display: flex;align-items: center;text-align: center;}
</style>