exam_appointment.vue 12 KB

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