order.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. <template>
  2. <view class="safeAreas">
  3. <nav-bar title="预约考试"></nav-bar>
  4. <view class="appointment">
  5. <view class="appointmentItem">
  6. <view class="title">考试地点:</view>
  7. <view class="place" @click="showAddress">
  8. <view class="name">{{ addressName }}</view>
  9. <view
  10. ><u-icon name="arrow-right" color="#999999" size="28"></u-icon
  11. ></view>
  12. </view>
  13. </view>
  14. <view class="appointmentItem" v-if="activeList.length">
  15. <view class="title">考试时间:</view>
  16. <view class="main">
  17. <view
  18. v-for="(item, index) in activeList"
  19. class="item"
  20. :key="index"
  21. @click="choItem(index)"
  22. >
  23. <view class="checkbox"
  24. ><u-checkbox
  25. v-if="item.status === 0"
  26. v-model="item.checked"
  27. shape="circle"
  28. ></u-checkbox
  29. ></view>
  30. <view class="box">
  31. <view
  32. :class="[
  33. 'time',
  34. { active: item.checked },
  35. { no: item.status !== 0 },
  36. ]"
  37. >{{
  38. item.dataTime + " " + item.startTime + " ~ " + item.endTime
  39. }}</view
  40. >
  41. <view class="statusInfo" v-if="item.status !== 0">
  42. <template v-if="item.status === 2"> 预约名额已满 </template>
  43. <template v-if="item.status === 1">
  44. 此时段您已经有其他考试预约
  45. </template>
  46. </view>
  47. </view>
  48. <view class="num"
  49. >已报:{{ item.registration }}/{{ item.num }}</view
  50. >
  51. </view>
  52. </view>
  53. </view>
  54. <view v-else class="appointmentItem">
  55. <view class="title">
  56. <text v-if="addressName && addressName != '请选择'">
  57. 该考试地点暂无考试时间,建议重新选择考试地点
  58. </text>
  59. <!-- <text v-else>
  60. 当前考培地点无考前培训时间点
  61. </text> -->
  62. </view>
  63. </view>
  64. <!-- 考试疫情承诺书 -->
  65. <view class="appointmentItem">
  66. <view class="title"><text class="star_red">*</text> 考试疫情承诺书</view>
  67. <view class="commitment">
  68. 本人参加“住房和城乡建设领域施工现场专业人员岗位”考试,愿意遵守疫情防控各项管理的相关要求,秉承对自己、对他人负责的原则,承担疫情防控社会责任,郑重作出以下承诺:<br/>
  69. 一、充分理解并遵守考试期间考点各项防疫安全的要求。<br/>
  70. 二、在考试前14天内,没有到过国内疫情中风险、高风险地区,未出境,不存在自境外回国情形。<br/>
  71. 三、在考试前14天内,每日自觉监测体温,体温均未出现高于37.3度的情形,无发热和呼吸道门诊就诊史。<br/>
  72. 四、在考试前14天内,未和新冠肺炎病例或疑似病例密切接触或间接接触,没有发烧、干咳、乏力、咳痰、气短、肌肉痛或关节痛、咽喉痛、头痛、寒颤、恶心或呕吐、鼻塞、腹泻、咳血、结膜充血等疑似新冠肺炎症状。<br/>
  73. 五、如出现与前述第二、三、四项任何一项不符的情形之一的,本人将及时在考前向相关管理机构报告,自觉配合采取隔离或其他防疫措施,并根据情况,自愿放弃参加考试。<br/>
  74. 六、考试当日自行做好防护工作,佩戴防护口罩。提前抵达考点,配合查验健康码、测量体温等。<br/>
  75. 七、考试期间,将严格遵守应考人员考场守则及疫情防控相关管理要求,完成考试后立即离场,不扎堆,不聚集。<br/>
  76. 八、本人承诺遵守《应考人员安全承诺书》中所有承诺内容,若因有瞒报、谎报造成新冠肺炎疫情传播的,一经查实,由本人承担相应的法律和经济责任。
  77. </view>
  78. </view>
  79. <view class="appointmentItem">
  80. <view class="title"><text class="star_red">*</text>签名板</view>
  81. <view class="dis_stys">
  82. <text style="color: #999999">请在下方签名区进行签名</text>
  83. <text @click="retDraw" mode="">清空</text>
  84. </view>
  85. <view class="handCenter">
  86. <!-- v-if="!form[item.fieldKey]" -->
  87. <canvas
  88. class="handWriting"
  89. disable-scroll="true"
  90. :catchtouchmove="true"
  91. @touchstart="uploadScaleStart"
  92. @touchmove="uploadScaleMove"
  93. @touchend="uploadScaleEnd"
  94. canvas-id="handWriting"
  95. ></canvas>
  96. <!-- <view
  97. v-else
  98. style="width: 100%; height: 100%; position: relative"
  99. >
  100. <view class="ctoples">图片</view>
  101. <image
  102. style="width: 100%; height: 100%"
  103. :src="$method.splitImgHost(form[item.fieldKey])"
  104. mode=""
  105. ></image>
  106. </view> -->
  107. </view>
  108. </view>
  109. <view class="btnMain">
  110. <view class="return" @click="backPage">上一步</view>
  111. <view class="sure" @click="sureOppoint">{{
  112. dataId === 1 ? "下一步" : dataId === 2 ? "确定预约" : "异常"
  113. }}</view>
  114. </view>
  115. </view>
  116. <!-- 弹框-->
  117. <u-popup v-model="address_show" mode="bottom" class="addModel">
  118. <view class="tipBox safeArea">
  119. <view class="line"></view>
  120. <view class="title">温馨提示</view>
  121. <u-line color="#EEEEEE" />
  122. <scroll-view class="addressList" :scroll-y="true">
  123. <view
  124. class="item"
  125. v-for="(item, index) in listData"
  126. :key="index"
  127. @click="choAddress(item, index)"
  128. >
  129. <u-checkbox
  130. class="checkbox"
  131. v-model="item.checked"
  132. shape="circle"
  133. ></u-checkbox>
  134. <view :class="['address', { active: item.checked }]">{{
  135. item.siteAddress
  136. }}</view>
  137. </view>
  138. </scroll-view>
  139. <u-line color="#EEEEEE" />
  140. <view class="btn" @click="sureAddress">确认</view>
  141. </view>
  142. </u-popup>
  143. </view>
  144. </template>
  145. <script>
  146. import { mapGetters } from "vuex";
  147. import Handwriting from "@/common/signature.js";
  148. export default {
  149. data() {
  150. return {
  151. orderGoodsId: 0,
  152. address_show: false,
  153. addressName: "请选择",
  154. addressId: null, //当前选中考试点ID
  155. listData: [], //考试地点数据
  156. activeList: [], //选中考试地点列表
  157. applyId: null, //考试计划ID
  158. goodsId: null, //商品ID
  159. applyStatus: null, //学员状态ID
  160. sysTime: 0,
  161. dataId: null, //跳转拷贝
  162. handwriting: '',
  163. lineColor: "black",
  164. slideValue: 50,
  165. openVerify: false, // 控制是否手动验证
  166. commitment_electr_signature: '',
  167. isUploading: false,
  168. siteId: '', // 考试id
  169. };
  170. },
  171. async onLoad(option) {
  172. this.applyId = Number(option.applyId);
  173. this.goodsId = Number(option.goodsId);
  174. this.applyStatus = Number(option.applyStatus);
  175. this.dataId = Number(option.dataId);
  176. this.orderGoodsId = Number(option.orderGoodsId);
  177. await this.commonSystemTime();
  178. this.getInfo();
  179. },
  180. onReady(res) {
  181. this.handwriting = new Handwriting({
  182. lineColor: this.lineColor,
  183. slideValue: this.slideValue, // 0, 25, 50, 75, 100
  184. canvasName: "handWriting",
  185. });
  186. // this.$refs.uForm.setRules(this.rules);
  187. },
  188. methods: {
  189. commonSystemTime() {
  190. return new Promise((resolve) => {
  191. this.$api.commonSystemTime().then((res) => {
  192. this.sysTime = res.data.data;
  193. resolve();
  194. });
  195. });
  196. },
  197. //获取考试地点
  198. getInfo() {
  199. // apply/subscribeApplySite
  200. this.$api
  201. .getApplysubscribeApplySite({ applyId: this.applyId })
  202. .then((res) => {
  203. if (res.data.code === 200) {
  204. res.data.data.forEach((item, index) => {
  205. item.checked = false;
  206. });
  207. this.listData = res.data.data;
  208. console.log('this.listData:', this.listData)
  209. }
  210. });
  211. },
  212. showAddress() {
  213. this.address_show = true;
  214. },
  215. choAddress(item, index) {
  216. this.siteId = item.siteId
  217. this.listData.forEach((item, idx) => {
  218. this.$set(item, "checked", false);
  219. if (idx === index) {
  220. this.$set(item, "checked", true);
  221. }
  222. });
  223. },
  224. sureAddress() {
  225. var self = this;
  226. const index = this.listData.findIndex((item) => item.checked);
  227. if (index === -1) {
  228. uni.showToast({
  229. title: "请选择考试地点",
  230. icon: "none",
  231. });
  232. return;
  233. }
  234. this.siteId = this.listData[index].siteId
  235. console.log('siteId: ', this.siteId, index)
  236. if (this.addressId === this.listData[index].id) {
  237. this.address_show = false;
  238. return;
  239. }
  240. this.addressName = this.listData[index].siteAddress;
  241. this.addressId = this.listData[index].id;
  242. var arrays = [];
  243. this.listData[index].examUserApplySiteTime.forEach((item) => {
  244. item.examApplySiteTimeTwoVo.forEach((items) => {
  245. arrays.push({
  246. examTime: item.examTime,
  247. startTimeC: items.startTime,
  248. endTimeC: items.endTime,
  249. dataTime: self.$method
  250. .timestampToTime(item.examTime)
  251. .replace(/-/g, "/"),
  252. startTime: items.startTime,
  253. endTime: items.endTime,
  254. num: items.num,
  255. registration: items.registration,
  256. checked: false,
  257. status:
  258. items.status === 1
  259. ? items.status
  260. : items.registration >= items.num
  261. ? 2
  262. : items.status,
  263. });
  264. });
  265. });
  266. this.activeList = arrays.filter((item, index) => {
  267. console.log(item);
  268. // const newTime = parseInt(new Date().getTime() / 1000)
  269. console.log(
  270. item.dataTime.replace(/-/g, "/") + "" + item.startTime + ":00"
  271. );
  272. const liTime = parseInt(
  273. new Date(
  274. item.dataTime.replace(/-/g, "/") + "" + item.startTime + ":00"
  275. ).getTime() / 1000
  276. );
  277. console.log(liTime, "liTime");
  278. console.log(this.sysTime, "newTime");
  279. if (liTime > this.sysTime) {
  280. return item;
  281. }
  282. });
  283. console.log('----',this.activeList);
  284. this.address_show = false;
  285. },
  286. choItem(index) {
  287. const item = this.activeList[index];
  288. if (item.status !== 0) {
  289. return;
  290. }
  291. this.activeList.forEach((item, idx) => {
  292. item.checked = false;
  293. if (idx === index) {
  294. item.checked = true;
  295. }
  296. });
  297. },
  298. async sureOppoint() {
  299. if (this.isUploading) {
  300. return;
  301. }
  302. this.isUploading = true
  303. console.log('commitment_electr_signature', this.commitment_electr_signature)
  304. var self = this;
  305. if (self.addressId) {
  306. var ast = self.activeList.some((item) => {
  307. return item.checked === true;
  308. });
  309. console.log('ast', ast)
  310. if (ast) {
  311. await this.subCanvas()
  312. if (!this.commitment_electr_signature) {
  313. uni.showToast({
  314. title: "请签名",
  315. icon: "none",
  316. })
  317. return
  318. } else {
  319. await this.submitApi()
  320. }
  321. console.log('this.00000', this.commitment_electr_signature)
  322. // return
  323. var copyData = JSON.parse(JSON.stringify(self.activeList));
  324. const index = copyData.findIndex((item) => item.checked);
  325. var data = {
  326. applyId: self.applyId,
  327. goodsId: self.goodsId,
  328. studentType: self.applyStatus,
  329. applySiteAddress: self.addressName,
  330. applySiteExamTime: copyData[index].examTime,
  331. applySiteStartTime: copyData[index].startTimeC,
  332. applySiteEndTime: copyData[index].endTimeC,
  333. orderGoodsId: self.orderGoodsId,
  334. siteId: this.siteId, // 考场id
  335. reportFile: this.commitment_electr_signature,
  336. };
  337. console.log('-----data', data)
  338. // return
  339. if (self.dataId === 1) {
  340. self.$store.commit("updateApplyData", data);
  341. self.$navTo.togo("/pages2/appointment/kporder", {
  342. applyId: self.applyId,
  343. applyStatus: self.applyStatus,
  344. goodsId: self.goodsId,
  345. orderGoodsId: self.orderGoodsId,
  346. });
  347. }
  348. if (self.dataId === 2) {
  349. self.$api.addApply(data).then((res) => {
  350. if (res.data.code === 200) {
  351. uni.reLaunch({
  352. url: `/pages2/appointment/appointment_success?subscribeId=${res.data.data}`,
  353. });
  354. } else {
  355. uni.showToast({
  356. icon: "none",
  357. title: res.data.msg,
  358. });
  359. }
  360. });
  361. }
  362. this.isUploading = false
  363. } else {
  364. uni.showToast({
  365. title: "请选择考试时间",
  366. icon: "none",
  367. });
  368. this.isUploading = false
  369. }
  370. } else {
  371. uni.showToast({
  372. title: "请选择考试地点",
  373. icon: "none",
  374. });
  375. this.isUploading = false
  376. }
  377. },
  378. backPage() {
  379. uni.navigateBack({
  380. delta: 1,
  381. });
  382. },
  383. retDraw() {
  384. this.handwriting.retDraw()
  385. this.commitment_electr_signature = ''
  386. // this.$set(this.form, "commitment_electr_signature", "");
  387. this.openVerify = false;
  388. },
  389. uploadScaleStart(event) {
  390. this.handwriting.uploadScaleStart(event);
  391. },
  392. uploadScaleMove(event) {
  393. this.handwriting.uploadScaleMove(event);
  394. },
  395. uploadScaleEnd(event) {
  396. this.handwriting.uploadScaleEnd(event);
  397. },
  398. subCanvas() {
  399. console.log("签名-------");
  400. return new Promise((resolve, reject) => {
  401. if (this.commitment_electr_signature) {
  402. resolve();
  403. return;
  404. }
  405. this.handwriting.saveCanvas().then((res) => {
  406. if (this.handwriting.linePrack.length) {
  407. console.log('签名-----res', res)
  408. // this.$set(this.form, "commitment_electr_signature", res);
  409. this.commitment_electr_signature = res
  410. }
  411. resolve(res)
  412. })
  413. .catch((err) => {
  414. uni.showToast({
  415. title: "签名上传失败",
  416. icon: "error",
  417. });
  418. });
  419. this.isUploading = false
  420. });
  421. },
  422. // async submits() {
  423. // if (this.isUploading) {
  424. // return;
  425. // }
  426. // this.isUploading = true;
  427. // var ast = this.listData.some((item) => {
  428. // return item.fieldKey === "commitment_electr_signature";
  429. // });
  430. // if (ast) {
  431. // await this.subCanvas();
  432. // }
  433. // this.openVerify = true;
  434. // },
  435. //提交表单
  436. async submitApi() {
  437. if (this.commitment_electr_signature) {
  438. this.commitment_electr_signature = await this.$method.uploadFile(
  439. this.commitment_electr_signature,
  440. 0
  441. );
  442. console.log('----commitment_electr_signature', this.commitment_electr_signature)
  443. }
  444. // this.uploadDatas(data);
  445. },
  446. },
  447. };
  448. </script>
  449. <style>
  450. page {
  451. background-color: #eaeef1;
  452. }
  453. .addModel .u-drawer-bottom {
  454. box-shadow: 0px 0px 16px 4px rgba(145, 156, 178, 0.1);
  455. border-radius: 32rpx 32rpx 0px 0px;
  456. }
  457. </style>
  458. <style scoped lang="scss">
  459. .safeAreas {
  460. padding-bottom: 30rpx;
  461. }
  462. .appointment {
  463. padding: 0 8rpx;
  464. .appointmentItem {
  465. margin: 24rpx 0 40rpx;
  466. .title {
  467. font-size: 30rpx;
  468. font-family: PingFang SC;
  469. font-weight: 500;
  470. color: #333333;
  471. line-height: 1;
  472. margin-bottom: 16rpx;
  473. padding-left: 24rpx;
  474. .star_red {
  475. color: red;
  476. }
  477. }
  478. .place {
  479. height: 80rpx;
  480. background: #ffffff;
  481. border-radius: 16rpx;
  482. display: flex;
  483. justify-content: space-between;
  484. align-items: center;
  485. padding: 0 24rpx;
  486. }
  487. .commitment {
  488. padding: 12rpx;
  489. height: 300rpx;
  490. background: #ffffff;
  491. overflow-y: auto;
  492. }
  493. .handCenter, .dis_stys, .commitment {
  494. margin: 0rpx 24rpx;
  495. }
  496. .dis_stys {
  497. display: flex;
  498. justify-content: space-between;
  499. align-items: center;
  500. margin-bottom: 16rpx;
  501. }
  502. .handCenter {
  503. .handWriting {
  504. width: 100%;
  505. height: 400rpx;
  506. background: #fff;
  507. }
  508. }
  509. }
  510. .main {
  511. background: #ffffff;
  512. border-radius: 16rpx;
  513. padding: 32rpx 16rpx;
  514. .item {
  515. display: flex;
  516. align-items: center;
  517. margin-bottom: 16rpx;
  518. font-size: 28rpx;
  519. font-family: PingFang SC;
  520. font-weight: 500;
  521. color: #333333;
  522. .statusInfo {
  523. font-size: 24rpx;
  524. font-family: PingFang SC;
  525. font-weight: 500;
  526. color: #ff3b30;
  527. padding-left: 24rpx;
  528. }
  529. .checkbox {
  530. width: 32rpx;
  531. height: 32rpx;
  532. display: flex;
  533. align-items: center;
  534. }
  535. .time {
  536. width: 430rpx;
  537. height: 80rpx;
  538. line-height: 80rpx;
  539. background: #f5f5f5;
  540. border: 2rpx solid #f5f5f5;
  541. border-radius: 16rpx;
  542. font-size: 30rpx;
  543. font-family: PingFang SC;
  544. font-weight: bold;
  545. text-align: center;
  546. color: #333333;
  547. margin: 0 18rpx 0 8rpx;
  548. &.active {
  549. background: #ebf5ff;
  550. border: 2rpx solid #007aff;
  551. }
  552. &.no {
  553. background: #ffdddb;
  554. border: 2rpx solid #ffdddb;
  555. }
  556. }
  557. }
  558. }
  559. .btnMain {
  560. display: flex;
  561. justify-content: center;
  562. text-align: center;
  563. .return {
  564. width: 200rpx;
  565. height: 80rpx;
  566. line-height: 80rpx;
  567. background: #f5f5f5;
  568. border-radius: 40rpx;
  569. font-size: 30rpx;
  570. font-family: PingFang SC;
  571. font-weight: bold;
  572. color: #007aff;
  573. }
  574. .sure {
  575. width: 438rpx;
  576. height: 80rpx;
  577. line-height: 80rpx;
  578. background: #007aff;
  579. border-radius: 40rpx;
  580. font-size: 30rpx;
  581. font-family: PingFang SC;
  582. font-weight: bold;
  583. color: #ffffff;
  584. margin-left: 24rpx;
  585. }
  586. }
  587. }
  588. .tipBox {
  589. width: 100%;
  590. font-family: PingFang SC;
  591. .line {
  592. width: 80rpx;
  593. height: 8rpx;
  594. background: #999999;
  595. border-radius: 4rpx;
  596. margin: 8rpx auto;
  597. }
  598. .title {
  599. text-align: center;
  600. font-size: 24rpx;
  601. font-family: PingFang SC;
  602. font-weight: 500;
  603. color: #999999;
  604. margin: 15rpx 0;
  605. }
  606. .main {
  607. font-size: 30rpx;
  608. font-weight: 500;
  609. color: #666666;
  610. line-height: 48rpx;
  611. margin-bottom: 40rpx;
  612. }
  613. .addressList {
  614. height: 500rpx;
  615. padding-top: 24rpx;
  616. .item {
  617. display: flex;
  618. align-items: center;
  619. padding: 0 24rpx;
  620. margin-bottom: 24rpx;
  621. .checkbox {
  622. width: 32rpx;
  623. height: 32rpx;
  624. display: flex;
  625. align-items: center;
  626. margin-right: 8rpx;
  627. }
  628. .address {
  629. width: 654rpx;
  630. height: 80rpx;
  631. line-height: 80rpx;
  632. background: #f5f5f5;
  633. border-radius: 16rpx;
  634. font-size: 30rpx;
  635. font-family: PingFang SC;
  636. font-weight: bold;
  637. color: #333333;
  638. padding: 0 24rpx;
  639. &.active {
  640. background: #ebf5ff;
  641. border: 2rpx solid #007aff;
  642. }
  643. }
  644. }
  645. }
  646. .btn {
  647. width: 200rpx;
  648. height: 64rpx;
  649. line-height: 64rpx;
  650. background: linear-gradient(0deg, #015eea, #00c0fa);
  651. border-radius: 32rpx;
  652. margin: 17rpx auto;
  653. font-size: 30rpx;
  654. font-family: PingFang SC;
  655. font-weight: 500;
  656. text-align: center;
  657. color: #ffffff;
  658. }
  659. }
  660. </style>