arrive.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. <template>
  2. <view class="container">
  3. <view class="header">注:请按照自己的真实情况填写</view>
  4. <view class="form">
  5. <view class="form_box">
  6. <view class="form_key">按时报到:</view>
  7. <switch :checked="studentInfo.registerOntime == 1" color="#0061FF" style="transform: scale(0.9)" @change="switchChange" />
  8. </view>
  9. <view class="form_box">
  10. <view class="form_key">交通方式:</view>
  11. <view class="form_value">
  12. <picker @change="bindPickerChange" :value="currtIndex" :range="wayList">
  13. <view class="select" :class="{ active: currtIndex != null }">
  14. {{ currtIndex != null ? wayList[currtIndex] : '请选择交通方式' }}
  15. <uni-icons type="down" size="20" color="#ccc"></uni-icons>
  16. </view>
  17. </picker>
  18. </view>
  19. </view>
  20. <view class="form_box">
  21. <view class="form_key">到站地点:</view>
  22. <view class="form_value">
  23. <picker @change="bindPickerChange_place" :value="currtIndex_place" :range="placeList">
  24. <view class="select" :class="{ active: currtIndex_place != null }">
  25. {{ currtIndex_place != null ? placeList[currtIndex_place] : '请选择到站地点' }}
  26. <uni-icons type="down" size="20" color="#ccc"></uni-icons>
  27. </view>
  28. </picker>
  29. </view>
  30. </view>
  31. <view class="form_box">
  32. <view class="form_key">到站日期:</view>
  33. <view class="form_value">
  34. <uni-datetime-picker type="date" v-model="studentInfo.arrvieDate">
  35. <view class="select" :class="{ active: studentInfo.arrvieDate }">
  36. {{ studentInfo.arrvieDate ? studentInfo.arrvieDate : '请输入到站日期' }}
  37. <uni-icons type="down" size="20" color="#ccc"></uni-icons>
  38. </view>
  39. </uni-datetime-picker>
  40. </view>
  41. </view>
  42. <view class="form_box start noMargin">
  43. <view class="form_key">到站时间:</view>
  44. <radio-group @change="radioChange">
  45. <label v-for="(item, index) in timeList" :key="item">
  46. <view class="form_time">
  47. <radio style="transform: scale(0.8)" :value="index.toString()" :checked="index === currentIndex" />
  48. <view>{{ item.timeStr }}</view>
  49. </view>
  50. </label>
  51. </radio-group>
  52. </view>
  53. </view>
  54. <!-- 陪同人员信息区域 -->
  55. <view class="family">
  56. <view class="family_top">
  57. <uni-icons type="staff-filled" size="30"></uni-icons>
  58. <view class="top_title">陪同人员信息</view>
  59. <uni-icons style="margin-left: auto" type="personadd" size="26" color="#0061FF" @click="handleAdd"></uni-icons>
  60. </view>
  61. <view class="family_table" v-if="avs.length">
  62. <view class="table_box top">
  63. <view class="title">序号</view>
  64. <view class="name">姓名</view>
  65. <view class="phone">联系电话</view>
  66. </view>
  67. <view class="table_box" v-for="(item, index) in avs" :key="index">
  68. <view class="title">{{ index + 1 }}</view>
  69. <view class="name">{{ item.name }}</view>
  70. <view class="phone">{{ item.phone }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 温馨提示区域 -->
  75. <view class="tips">
  76. <view class="tips_box">
  77. <view class="box_title">温馨提示:</view>
  78. <view class="box_text">{{ info }}</view>
  79. </view>
  80. </view>
  81. <!-- 按钮区域 -->
  82. <view class="btns">
  83. <view v-if="!editType" class="btn up" @click="handleUp">上一步</view>
  84. <view class="btn down" @click="handleNext">提交</view>
  85. </view>
  86. <!-- 添加陪同成员弹窗区域 -->
  87. <uni-popup ref="popup" :is-mask-click="false">
  88. <view class="pop">
  89. <image class="pop_img" src="/static/3.png" mode="aspectFill"></image>
  90. <!-- 关闭图标 -->
  91. <uni-icons class="pop_close" type="closeempty" color="#808080" size="20" @click="handleClose"></uni-icons>
  92. <view class="pop_box">
  93. <view class="box_key">姓名:</view>
  94. <view class="box_value">
  95. <input class="input" type="text" placeholder="请输入姓名" placeholder-style="color:#CCCCCC;font-size:28rpx;" v-model="popObj.name" />
  96. </view>
  97. </view>
  98. <view class="pop_box">
  99. <view class="box_key">联系电话:</view>
  100. <view class="box_value">
  101. <input class="input" type="text" placeholder="请输入联系电话" placeholder-style="color:#CCCCCC;font-size:28rpx;" v-model="popObj.phone" />
  102. </view>
  103. </view>
  104. <view class="pop_btn" @click="handleConfirm">确定</view>
  105. </view>
  106. </uni-popup>
  107. <!-- 提示缴费弹窗区域 -->
  108. <uni-popup ref="popup_tips" :is-mask-click="false">
  109. <view class="pop_tips">
  110. <image class="pop_img" src="/static/3.png" mode="aspectFill"></image>
  111. <!-- 关闭图标 -->
  112. <uni-icons class="pop_close" type="closeempty" color="#808080" size="20" @click="handleClose_tips"></uni-icons>
  113. <view class="pop_title">温馨提示</view>
  114. <view class="pop_text">
  115. {{ pop_info }}
  116. </view>
  117. <view class="pop_btn" @click="handleFinish_tips">去完成缴费</view>
  118. </view>
  119. </uni-popup>
  120. <!-- web弹窗区域 -->
  121. <uni-popup ref="popup_web" :is-mask-click="false">
  122. <view class="pop_web">
  123. <!-- 关闭图标 -->
  124. <uni-icons class="pop_close" type="closeempty" color="#808080" size="20" @click="handleClose_web"></uni-icons>
  125. <view class="web">
  126. <iframe class="iframe" src="https://pay.ncjti.edu.cn" frameborder="0"></iframe>
  127. </view>
  128. </view>
  129. </uni-popup>
  130. </view>
  131. </template>
  132. <script setup>
  133. import { onLoad } from '@dcloudio/uni-app'
  134. import { ref } from 'vue'
  135. import { submitInfoReq, getArriveTimeListReq, getStudentPayInfo } from '@/api/index.js'
  136. const currtIndex = ref(null)
  137. const wayList = ref(['火车', '飞机', '汽车', '自驾', '其他'])
  138. const currtIndex_place = ref(null)
  139. const placeList = ref(['南昌火车站', '南昌西站', '南昌东站', '昌北机场', '南昌长途汽车西站', '靖安汽车站', '墨轩湖校区', '黄家湖校区'])
  140. // 学生信息
  141. const studentInfo = ref({})
  142. // 到达时间数组
  143. const timeList = ref([])
  144. // 陪同人员数组
  145. const avs = ref([])
  146. // 到站时间索引
  147. const currentIndex = ref(null)
  148. // 弹窗DOM
  149. const popup = ref()
  150. const popup_tips = ref()
  151. const popup_web = ref()
  152. // 弹窗对象数据
  153. const popObj = ref({
  154. name: '',
  155. phone: ''
  156. })
  157. const info = ref()
  158. const pop_info = ref()
  159. const editType = ref()
  160. onLoad(() => {
  161. studentInfo.value = uni.getStorageSync('studentInfo')
  162. info.value = uni.getStorageSync('settingInfo').arriveSchool
  163. pop_info.value = uni.getStorageSync('settingInfo').chooseDormitory
  164. editType.value = uni.getStorageSync('editType')
  165. // console.log(studentInfo.value)
  166. // console.log(info.value)
  167. if (!studentInfo.value.registerOntime) {
  168. studentInfo.value.registerOntime = 0
  169. }
  170. if (studentInfo.value.trafficMethod) {
  171. // console.log(studentInfo.value.trafficMethod)
  172. wayList.value.forEach((ele, index) => {
  173. if (ele == studentInfo.value.trafficMethod) {
  174. currtIndex.value = index
  175. }
  176. })
  177. if (studentInfo.value.trafficMethod == '自驾') {
  178. placeList.value = ['墨轩湖校区', '黄家湖校区']
  179. } else if (studentInfo.value.trafficMethod == '火车') {
  180. placeList.value = ['南昌火车站', '南昌西站', '南昌东站']
  181. } else if (studentInfo.value.trafficMethod == '飞机') {
  182. placeList.value = ['昌北机场']
  183. } else {
  184. placeList.value = ['南昌火车站', '南昌西站', '南昌东站', '昌北机场', '南昌长途汽车西站', '靖安汽车站', '墨轩湖校区', '黄家湖校区']
  185. }
  186. }
  187. if (studentInfo.value.arrive) {
  188. // console.log(studentInfo.value.arrive)
  189. placeList.value.forEach((ele, index) => {
  190. if (ele == studentInfo.value.arrive) {
  191. currtIndex_place.value = index
  192. }
  193. })
  194. }
  195. avs.value = studentInfo.value.avs || []
  196. getArriveTimeList()
  197. })
  198. // 获取到达时间数组
  199. const getArriveTimeList = async () => {
  200. const res = await getArriveTimeListReq()
  201. // console.log(res)
  202. if (res.code == 200) {
  203. timeList.value = res.data
  204. if (studentInfo.value.arriveTimeId) {
  205. timeList.value.forEach((ele, index) => {
  206. if (ele.id == studentInfo.value.arriveTimeId) {
  207. currentIndex.value = index
  208. }
  209. })
  210. // console.log(currentIndex.value)
  211. }
  212. }
  213. }
  214. // 选择交通方式回调
  215. const bindPickerChange = (e) => {
  216. // console.log(e)
  217. currtIndex.value = e.detail.value
  218. studentInfo.value.trafficMethod = wayList.value[currtIndex.value]
  219. currtIndex_place.value = null
  220. if (studentInfo.value.trafficMethod == '自驾') {
  221. placeList.value = ['墨轩湖校区', '黄家湖校区']
  222. } else if (studentInfo.value.trafficMethod == '火车') {
  223. placeList.value = ['南昌火车站', '南昌西站', '南昌东站']
  224. } else if (studentInfo.value.trafficMethod == '飞机') {
  225. placeList.value = ['昌北机场']
  226. } else {
  227. placeList.value = ['南昌火车站', '南昌西站', '南昌东站', '昌北机场', '南昌长途汽车西站', '靖安汽车站', '墨轩湖校区', '黄家湖校区']
  228. }
  229. }
  230. // 选择到站地点回调
  231. const bindPickerChange_place = (e) => {
  232. currtIndex_place.value = e.detail.value
  233. studentInfo.value.arrive = placeList.value[currtIndex_place.value]
  234. }
  235. // 添加陪同成员按钮回调
  236. const handleAdd = () => {
  237. popup.value.open()
  238. }
  239. // 陪同成员弹窗关闭图标回调
  240. const handleClose = () => {
  241. popup.value.close()
  242. }
  243. // 点击陪同成员弹窗确定按钮回调
  244. const handleConfirm = () => {
  245. if (!popObj.value.name) {
  246. uni.showToast({
  247. title: '请输入姓名',
  248. icon: 'none'
  249. })
  250. return
  251. }
  252. if (!popObj.value.phone) {
  253. uni.showToast({
  254. title: '请输入联系电话',
  255. icon: 'none'
  256. })
  257. return
  258. }
  259. let reg = /^1[3-9]\d{9}$/
  260. if (!reg.test(popObj.value.phone)) {
  261. uni.showToast({
  262. title: '联系电话格式错误',
  263. icon: 'none'
  264. })
  265. return
  266. }
  267. uni.showModal({
  268. title: '提示',
  269. content: '确定添加吗?',
  270. success: (res) => {
  271. if (res.confirm) {
  272. avs.value.push(popObj.value)
  273. popObj.value = {
  274. name: '',
  275. phone: ''
  276. }
  277. popup.value.close()
  278. }
  279. }
  280. })
  281. }
  282. // 提示缴费弹窗关闭图标回调
  283. const handleClose_tips = () => {
  284. popup_tips.value.close()
  285. }
  286. // 提示缴费弹窗去完成缴费按钮回调
  287. const handleFinish_tips = () => {
  288. popup_tips.value.close()
  289. popup_web.value.open()
  290. }
  291. // web弹窗关闭图标回调
  292. const handleClose_web = async () => {
  293. // 关闭弹窗时查询用户是否已经支付
  294. // const res = await getStudentPayInfo({
  295. // admissNum: studentInfo.value.admissNum
  296. // })
  297. // console.log(res)
  298. // if (res.code == 200) {
  299. // if (res.data.isPay == 0) {
  300. // popup_web.value.close()
  301. // popup_tips.value.open()
  302. // } else if (res.data.isPay == 1) {
  303. // studentInfo.value.isPay = 1
  304. // uni.setStorageSync('studentInfo', studentInfo.value)
  305. // uni.reLaunch({
  306. // url: '/pages/payInfo/payInfo'
  307. // })
  308. // }
  309. // }
  310. popup_web.value.close()
  311. setTimeout(() => {
  312. uni.navigateTo({
  313. url: '/pages/payInfo/payInfo'
  314. })
  315. }, 500)
  316. }
  317. // 切换按时报到
  318. const switchChange = (e) => {
  319. // console.log(e.detail.value)
  320. if (e.detail.value) {
  321. studentInfo.value.registerOntime = 1
  322. } else {
  323. studentInfo.value.registerOntime = 0
  324. }
  325. }
  326. // 选择到达时间
  327. const radioChange = (e) => {
  328. // console.log(e.detail.value)
  329. studentInfo.value.arriveTime = timeList.value[e.detail.value].timeStr
  330. studentInfo.value.arriveTimeId = timeList.value[e.detail.value].id
  331. }
  332. // 点击上一步按钮回调
  333. const handleUp = () => {
  334. uni.navigateBack()
  335. }
  336. // 点击提交按钮回调
  337. const handleNext = () => {
  338. if (currtIndex.value == null) {
  339. uni.showToast({
  340. title: '请选择交通方式',
  341. icon: 'none'
  342. })
  343. return
  344. }
  345. if (currtIndex_place.value == null) {
  346. uni.showToast({
  347. title: '请选择到站地点',
  348. icon: 'none'
  349. })
  350. return
  351. }
  352. if (!studentInfo.value.arrvieDate) {
  353. uni.showToast({
  354. title: '请选择到站日期',
  355. icon: 'none'
  356. })
  357. return
  358. }
  359. if (!studentInfo.value.arriveTime) {
  360. uni.showToast({
  361. title: '请选择到站时间',
  362. icon: 'none'
  363. })
  364. return
  365. }
  366. studentInfo.value.avs = avs.value
  367. uni.setStorageSync('studentInfo', studentInfo.value)
  368. const mergedObj = { ...studentInfo.value, arrvieDate: studentInfo.value.arrvieDate + ' 00:00:00' }
  369. // console.log(mergedObj)
  370. // console.log(studentInfo.value)
  371. uni.showModal({
  372. title: '提示',
  373. content: '确定提交吗?',
  374. success: async (res) => {
  375. if (res.confirm) {
  376. const res = await submitInfoReq(mergedObj)
  377. // console.log(res)
  378. if (res.code == 200) {
  379. uni.showToast({
  380. title: res.message,
  381. icon: 'success'
  382. })
  383. setTimeout(() => {
  384. uni.reLaunch({
  385. url: '/pages/myMsg/myMsg'
  386. })
  387. }, 1500)
  388. }
  389. }
  390. }
  391. })
  392. }
  393. </script>
  394. <style lang="scss" scoped>
  395. .container {
  396. min-height: 100vh;
  397. background-color: #f5f9ff;
  398. .header {
  399. padding-left: 20rpx;
  400. height: 93rpx;
  401. line-height: 93rpx;
  402. font-size: 28rpx;
  403. font-weight: bold;
  404. background-color: #fff;
  405. }
  406. .form {
  407. padding: 25rpx 0 0;
  408. margin-top: 10rpx;
  409. background-color: #fff;
  410. .form_box {
  411. display: flex;
  412. align-items: center;
  413. margin-bottom: 20rpx;
  414. min-height: 75rpx;
  415. .form_key {
  416. width: 170rpx;
  417. font-size: 28rpx;
  418. text-align: end;
  419. }
  420. .form_value {
  421. box-sizing: border-box;
  422. padding: 0 25rpx;
  423. width: 560rpx;
  424. height: 75rpx;
  425. border-radius: 4rpx;
  426. border: 2rpx solid #cccccc;
  427. .input {
  428. height: 100%;
  429. }
  430. .select {
  431. display: flex;
  432. align-items: center;
  433. justify-content: space-between;
  434. height: 74rpx;
  435. font-size: 28rpx;
  436. color: #ccc;
  437. }
  438. .active {
  439. color: #000;
  440. }
  441. }
  442. .form_time {
  443. display: flex;
  444. margin-bottom: 20rpx;
  445. font-size: 28rpx;
  446. }
  447. }
  448. .start {
  449. align-items: start;
  450. }
  451. .noMargin {
  452. margin-top: 30rpx;
  453. margin-bottom: 0;
  454. }
  455. }
  456. .family {
  457. background-color: #fff;
  458. .family_top {
  459. display: flex;
  460. align-items: center;
  461. padding: 0 20rpx;
  462. height: 90rpx;
  463. .top_title {
  464. margin-left: 20rpx;
  465. font-size: 30rpx;
  466. font-weight: bold;
  467. }
  468. }
  469. .family_table {
  470. padding: 0 20rpx;
  471. font-size: 24rpx;
  472. .table_box {
  473. display: flex;
  474. justify-content: space-between;
  475. align-items: center;
  476. height: 70rpx;
  477. border-bottom: 2rpx solid #e6e6e6;
  478. .title {
  479. width: 140rpx;
  480. text-align: center;
  481. white-space: nowrap;
  482. text-overflow: ellipsis;
  483. overflow: hidden;
  484. }
  485. .name {
  486. width: 140rpx;
  487. text-align: center;
  488. white-space: nowrap;
  489. text-overflow: ellipsis;
  490. overflow: hidden;
  491. }
  492. .work {
  493. width: 200rpx;
  494. text-align: center;
  495. white-space: nowrap;
  496. text-overflow: ellipsis;
  497. overflow: hidden;
  498. }
  499. .phone {
  500. width: 200rpx;
  501. text-align: center;
  502. white-space: nowrap;
  503. text-overflow: ellipsis;
  504. overflow: hidden;
  505. }
  506. }
  507. .top {
  508. background-color: #f0f3f7;
  509. }
  510. }
  511. }
  512. .tips {
  513. padding: 25rpx 15rpx;
  514. font-size: 24rpx;
  515. background-color: #fff;
  516. .tips_box {
  517. padding: 20rpx 0 20rpx 10rpx;
  518. line-height: 48rpx;
  519. background-color: #fff2f2;
  520. }
  521. }
  522. .btns {
  523. display: flex;
  524. align-items: center;
  525. justify-content: space-around;
  526. padding: 10rpx 0 50rpx;
  527. height: 100rpx;
  528. background-color: #fff;
  529. .btn {
  530. display: flex;
  531. align-items: center;
  532. justify-content: center;
  533. width: 300rpx;
  534. height: 100rpx;
  535. font-size: 32rpx;
  536. border-radius: 8rpx;
  537. }
  538. .up {
  539. border: 2rpx solid #0061ff;
  540. }
  541. .down {
  542. color: #fff;
  543. background-color: #0061ff;
  544. }
  545. }
  546. .pop {
  547. position: relative;
  548. display: flex;
  549. flex-direction: column;
  550. align-items: center;
  551. box-sizing: border-box;
  552. padding: 150rpx 20rpx 50rpx;
  553. width: 659rpx;
  554. height: 528rpx;
  555. border-radius: 15rpx;
  556. background: linear-gradient(180deg, #ebf2ff 0%, #ffffff 100%);
  557. .pop_img {
  558. position: absolute;
  559. top: -103rpx;
  560. left: 227rpx;
  561. width: 206rpx;
  562. height: 206rpx;
  563. }
  564. .pop_close {
  565. position: absolute;
  566. top: 19rpx;
  567. right: 29rpx;
  568. }
  569. .pop_box {
  570. display: flex;
  571. align-items: center;
  572. margin-bottom: 20rpx;
  573. .box_key {
  574. width: 150rpx;
  575. font-size: 28rpx;
  576. text-align: end;
  577. }
  578. .box_value {
  579. width: 300rpx;
  580. height: 70rpx;
  581. border-radius: 4rpx;
  582. border: 2rpx solid #cccccc;
  583. .input {
  584. padding: 0 20rpx;
  585. height: 100%;
  586. }
  587. }
  588. }
  589. .pop_btn {
  590. display: flex;
  591. align-items: center;
  592. justify-content: center;
  593. margin-top: 30rpx;
  594. width: 460rpx;
  595. height: 100rpx;
  596. color: #fff;
  597. font-size: 32rpx;
  598. border-radius: 8rpx;
  599. background-color: #0061ff;
  600. }
  601. }
  602. .pop_tips {
  603. position: relative;
  604. box-sizing: border-box;
  605. padding: 150rpx 20rpx 50rpx;
  606. width: 659rpx;
  607. height: 728rpx;
  608. border-radius: 15rpx;
  609. background: linear-gradient(180deg, #ebf2ff 0%, #ffffff 100%);
  610. .pop_img {
  611. position: absolute;
  612. top: -103rpx;
  613. left: 227rpx;
  614. width: 206rpx;
  615. height: 206rpx;
  616. }
  617. .pop_close {
  618. position: absolute;
  619. top: 19rpx;
  620. right: 29rpx;
  621. }
  622. .pop_title {
  623. margin-bottom: 28rpx;
  624. font-size: 32rpx;
  625. font-weight: bold;
  626. }
  627. .pop_text {
  628. font-size: 28rpx;
  629. line-height: 50rpx;
  630. }
  631. .pop_btn {
  632. display: flex;
  633. align-items: center;
  634. justify-content: center;
  635. margin: 90rpx auto 0;
  636. width: 543rpx;
  637. height: 100rpx;
  638. color: #fff;
  639. font-size: 32rpx;
  640. border-radius: 8rpx;
  641. background-color: #0061ff;
  642. }
  643. }
  644. .pop_web {
  645. position: relative;
  646. box-sizing: border-box;
  647. padding: 80rpx 20rpx 50rpx;
  648. width: 90vw;
  649. height: 90vh;
  650. border-radius: 15rpx;
  651. background: linear-gradient(180deg, #ebf2ff 0%, #ffffff 100%);
  652. .pop_close {
  653. position: absolute;
  654. top: 19rpx;
  655. right: 29rpx;
  656. }
  657. .web {
  658. height: calc(90vh - 90rpx);
  659. .iframe {
  660. width: 100%;
  661. height: 100%;
  662. }
  663. }
  664. }
  665. }
  666. </style>