更新证书
Showing
1 changed file
with
305 additions
and
188 deletions
| 1 | <template> | ||
| 2 | <view> | ||
| 3 | <view class="searchbar"> | ||
| 4 | <uni-easyinput placeholderStyle="font-size:30rpx" :input-border="false" prefixIcon="search" | ||
| 5 | v-model="queryParams.name" placeholder="搜索姓名" @blur="getList()" @clear="getList()"> | ||
| 6 | </uni-easyinput> | ||
| 7 | </view> | ||
| 8 | <view class="indexboxre" style="height: calc(100vh - 180rpx)"> | ||
| 9 | <view class="userlist"> | ||
| 10 | <view class="item" v-for="n in list" :key="n.id"> | ||
| 11 | <view class="w100"> | ||
| 12 | <view class="status"> | ||
| 13 | <text class="text-success" v-if="n.isCert == '1' ">已发送</text> | ||
| 14 | <text class="text-warning" v-else>未发送</text> | ||
| 15 | </view> | ||
| 16 | <view class="name">{{n.realName}}</view> | ||
| 17 | <view class="date"> | ||
| 18 | 所属团体: {{n.memName}} | ||
| 19 | </view> | ||
| 20 | |||
| 21 | <view class="flexbox mtb30"> | ||
| 22 | <view> | ||
| 23 | 会员有效期 | ||
| 24 | <text>{{n.vaildityDate?.slice(0,10)}}</text> | ||
| 25 | </view> | ||
| 26 | <view class="w50">{{queryParams.type=='1'?'级位':'段位'}} | ||
| 27 | <text> | ||
| 28 | {{ szToHz(n.levelNew) }}{{ queryParams.type=='1'?'级':'段/品' }} | ||
| 29 | </text> | ||
| 30 | </view> | ||
| 31 | </view> | ||
| 32 | |||
| 33 | <div class="func"> | ||
| 34 | <button @click="sendCert(n)">{{ ['发送证书','更新证书'][n.isCert] }}</button> | ||
| 35 | </div> | ||
| 36 | </view> | ||
| 37 | </view> | ||
| 38 | </view> | ||
| 39 | |||
| 40 | </view> | ||
| 41 | |||
| 42 | </view> | ||
| 43 | </template> | ||
| 44 | |||
| 45 | <script setup> | ||
| 46 | import * as api from '@/common/api.js' | ||
| 47 | import config from '@/config.js' | ||
| 48 | import { | ||
| 49 | szToHz | ||
| 50 | } from '@/common/utils.js' | ||
| 51 | import { | ||
| 52 | ref, | ||
| 53 | getCurrentInstance | ||
| 54 | } from 'vue' | ||
| 55 | import { | ||
| 56 | onLoad | ||
| 57 | } from '@dcloudio/uni-app' | ||
| 58 | const { | ||
| 59 | proxy | ||
| 60 | } = getCurrentInstance() | ||
| 61 | const app = getApp(); | ||
| 62 | const queryParams = ref({}) | ||
| 63 | const list = ref([]) | ||
| 64 | const total = ref(0) | ||
| 65 | const userType = ref('') | ||
| 66 | onLoad((option) => { | ||
| 67 | queryParams.value.examId = option.examId | ||
| 68 | queryParams.value.payId = option.payId | ||
| 69 | queryParams.value.type = option.type | ||
| 70 | getList() | ||
| 71 | }) | ||
| 72 | |||
| 73 | function getList() { | ||
| 74 | uni.showLoading({ | ||
| 75 | title: '加载中' | ||
| 76 | }) | ||
| 77 | if (queryParams.value.name == '') { | ||
| 78 | delete queryParams.value.name | ||
| 79 | } | ||
| 80 | api.certStudentList(queryParams.value).then(res => { | ||
| 81 | list.value = res.rows | ||
| 82 | uni.hideLoading() | ||
| 83 | }) | ||
| 84 | } | ||
| 85 | function checkCert(row){ | ||
| 86 | return api.checkPersonByPersonId(row.perId).then(res => { | ||
| 87 | if (!res.data) { | ||
| 88 | uni.showModal({ | ||
| 89 | title: '提示', | ||
| 90 | content:'该学员没有照片,无法生成证书!', | ||
| 91 | success: () => {} | ||
| 92 | }) | ||
| 93 | return Promise.reject() | ||
| 94 | } | ||
| 95 | }) | ||
| 96 | } | ||
| 97 | function sendCert(row) { | ||
| 98 | let msg | ||
| 99 | if (row.isCert == 1) { | ||
| 100 | msg = `更新` | ||
| 101 | } else { | ||
| 102 | msg = `下发` | ||
| 103 | } | ||
| 104 | checkCert(row).then(() => { | ||
| 105 | uni.showModal({ | ||
| 106 | title: '提示', | ||
| 107 | content: `确定${msg}${row.realName}的证书吗`, | ||
| 108 | success: function(res) { | ||
| 109 | if (res.confirm) { | ||
| 110 | const params = [{ | ||
| 111 | id: queryParams.value.payId, | ||
| 112 | children: [{ | ||
| 113 | id: queryParams.value.examId, | ||
| 114 | children: [row.id] | ||
| 115 | }] | ||
| 116 | }] | ||
| 117 | |||
| 118 | api.submitCert2(params).then(res => { | ||
| 119 | uni.showToast({ | ||
| 120 | title: `下发成功` | ||
| 121 | }) | ||
| 122 | getList() | ||
| 123 | }) | ||
| 124 | } | ||
| 125 | } | ||
| 126 | }) | ||
| 127 | }) | ||
| 128 | } | ||
| 129 | |||
| 130 | |||
| 131 | function handleImport() { | ||
| 132 | var arr = [] | ||
| 133 | for (var n of list.value) { | ||
| 134 | if (n.checked) { | ||
| 135 | arr.push(n.perId) | ||
| 136 | } | ||
| 137 | } | ||
| 138 | if (arr.length == 0) { | ||
| 139 | uni.showToast({ | ||
| 140 | title: "请选择会员", | ||
| 141 | icon: "none" | ||
| 142 | }) | ||
| 143 | return | ||
| 144 | } | ||
| 145 | api.addPersonPaymentGroup({ | ||
| 146 | rangeId: queryParams.value.paymentRangeId, | ||
| 147 | personIdArray: arr.join(',') | ||
| 148 | }).then(res => { | ||
| 149 | let path = `/personalVip/renew?rangeId=${res.data.rangeId}` | ||
| 150 | uni.redirectTo({ | ||
| 151 | url: path | ||
| 152 | }); | ||
| 153 | }) | ||
| 154 | } | ||
| 155 | </script> | ||
| 156 | |||
| 157 | <style scoped lang="scss"> | ||
| 158 | .indexboxre { | ||
| 159 | padding: 0 30rpx; | ||
| 160 | |||
| 161 | .tt { | ||
| 162 | font-size: 30rpx; | ||
| 163 | margin: 0 0 30rpx; | ||
| 164 | color: #4C5359; | ||
| 165 | } | ||
| 166 | |||
| 167 | position: relative; | ||
| 168 | height: calc(100vh - 280rpx); | ||
| 169 | overflow: auto; | ||
| 170 | } | ||
| 171 | |||
| 172 | .searchbar { | ||
| 173 | display: flex; | ||
| 174 | align-items: center; | ||
| 175 | padding: 25rpx; | ||
| 176 | box-sizing: border-box; | ||
| 177 | |||
| 178 | :deep(.uni-easyinput .uni-easyinput__content) { | ||
| 179 | border-radius: 35rpx; | ||
| 180 | border: none; | ||
| 181 | height: 70rpx; | ||
| 182 | } | ||
| 183 | |||
| 184 | :deep(.uni-easyinput__content-input) { | ||
| 185 | font-size: 26rpx; | ||
| 186 | } | ||
| 187 | } | ||
| 188 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <template> | ||
| 2 | <view> | ||
| 3 | <view class="searchbar"> | ||
| 4 | <uni-easyinput placeholderStyle="font-size:30rpx" :input-border="false" prefixIcon="search" | ||
| 5 | v-model="queryParams.name" placeholder="搜索姓名" @blur="getList()" @clear="getList()"> | ||
| 6 | </uni-easyinput> | ||
| 7 | </view> | ||
| 8 | <view class="indexboxre" style="height: calc(100vh - 180rpx)"> | ||
| 9 | <view class="userlist"> | ||
| 10 | <view class="item" v-for="n in list" :key="n.id"> | ||
| 11 | <view class="w100"> | ||
| 12 | <view class="status"> | ||
| 13 | <text class="text-success" v-if="n.isCert == '1'">已发送</text> | ||
| 14 | <text class="text-warning" v-else-if="n.isCert == '0'">未发送</text> | ||
| 15 | <text class="text-primary" v-else>生成中</text> | ||
| 16 | </view> | ||
| 17 | <view class="name">{{n.realName}}</view> | ||
| 18 | <view class="date"> | ||
| 19 | 所属团体: {{n.memName}} | ||
| 20 | </view> | ||
| 21 | |||
| 22 | <view class="flexbox mtb30"> | ||
| 23 | <view> | ||
| 24 | 会员有效期 | ||
| 25 | <text>{{n.vaildityDate?.slice(0,10)}}</text> | ||
| 26 | </view> | ||
| 27 | <view class="w50">{{queryParams.type=='1'?'级位':'段位'}} | ||
| 28 | <text> | ||
| 29 | {{ szToHz(n.levelNew) }}{{ queryParams.type=='1'?'级':'段/品' }} | ||
| 30 | </text> | ||
| 31 | </view> | ||
| 32 | </view> | ||
| 33 | |||
| 34 | <view class="func"> | ||
| 35 | <button :disabled="!(n.isCert == '0' || n.isCert == '1')" @click="sendCert(n)">{{ n.isCert == '1' ? '更新证书' : '发送证书' }}</button> | ||
| 36 | </view> | ||
| 37 | </view> | ||
| 38 | </view> | ||
| 39 | </view> | ||
| 40 | |||
| 41 | </view> | ||
| 42 | |||
| 43 | <!-- 证书操作提示弹层 --> | ||
| 44 | <uni-popup ref="certPopup" type="center" :is-mask-click="false"> | ||
| 45 | <view class="cert-dialog"> | ||
| 46 | <view class="cert-dialog__head"> | ||
| 47 | <uni-icons type="info-filled" size="24" color="#FAAD14" /> | ||
| 48 | <view class="cert-dialog__title">{{ popupTitle }}</view> | ||
| 49 | </view> | ||
| 50 | <view class="cert-dialog__content">{{ popupContent }}</view> | ||
| 51 | <view class="cert-dialog__btns"> | ||
| 52 | <view | ||
| 53 | v-if="!popupIsAlert" | ||
| 54 | class="cert-dialog__btn cert-dialog__btn--cancel" | ||
| 55 | @click="onPopupCancel" | ||
| 56 | >取消</view> | ||
| 57 | <view | ||
| 58 | class="cert-dialog__btn cert-dialog__btn--sure" | ||
| 59 | @click="onPopupSure" | ||
| 60 | >{{ popupBtnText }}</view> | ||
| 61 | </view> | ||
| 62 | </view> | ||
| 63 | </uni-popup> | ||
| 64 | </view> | ||
| 65 | </template> | ||
| 66 | |||
| 67 | <script setup> | ||
| 68 | import * as api from '@/common/api.js' | ||
| 69 | import config from '@/config.js' | ||
| 70 | import { | ||
| 71 | szToHz | ||
| 72 | } from '@/common/utils.js' | ||
| 73 | import { | ||
| 74 | ref, | ||
| 75 | getCurrentInstance | ||
| 76 | } from 'vue' | ||
| 77 | import { | ||
| 78 | onLoad | ||
| 79 | } from '@dcloudio/uni-app' | ||
| 80 | const { | ||
| 81 | proxy | ||
| 82 | } = getCurrentInstance() | ||
| 83 | const app = getApp(); | ||
| 84 | const queryParams = ref({}) | ||
| 85 | const list = ref([]) | ||
| 86 | const total = ref(0) | ||
| 87 | const userType = ref('') | ||
| 88 | |||
| 89 | // 证书操作提示弹层 | ||
| 90 | const certPopup = ref(null) | ||
| 91 | const popupTitle = ref('提示') | ||
| 92 | const popupContent = ref('') | ||
| 93 | const popupIsAlert = ref(false) | ||
| 94 | const popupBtnText = ref('确认') | ||
| 95 | let popupSure = () => {} | ||
| 96 | |||
| 97 | onLoad((option) => { | ||
| 98 | queryParams.value.examId = option.examId | ||
| 99 | queryParams.value.payId = option.payId | ||
| 100 | queryParams.value.type = option.type | ||
| 101 | getList() | ||
| 102 | }) | ||
| 103 | |||
| 104 | function getList() { | ||
| 105 | uni.showLoading({ | ||
| 106 | title: '加载中' | ||
| 107 | }) | ||
| 108 | if (queryParams.value.name == '') { | ||
| 109 | delete queryParams.value.name | ||
| 110 | } | ||
| 111 | api.certStudentList(queryParams.value).then(res => { | ||
| 112 | list.value = res.rows | ||
| 113 | uni.hideLoading() | ||
| 114 | }) | ||
| 115 | } | ||
| 116 | |||
| 117 | function checkCert(row) { | ||
| 118 | return api.checkPersonByPersonId(row.perId).then(res => { | ||
| 119 | if (!res.data) { | ||
| 120 | openCertPopup({ | ||
| 121 | title: '提示', | ||
| 122 | content: '该学员没有照片,无法生成证书!', | ||
| 123 | isAlert: true, | ||
| 124 | btnText: '知道了', | ||
| 125 | sure: () => {} | ||
| 126 | }) | ||
| 127 | return Promise.reject() | ||
| 128 | } | ||
| 129 | }) | ||
| 130 | } | ||
| 131 | |||
| 132 | function sendCert(row) { | ||
| 133 | let msg = row.isCert == 1 ? '更新' : '下发' | ||
| 134 | checkCert(row).then(() => { | ||
| 135 | openCertPopup({ | ||
| 136 | title: '提示', | ||
| 137 | content: `确定${msg}${row.realName}的证书吗`, | ||
| 138 | isAlert: false, | ||
| 139 | btnText: `确认${msg}`, | ||
| 140 | sure: () => { | ||
| 141 | const params = [{ | ||
| 142 | id: queryParams.value.payId, | ||
| 143 | children: [{ | ||
| 144 | id: queryParams.value.examId, | ||
| 145 | children: [row.id] | ||
| 146 | }] | ||
| 147 | }] | ||
| 148 | |||
| 149 | api.submitCert3(params).then(() => { | ||
| 150 | uni.showToast({ | ||
| 151 | title: `${msg}成功` | ||
| 152 | }) | ||
| 153 | getList() | ||
| 154 | }) | ||
| 155 | } | ||
| 156 | }) | ||
| 157 | }) | ||
| 158 | } | ||
| 159 | |||
| 160 | /** 打开自定义弹层 */ | ||
| 161 | function openCertPopup(opt) { | ||
| 162 | popupTitle.value = opt.title || '提示' | ||
| 163 | popupContent.value = opt.content | ||
| 164 | popupIsAlert.value = !!opt.isAlert | ||
| 165 | popupBtnText.value = opt.btnText || '确认' | ||
| 166 | popupSure = opt.sure || (() => {}) | ||
| 167 | certPopup.value.open() | ||
| 168 | } | ||
| 169 | |||
| 170 | function onPopupCancel() { | ||
| 171 | certPopup.value.close() | ||
| 172 | } | ||
| 173 | |||
| 174 | function onPopupSure() { | ||
| 175 | certPopup.value.close() | ||
| 176 | popupSure() | ||
| 177 | } | ||
| 178 | |||
| 179 | function handleImport() { | ||
| 180 | var arr = [] | ||
| 181 | for (var n of list.value) { | ||
| 182 | if (n.checked) { | ||
| 183 | arr.push(n.perId) | ||
| 184 | } | ||
| 185 | } | ||
| 186 | if (arr.length == 0) { | ||
| 187 | uni.showToast({ | ||
| 188 | title: "请选择会员", | ||
| 189 | icon: "none" | ||
| 190 | }) | ||
| 191 | return | ||
| 192 | } | ||
| 193 | api.addPersonPaymentGroup({ | ||
| 194 | rangeId: queryParams.value.paymentRangeId, | ||
| 195 | personIdArray: arr.join(',') | ||
| 196 | }).then(res => { | ||
| 197 | let path = `/personalVip/renew?rangeId=${res.data.rangeId}` | ||
| 198 | uni.redirectTo({ | ||
| 199 | url: path | ||
| 200 | }); | ||
| 201 | }) | ||
| 202 | } | ||
| 203 | </script> | ||
| 204 | |||
| 205 | <style scoped lang="scss"> | ||
| 206 | .indexboxre { | ||
| 207 | padding: 0 30rpx; | ||
| 208 | |||
| 209 | .tt { | ||
| 210 | font-size: 30rpx; | ||
| 211 | margin: 0 0 30rpx; | ||
| 212 | color: #4C5359; | ||
| 213 | } | ||
| 214 | |||
| 215 | position: relative; | ||
| 216 | height: calc(100vh - 280rpx); | ||
| 217 | overflow: auto; | ||
| 218 | } | ||
| 219 | |||
| 220 | .searchbar { | ||
| 221 | display: flex; | ||
| 222 | align-items: center; | ||
| 223 | padding: 25rpx; | ||
| 224 | box-sizing: border-box; | ||
| 225 | |||
| 226 | :deep(.uni-easyinput .uni-easyinput__content) { | ||
| 227 | border-radius: 35rpx; | ||
| 228 | border: none; | ||
| 229 | height: 70rpx; | ||
| 230 | } | ||
| 231 | |||
| 232 | :deep(.uni-easyinput__content-input) { | ||
| 233 | font-size: 26rpx; | ||
| 234 | } | ||
| 235 | } | ||
| 236 | |||
| 237 | .func button[disabled] { | ||
| 238 | opacity: 0.4; | ||
| 239 | color: #999; | ||
| 240 | border-color: #ccc; | ||
| 241 | } | ||
| 242 | /* 证书操作提示弹层 */ | ||
| 243 | .cert-dialog { | ||
| 244 | width: 560rpx; | ||
| 245 | background: #fff; | ||
| 246 | border-radius: 24rpx; | ||
| 247 | padding: 40rpx 32rpx 28rpx; | ||
| 248 | display: flex; | ||
| 249 | flex-direction: column; | ||
| 250 | align-items: center; | ||
| 251 | |||
| 252 | &__head { | ||
| 253 | display: flex; | ||
| 254 | align-items: center; | ||
| 255 | justify-content: center; | ||
| 256 | margin-bottom: 16rpx; | ||
| 257 | } | ||
| 258 | |||
| 259 | &__title { | ||
| 260 | font-size: 32rpx; | ||
| 261 | font-weight: 600; | ||
| 262 | color: #303133; | ||
| 263 | margin-left: 10rpx; | ||
| 264 | } | ||
| 265 | |||
| 266 | &__content { | ||
| 267 | font-size: 28rpx; | ||
| 268 | color: #606266; | ||
| 269 | line-height: 1.6; | ||
| 270 | text-align: center; | ||
| 271 | margin-bottom: 36rpx; | ||
| 272 | } | ||
| 273 | |||
| 274 | &__btns { | ||
| 275 | width: 100%; | ||
| 276 | display: flex; | ||
| 277 | justify-content: center; | ||
| 278 | align-items: center; | ||
| 279 | } | ||
| 280 | |||
| 281 | &__btn { | ||
| 282 | flex: 1; | ||
| 283 | margin: 0 8rpx; | ||
| 284 | height: 76rpx; | ||
| 285 | line-height: 76rpx; | ||
| 286 | text-align: center; | ||
| 287 | font-size: 28rpx; | ||
| 288 | border-radius: 38rpx; | ||
| 289 | |||
| 290 | &--cancel { | ||
| 291 | background: #f4f4f5; | ||
| 292 | color: #909399; | ||
| 293 | } | ||
| 294 | |||
| 295 | &--sure { | ||
| 296 | background: #AD181F; | ||
| 297 | color: #fff; | ||
| 298 | } | ||
| 299 | |||
| 300 | &:active { | ||
| 301 | opacity: 0.85; | ||
| 302 | } | ||
| 303 | } | ||
| 304 | } | ||
| 305 | </style> | ... | ... |
-
Please register or sign in to post a comment