exam_appointment.vue 13 KB

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