exam_appointment.vue 12 KB

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