exam_appointment.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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>
  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,mapActions } 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.setSystemTime()
  170. this.$api.getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 }).then(res => {
  171. if (res.data.code === 200) {
  172. this.listData = res.data.rows;
  173. }
  174. });
  175. },
  176. onShow() {
  177. /* if(this.current === 2 && this.$method.isLogin()){
  178. this.$refs.refMy.init();
  179. } */
  180. },
  181. onShareAppMessage(res) {
  182. var self = this;
  183. return {
  184. title: '中正',
  185. path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
  186. };
  187. },
  188. methods: {
  189. ...mapActions(['setSystemTime']),
  190. isShowFun(times) {
  191. // var timestamp = parseInt(new Date().getTime() / 1000);
  192. var newDataAge = parseInt(new Date(new Date(this.sysTime*1000).toLocaleDateString()).getTime() / 1000);
  193. //报名开放时间”过了“结束时间点”,【取消预约】按钮隐藏
  194. if (times.applyEndTime <= this.sysTime) {
  195. return false;
  196. } else {
  197. //报名开放时间-进行中,【前培标记:已开通】,【取消预约】按钮隐藏
  198. if (times.beforeStatus === 1) {
  199. console.log(1);
  200. return false;
  201. } else if (times.examStatus !== 0) {
  202. console.log(2);
  203. return false;
  204. } else if (times.applySiteExamTime < newDataAge) {
  205. console.log(3);
  206. return false;
  207. } else if (times.applySiteExamTime > newDataAge) {
  208. console.log(4);
  209. return true;
  210. } else if (times.applySiteExamTime == newDataAge) {
  211. console.log(5);
  212. var hours = new Date(this.sysTime*1000).getHours();
  213. var mins = new Date(this.sysTime*1000).getMinutes();
  214. var arrays = times.applySiteStartTime.split(':').map(Number);
  215. if (arrays[0] > hours) {
  216. return true;
  217. } else if (arrays[0] < hours) {
  218. return false;
  219. } else {
  220. if (arrays[1] <= mins) {
  221. return false;
  222. } else {
  223. return true;
  224. }
  225. }
  226. } else {
  227. return true;
  228. }
  229. }
  230. },
  231. showDetails(item) {
  232. this.activeList = JSON.parse(JSON.stringify(item));
  233. this.details_show = true;
  234. },
  235. cancelBtn() {
  236. this.cancel_show = true;
  237. },
  238. hideModel() {
  239. this.details_show = false;
  240. },
  241. submit() {
  242. var bols = this.isShowFun(this.activeList);
  243. if (!bols) {
  244. uni.showToast({
  245. icon: 'none',
  246. title: '当前已无法取消预约'
  247. });
  248. return;
  249. }
  250. this.$api
  251. .editApply({
  252. subscribeId: this.activeList.subscribeId,
  253. subscribeStatus: 2
  254. })
  255. .then(res => {
  256. if (res.data.code === 200) {
  257. this.cancel_show = false;
  258. this.details_show = false;
  259. this.$api.getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 }).then(res => {
  260. this.listData = res.data.rows;
  261. this.setSystemTime()
  262. });
  263. }
  264. });
  265. },
  266. change(index) {
  267. if (this.current === index) {
  268. return;
  269. }
  270. this.current = index;
  271. var data = {};
  272. if (index === 0) {
  273. data = {
  274. subscribeStatus: 1,
  275. exceedExamExpend: 2
  276. };
  277. }
  278. if (index === 1) {
  279. data = {
  280. subscribeStatus: 2
  281. };
  282. }
  283. if (index === 2) {
  284. data = {
  285. subscribeStatus: 1,
  286. exceedExamExpend: 1
  287. };
  288. }
  289. this.$api.getApplylist(data).then(res => {
  290. if (res.data.code === 200) {
  291. this.listData = res.data.rows;
  292. }
  293. });
  294. }
  295. },
  296. onReachBottom() {},
  297. computed: { ...mapGetters(['userInfo','sysTime']) }
  298. };
  299. </script>
  300. <style>
  301. page {
  302. background: #eaeef1;
  303. }
  304. .detailsModel .u-mode-center-box {
  305. border-radius: 24rpx;
  306. }
  307. </style>
  308. <style scoped lang="scss">
  309. .noData {
  310. text-align: center;
  311. font-size: 32rpx;
  312. font-family: PingFang SC;
  313. font-weight: 500;
  314. color: #999999;
  315. margin: 200rpx 0;
  316. }
  317. .examMain {
  318. padding: 8rpx;
  319. .time {
  320. text-align: center;
  321. font-size: 24rpx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #999999;
  325. }
  326. .main {
  327. background: #ffffff;
  328. border-radius: 16rpx;
  329. margin: 20rpx 0;
  330. }
  331. .top {
  332. height: 103rpx;
  333. display: flex;
  334. justify-content: center;
  335. align-items: center;
  336. border-bottom: 1px solid #eeeeee;
  337. .subject {
  338. max-width: 514rpx;
  339. height: 40rpx;
  340. font-size: 30rpx;
  341. font-family: PingFang SC;
  342. font-weight: bold;
  343. color: #007aff;
  344. white-space: nowrap;
  345. overflow: hidden;
  346. text-overflow: ellipsis;
  347. }
  348. }
  349. .item {
  350. display: flex;
  351. justify-content: space-between;
  352. align-items: center;
  353. margin-left: 31rpx;
  354. height: 80rpx;
  355. padding-right: 24rpx;
  356. border-bottom: 1px solid #eeeeee;
  357. font-size: 24rpx;
  358. font-family: PingFang SC;
  359. font-weight: 500;
  360. color: #666666;
  361. .right {
  362. font-size: 30rpx;
  363. font-family: PingFang SC;
  364. font-weight: bold;
  365. }
  366. }
  367. }
  368. .detailsBox {
  369. width: 640rpx;
  370. background: #ffffff;
  371. border-radius: 24rpx;
  372. .time {
  373. margin: 32rpx 0;
  374. padding: 0 37rpx;
  375. font-size: 30rpx;
  376. font-family: PingFang SC;
  377. font-weight: bold;
  378. color: #333333;
  379. }
  380. .boxItem {
  381. margin-left: 36rpx;
  382. margin-bottom: 29rpx;
  383. &.border {
  384. border-bottom: 1px solid #eee;
  385. }
  386. .title {
  387. font-size: 24rpx;
  388. font-family: PingFang SC;
  389. font-weight: 500;
  390. color: #007aff;
  391. position: relative;
  392. &::before {
  393. content: '';
  394. width: 4rpx;
  395. height: 24rpx;
  396. background: #007aff;
  397. border-radius: 2rpx;
  398. position: absolute;
  399. top: 6rpx;
  400. left: -8rpx;
  401. }
  402. }
  403. .item {
  404. margin: 24rpx 0;
  405. font-size: 26rpx;
  406. font-family: PingFang SC;
  407. font-weight: 500;
  408. color: #999999;
  409. .val {
  410. color: #333333;
  411. }
  412. }
  413. }
  414. .foot {
  415. padding: 20rpx 40rpx;
  416. display: flex;
  417. justify-content: center;
  418. .btn {
  419. width: 200rpx;
  420. height: 80rpx;
  421. line-height: 80rpx;
  422. text-align: center;
  423. background: #f5f5f5;
  424. border-radius: 40rpx;
  425. font-size: 30rpx;
  426. font-family: PingFang SC;
  427. font-weight: bold;
  428. color: #007aff;
  429. &.cancel {
  430. background: #ff3b30;
  431. color: #ffffff;
  432. }
  433. }
  434. .abtns {
  435. width: 526rpx;
  436. height: 80rpx;
  437. line-height: 80rpx;
  438. text-align: center;
  439. background: #007aff;
  440. border-radius: 40rpx;
  441. font-size: 30rpx;
  442. font-family: PingFang SC;
  443. font-weight: bold;
  444. color: #fff;
  445. }
  446. }
  447. }
  448. .tipBox {
  449. width: 640rpx;
  450. padding: 30rpx 20rpx 40rpx;
  451. background: #ffffff;
  452. border-radius: 24rpx;
  453. font-family: PingFang SC;
  454. .title {
  455. text-align: center;
  456. font-size: 30rpx;
  457. font-weight: bold;
  458. color: #333333;
  459. margin-bottom: 40rpx;
  460. }
  461. .main {
  462. font-size: 30rpx;
  463. font-weight: 500;
  464. color: #666666;
  465. line-height: 48rpx;
  466. margin-bottom: 40rpx;
  467. }
  468. .btn {
  469. display: flex;
  470. justify-content: center;
  471. .btn1 {
  472. width: 200rpx;
  473. height: 80rpx;
  474. line-height: 80rpx;
  475. text-align: center;
  476. background: #f5f5f5;
  477. border-radius: 40px;
  478. font-size: 30rpx;
  479. font-weight: bold;
  480. color: #007aff;
  481. margin: 0 20rpx;
  482. &.submit {
  483. background: #007aff;
  484. color: #fff;
  485. }
  486. }
  487. }
  488. }
  489. </style>