exam_appointment.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <view>
  3. <nav-bar title="考试预约"></nav-bar>
  4. <view style="width: 100%;text-align: center;position: fixed;height: 96rpx;z-index: 999;">
  5. <u-tabs :list="list" sticky :current="current" @change="change" active-color="#007AFF" inactive-color="#999"></u-tabs>
  6. </view>
  7. <view class="safeArea" style="position: absolute;top: 288rpx;width: 100%;">
  8. <view class="examMain">
  9. <view class="noData" v-if="!listData.length">您暂无相关考试预约哦~</view>
  10. <view v-for="(item, index) in listData" :key="index" class="examList">
  11. <view class="time">{{ $method.timestampToTime(item.createTime, false) }}</view>
  12. <view class="main">
  13. <view class="top" @click="showDetails(item)">
  14. <view class="subject">{{ item.goodsName }}</view>
  15. <u-icon name="arrow-right" color="#999999" size="28"></u-icon>
  16. </view>
  17. <view class="item">
  18. <view class="left">报考专业</view>
  19. <view class="right" v-if="item.categoryName">{{ item.categoryName }}专业</view>
  20. </view>
  21. <view class="item">
  22. <view class="left">考试地点</view>
  23. <view class="right">{{ item.applySiteAddress }}</view>
  24. </view>
  25. <view class="item">
  26. <view class="left">考试时间</view>
  27. <view class="right">
  28. {{ $method.timestampToTime(item.applySiteExamTime) }} {{ item.applySiteStartTime }} ~
  29. {{ item.applySiteEndTime }}
  30. </view>
  31. </view>
  32. <view class="item" v-if="item.applySiteAddressTrain">
  33. <view class="left">考前培训地点</view>
  34. <view class="right">{{ item.applySiteAddressTrain }}</view>
  35. </view>
  36. <view class="item" v-if="item.applySiteExamTrainTime && item.applySiteStartTrainTime && item.applySiteEndTrainTime">
  37. <view class="left">考前培训时间</view>
  38. <view class="right">
  39. {{ $method.timestampToTime(item.applySiteExamTrainTime) }} {{ item.applySiteStartTrainTime }} ~
  40. {{ item.applySiteEndTrainTime }}
  41. </view>
  42. </view>
  43. <view class="item">
  44. <view class="left">准考证号</view>
  45. <view class="right">
  46. {{ item.examineeCode }}
  47. </view>
  48. </view>
  49. <view class="item">
  50. <view class="left">座位号</view>
  51. <view class="right">
  52. {{ item.seatNumber }}
  53. </view>
  54. </view>
  55. <view class="item" @click="toSign(item)">
  56. <view class="left">疫情防控承诺书</view>
  57. <view class="right" :class="{unSign: item.reportStatus == 0}">
  58. {{ item.reportStatus == 1 ? '已签署' : item.reportStatus == 0 ? '未签署' : '' }}
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <!-- 弹框 考试详情-->
  66. <u-popup v-model="details_show" mode="center" class="detailsModel">
  67. <view class="detailsBox">
  68. <view class="time">{{ $method.timestampToTime(activeList.createTime, false) }}</view>
  69. <view class="boxItem border">
  70. <view class="title">报考学员信息</view>
  71. <view class="item">
  72. 姓名:
  73. <text class="val">{{ activeList.realname }}</text>
  74. </view>
  75. <view class="item">
  76. 身份证:
  77. <text class="val">{{ activeList.idCard }}</text>
  78. </view>
  79. <view class="item">
  80. 考试身份:
  81. <text class="val">{{ activeList.studentType == 1 ? '非补考学员' : activeList.studentType == 2 ? '补考学员' : '' }}</text>
  82. </view>
  83. </view>
  84. <view class="boxItem border">
  85. <view class="title">考试预约信息</view>
  86. <view class="item">
  87. 考试标题:
  88. <text class="val">{{ activeList.applyName }}</text>
  89. </view>
  90. <view class="item">
  91. 报名开放时间:
  92. <text class="val">{{ $method.timestampToTime(activeList.applyStartTime) }} ~ {{ $method.timestampToTime(activeList.applyEndTime) }}</text>
  93. </view>
  94. <view class="item">
  95. 报考专业:
  96. <text class="val">{{ activeList.categoryName || ''}}</text>
  97. </view>
  98. <view class="item">
  99. 考试地点:
  100. <text class="val">{{ activeList.applySiteAddress }}</text>
  101. </view>
  102. <view class="item">
  103. 考试时间:
  104. <text class="val">
  105. {{
  106. $method.timestampToTime(activeList.applySiteExamTime) +
  107. ' ' +
  108. activeList.applySiteStartTime +
  109. '~' +
  110. activeList.applySiteEndTime
  111. }}
  112. </text>
  113. </view>
  114. <view class="item">
  115. 准考证号:
  116. <text class="val">
  117. {{ activeList.examineeCode }}
  118. </text>
  119. </view>
  120. <view class="item">
  121. 座位号:
  122. <text class="val">
  123. {{ activeList.seatNumber }}
  124. </text>
  125. </view>
  126. <view class="item" v-if="activeList.applySiteAddressTrain">
  127. 考前培训地点:
  128. <text class="val">{{ activeList.applySiteAddressTrain }}</text>
  129. </view>
  130. <view class="item" v-if="activeList.applySiteExamTrainTime && activeList.applySiteStartTrainTime && activeList.applySiteEndTrainTime">
  131. 考前培训时间:
  132. <text class="val">
  133. {{
  134. $method.timestampToTime(activeList.applySiteExamTrainTime) +
  135. ' ' +
  136. activeList.applySiteStartTrainTime +
  137. '~' +
  138. activeList.applySiteEndTrainTime
  139. }}
  140. </text>
  141. </view>
  142. </view>
  143. <view class="boxItem border">
  144. <view class="title">考试成绩和证书信息</view>
  145. <view class="item">
  146. 考试成绩:
  147. <text class="val">{{ activeList.performance || '-' }}分</text>
  148. </view>
  149. <view class="item">
  150. 考试结果:
  151. <text class="val">{{ activeList.syncExamResult }}</text>
  152. </view>
  153. </view>
  154. <u-line color="#EEEEEE" />
  155. <view class="foot" v-if="activeList.subscribeStatus === 1">
  156. <view class="btn" @click="hideModel">知道了</view>
  157. <view class="btn cancel" v-if="isShowFun(activeList)" @click="cancelBtn">取消预约</view>
  158. </view>
  159. <view class="foot" v-else><view class="abtns" @click="hideModel">知道了</view></view>
  160. </view>
  161. </u-popup>
  162. <!-- 弹框 取消预约-->
  163. <u-popup v-model="cancel_show" mode="center" class="detailsModel">
  164. <view class="tipBox">
  165. <view class="title">温馨提示</view>
  166. <view class="main">
  167. <view class="item">每次考试均有名额限制,</view>
  168. <view class="item">取消预约后,您可能无法再次预约本次考试。</view>
  169. <view class="item">请慎重考虑。</view>
  170. <view class="item">您确定要取消本次考试预约吗?。</view>
  171. </view>
  172. <view class="btn">
  173. <view class="btn1 cancel" @click="cancel_show = false">取消</view>
  174. <view class="btn1 submit" @click="submit">确定</view>
  175. </view>
  176. </view>
  177. </u-popup>
  178. </view>
  179. </template>
  180. <script>
  181. import { mapGetters,mapActions } from 'vuex';
  182. export default {
  183. data() {
  184. return {
  185. details_show: false,
  186. cancel_show: false,
  187. list: [
  188. {
  189. name: '已预约'
  190. },
  191. {
  192. name: '已取消'
  193. },
  194. {
  195. name: '已过期'
  196. }
  197. ],
  198. listData: [],
  199. current: 0,
  200. activeList: {
  201. applySiteStartTime: '',
  202. applySiteEndTime: '',
  203. applySiteStartTrainTime: '',
  204. applySiteEndTrainTime: ''
  205. },
  206. paramCount: '',
  207. };
  208. },
  209. onPullDownRefresh() {},
  210. onLoad(option) {
  211. option.current && (this.paramCount = option.current)
  212. },
  213. onShow() {
  214. if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
  215. return;
  216. }
  217. if (String(this.paramCount)) {
  218. console.log('公众号', this.paramCount)
  219. this.current = +this.paramCount
  220. this.change(+this.paramCount)
  221. return
  222. }
  223. this.setSystemTime()
  224. this.$api.getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 }).then(res => {
  225. if (res.data.code === 200) {
  226. this.listData = res.data.rows;
  227. }
  228. });
  229. /* if(this.current === 2 && this.$method.isLogin()){
  230. this.$refs.refMy.init();
  231. } */
  232. },
  233. onShareAppMessage(res) {
  234. var self = this;
  235. return {
  236. title: '中正',
  237. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  238. };
  239. },
  240. methods: {
  241. ...mapActions(['setSystemTime']),
  242. toSign(item) {
  243. if (item.reportStatus == 0) {
  244. uni.navigateTo({
  245. url: 'pages2/exam/signCommit'
  246. })
  247. }
  248. },
  249. isShowFun(times) {
  250. // var timestamp = parseInt(new Date().getTime() / 1000);
  251. var newDataAge = parseInt(new Date(new Date(this.sysTime*1000).toLocaleDateString()).getTime() / 1000);
  252. //报名开放时间”过了“结束时间点”,【取消预约】按钮隐藏
  253. if (times.applyEndTime <= this.sysTime) {
  254. return false;
  255. } else {
  256. //报名开放时间-进行中,【前培标记:已开通】,【取消预约】按钮隐藏
  257. if (times.beforeStatus === 1) {
  258. console.log(1);
  259. return false;
  260. } else if (times.examStatus !== 0) {
  261. console.log(2);
  262. return false;
  263. } else if (times.applySiteExamTime < newDataAge) {
  264. console.log(3);
  265. return false;
  266. } else if (times.applySiteExamTime > newDataAge) {
  267. console.log(4);
  268. return true;
  269. } else if (times.applySiteExamTime == newDataAge) {
  270. console.log(5);
  271. var hours = new Date(this.sysTime*1000).getHours();
  272. var mins = new Date(this.sysTime*1000).getMinutes();
  273. var arrays = times.applySiteStartTime.split(':').map(Number);
  274. if (arrays[0] > hours) {
  275. return true;
  276. } else if (arrays[0] < hours) {
  277. return false;
  278. } else {
  279. if (arrays[1] <= mins) {
  280. return false;
  281. } else {
  282. return true;
  283. }
  284. }
  285. } else {
  286. return true;
  287. }
  288. }
  289. },
  290. showDetails(item) {
  291. this.activeList = JSON.parse(JSON.stringify(item));
  292. this.details_show = true;
  293. },
  294. cancelBtn() {
  295. this.cancel_show = true;
  296. },
  297. hideModel() {
  298. this.details_show = false;
  299. },
  300. submit() {
  301. var bols = this.isShowFun(this.activeList);
  302. if (!bols) {
  303. uni.showToast({
  304. icon: 'none',
  305. title: '当前已无法取消预约'
  306. });
  307. return;
  308. }
  309. this.$api
  310. .editApply({
  311. subscribeId: this.activeList.subscribeId,
  312. subscribeStatus: 2
  313. })
  314. .then(res => {
  315. if (res.data.code === 200) {
  316. this.cancel_show = false;
  317. this.details_show = false;
  318. this.$api.getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 }).then(res => {
  319. this.listData = res.data.rows;
  320. this.setSystemTime()
  321. });
  322. }
  323. });
  324. },
  325. change(index) {
  326. // if (this.current === index) {
  327. // return;
  328. // }
  329. console.log('----')
  330. this.current = index;
  331. var data = {};
  332. if (index === 0) {
  333. data = {
  334. subscribeStatus: 1,
  335. exceedExamExpend: 2
  336. };
  337. }
  338. if (index === 1) {
  339. data = {
  340. subscribeStatus: 2
  341. };
  342. }
  343. if (index === 2) {
  344. data = {
  345. subscribeStatus: 1,
  346. exceedExamExpend: 1
  347. };
  348. }
  349. // apply/list
  350. this.$api.getApplylist(data).then(res => {
  351. if (res.data.code === 200) {
  352. // this.listData = res.data.rows;
  353. this.listData = [1,2]
  354. }
  355. });
  356. }
  357. },
  358. onReachBottom() {},
  359. computed: { ...mapGetters(['userInfo','sysTime']) }
  360. };
  361. </script>
  362. <style>
  363. page {
  364. background: #eaeef1;
  365. }
  366. .detailsModel .u-mode-center-box {
  367. border-radius: 24rpx;
  368. }
  369. </style>
  370. <style scoped lang="scss">
  371. .noData {
  372. text-align: center;
  373. font-size: 32rpx;
  374. font-family: PingFang SC;
  375. font-weight: 500;
  376. color: #999999;
  377. margin: 200rpx 0;
  378. }
  379. .examMain {
  380. padding: 8rpx;
  381. .time {
  382. text-align: center;
  383. font-size: 24rpx;
  384. font-family: PingFang SC;
  385. font-weight: 500;
  386. color: #999999;
  387. }
  388. .main {
  389. background: #ffffff;
  390. border-radius: 16rpx;
  391. margin: 20rpx 0;
  392. }
  393. .top {
  394. height: 103rpx;
  395. display: flex;
  396. justify-content: center;
  397. align-items: center;
  398. border-bottom: 1px solid #eeeeee;
  399. .subject {
  400. max-width: 514rpx;
  401. height: 40rpx;
  402. font-size: 30rpx;
  403. font-family: PingFang SC;
  404. font-weight: bold;
  405. color: #007aff;
  406. white-space: nowrap;
  407. overflow: hidden;
  408. text-overflow: ellipsis;
  409. }
  410. }
  411. .item {
  412. display: flex;
  413. justify-content: space-between;
  414. align-items: center;
  415. margin-left: 31rpx;
  416. height: 80rpx;
  417. padding-right: 24rpx;
  418. border-bottom: 1px solid #eeeeee;
  419. font-size: 24rpx;
  420. font-family: PingFang SC;
  421. font-weight: 500;
  422. color: #666666;
  423. .right {
  424. font-size: 30rpx;
  425. font-family: PingFang SC;
  426. font-weight: bold;
  427. }
  428. .unSign {
  429. text-decoration: underline;
  430. }
  431. }
  432. }
  433. .detailsBox {
  434. width: 640rpx;
  435. background: #ffffff;
  436. border-radius: 24rpx;
  437. .time {
  438. margin: 32rpx 0;
  439. padding: 0 37rpx;
  440. font-size: 30rpx;
  441. font-family: PingFang SC;
  442. font-weight: bold;
  443. color: #333333;
  444. }
  445. .boxItem {
  446. margin-left: 36rpx;
  447. margin-bottom: 29rpx;
  448. &.border {
  449. border-bottom: 1px solid #eee;
  450. }
  451. .title {
  452. font-size: 24rpx;
  453. font-family: PingFang SC;
  454. font-weight: 500;
  455. color: #007aff;
  456. position: relative;
  457. &::before {
  458. content: '';
  459. width: 4rpx;
  460. height: 24rpx;
  461. background: #007aff;
  462. border-radius: 2rpx;
  463. position: absolute;
  464. top: 6rpx;
  465. left: -8rpx;
  466. }
  467. }
  468. .item {
  469. margin: 24rpx 0;
  470. font-size: 26rpx;
  471. font-family: PingFang SC;
  472. font-weight: 500;
  473. color: #999999;
  474. .val {
  475. color: #333333;
  476. }
  477. }
  478. }
  479. .foot {
  480. padding: 20rpx 40rpx;
  481. display: flex;
  482. justify-content: center;
  483. .btn {
  484. width: 200rpx;
  485. height: 80rpx;
  486. line-height: 80rpx;
  487. text-align: center;
  488. background: #f5f5f5;
  489. border-radius: 40rpx;
  490. font-size: 30rpx;
  491. font-family: PingFang SC;
  492. font-weight: bold;
  493. color: #007aff;
  494. &.cancel {
  495. background: #ff3b30;
  496. color: #ffffff;
  497. }
  498. }
  499. .abtns {
  500. width: 526rpx;
  501. height: 80rpx;
  502. line-height: 80rpx;
  503. text-align: center;
  504. background: #007aff;
  505. border-radius: 40rpx;
  506. font-size: 30rpx;
  507. font-family: PingFang SC;
  508. font-weight: bold;
  509. color: #fff;
  510. }
  511. }
  512. }
  513. .tipBox {
  514. width: 640rpx;
  515. padding: 30rpx 20rpx 40rpx;
  516. background: #ffffff;
  517. border-radius: 24rpx;
  518. font-family: PingFang SC;
  519. .title {
  520. text-align: center;
  521. font-size: 30rpx;
  522. font-weight: bold;
  523. color: #333333;
  524. margin-bottom: 40rpx;
  525. }
  526. .main {
  527. font-size: 30rpx;
  528. font-weight: 500;
  529. color: #666666;
  530. line-height: 48rpx;
  531. margin-bottom: 40rpx;
  532. }
  533. .btn {
  534. display: flex;
  535. justify-content: center;
  536. .btn1 {
  537. width: 200rpx;
  538. height: 80rpx;
  539. line-height: 80rpx;
  540. text-align: center;
  541. background: #f5f5f5;
  542. border-radius: 40px;
  543. font-size: 30rpx;
  544. font-weight: bold;
  545. color: #007aff;
  546. margin: 0 20rpx;
  547. &.submit {
  548. background: #007aff;
  549. color: #fff;
  550. }
  551. }
  552. }
  553. }
  554. </style>