exam_appointment.vue 13 KB

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