|
@@ -85,7 +85,12 @@
|
85
|
85
|
<checkbox-group style="width: 100%;" v-model="checked">
|
86
|
86
|
<view class="cu-item bg-white padding margin-bottom-sm" v-for="(item, i) in attends" :key="i">
|
87
|
87
|
<view>{{ item.week }}</view>
|
88
|
|
- <view v-for="(course, c) in item.list" class="solid-bottom" :key="c" :class="course.status == 0 ? 'disabled-course' : ''">
|
|
88
|
+ <view
|
|
89
|
+ v-for="(course, c) in item.list"
|
|
90
|
+ class="solid-bottom"
|
|
91
|
+ :key="c"
|
|
92
|
+ :class="course.status == 0 || payOrders.includes(course.class_attend_id) ? 'disabled-course' : ''"
|
|
93
|
+ >
|
89
|
94
|
<view class="cu-bar">
|
90
|
95
|
<view>
|
91
|
96
|
<label @tap="classChange(course, i)">
|
|
@@ -96,7 +101,7 @@
|
96
|
101
|
<view>
|
97
|
102
|
<checkbox
|
98
|
103
|
:value="course.class_attend_id"
|
99
|
|
- :disabled="course.status == 0"
|
|
104
|
+ :disabled="course.status == 0 || payOrders.includes(course.class_attend_id)"
|
100
|
105
|
:checked="checked[i].includes(course.class_attend_id)"
|
101
|
106
|
class="round cyan"
|
102
|
107
|
style="transform: scale(0.7);"
|
|
@@ -114,7 +119,7 @@
|
114
|
119
|
:checked="
|
115
|
120
|
checked_props[i][c] ? checked_props[i][c].class_attend_id === course.class_attend_id && checked_props[i][c].prop.includes(prop.id) : false
|
116
|
121
|
"
|
117
|
|
- :disabled="course.status == 0"
|
|
122
|
+ :disabled="course.status == 0 || payOrders.includes(course.class_attend_id)"
|
118
|
123
|
:value="prop.id"
|
119
|
124
|
class="cyan"
|
120
|
125
|
style="transform: scale(0.7);"
|
|
@@ -149,7 +154,7 @@
|
149
|
154
|
</template>
|
150
|
155
|
|
151
|
156
|
<script>
|
152
|
|
-import { _intelligentDates, _intelligentInterests, _intelligentCourses, _intelligentGetKeys, _joinShops, _checkConflict } from '@/api/course'
|
|
157
|
+import { _intelligentDates, _intelligentInterests, _intelligentCourses, _intelligentGetKeys, _joinShops, _checkConflict, _checkOrders } from '@/api/course'
|
153
|
158
|
import { mapGetters } from 'vuex'
|
154
|
159
|
import socket from '@/common/webSocket'
|
155
|
160
|
export default {
|
|
@@ -173,6 +178,7 @@ export default {
|
173
|
178
|
days: [], //周期
|
174
|
179
|
daysMap: { 星期一: '1', 星期二: '2', 星期三: '3', 星期四: '4', 星期五: '5' },
|
175
|
180
|
interests: [], //兴趣
|
|
181
|
+ interestMax: 5, //限定兴趣数量
|
176
|
182
|
attends: [], //课程
|
177
|
183
|
week: [], //记录日期
|
178
|
184
|
tuoguan: [], //记录托管
|
|
@@ -190,6 +196,7 @@ export default {
|
190
|
196
|
checked_props: [], // 选中工具
|
191
|
197
|
checkedIds: [], //已选中选项
|
192
|
198
|
conflictIds: [], //冲突选项
|
|
199
|
+ payOrders: [], //已付款订单
|
193
|
200
|
attend_id: 0, // 添加成功课程
|
194
|
201
|
disableBtn: false, // 避免多次重复点击
|
195
|
202
|
action: 'stopmove'
|
|
@@ -208,15 +215,26 @@ export default {
|
208
|
215
|
this.disableBtn = false
|
209
|
216
|
},
|
210
|
217
|
methods: {
|
211
|
|
- init() {
|
|
218
|
+ async init() {
|
212
|
219
|
this.getDateConfig()
|
213
|
220
|
socket.initSocket()
|
|
221
|
+ await this.checkOrders() //获取支付订单
|
214
|
222
|
},
|
215
|
223
|
getDateConfig() {
|
216
|
224
|
_intelligentDates().then(res => {
|
217
|
225
|
this.days = res.data
|
218
|
226
|
})
|
219
|
227
|
},
|
|
228
|
+ //查询已付款订单
|
|
229
|
+ checkOrders() {
|
|
230
|
+ return new Promise((resolve, reject) => {
|
|
231
|
+ _checkOrders().then(res => {
|
|
232
|
+ this.payOrders = res.data
|
|
233
|
+ resolve(true)
|
|
234
|
+ })
|
|
235
|
+ })
|
|
236
|
+ },
|
|
237
|
+ //查询冲突判断
|
220
|
238
|
checkConflict(id) {
|
221
|
239
|
return new Promise((resolve, reject) => {
|
222
|
240
|
if (this.checkedIds.length < 1) {
|
|
@@ -229,6 +247,7 @@ export default {
|
229
|
247
|
}
|
230
|
248
|
_checkConflict(params).then(res => {
|
231
|
249
|
this.checkedIds = res.data.checked_list.map(item => item.class_attend_id)
|
|
250
|
+ this.checkedIds = [...new Set(this.checkedIds.concat(this.payOrders))]
|
232
|
251
|
this.conflictIds = res.data.conflict_list.map(item => item.class_attend_id)
|
233
|
252
|
resolve(res.data.checked_res)
|
234
|
253
|
})
|
|
@@ -252,18 +271,23 @@ export default {
|
252
|
271
|
return false
|
253
|
272
|
}
|
254
|
273
|
this.interests = this.keys.filter(item => item.includes(this.serachKey))
|
|
274
|
+ //兴趣选择数量补充
|
|
275
|
+ if (this.interests.length < this.interestMax) {
|
|
276
|
+ const others = this.keys.filter(item => !this.params.hobbyOther.includes(item) && !this.interests.includes(item))
|
|
277
|
+ const fixNum = this.interestMax - this.interests.length
|
|
278
|
+ this.interests = this.interests.concat(others.slice(0, fixNum))
|
|
279
|
+ }
|
255
|
280
|
},
|
256
|
281
|
check_key(key) {
|
257
|
282
|
const params = { week: this.params.week.join(','), student_id: this.kid, keywords: key }
|
258
|
|
- _intelligentGetKeys(params).then(res => {
|
259
|
|
- if (res.data.length < 1) {
|
260
|
|
- this.params.hobbyOther = this.params.hobbyOther.filter(k => k != key)
|
261
|
|
- uni.showToast({
|
262
|
|
- title: '未找到相关课程',
|
263
|
|
- icon: 'none',
|
264
|
|
- duration: 2000
|
265
|
|
- })
|
266
|
|
- }
|
|
283
|
+ return new Promise((resolve, reject) => {
|
|
284
|
+ _intelligentGetKeys(params).then(res => {
|
|
285
|
+ if (res.data.length < 1) {
|
|
286
|
+ resolve(false)
|
|
287
|
+ } else {
|
|
288
|
+ resolve(true)
|
|
289
|
+ }
|
|
290
|
+ })
|
267
|
291
|
})
|
268
|
292
|
},
|
269
|
293
|
get_options() {
|
|
@@ -280,9 +304,9 @@ export default {
|
280
|
304
|
const week = course.week
|
281
|
305
|
const dayKey = this.daysMap[week]
|
282
|
306
|
const item = list[0]
|
283
|
|
- const class_attend_id = item.status == 0 || !this.params.week.includes(dayKey) ? null : item.class_attend_id
|
|
307
|
+ const class_attend_id = item.status == 0 || this.payOrders.includes(item.class_attend_id) || !this.params.week.includes(dayKey) ? null : item.class_attend_id
|
284
|
308
|
this.$set(this.checked, index, [class_attend_id])
|
285
|
|
- const prop = item.prop.length > 0 ? [item.prop[0].id] : []
|
|
309
|
+ const prop = class_attend_id && item.prop.length > 0 ? [item.prop[0].id] : []
|
286
|
310
|
this.$set(this.checked_props, index, [{ class_attend_id: class_attend_id, prop: prop }])
|
287
|
311
|
})
|
288
|
312
|
this.checkedIds = this.getCheckedIds()
|
|
@@ -295,17 +319,25 @@ export default {
|
295
|
319
|
this.checked.forEach(v => {
|
296
|
320
|
arr = arr.concat(v)
|
297
|
321
|
})
|
298
|
|
- return arr.filter(e => e)
|
|
322
|
+ return [...new Set(arr.filter(e => e).concat(this.payOrders))]
|
299
|
323
|
},
|
300
|
324
|
delHobby(key) {
|
301
|
325
|
this.params.hobbyOther = this.params.hobbyOther.filter(item => item != key)
|
302
|
326
|
},
|
303
|
|
- chooseInterest(key) {
|
|
327
|
+ async chooseInterest(key) {
|
304
|
328
|
if (this.params.hobbyOther.includes(key)) {
|
305
|
329
|
this.params.hobbyOther = this.params.hobbyOther.filter(item => item != key)
|
306
|
330
|
} else {
|
307
|
331
|
this.params.hobbyOther.push(key)
|
308
|
|
- this.check_key(key)
|
|
332
|
+ const pass = await this.check_key(key)
|
|
333
|
+ if (!pass) {
|
|
334
|
+ this.params.hobbyOther = this.params.hobbyOther.filter(k => k != key)
|
|
335
|
+ uni.showToast({
|
|
336
|
+ title: '未找到相关课程',
|
|
337
|
+ icon: 'none',
|
|
338
|
+ duration: 2000
|
|
339
|
+ })
|
|
340
|
+ }
|
309
|
341
|
}
|
310
|
342
|
},
|
311
|
343
|
checkboxChange(e) {
|
|
@@ -327,7 +359,7 @@ export default {
|
327
|
359
|
console.log('error')
|
328
|
360
|
}
|
329
|
361
|
},
|
330
|
|
- changeStep(index) {
|
|
362
|
+ async changeStep(index) {
|
331
|
363
|
if (index === 1 && this.params.week.length < 1) {
|
332
|
364
|
uni.showToast({ title: '请先选择周期', icon: 'none' })
|
333
|
365
|
return false
|
|
@@ -338,6 +370,10 @@ export default {
|
338
|
370
|
}
|
339
|
371
|
if (index === 1) {
|
340
|
372
|
this.getHobbyConfig()
|
|
373
|
+ const pass = await this.check_key('晚托')
|
|
374
|
+ if (pass) {
|
|
375
|
+ this.params.hobbyOther[0] = '晚托'
|
|
376
|
+ }
|
341
|
377
|
}
|
342
|
378
|
const step = Math.abs(index - this.cur)
|
343
|
379
|
if (step > 1) return false
|
|
@@ -357,7 +393,13 @@ export default {
|
357
|
393
|
if (course.status == 0) {
|
358
|
394
|
return false
|
359
|
395
|
}
|
|
396
|
+ //已报课程
|
|
397
|
+ if (this.payOrders.includes(course.class_attend_id)) {
|
|
398
|
+ uni.showToast({ title: '该课程已报,请重选!', icon: 'none', duration: 2000 })
|
|
399
|
+ return false
|
|
400
|
+ }
|
360
|
401
|
const class_attend_id = course.class_attend_id
|
|
402
|
+
|
361
|
403
|
if (this.checked[i].includes(class_attend_id)) {
|
362
|
404
|
this.batchCancel([class_attend_id])
|
363
|
405
|
} else {
|