Form copy.vue
10.7 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<template>
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="90%">
<el-row :gutter="15" class="" >
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
<el-col :span="8" v-if="false" >
<el-form-item label="退卡编号" prop="id">
<el-input v-model="dataForm.id" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="门店" prop="md">
<el-select v-model="dataForm.md" placeholder="请选择" clearable :style='{"width":"100%"}' filterable >
<el-option v-for="(item, index) in mdOptions" :key="index" :label="item.fullName" :value="item.id" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="门店编号" prop="mcbh">
<el-input v-model="dataForm.mcbh" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="门店名称" prop="mdmc">
<el-input v-model="dataForm.mdmc" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="会员" prop="hy">
<el-select v-model="dataForm.hy" placeholder="请选择" clearable :style='{"width":"100%"}' filterable >
<el-option v-for="(item, index) in hyOptions" :key="index" :label="item.fullName" :value="item.id" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="会员姓名" prop="hyxm">
<el-input v-model="dataForm.hyxm" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="会员账号" prop="hyzh">
<el-input v-model="dataForm.hyzh" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="健康师" prop="jks">
<user-select v-model="dataForm.jks" placeholder="请选择" clearable >
</user-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="健康师账号" prop="jkszh">
<el-input v-model="dataForm.jkszh" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="健康师姓名" prop="jksxm">
<el-input v-model="dataForm.jksxm" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="bz">
<el-input v-model="dataForm.bz" placeholder="请输入" show-word-limit :style='{"width":"100%"}' type='textarea' :autosize='{"minRows":4,"maxRows":4}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="24" v-if="false" >
<el-form-item label="退卡品项" prop="tkpx">
<el-input v-model="dataForm.tkpx" placeholder="请输入" clearable :style='{"width":"100%"}' >
</el-input>
</el-form-item>
</el-col>
<el-col :span="24" v-if="false" >
<el-form-item label="退卡时间" prop="tksj">
<el-input v-model="dataForm.tksj" placeholder="系统自动生成" readonly >
</el-input>
</el-form-item>
</el-col>
<el-col :span="24" v-if="false" >
<el-form-item label="退卡人" prop="tkr">
<el-input v-model="dataForm.tkr" placeholder="系统自动生成" readonly >
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label-width="0">
<el-table :data="dataForm.lqHytkMxList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="id" label="明细编号" v-if="false">
<template slot-scope="scope">
<el-input v-model="scope.row.id" placeholder="请输入" clearable ></el-input>
</template>
</el-table-column>
<el-table-column prop="gltkbh" label="关联退卡编号" v-if="false">
<template slot-scope="scope">
<el-input v-model="scope.row.gltkbh" placeholder="请输入" clearable ></el-input>
</template>
</el-table-column>
<el-table-column prop="px" label="品项">
<template slot-scope="scope">
<el-select v-model="scope.row.px" placeholder="请选择" clearable >
<el-option v-for="(item, index) in pxOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="mc" label="品项名称">
<template slot-scope="scope">
<el-input v-model="scope.row.mc" placeholder="请输入" clearable ></el-input>
</template>
</el-table-column>
<el-table-column prop="tkje" label="退款金额">
<template slot-scope="scope">
<el-input v-model="scope.row.tkje" placeholder="请输入" clearable ></el-input>
</template>
</el-table-column>
<el-table-column prop="cs" label="次数">
<template slot-scope="scope">
<el-input v-model="scope.row.cs" placeholder="请输入" clearable ></el-input>
</template>
</el-table-column>
<el-table-column prop="dchk" label="单次耗卡">
<template slot-scope="scope">
<el-input v-model="scope.row.dchk" placeholder="请输入" clearable ></el-input>
</template>
</el-table-column>
<el-table-column prop="fssj" label="发生时间" v-if="false">
<template slot-scope="scope">
<el-input v-model="scope.row.fssj" placeholder="请输入" clearable ></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="NCC-table-delBtn" @click="handleDelLqHytkMxEntityList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addHandleLqHytkMxEntityList()">
<el-button type="text" icon="el-icon-plus">新增</el-button>
</div>
</el-form-item>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取 消</el-button>
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { previewDataInterface } from '@/api/systemData/dataInterface'
export default {
components: {},
props: [],
data() {
return {
loading: false,
visible: false,
isDetail: false,
dataForm: {
id:'',
id:undefined,
md:undefined,
mcbh:undefined,
mdmc:undefined,
hy:undefined,
hyxm:undefined,
hyzh:undefined,
jks:undefined,
jkszh:undefined,
jksxm:undefined,
bz:undefined,
tkpx:undefined,
tksj:undefined,
tkr:undefined,
lqHytkMxList:[],
},
rules: {
},
mdOptions : [],
hyOptions : [],
pxOptions : [],
}
},
computed: {},
watch: {},
created() {
this.getmdOptions();
this.gethyOptions();
this.getpxOptions();
},
mounted() {
},
methods: {
getmdOptions(){
previewDataInterface('730960205902251269').then(res => {
this.mdOptions = res.data
});
},
gethyOptions(){
previewDataInterface('730998109110273285').then(res => {
this.hyOptions = res.data
});
},
getpxOptions(){
previewDataInterface('730971133356016901').then(res => {
this.pxOptions = res.data
});
},
goBack() {
this.$emit('refresh')
},
init(id, isDetail) {
this.dataForm.id = id || 0;
this.visible = true;
this.isDetail = isDetail || false;
this.$nextTick(() => {
this.$refs['elForm'].resetFields();
if (this.dataForm.id) {
request({
url: '/api/Extend/LqHytkHytk/' + this.dataForm.id,
method: 'get'
}).then(res =>{
this.dataForm = res.data;
})
}
})
},
dataFormSubmit() {
this.$refs['elForm'].validate((valid) => {
if (valid) {
if (!this.dataForm.id) {
request({
url: `/api/Extend/LqHytkHytk`,
method: 'post',
data: this.dataForm,
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false,
this.$emit('refresh', true)
}
})
})
} else {
request({
url: '/api/Extend/LqHytkHytk/' + this.dataForm.id,
method: 'PUT',
data: this.dataForm
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
}
}
})
},
addHandleLqHytkMxEntityList() {
let item = {
id:undefined,
gltkbh:undefined,
px:undefined,
mc:undefined,
tkje:undefined,
cs:undefined,
dchk:undefined,
fssj:undefined,
}
this.dataForm.lqHytkMxList.push(item)
},
handleDelLqHytkMxEntityList(index) {
this.dataForm.lqHytkMxList.splice(index, 1);
},
}
}
</script>