培训报名规则修改
Showing
4 changed files
with
742 additions
and
654 deletions
| 1 | <template> | 1 | <template> |
| 2 | <view> | 2 | <view> |
| 3 | <!-- 培训信息完善 --> | 3 | <!-- 培训信息完善 --> |
| 4 | <view class="title-left-border">培训信息</view> | 4 | <view class="title-left-border">培训信息</view> |
| 5 | <uni-forms ref="baseForm" :modelValue="form" label-width="120"> | 5 | <uni-forms ref="baseForm" :modelValue="form" label-width="120"> |
| 6 | <uni-forms-item label="所在单位名称" required name="unitName"> | 6 | <uni-forms-item label="所在单位名称" required name="unitName"> |
| 7 | <uni-easyinput v-model="form.unitName" placeholder="请输入所在单位名称" /> | 7 | <uni-easyinput v-model="form.unitName" placeholder="请输入所在单位名称" /> |
| 8 | </uni-forms-item> | 8 | </uni-forms-item> |
| 9 | <uni-forms-item label="现任职务" required name="unitRole"> | 9 | <uni-forms-item label="现任职务" required name="unitRole"> |
| 10 | <uni-easyinput v-model="form.unitRole" placeholder="请输入现任职务" /> | 10 | <uni-easyinput v-model="form.unitRole" placeholder="请输入现任职务" /> |
| 11 | </uni-forms-item> | 11 | </uni-forms-item> |
| 12 | <view v-if="activity.invoiceFlag=='1'"> | 12 | <view v-if="activity.invoiceFlag=='1'"> |
| 13 | <uni-forms-item label="是否需要发票" required name="invoiceFlag"> | 13 | <uni-forms-item label="是否需要发票" required name="invoiceFlag"> |
| 14 | <uni-data-checkbox v-model="form.invoiceFlag" :localdata="invoiceFlag" /> | 14 | <uni-data-checkbox v-model="form.invoiceFlag" :localdata="invoiceFlag" /> |
| 15 | </uni-forms-item> | 15 | </uni-forms-item> |
| 16 | <uni-forms-item label="发票形式" v-if="form.invoiceFlag=='1'" required name="invoiceType"> | 16 | <uni-forms-item label="发票形式" v-if="form.invoiceFlag=='1'" required name="invoiceType"> |
| 17 | <uni-data-checkbox v-model="form.invoiceType" :localdata="invoiceType" /> | 17 | <uni-data-checkbox v-model="form.invoiceType" :localdata="invoiceType" /> |
| 18 | </uni-forms-item> | 18 | </uni-forms-item> |
| 19 | <uni-forms-item label="开票信息" v-if="form.invoiceFlag=='1'" required name="invoiceInfo"> | 19 | <uni-forms-item label="开票信息" v-if="form.invoiceFlag=='1'" required name="invoiceInfo"> |
| 20 | <uni-easyinput v-model="form.invoiceInfo" placeholder="请输入开票信息" /> | 20 | <uni-easyinput v-model="form.invoiceInfo" placeholder="请输入开票信息" /> |
| 21 | </uni-forms-item> | 21 | </uni-forms-item> |
| 22 | </view> | 22 | </view> |
| 23 | <uni-forms-item :label="c.name" v-for="c in customInfo" :key="c.id"> | 23 | <uni-forms-item :label="c.name" v-for="c in customInfo" :key="c.id"> |
| 24 | <uni-easyinput v-if="c.type=='1'" v-model="form.customInfoObj[c.id]" placeholder="请输入" /> | 24 | <uni-easyinput v-if="c.type=='1'" v-model="form.customInfoObj[c.id]" placeholder="请输入" /> |
| 25 | <view> | 25 | <view> |
| 26 | 26 | ||
| 27 | <uni-file-picker v-if="c.type == '2'" limit="1" file-mediatype="all" file-extname="doc,docx,pdf,txt" | 27 | <uni-file-picker v-if="c.type == '2'" limit="1" file-mediatype="all" file-extname="doc,docx,pdf,txt" |
| 28 | v-model="c.value" @select="selectFile" | 28 | v-model="c.value" @select="selectFile" |
| 29 | @delete="delSupplementFile(c,$event)" /> | 29 | @delete="delSupplementFile(c,$event)" /> |
| 30 | <text v-if="c.type == '2'" style="font-size: 24rpx;color: #999;">仅支持上传doc,docx,pdf,txt</text> | 30 | <text v-if="c.type == '2'" style="font-size: 24rpx;color: #999;">仅支持上传doc,docx,pdf,txt</text> |
| 31 | 31 | ||
| 32 | <uni-file-picker v-if="c.type == '3'" v-model="upSupplement3Value" return-type="object" limit="1" | 32 | <uni-file-picker v-if="c.type == '3'" v-model="upSupplement3Value" return-type="object" limit="1" |
| 33 | @select="upSupplement3" @delete="delSupplementImg(c,$event)" /> | 33 | @select="upSupplement3" @delete="delSupplementImg(c,$event)" /> |
| 34 | </view> | 34 | </view> |
| 35 | <uni-data-select v-model="c.value" v-if="c.type == '4'" :localdata="c.option"></uni-data-select> | 35 | <uni-data-select v-model="c.value" v-if="c.type == '4'" :localdata="c.option"></uni-data-select> |
| 36 | 36 | ||
| 37 | </uni-forms-item> | 37 | </uni-forms-item> |
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | </uni-forms> | 41 | </uni-forms> |
| 42 | </view> | 42 | </view> |
| 43 | 43 | ||
| 44 | <view class="fixedBottom"> | 44 | <view class="fixedBottom"> |
| 45 | <button class="btn btn-red-kx" @click="prev">上一步</button> | 45 | <button class="btn btn-red-kx" @click="prev">上一步</button> |
| 46 | <button class="btn btn-red" @click="next">下一步</button> | 46 | <button class="btn btn-red" @click="next">下一步</button> |
| 47 | </view> | 47 | </view> |
| 48 | </template> | 48 | </template> |
| 49 | 49 | ||
| 50 | <script setup> | 50 | <script setup> |
| 51 | import { | 51 | import { |
| 52 | onLoad | 52 | onLoad |
| 53 | } from '@dcloudio/uni-app' | 53 | } from '@dcloudio/uni-app' |
| 54 | import { | 54 | import { |
| 55 | ref, | 55 | ref, |
| 56 | reactive, | 56 | reactive, |
| 57 | toRefs, | 57 | toRefs, |
| 58 | computed, | 58 | computed, |
| 59 | watch | 59 | watch |
| 60 | } from 'vue' | 60 | } from 'vue' |
| 61 | import _ from 'lodash' | 61 | import _ from 'lodash' |
| 62 | import * as train from '@/training/train.js' | 62 | import * as train from '@/training/train.js' |
| 63 | 63 | ||
| 64 | const emit = defineEmits(['prev', 'next']) | 64 | const emit = defineEmits(['prev', 'next']) |
| 65 | const props = defineProps({ | 65 | const props = defineProps({ |
| 66 | activity: { | 66 | activity: { |
| 67 | type: Object, | 67 | type: Object, |
| 68 | default: () => {} | 68 | default: () => {} |
| 69 | }, | 69 | }, |
| 70 | trainId: { | 70 | trainId: { |
| 71 | type: String, | 71 | type: String, |
| 72 | default: () => {} | 72 | default: () => {} |
| 73 | }, | 73 | }, |
| 74 | active: { | 74 | active: { |
| 75 | type: Number, | 75 | type: Number, |
| 76 | default: () => {} | 76 | default: 0 |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | }) | 79 | }) |
| 80 | 80 | ||
| 81 | const customInfo = computed(() => { | 81 | const customInfo = computed(() => { |
| 82 | if (props.activity.customInfo) { | 82 | if (props.activity.customInfo) { |
| 83 | return JSON.parse(props.activity.customInfo).info | 83 | return JSON.parse(props.activity.customInfo).info |
| 84 | } else { | 84 | } else { |
| 85 | return [] | 85 | return [] |
| 86 | } | 86 | } |
| 87 | }) | 87 | }) |
| 88 | 88 | ||
| 89 | const data = reactive({ | 89 | const data = reactive({ |
| 90 | form: { | 90 | form: { |
| 91 | invoiceFlag: '1', | 91 | invoiceFlag: '1', |
| 92 | customInfoObj: {} | 92 | customInfoObj: {} |
| 93 | }, | 93 | }, |
| 94 | invoiceFlag: [{ | 94 | invoiceFlag: [{ |
| 95 | value: '0', | 95 | value: '0', |
| 96 | text: '否' | 96 | text: '否' |
| 97 | }, { | 97 | }, { |
| 98 | value: '1', | 98 | value: '1', |
| 99 | text: '是' | 99 | text: '是' |
| 100 | }], | 100 | }], |
| 101 | invoiceType: [{ | 101 | invoiceType: [{ |
| 102 | value: 0, | 102 | value: 0, |
| 103 | text: '电子票' | 103 | text: '电子票' |
| 104 | }, { | 104 | }, { |
| 105 | value: 1, | 105 | value: 1, |
| 106 | text: '纸质专票' | 106 | text: '纸质专票' |
| 107 | }, { | 107 | }, { |
| 108 | value: 2, | 108 | value: 2, |
| 109 | text: '纸质普票' | 109 | text: '纸质普票' |
| 110 | }] | 110 | }] |
| 111 | }) | 111 | }) |
| 112 | const { | 112 | const { |
| 113 | form, | 113 | form, |
| 114 | invoiceType, | 114 | invoiceType, |
| 115 | invoiceFlag | 115 | invoiceFlag |
| 116 | } = toRefs(data) | 116 | } = toRefs(data) |
| 117 | 117 | ||
| 118 | watch(() => props.activity.invoiceFlag, (val) => { | 118 | watch(() => props.activity.invoiceFlag, (val) => { |
| 119 | if (val == '1') { | 119 | if (val == '1') { |
| 120 | if (!form.value.invoiceType) { | 120 | if (!form.value.invoiceType) { |
| 121 | form.value.invoiceType = _.orderBy(props.activity.invoiceType.split(','))[0] | 121 | form.value.invoiceType = _.orderBy(props.activity.invoiceType.split(','))[0] |
| 122 | } | 122 | } |
| 123 | } | 123 | } |
| 124 | }, { | 124 | }, { |
| 125 | immediate: true | 125 | immediate: true |
| 126 | }) | 126 | }) |
| 127 | watch(() => props.active, (val) => { | 127 | watch(() => props.active, (val) => { |
| 128 | if (val == 2) { | 128 | if (val == 2) { |
| 129 | uni.showLoading({ | 129 | uni.showLoading({ |
| 130 | title:'加载中' | 130 | title:'加载中' |
| 131 | }) | 131 | }) |
| 132 | train.getTrainPersonalInfo(props.trainId).then(res => { | 132 | train.getTrainPersonalInfo(props.trainId).then(res => { |
| 133 | 133 | form.value = res.data || {} | |
| 134 | form.value = res.data || {} | 134 | if (res.data?.customInfo) { |
| 135 | if (res.data?.customInfo) { | 135 | form.value.customInfoObj = JSON.parse(res.data.customInfo) |
| 136 | form.value.customInfoObj = JSON.parse(res.data.customInfo) | 136 | } else { |
| 137 | } else { | 137 | form.value.customInfoObj = {} |
| 138 | form.value.customInfoObj = {} | 138 | } |
| 139 | } | 139 | uni.hideLoading() |
| 140 | uni.hideLoading() | 140 | }) |
| 141 | 141 | } | |
| 142 | }) | 142 | }) |
| 143 | } | 143 | |
| 144 | }) | 144 | function prev() { |
| 145 | 145 | emit('prev') | |
| 146 | function prev() { | 146 | } |
| 147 | emit('prev') | 147 | |
| 148 | } | 148 | function next() { |
| 149 | 149 | // 判断必填 | |
| 150 | function next() { | 150 | if(!form.value.unitName){ |
| 151 | // 判断必填 | 151 | uni.showToast({ |
| 152 | if(!form.value.unitName){ | 152 | title: '请填写所在单位', |
| 153 | uni.showToast({ | 153 | icon: 'none' |
| 154 | title: '请填写所在单位', | 154 | }) |
| 155 | icon: 'none' | 155 | return |
| 156 | }) | 156 | } |
| 157 | return | 157 | if(!form.value.unitRole){ |
| 158 | } | 158 | uni.showToast({ |
| 159 | if(!form.value.unitRole){ | 159 | title: '请填写职务信息', |
| 160 | uni.showToast({ | 160 | icon: 'none' |
| 161 | title: '请填写职务信息', | 161 | }) |
| 162 | icon: 'none' | 162 | return |
| 163 | }) | 163 | } |
| 164 | return | 164 | form.value.activityId = props.trainId |
| 165 | } | 165 | form.value.customInfo = JSON.stringify(form.value.customInfoObj) |
| 166 | form.value.activityId = props.trainId | 166 | train.savePersonalInfo(form.value).then(() => { |
| 167 | form.value.customInfo = JSON.stringify(form.value.customInfoObj) | 167 | uni.showToast({ |
| 168 | train.savePersonalInfo(form.value).then(() => { | 168 | title: '保存成功', |
| 169 | uni.showToast({ | 169 | icon: 'none' |
| 170 | title: '保存成功', | 170 | }).finally(res=>{ |
| 171 | icon: 'none' | 171 | emit('next') |
| 172 | }).finally(res=>{ | 172 | }) |
| 173 | emit('next') | 173 | }) |
| 174 | }) | 174 | } |
| 175 | }) | ||
| 176 | } | ||
| 177 | </script> | 175 | </script> |
| 178 | 176 | ||
| 179 | <style scoped lang="scss"> | 177 | <style scoped lang="scss"> | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view> | 2 | <view> |
| 3 | <!-- 培训考试选择 --> | 3 | <!-- 培训考试选择 --> |
| 4 | <view class="title-left-border">个人信息</view> | 4 | <view class="title-left-border">个人信息</view> |
| 5 | <view class="descriptionsBox"> | 5 | <view class="descriptionsBox"> |
| 6 | <view class="flexRow"> | 6 | <view class="flexRow"> |
| 7 | <label>姓名:</label>{{ personal.name }} | 7 | <label>姓名:</label>{{ personal.name }} |
| 8 | </view> | 8 | </view> |
| 9 | <view class="flexRow"> | 9 | <view class="flexRow"> |
| 10 | <label>会员编号:</label>{{ personal.perCode }} | 10 | <label>会员编号:</label>{{ personal.perCode }} |
| 11 | </view> | 11 | </view> |
| 12 | <view class="flexRow"> | 12 | <view class="flexRow"> |
| 13 | <label>有效期:</label>{{ personal.validityDate?.slice(0,10) }} | 13 | <label>有效期:</label>{{ personal.validityDate?.slice(0,10) }} |
| 14 | </view> | 14 | </view> |
| 15 | <view class="flexRow"> | 15 | <view class="flexRow"> |
| 16 | <label>段位:</label>{{ (personal.levelDuan && personal.levelDuan!=0)? (szToHz(personal.levelDuan)+'段/品') :'--' }} | 16 | <label>段位:</label>{{ (personal.levelDuan && personal.levelDuan!=0)? (szToHz(personal.levelDuan)+'段/品') :'--' }} |
| 17 | </view> | 17 | </view> |
| 18 | <view class="flexRow"> | 18 | <view class="flexRow"> |
| 19 | <label>教练员等级:</label>{{ personal.coachLabel?.name||'--'}} | 19 | <label>教练员等级:</label>{{ personal.coachLabel?.name||'--'}} |
| 20 | </view> | 20 | </view> |
| 21 | <view class="flexRow"> | 21 | <view class="flexRow"> |
| 22 | <label>裁判员等级:</label>{{ personal.refereeLabel?.name||'--'}} | 22 | <label>裁判员等级:</label>{{ personal.refereeLabel?.name||'--'}} |
| 23 | </view> | 23 | </view> |
| 24 | <view class="flexRow"> | 24 | <view class="flexRow"> |
| 25 | <label>晋级官等级:</label>{{ personal.examinerJiLabel?.name||'--'}} | 25 | <label>晋级官等级:</label>{{ personal.examinerJiLabel?.name||'--'}} |
| 26 | </view> | 26 | </view> |
| 27 | <view class="flexRow"> | 27 | <view class="flexRow"> |
| 28 | <label>晋段官等级:</label>{{ personal.examinerDuanLabel?.name||'--'}} | 28 | <label>晋段官等级:</label>{{ personal.examinerDuanLabel?.name||'--'}} |
| 29 | </view> | 29 | </view> |
| 30 | </view> | 30 | </view> |
| 31 | 31 | ||
| 32 | <view class="title-left-border">培训科目</view> | 32 | <view class="title-left-border">培训科目</view> |
| 33 | <view> | 33 | <view> |
| 34 | <view v-for="t in trainList" @click="changeTrainIds(t)" :key="t.id" | 34 | <view v-for="t in trainList" @click="changeTrainIds(t)" :key="t.id" |
| 35 | :class="t.required || t.disabled?'disabled kkitem':'kkitem'"> | 35 | :class="t.required || t.disabled?'disabled kkitem':'kkitem'"> |
| 36 | <view class="checkarea"> | 36 | <view class="checkarea"> |
| 37 | <uni-icons v-if="t.required||t.checked" color="#C5161E" type="checkbox-filled" | 37 | <uni-icons v-if="t.required||t.checked" color="#C5161E" type="checkbox-filled" |
| 38 | size="30"></uni-icons> | 38 | size="30"></uni-icons> |
| 39 | <uni-icons v-else type="circle" size="30"></uni-icons> | 39 | <uni-icons v-else type="circle" size="30"></uni-icons> |
| 40 | </view> | 40 | </view> |
| 41 | <view class="content"> | 41 | <view class="content"> |
| 42 | <view class="name">{{ t.name }} | 42 | <view class="name">{{ t.name }} |
| 43 | <view> | 43 | <view> |
| 44 | <text class="text-danger">¥{{ t.price }}</text>人/次 | 44 | <text class="text-danger">¥{{ t.price }}</text>人/次 |
| 45 | </view> | 45 | </view> |
| 46 | </view> | 46 | </view> |
| 47 | <view class="date"> | 47 | <view class="date"> |
| 48 | <text>报名限制条件:</text> | 48 | <text>报名限制条件:</text> |
| 49 | <text v-if="signRules[t.twoSubjectId]?.openFlag"> | 49 | <text v-if="openFlag && signRules[t.twoSubjectId]"> |
| 50 | <text>等级</text><text>{{ signRules[t.twoSubjectId]?.name }}</text> | 50 | <text v-if="t.subjectType=='0'"> |
| 51 | <text>段位</text><text>{{ signRules[t.twoSubjectId]?.duanStr }}</text> | 51 | <text>等级</text><text>{{ signRules[t.twoSubjectId]?.name }}</text> |
| 52 | <text>年限</text><text>{{ signRules[t.twoSubjectId]?.limitStr }}</text> | 52 | <text>段位</text><text>{{ signRules[t.twoSubjectId]?.duanStr }}</text> |
| 53 | </text> | 53 | <text>年限</text><text>{{ signRules[t.twoSubjectId]?.limitStr }}</text> |
| 54 | <text v-else> | 54 | </text> |
| 55 | -- | 55 | <text v-else> |
| 56 | </text> | 56 | <text>等级</text><text>{{ signRules2[t.twoSubjectId]?.name }}</text> |
| 57 | </view> | 57 | </text> |
| 58 | </view> | 58 | </text> |
| 59 | </view> | 59 | <text v-else> |
| 60 | </view> | 60 | -- |
| 61 | 61 | </text> | |
| 62 | <view class="title-left-border">考试科目</view> | 62 | </view> |
| 63 | <view> | 63 | </view> |
| 64 | <view v-for="t in examList" @click="changeExamIds(t)" :key="t.id" | 64 | </view> |
| 65 | :class="(t.required || t.disabled|| !t.passRelate)?'disabled kkitem':'kkitem'"> | 65 | </view> |
| 66 | <view class="checkarea"> | 66 | |
| 67 | <uni-icons v-if="t.required||t.checked" color="#C5161E" type="checkbox-filled" | 67 | <view class="title-left-border">考试科目</view> |
| 68 | size="30"></uni-icons> | 68 | <view> |
| 69 | <uni-icons v-else type="circle" size="30"></uni-icons> | 69 | <view v-for="t in examList" @click="changeExamIds(t)" :key="t.id" |
| 70 | </view> | 70 | :class="(t.required || t.disabled|| !t.passRelate)?'disabled kkitem':'kkitem'"> |
| 71 | <view class="content"> | 71 | <view class="checkarea"> |
| 72 | <view class="name">{{ t.name }} | 72 | <uni-icons v-if="t.required||t.checked" color="#C5161E" type="checkbox-filled" |
| 73 | <view> | 73 | size="30"></uni-icons> |
| 74 | <text class="text-danger">¥{{ t.price }}</text>人/次 | 74 | <uni-icons v-else type="circle" size="30"></uni-icons> |
| 75 | </view> | 75 | </view> |
| 76 | </view> | 76 | <view class="content"> |
| 77 | <view class="date"> | 77 | <view class="name">{{ t.name }} |
| 78 | <text>报名限制条件:</text> | 78 | <view> |
| 79 | <text v-if="signRules[t.twoSubjectId]?.openFlag"> | 79 | <text class="text-danger">¥{{ t.price }}</text>人/次 |
| 80 | <text>等级</text><text>{{ signRules[t.twoSubjectId]?.name }}</text> | 80 | </view> |
| 81 | <text>段位</text><text>{{ signRules[t.twoSubjectId]?.duanStr }}</text> | 81 | </view> |
| 82 | <text>年限</text><text>{{ signRules[t.twoSubjectId]?.limitStr }}</text> | 82 | <view class="date"> |
| 83 | </text> | 83 | <text>报名限制条件:</text> |
| 84 | <text v-else> | 84 | <text v-if="openFlag && signRules[t.twoSubjectId]"> |
| 85 | -- | 85 | <text v-if="t.subjectType=='0'"> |
| 86 | </text> | 86 | <text>等级</text><text>{{ signRules[t.twoSubjectId]?.name }}、</text> |
| 87 | </view> | 87 | <text>段位</text><text>{{ signRules[t.twoSubjectId]?.duanStr }}、</text> |
| 88 | </view> | 88 | <text>年限</text><text>{{ signRules[t.twoSubjectId]?.limitStr }}</text> |
| 89 | </view> | 89 | </text> |
| 90 | </view> | 90 | <text v-else> |
| 91 | </view> | 91 | <text>等级</text><text>{{ signRules2[t.twoSubjectId]?.name }}</text> |
| 92 | 92 | </text> | |
| 93 | <view class="fixedBottom"> | 93 | </text> |
| 94 | <button class="btn btn-red-kx" @click="prev">上一步</button> | 94 | <text v-else> |
| 95 | <button class="btn btn-red" @click="submitForm">提交审核</button> | 95 | -- |
| 96 | </view> | 96 | </text> |
| 97 | </view> | ||
| 98 | </view> | ||
| 99 | </view> | ||
| 100 | </view> | ||
| 101 | </view> | ||
| 102 | |||
| 103 | <view class="fixedBottom"> | ||
| 104 | <button class="btn btn-red-kx" @click="prev">上一步</button> | ||
| 105 | <button class="btn btn-red" @click="submitForm">提交审核</button> | ||
| 106 | </view> | ||
| 97 | 107 | ||
| 98 | 108 | ||
| 99 | <!-- 线下支付 --> | 109 | <!-- 线下支付 --> |
| 100 | <uni-popup ref="bankShow" type="bottom" background-color="#fff"> | 110 | <uni-popup ref="bankShow" type="bottom" background-color="#fff"> |
| 101 | <view class="popupBody"> | 111 | <view class="popupBody"> |
| 102 | <view class="title">线下支付</view> | 112 | <view class="title">线下支付</view> |
| 103 | <view @click="copyPlat"> | 113 | <view @click="copyPlat"> |
| 104 | <view class="flexRow"> | 114 | <view class="flexRow"> |
| 105 | <label>单位名称</label> | 115 | <label>单位名称</label> |
| 106 | <view>{{ bankInfo.name}}</view> | 116 | <view>{{ bankInfo.name}}</view> |
| 107 | </view> | 117 | </view> |
| 108 | <view class="flexRow"> | 118 | <view class="flexRow"> |
| 109 | <label>开户行</label> | 119 | <label>开户行</label> |
| 110 | <view>{{bankInfo.bank}}</view> | 120 | <view>{{bankInfo.bank}}</view> |
| 111 | </view> | 121 | </view> |
| 112 | <view class="flexRow"> | 122 | <view class="flexRow"> |
| 113 | <label>账户</label> | 123 | <label>账户</label> |
| 114 | <view>{{ bankInfo.account }}</view> | 124 | <view>{{ bankInfo.account }}</view> |
| 115 | </view> | 125 | </view> |
| 116 | <view class="flexRow"> | 126 | <view class="flexRow"> |
| 117 | <label>打款金额</label> | 127 | <label>打款金额</label> |
| 118 | <view>{{totalAmount}}</view> | 128 | <view>{{totalAmount}}</view> |
| 119 | </view> | 129 | </view> |
| 120 | </view> | 130 | </view> |
| 121 | <button class="btn btn-red" @click="sure">确定</button> | 131 | <button class="btn btn-red" @click="sure">确定</button> |
| 122 | </view> | 132 | </view> |
| 123 | </uni-popup> | 133 | </uni-popup> |
| 124 | </template> | 134 | </template> |
| 125 | 135 | ||
| 126 | <script setup> | 136 | <script setup> |
| 127 | import { | 137 | import { |
| 128 | onLoad | 138 | onLoad |
| 129 | } from '@dcloudio/uni-app' | 139 | } from '@dcloudio/uni-app' |
| 130 | import _ from 'lodash' | 140 | import _ from 'lodash' |
| 131 | import { | 141 | import { |
| 132 | ref, | 142 | ref, |
| 133 | reactive, | 143 | reactive, |
| 134 | toRefs, | 144 | toRefs, |
| 135 | computed, | 145 | computed, |
| 136 | watch | 146 | watch, |
| 137 | } from 'vue' | 147 | onMounted |
| 138 | import * as train from '@/training/train.js' | 148 | } from 'vue' |
| 149 | import * as train from '@/training/train.js' | ||
| 139 | import trainListVue from '../trainList.vue'; | 150 | import trainListVue from '../trainList.vue'; |
| 140 | const data = reactive({ | 151 | |
| 141 | form: { | 152 | const data = reactive({ |
| 142 | trainIds: [], | 153 | form: { |
| 143 | examIds: [] | 154 | trainIds: [], |
| 144 | }, | 155 | examIds: [] |
| 145 | signRules: {}, | 156 | }, |
| 146 | bankShow: null, | 157 | signRules: {}, // 晋级 |
| 147 | totalAmount: null | 158 | signRules2: {}, // 复训 |
| 148 | }) | 159 | bankShow: null, |
| 149 | const { | 160 | totalAmount: null, |
| 150 | form, | 161 | openFlag:false |
| 151 | signRules, | 162 | }) |
| 152 | bankShow, | 163 | const { |
| 153 | totalAmount | 164 | form, |
| 154 | } = toRefs(data) | 165 | signRules, |
| 155 | const emit = defineEmits(['prev', 'publish']) | 166 | signRules2, |
| 156 | const props = defineProps({ | 167 | bankShow, |
| 157 | activity: { | 168 | totalAmount, |
| 158 | type: Object, | 169 | openFlag |
| 159 | default: () => {} | 170 | } = toRefs(data) |
| 160 | }, | 171 | |
| 161 | personal: { | 172 | |
| 162 | type: Object, | 173 | const emit = defineEmits(['prev', 'publish']) |
| 163 | default: () => {} | 174 | const props = defineProps({ |
| 164 | }, | 175 | activity: { |
| 165 | examList: { | 176 | type: Object, |
| 166 | type: Array, | 177 | default: () => {} |
| 167 | default: () => [] | 178 | }, |
| 168 | }, | 179 | personal: { |
| 169 | trainList: { | 180 | type: Object, |
| 170 | type: Array, | 181 | default: () => {} |
| 171 | default: () => [] | 182 | }, |
| 172 | }, | 183 | examList: { |
| 173 | trainId: { | 184 | type: Array, |
| 174 | type: String, | 185 | default: () => [] |
| 175 | default: () => {} | 186 | }, |
| 176 | } | 187 | trainList: { |
| 177 | }) | 188 | type: Array, |
| 178 | const bankInfo = computed(() => { | 189 | default: () => [] |
| 179 | if (props.activity.receivingInfo) { | 190 | }, |
| 180 | return JSON.parse(props.activity.receivingInfo) | 191 | trainId: { |
| 181 | } else { | 192 | type: String, |
| 182 | return {} | 193 | default: () => {} |
| 183 | } | 194 | }, |
| 184 | }) | 195 | active: { |
| 185 | onLoad(options => { | 196 | type: Number, |
| 186 | getRules() | 197 | default: 0 |
| 187 | }) | 198 | } |
| 188 | 199 | }) | |
| 189 | function getRules() { | 200 | const bankInfo = computed(() => { |
| 190 | Promise.all([ | 201 | if (props.activity.receivingInfo) { |
| 191 | train.getCoachRules(), | 202 | return JSON.parse(props.activity.receivingInfo) |
| 192 | train.getRefereeRules(), | 203 | } else { |
| 193 | train.getExaminerJiRules(), | 204 | return {} |
| 194 | train.getExaminerDuanRules() | 205 | } |
| 195 | ]).then((res) => { | 206 | }) |
| 196 | _.each(res, (r) => _.each(r.data, (d) => { | 207 | |
| 197 | signRules.value[d.id] = d | 208 | watch(() => props.active, (val) => { |
| 198 | })) | 209 | if (val == 3) { |
| 199 | }) | 210 | uni.showLoading({ |
| 200 | } | 211 | title:'加载中' |
| 201 | watch([() => Object.keys(signRules.value).length, () => props.trainList.length], (val) => { | 212 | }) |
| 202 | if (val[0] && val[1]) { | 213 | getRules().then(()=>{ |
| 203 | checkCanSign(props.trainList, 1) | 214 | uni.hideLoading() |
| 204 | checkCanSign(props.examList, 2) | 215 | }) |
| 205 | 216 | } | |
| 206 | // 考试关联培训 | 217 | }) |
| 207 | fillRelateTrain() | 218 | |
| 208 | checkRelateTrain() | 219 | |
| 209 | } | 220 | |
| 210 | }) | 221 | function getRules() { |
| 211 | 222 | return train.getAllRules(props.trainId).then((res) => { | |
| 212 | function checkCanSign(list, flag) { | 223 | openFlag.value = res.data.openFlag |
| 213 | _.each(list, (l) => { | 224 | _.each(res.data.rules, (r) => { |
| 214 | if (l.requiredFlag == '1') { | 225 | // 晋级 |
| 215 | l.required = true | 226 | if (r.subjectType == '0') { |
| 216 | l.checked = true | 227 | _.each(r.list, (l) => { |
| 217 | switch (flag) { | 228 | signRules.value[l.id] = l |
| 218 | case 1: // 培训 | 229 | }) |
| 219 | form.value.trainIds.push(l.id) | 230 | } |
| 220 | break | 231 | // 复训 |
| 221 | case 2: // 考试 | 232 | else { |
| 222 | form.value.examIds.push(l.id) | 233 | _.each(r.list, (l) => { |
| 223 | break | 234 | signRules2.value[l.id] = l |
| 224 | } | 235 | }) |
| 225 | } | 236 | } |
| 226 | if (l.twoSubjectId && signRules.value[l.twoSubjectId.toString()]) { | 237 | }) |
| 227 | const rule = signRules.value[l.twoSubjectId] | 238 | }) |
| 228 | // 有报名条件 | 239 | } |
| 229 | if (rule.openFlag) { | 240 | |
| 230 | let currLevel, currYear | 241 | watch([() => { |
| 231 | const currDuan = parseInt(props.personal.levelDuan || 0) | 242 | return Object.keys(signRules.value).length || Object.keys(signRules2.value).length |
| 232 | switch (l.parentSubjectId) { | 243 | }, () => props.trainList.length], (val) => { |
| 233 | case 100: // 教练 | 244 | if (val[0] && val[1]) { |
| 234 | currLevel = parseInt(props.personal.coachLabel?.type || 0) | 245 | checkCanSign(props.trainList, 1) |
| 235 | currYear = parseInt(props.personal.coachLabel?.yearLimit || 0) | 246 | checkCanSign(props.examList, 2) |
| 236 | if (!(currLevel >= parseInt(rule.type) && currDuan >= parseInt(rule.duan) && | 247 | |
| 237 | currYear >= parseInt(rule.limit))) { | 248 | // 考试关联培训 |
| 238 | l.disabled = true | 249 | fillRelateTrain() |
| 239 | } | 250 | checkRelateTrain() |
| 240 | break | 251 | } |
| 241 | case 200: // 裁判 | 252 | }) |
| 242 | currLevel = parseInt(props.personal.refereeLabel?.type || 0) | 253 | |
| 243 | currYear = parseInt(props.personal.refereeLabel?.yearLimit || 0) | 254 | |
| 244 | if (!(currLevel >= parseInt(rule.type) && currDuan >= parseInt(rule.duan) && | 255 | function checkCanSign(list, flag) { |
| 245 | currYear >= parseInt(rule.limit))) { | 256 | _.each(list, (l) => { |
| 246 | l.disabled = true | 257 | l.required = false |
| 247 | } | 258 | if (l.requiredFlag == '1') { |
| 248 | break | 259 | l.required = true |
| 249 | case 300: // 晋级 | 260 | switch (flag) { |
| 250 | if (!(currDuan >= parseInt(rule.duan))) { | 261 | case 1:// 培训 |
| 251 | l.disabled = true | 262 | form.value.trainIds.push(l.id) |
| 252 | } | 263 | break |
| 253 | break | 264 | case 2:// 考试 |
| 254 | case 400: // 晋段 | 265 | form.value.examIds.push(l.id) |
| 255 | currLevel = parseInt(props.personal.examinerDuanLabel?.type || 0) | 266 | break |
| 256 | if (!(currLevel >= parseInt(rule.type) && currDuan >= parseInt(rule.duan))) { | 267 | } |
| 257 | l.disabled = true | 268 | } |
| 258 | } | 269 | |
| 259 | break | 270 | if (openFlag.value) { |
| 260 | } | 271 | let rule, currLevel, currYear, currDuan |
| 261 | } | 272 | l.disabled = false |
| 262 | } | 273 | // 晋级 |
| 263 | }) | 274 | if (l.subjectType == '0') { |
| 264 | } | 275 | if (l.twoSubjectId && signRules.value[l.twoSubjectId.toString()]) { |
| 265 | 276 | rule = signRules.value[l.twoSubjectId] | |
| 266 | function fillRelateTrain() { | 277 | currDuan = parseInt(props.personal.levelDuan || 0) |
| 267 | _.each(props.examList, (e) => { | 278 | |
| 268 | if (e.relateTrainIds) { | 279 | switch (l.parentSubjectId) { |
| 269 | const trainNames = [] | 280 | case 100:// 教练 |
| 270 | _.each(e.relateTrainIds.split(','), (id) => { | 281 | currLevel = parseInt(props.personal.coachLabel?.type || 0) |
| 271 | const train = _.find(props.trainList, (t) => t.id == id) | 282 | currYear = parseInt(props.personal.coachLabel?.yearLimit || 0) |
| 272 | trainNames.push(train?.name || '关联错误的培训') | 283 | if (!(currLevel >= parseInt(rule.type) && currDuan >= parseInt(rule.duan) && currYear >= parseInt(rule.limit))) { |
| 273 | }) | 284 | l.disabled = true |
| 274 | e.relateTrainNames = trainNames.join(',') | 285 | } |
| 275 | } | 286 | break |
| 276 | }) | 287 | case 200:// 裁判 |
| 277 | } | 288 | currLevel = parseInt(props.personal.refereeLabel?.type || 0) |
| 278 | 289 | currYear = parseInt(props.personal.refereeLabel?.yearLimit || 0) | |
| 279 | function checkRelateTrain() { | 290 | if (!(currLevel >= parseInt(rule.type) && currDuan >= parseInt(rule.duan) && currYear >= parseInt(rule.limit))) { |
| 280 | _.each(props.examList, (e) => { | 291 | l.disabled = true |
| 281 | e.passRelate = true | 292 | } |
| 282 | if (e.relateTrainIds) { | 293 | break |
| 283 | if (_.some(e.relateTrainIds.split(','), (id) => form.value.trainIds.indexOf(id) == -1)) { | 294 | case 300:// 晋级 |
| 284 | e.passRelate = false | 295 | if (!(currDuan >= parseInt(rule.duan))) { |
| 285 | } | 296 | l.disabled = true |
| 286 | } | 297 | } |
| 287 | }) | 298 | break |
| 288 | } | 299 | case 400:// 晋段 |
| 289 | 300 | currLevel = parseInt(props.personal.examinerDuanLabel?.type || 0) | |
| 290 | function submitForm() { | 301 | if (!(currLevel >= parseInt(rule.type) && currDuan >= parseInt(rule.duan))) { |
| 291 | console.log(form.value) | 302 | l.disabled = true |
| 292 | if (form.value.trainIds.length == 0) { | 303 | } |
| 293 | uni.showToast({ | 304 | break |
| 294 | title: '请选择培训科目', | 305 | case 500:// 培训讲师 |
| 295 | icon: 'none' | 306 | if (!(currDuan >= parseInt(rule.duan))) { |
| 296 | }) | 307 | l.disabled = true |
| 297 | return | 308 | } |
| 298 | } | 309 | break |
| 299 | 310 | } | |
| 300 | if (_.some(form.value.trainIds, (id) => { | 311 | } |
| 301 | const train = _.find(props.trainList, (t) => t.id == id) | 312 | } |
| 302 | return train.disabled | 313 | // 复训 |
| 303 | })) { | 314 | else { |
| 304 | uni.showToast({ | 315 | if (l.twoSubjectId && signRules2.value[l.twoSubjectId.toString()]) { |
| 305 | title: '选中了不满足报名条件的培训科目', | 316 | rule = signRules2.value[l.twoSubjectId] |
| 306 | icon: 'none' | 317 | |
| 307 | }) | 318 | switch (l.parentSubjectId) { |
| 308 | return | 319 | case 100:// 教练 |
| 309 | } | 320 | currLevel = parseInt(props.personal.coachLabel?.type || 0) |
| 310 | 321 | break | |
| 311 | if (_.some(form.value.examIds, (id) => { | 322 | case 200:// 裁判 |
| 312 | const exam = _.find(props.examList, (t) => t.id == id) | 323 | currLevel = parseInt(props.personal.refereeLabel?.type || 0) |
| 313 | return exam.disabled || !exam.passRelate | 324 | break |
| 314 | })) { | 325 | case 300:// 晋级 |
| 315 | uni.showToast({ | 326 | currLevel = parseInt(props.personal.examinerJiLabel?.type || 0) |
| 316 | title: '选中了不满足报名条件的考试科目', | 327 | break |
| 317 | icon: 'none' | 328 | case 400:// 晋段 |
| 318 | }) | 329 | currLevel = parseInt(props.personal.examinerDuanLabel?.type || 0) |
| 319 | return | 330 | break |
| 320 | } | 331 | case 500:// 培训讲师 |
| 321 | 332 | currLevel = parseInt(props.personal.lecturerLabel?.type || 0) | |
| 322 | let amount = _.chain(props.trainList) | 333 | break |
| 323 | .filter((t) => form.value.trainIds.indexOf(t.id) > -1) | 334 | } |
| 324 | .sumBy((t) => parseFloat(t.price)) | 335 | |
| 325 | .valueOf() | 336 | if (currLevel < parseInt(rule.type)) { |
| 326 | 337 | l.disabled = true | |
| 327 | amount += _.chain(props.examList) | 338 | } |
| 328 | .filter((e) => form.value.examIds.indexOf(e.id) > -1) | 339 | } |
| 329 | .sumBy((e) => parseFloat(e.price)) | 340 | } |
| 330 | .valueOf() | 341 | } |
| 331 | 342 | }) | |
| 332 | totalAmount.value = amount.toFixed(2) | 343 | } |
| 333 | if(totalAmount.value > 0){ | 344 | |
| 334 | bankShow.value.open() | 345 | function fillRelateTrain() { |
| 335 | } else { | 346 | _.each(props.examList, (e) => { |
| 336 | sure() | 347 | if (e.relateTrainIds) { |
| 337 | } | 348 | const trainNames = [] |
| 338 | } | 349 | _.each(e.relateTrainIds.split(','), (id) => { |
| 339 | 350 | const train = _.find(props.trainList, (t) => t.id == id) | |
| 340 | function sure() { | 351 | trainNames.push(train?.name || '关联错误的培训') |
| 341 | form.value.activityId = props.trainId | 352 | }) |
| 342 | train.commitSign(form.value).then(() => { | 353 | e.relateTrainNames = trainNames.join(',') |
| 343 | uni.showToast({ | 354 | } |
| 344 | title: '提交成功,等待审核', | 355 | }) |
| 345 | icon: 'none' | 356 | } |
| 346 | }) | 357 | |
| 347 | emit('publish') | 358 | function checkRelateTrain() { |
| 348 | }) | 359 | _.each(props.examList, (e) => { |
| 349 | } | 360 | e.passRelate = true |
| 350 | 361 | if (e.relateTrainIds) { | |
| 351 | function prev() { | 362 | if (_.some(e.relateTrainIds.split(','), (id) => form.value.trainIds.indexOf(id) == -1)) { |
| 352 | emit('prev') | 363 | e.passRelate = false |
| 353 | } | 364 | } |
| 354 | 365 | } | |
| 355 | function szToHz(num) { | 366 | }) |
| 356 | const hzArr = ['〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'] | 367 | } |
| 357 | return hzArr[parseInt(num)] | 368 | |
| 358 | } | 369 | function submitForm() { |
| 359 | 370 | if (form.value.trainIds.length == 0) { | |
| 360 | function changeTrainIds(item) { | 371 | uni.showToast({ |
| 361 | if(item.disabled||item.required){ | 372 | title: '请选择培训科目', |
| 362 | return | 373 | icon: 'none' |
| 363 | } | 374 | }) |
| 364 | if(item.checked){ | 375 | return |
| 365 | item.checked = false | 376 | } |
| 366 | if(form.value.trainIds.indexOf(item.id)>-1){ | 377 | |
| 367 | _.pull(form.value.trainIds, item.id) | 378 | if (_.some(form.value.trainIds, (id) => { |
| 368 | } | 379 | const train = _.find(props.trainList, (t) => t.id == id) |
| 369 | } else { | 380 | return train.disabled |
| 370 | item.checked = true | 381 | })) { |
| 371 | form.value.trainIds.push(item.id) | 382 | uni.showToast({ |
| 372 | console.log(form.value.trainIds) | 383 | title: '选中了不满足报名条件的培训科目', |
| 373 | } | 384 | icon: 'none' |
| 374 | } | 385 | }) |
| 375 | 386 | return | |
| 376 | function changeExamIds(item) { | 387 | } |
| 377 | if(item.disabled||item.required){ | 388 | |
| 378 | return | 389 | if (_.some(form.value.examIds, (id) => { |
| 379 | } | 390 | const exam = _.find(props.examList, (t) => t.id == id) |
| 380 | if(item.checked){ | 391 | return exam.disabled || !exam.passRelate |
| 381 | item.checked = false | 392 | })) { |
| 382 | if(form.value.examIds.indexOf(item.id)>-1){ | 393 | uni.showToast({ |
| 383 | _.pull(form.value.examIds, item.id) | 394 | title: '选中了不满足报名条件的考试科目', |
| 384 | } | 395 | icon: 'none' |
| 385 | } else { | 396 | }) |
| 386 | item.checked = true | 397 | return |
| 387 | form.value.examIds.push(item.id) | 398 | } |
| 388 | console.log(form.value.examIds) | 399 | |
| 389 | } | 400 | let amount = _.chain(props.trainList) |
| 390 | } | 401 | .filter((t) => form.value.trainIds.indexOf(t.id) > -1) |
| 391 | function copyPlat(){ | 402 | .sumBy((t) => parseFloat(t.price)) |
| 392 | let str = `单位名称:${bankInfo.value.name};开户行:${bankInfo.value.bank};账户:${bankInfo.value.account};打款金额:${totalAmount.value};`; | 403 | .valueOf() |
| 393 | uni.setClipboardData({ | 404 | |
| 394 | data: str, | 405 | amount += _.chain(props.examList) |
| 395 | success: function() { | 406 | .filter((e) => form.value.examIds.indexOf(e.id) > -1) |
| 396 | uni.showToast({ | 407 | .sumBy((e) => parseFloat(e.price)) |
| 397 | title: '已复制', | 408 | .valueOf() |
| 398 | icon: 'none' | 409 | |
| 399 | }) | 410 | totalAmount.value = amount.toFixed(2) |
| 400 | } | 411 | if(totalAmount.value > 0){ |
| 401 | }); | 412 | bankShow.value.open() |
| 402 | } | 413 | } else { |
| 414 | sure() | ||
| 415 | } | ||
| 416 | } | ||
| 417 | |||
| 418 | function sure() { | ||
| 419 | form.value.activityId = props.trainId | ||
| 420 | train.commitSign(form.value).then(() => { | ||
| 421 | uni.showToast({ | ||
| 422 | title: '提交成功,等待审核', | ||
| 423 | icon: 'none' | ||
| 424 | }).then(()=>{ | ||
| 425 | setTimeout(()=>{ | ||
| 426 | emit('publish') | ||
| 427 | },1000) | ||
| 428 | }) | ||
| 429 | }) | ||
| 430 | } | ||
| 431 | |||
| 432 | function prev() { | ||
| 433 | emit('prev') | ||
| 434 | } | ||
| 435 | |||
| 436 | function szToHz(num) { | ||
| 437 | const hzArr = ['〇', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'] | ||
| 438 | return hzArr[parseInt(num)] | ||
| 439 | } | ||
| 440 | |||
| 441 | function changeTrainIds(item) { | ||
| 442 | if(item.disabled||item.required){ | ||
| 443 | return | ||
| 444 | } | ||
| 445 | if(item.checked){ | ||
| 446 | item.checked = false | ||
| 447 | if(form.value.trainIds.indexOf(item.id)>-1){ | ||
| 448 | _.pull(form.value.trainIds, item.id) | ||
| 449 | } | ||
| 450 | } else { | ||
| 451 | item.checked = true | ||
| 452 | form.value.trainIds.push(item.id) | ||
| 453 | console.log(form.value.trainIds) | ||
| 454 | } | ||
| 455 | } | ||
| 456 | |||
| 457 | function changeExamIds(item) { | ||
| 458 | if(item.disabled||item.required){ | ||
| 459 | return | ||
| 460 | } | ||
| 461 | if(item.checked){ | ||
| 462 | item.checked = false | ||
| 463 | if(form.value.examIds.indexOf(item.id)>-1){ | ||
| 464 | _.pull(form.value.examIds, item.id) | ||
| 465 | } | ||
| 466 | } else { | ||
| 467 | item.checked = true | ||
| 468 | form.value.examIds.push(item.id) | ||
| 469 | console.log(form.value.examIds) | ||
| 470 | } | ||
| 471 | } | ||
| 472 | function copyPlat(){ | ||
| 473 | let str = `单位名称:${bankInfo.value.name};开户行:${bankInfo.value.bank};账户:${bankInfo.value.account};打款金额:${totalAmount.value};`; | ||
| 474 | uni.setClipboardData({ | ||
| 475 | data: str, | ||
| 476 | success: function() { | ||
| 477 | uni.showToast({ | ||
| 478 | title: '已复制', | ||
| 479 | icon: 'none' | ||
| 480 | }) | ||
| 481 | } | ||
| 482 | }); | ||
| 483 | } | ||
| 403 | 484 | ||
| 404 | </script> | 485 | </script> |
| 405 | 486 | ... | ... |
| ... | @@ -2,20 +2,20 @@ import request from '@/common/request.js' | ... | @@ -2,20 +2,20 @@ import request from '@/common/request.js' |
| 2 | import config from '@/config.js' | 2 | import config from '@/config.js' |
| 3 | // 获取培训列表 | 3 | // 获取培训列表 |
| 4 | export function getTrainList(params) { | 4 | export function getTrainList(params) { |
| 5 | return request({ | 5 | return request({ |
| 6 | url: `${config.trainUrl_api}/webPc/getTrains`, | 6 | url: `${config.trainUrl_api}/webPc/getTrains`, |
| 7 | method: 'get', | 7 | method: 'get', |
| 8 | params: params | 8 | params: params |
| 9 | }) | 9 | }) |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | // 查看培训项目 | 12 | // 查看培训项目 |
| 13 | export function getTrainDetail(id) { | 13 | export function getTrainDetail(id) { |
| 14 | return request({ | 14 | return request({ |
| 15 | url: `${config.trainUrl_api}/webPc/getTrainDetails`, | 15 | url: `${config.trainUrl_api}/webPc/getTrainDetails`, |
| 16 | method: 'get', | 16 | method: 'get', |
| 17 | params: {id} | 17 | params: { id } |
| 18 | }) | 18 | }) |
| 19 | } | 19 | } |
| 20 | export function getPersonalInfo() { | 20 | export function getPersonalInfo() { |
| 21 | return request({ | 21 | return request({ |
| ... | @@ -89,4 +89,13 @@ export function commitSign(data) { | ... | @@ -89,4 +89,13 @@ export function commitSign(data) { |
| 89 | method: 'put', | 89 | method: 'put', |
| 90 | params: data | 90 | params: data |
| 91 | }) | 91 | }) |
| 92 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 92 | } | ||
| 93 | |||
| 94 | |||
| 95 | export function getAllRules(id) { | ||
| 96 | return request({ | ||
| 97 | url: `${config.trainUrl_api}/train/activity/getAllRules`, | ||
| 98 | method: 'get', | ||
| 99 | params: { id } | ||
| 100 | }) | ||
| 101 | } | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view class="pd20"> | 2 | <view class="pd20"> |
| 3 | <uni-steps :options="steps" active-icon="checkmarkempty" :active="active" /> | 3 | <uni-steps :options="steps" active-icon="checkmarkempty" :active="active" /> |
| 4 | </view> | 4 | </view> |
| 5 | <view class="hasfixedbottom"> | 5 | <view class="hasfixedbottom"> |
| 6 | <view class="wpage"> | 6 | <view class="wpage"> |
| 7 | <step1 v-show="active==0" @prev="prev" @next="next" :activity="activity" /> | 7 | <step1 v-show="active==0" @prev="prev" @next="next" :activity="activity" /> |
| 8 | <step2 v-show="active==1" @prev="prev" @next="next" :personal="personal" /> | 8 | <step2 v-show="active==1" @prev="prev" @next="next" :personal="personal" /> |
| 9 | <step3 v-show="active==2" @prev="prev" @next="next" :activity="activity" :trainId="trainId" | 9 | <step3 v-show="active==2" @prev="prev" @next="next" :activity="activity" :trainId="trainId" |
| 10 | :active="active" /> | 10 | :active="active" /> |
| 11 | <step4 v-show="active==3" @prev="prev" @publish="publish" :personal="personal" :activity="activity" | 11 | <step4 v-show="active==3" @prev="prev" @publish="publish" :personal="personal" :activity="activity" |
| 12 | :exam-list="examList" :train-list="trainList" :trainId="trainId"/> | 12 | :exam-list="examList" :train-list="trainList" :trainId="trainId" :active="active"/> |
| 13 | </view> | 13 | </view> |
| 14 | </view> | 14 | </view> |
| 15 | 15 | ||
| 16 | </template> | 16 | </template> |
| 17 | 17 | ||
| 18 | <script setup> | 18 | <script setup> |
| 19 | import { | 19 | import { |
| 20 | onLoad | 20 | onLoad |
| 21 | } from '@dcloudio/uni-app' | 21 | } from '@dcloudio/uni-app' |
| 22 | import { | 22 | import { |
| 23 | ref, | 23 | ref, |
| 24 | reactive, | 24 | reactive, |
| 25 | toRefs | 25 | toRefs |
| 26 | } from 'vue' | 26 | } from 'vue' |
| 27 | import * as train from '@/training/train.js' | 27 | import * as train from '@/training/train.js' |
| 28 | import step1 from '@/training/components/step1' | 28 | import step1 from '@/training/components/step1' |
| 29 | import step2 from '@/training/components/step2' | 29 | import step2 from '@/training/components/step2' |
| 30 | import step3 from '@/training/components/step3' | 30 | import step3 from '@/training/components/step3' |
| 31 | import step4 from '@/training/components/step4' | 31 | import step4 from '@/training/components/step4' |
| 32 | const active = ref(0) | 32 | const active = ref(0) |
| 33 | 33 | ||
| 34 | const steps = ref([{ | 34 | const steps = ref([{ |
| 35 | title: '报名须知' | 35 | title: '报名须知' |
| 36 | }, { | 36 | }, { |
| 37 | title: '个人信息完善' | 37 | title: '个人信息完善' |
| 38 | }, { | 38 | }, { |
| 39 | title: '培训信息完善' | 39 | title: '培训信息完善' |
| 40 | }, { | 40 | }, { |
| 41 | title: '培训考试选择' | 41 | title: '培训考试选择' |
| 42 | }]) | 42 | }]) |
| 43 | 43 | ||
| 44 | const data = reactive({ | 44 | const data = reactive({ |
| 45 | activity: {}, | 45 | activity: {}, |
| 46 | examList: [], | 46 | examList: [], |
| 47 | trainList: [], | 47 | trainList: [], |
| 48 | personal: {}, | 48 | personal: {}, |
| 49 | trainId: '' | 49 | trainId: '' |
| 50 | }) | 50 | }) |
| 51 | const { | 51 | const { |
| 52 | activity, | 52 | activity, |
| 53 | examList, | 53 | examList, |
| 54 | trainList, | 54 | trainList, |
| 55 | personal, | 55 | personal, |
| 56 | trainId | 56 | trainId |
| 57 | } = toRefs(data) | 57 | } = toRefs(data) |
| 58 | onLoad(options => { | 58 | onLoad(options => { |
| 59 | active.value = options.step || 0 | 59 | active.value = options.step || 0 |
| 60 | trainId.value = options.id | 60 | trainId.value = options.id |
| 61 | train.getTrainDetail(trainId.value).then((res) => { | 61 | train.getTrainDetail(trainId.value).then((res) => { |
| 62 | activity.value = res.data.activity | 62 | activity.value = res.data.activity |
| 63 | examList.value = res.data.examVoList | 63 | examList.value = res.data.examVoList |
| 64 | trainList.value = res.data.subjectTrainList | 64 | trainList.value = res.data.subjectTrainList |
| 65 | 65 | ||
| 66 | if (activity.value.signNoticeAttachment) { | 66 | if (activity.value.signNoticeAttachment) { |
| 67 | activity.value.signNoticeAttachment = JSON.parse(activity.value.signNoticeAttachment)[0] | 67 | activity.value.signNoticeAttachment = JSON.parse(activity.value.signNoticeAttachment)[0] |
| 68 | } | 68 | } |
| 69 | }) | 69 | }) |
| 70 | 70 | ||
| 71 | train.getPersonalInfo().then((res) => { | 71 | train.getPersonalInfo().then((res) => { |
| 72 | personal.value = res.data || {} | 72 | personal.value = res.data || {} |
| 73 | }) | 73 | }) |
| 74 | }) | 74 | }) |
| 75 | 75 | ||
| 76 | function next() { | 76 | function next() { |
| 77 | active.value++ | 77 | active.value++ |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | function prev() { | 80 | function prev() { |
| 81 | active.value-- | 81 | active.value-- |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | function publish() { | 84 | function publish() { |
| 85 | uni.redirectTo({ | 85 | uni.redirectTo({ |
| 86 | url: `/training/trainList` | 86 | url: `/training/trainList` |
| 87 | }); | 87 | }); |
| 88 | } | 88 | } |
| 89 | </script> | 89 | </script> |
| 90 | 90 | ||
| 91 | <style scoped lang="scss"> | 91 | <style scoped lang="scss"> | ... | ... |
-
Please register or sign in to post a comment