addGuest.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. <template>
  2. <view>
  3. <view class="is-debug" v-if="needInitHotelList">
  4. <view class="guest-list" v-for="guest in guestList">
  5. <u-form class="guest-form" :model="guestModel" labelAlign="center" :ref="'form' + guest.id">
  6. <u-form-item class="guest-form-item" label="姓名:" prop="guest.name" labelWidth="160rpx">
  7. <u-input placeholder="请输入姓名" border="surround" v-model="guest.name" clearable></u-input>
  8. </u-form-item>
  9. <u-form-item class="guest-form-item" label="证件号:" prop="guest.idNumber" labelWidth="160rpx">
  10. <u-input placeholder="请输入证件号" border="surround" v-model="guest.idNumber" clearable></u-input>
  11. </u-form-item>
  12. <view class="guest-form-bottom">
  13. <view class="guest-form-bottom-left">
  14. <u-form-item class="" :label="uploadPicTip" prop="guest.pic" labelWidth="160rpx">
  15. <image v-if="userInfo.staticFaceCheck===false" style="width: 160rpx; height: 160rpx; "
  16. :src="'data:image/jpeg;base64,' + guest.picBase64" @click="gotoPreCheck(guest)">
  17. </image>
  18. <u-upload v-else :fileList="guest.pic" @afterRead="afterRead" @delete="deletePic"
  19. :name="guest.id" :maxCount="1" :previewFullImage="true" :maxSize="1024*1024*1.5"
  20. @oversize="oversize"></u-upload>
  21. </u-form-item>
  22. </view>
  23. <view class="delete-guest-btn">
  24. <u-button v-if="guestList.length>1" type="error"
  25. @click="deleteGuest(guest.id)">删除入住人</u-button>
  26. </view>
  27. </view>
  28. </u-form>
  29. </view>
  30. <view class="bottom">
  31. <view class="add-guest-btn">
  32. <u-button type="primary" :disabled="this.guestList.length >= 3" @click="addGuest">添加入住人</u-button>
  33. </view>
  34. <view class="checkin-btn">
  35. <u-button type="primary" @click="gotoSubmitOrder" :loading="checkinButtonLoading"
  36. :loadingText="checkinButtonLoadingText">确认</u-button>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="" v-else>
  41. <view class="guest-list" v-for="guest in guestList">
  42. <u-form class="guest-form" :model="guestModel" labelAlign="center" :ref="'form' + guest.id">
  43. <u-form-item class="guest-form-item" label="姓名:" prop="guest.name" labelWidth="160rpx">
  44. <u-input placeholder="请输入姓名" border="surround" v-model="guest.name"></u-input>
  45. </u-form-item>
  46. <u-form-item class="guest-form-item" label="证件号:" prop="guest.idNumber" labelWidth="160rpx">
  47. <u-input placeholder="请输入证件号" border="surround" v-model="guest.idNumber"></u-input>
  48. </u-form-item>
  49. <view class="guest-form-bottom">
  50. <view class="delete-guest-btn">
  51. <u-button v-if="guestList.length>1" type="error"
  52. @click="deleteGuest(guest.id)">删除入住人</u-button>
  53. </view>
  54. </view>
  55. </u-form>
  56. </view>
  57. <view class="add-guest-btn">
  58. <u-button type="primary" :disabled="this.guestList.length >= 3 && addGuestButtonDisabled"
  59. @click="authentication">添加入住人</u-button>
  60. </view>
  61. <view class="checkin-btn">
  62. <u-button type="primary" @click="gotoSubmitOrder" :disabled="checkinButtonDisabled">确认</u-button>
  63. </view>
  64. </view>
  65. <u-toast ref="uToast"></u-toast>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. startEid
  71. } from '../../mp_ecard_sdk/main.js'
  72. import {
  73. mapState,
  74. mapMutations
  75. } from 'vuex'
  76. import moment from 'moment'
  77. export default {
  78. data() {
  79. return {
  80. nameTip: '姓名:',
  81. idNumberTip: '证件号:',
  82. uploadPicTip: '人脸:',
  83. guestList: [],
  84. guestModel: {
  85. guestInfo: {
  86. name: '',
  87. idNumber: '',
  88. pic: []
  89. }
  90. },
  91. checkinButtonLoading: false,
  92. checkinButtonLoadingText: '办理中',
  93. needInitHotelList: false,
  94. addGuestButtonDisabled: false,
  95. checkinButtonDisabled: false,
  96. };
  97. },
  98. computed: {
  99. ...mapState('m_user', ['userInfo']),
  100. ...mapState('m_business', ['hotelParams', 'currentHotelId', 'reservationInfo']),
  101. },
  102. methods: {
  103. ...mapMutations('m_business', ['updateReservationInfo']),
  104. ...mapMutations('m_user', ['updateUserInfo']),
  105. setGuestPicBase64ById(id, base64) {
  106. this.guestList.forEach(guest => {
  107. if (guest.id == id) {
  108. guest.picBase64 = base64
  109. guest.picValid = true
  110. return
  111. }
  112. })
  113. },
  114. gotoPreCheck(guest) {
  115. if (guest.name === '' || guest.name === null || guest.name === undefined || guest.idNumber === '' || guest
  116. .idNumber === '' || guest.idNumber === '') {
  117. uni.$showMsg('请先填写姓名和身份证号')
  118. return
  119. }
  120. console.log(guest)
  121. uni.navigateTo({
  122. url: '/subpkg_checkin/dynamicFaceCheck/dynamicFaceCheck?guestId=' + guest.id + "&idNumber=" +
  123. guest
  124. .idNumber + "&name=" + guest.name
  125. })
  126. },
  127. addGuest() {
  128. if (this.guestList.length < 3) {
  129. this.guestList.push({
  130. id: this.guestList[this.guestList.length - 1].id + 1,
  131. name: '',
  132. idNumber: '',
  133. pic: [],
  134. picBase64: 'iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACkVJREFUeF7tnW1y00oQRe0A63hhJYSKqcouCCt5sBLydpGqOEVYCeyDJMKTknkisWzpzvV45D6u4g+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UmSRVAgiikiMuBAEECVFmklQJIIhKjrgQBBAkRJlJUiWAICo54kIQQJAQZSZJlQCCqOSIC0EAQUKUmSRVAgiikiMuBAEECVFmklQJIIhKjrgQBBAkRJlJUiWAICo54kIQQJAQZSZJlQCCqOSIC0EAQUKUmSRVAgiikiMuBAEECVFmklQJIIhKjrgQBH4DtH6CMu0Z/30AAAAASUVORK5CYII=',
  135. picValid: false
  136. })
  137. console.log(this.guestList[this.guestList.length - 1].id)
  138. } else {
  139. uni.$showMsg('入住人数已达到上限!')
  140. }
  141. },
  142. oversize() {
  143. uni.$showMsg('图片超出允许大小(1.5M)')
  144. },
  145. gotoCheck() {
  146. console.log('!!!!!!!!!!!')
  147. },
  148. async gotoSubmitOrder() {
  149. let checkinResult = await this.checkin()
  150. console.log(checkinResult)
  151. if (checkinResult === true) {
  152. this.reservationInfo.orderInfo.status = 'CHECKIN'
  153. uni.$http.put('/hotelOrder/' + this.reservationInfo.orderInfo.id, this.reservationInfo.orderInfo)
  154. setTimeout(() => {
  155. uni.switchTab({
  156. url: '/pages/home/home'
  157. })
  158. }, 1500)
  159. }
  160. // setTimeout(() => {
  161. // uni.navigateTo({
  162. // url: '/subpkg_checkin/submitOrder/submitOrder'
  163. // })
  164. // }, 1500)
  165. },
  166. //删除图片
  167. deletePic(event) {
  168. console.log(event.name)
  169. this.guestList.forEach(guest => {
  170. console.log(guest)
  171. if (guest.id == event.name) {
  172. guest.pic = []
  173. guest.picBase64 = ''
  174. return
  175. }
  176. })
  177. },
  178. //上传图片
  179. async afterRead(event) {
  180. try {
  181. this.addGuestButtonDisabled = true
  182. this.checkinButtonDisabled = true
  183. let _this = this
  184. let params = {
  185. type: 'loading',
  186. message: "正在加载",
  187. duration: '500'
  188. }
  189. this.$refs.uToast.show({
  190. ...params,
  191. complete() {
  192. console.log(event)
  193. _this.guestList.forEach(guest => {
  194. console.log(guest.id)
  195. console.log(guest.id == event.name)
  196. if (guest.id == event.name) {
  197. guest.pic.push(event.file)
  198. uni.getFileSystemManager().readFile({
  199. filePath: guest.pic[0].url, //选择图片返回的相对路径
  200. encoding: 'base64', //编码格式
  201. success: res => {
  202. console.log(res);
  203. guest.picBase64 = res.data
  204. uni.$http.post('/faceVerification/checkPic', {
  205. hotelId: _this.currentHotelId,
  206. faceData: guest.picBase64
  207. }).then((res) => {
  208. if (res.data.code === 200 && res
  209. .data
  210. .success ===
  211. true) {
  212. uni.$showMsg('上传成功!')
  213. guest.picValid = true
  214. } else {
  215. uni.$showMsg('未检测到人脸,请重新上传!')
  216. }
  217. console.log(res)
  218. })
  219. },
  220. fail: (e) => {
  221. uni.$showMsg('图片转换失败,请重试!')
  222. console.log("图片转换失败!");
  223. console.log(e);
  224. }
  225. })
  226. }
  227. })
  228. }
  229. })
  230. } finally {
  231. this.addGuestButtonDisabled = false
  232. this.checkinButtonDisabled = false
  233. }
  234. },
  235. deleteGuest(id) {
  236. console.log(id)
  237. this.guestList = this.guestList.filter(guest => guest.id != id)
  238. },
  239. async checkin() {
  240. //云极
  241. //#ifdef MP-WEIXIN
  242. if (this.hotelParams.wx === null || this.hotelParams.wx === undefined || this.hotelParams.wx === 0)
  243. //#endif
  244. //#ifdef MP-ALIPAY
  245. if (this.hotelParams.alipay === null || this.hotelParams.alipay === undefined || this.hotelParams
  246. .alipay === 0)
  247. //#endif
  248. {
  249. //检查姓名、证件号是否填入,上传图片是否通过检查
  250. if (this.guestList.length < 1) {
  251. uni.$showMsg('请添加入住人!')
  252. return
  253. } else {
  254. let isEmpty = false;
  255. let allPicValid = true;
  256. let fieldsToCheck = ['name', 'idNumber', 'picBase64']
  257. this.guestList.forEach((guest) => {
  258. if (!guest.picValid) {
  259. allPicValid = false
  260. return
  261. }
  262. fieldsToCheck.forEach(field => {
  263. if (guest[field] === null || guest[field] === undefined || guest[
  264. field] === '') {
  265. isEmpty = true
  266. return
  267. }
  268. })
  269. })
  270. if (isEmpty) {
  271. uni.$showMsg('请正确填写信息!')
  272. return
  273. }
  274. if (!allPicValid) {
  275. uni.$showMsg('请检查图片!')
  276. return
  277. }
  278. }
  279. this.checkinButtonLoading = true
  280. try {
  281. if (this.userInfo.skipIdMatching === false) {
  282. //检查人脸与姓名身份证号是否匹配
  283. for (let guest of this.guestList) {
  284. let yunjiFaceCheckInfo = {
  285. idNo: guest.idNumber,
  286. name: guest.name,
  287. image: guest.picBase64
  288. }
  289. let res = await uni.$http.post('/faceVerification/yunjiVerification',
  290. yunjiFaceCheckInfo)
  291. if (res.data.success === false) {
  292. uni.$showMsg('顾客' + guest.name + '身份验证未通过')
  293. return
  294. }
  295. }
  296. }
  297. let checkinInfo = {
  298. hotelId: this.reservationInfo.orderInfo.hotelId,
  299. building: this.reservationInfo.orderInfo.building,
  300. floorId: this.reservationInfo.orderInfo.floor,
  301. roomId: this.reservationInfo.orderInfo.room,
  302. startTime: moment(this.reservationInfo.orderInfo.startTime).format('YYMMDDHHmmss'),
  303. endTime: moment(this.reservationInfo.orderInfo.endTime).format('YYMMDDHHmmss'),
  304. cardId: '0',
  305. userType: 1,
  306. isDebug: this.userInfo.isDebug
  307. }
  308. let checkinResult = new Array(this.guestList.length).fill(false)
  309. console.log(checkinResult)
  310. for (let i = 0; i < this.guestList.length; i++) {
  311. checkinInfo.userName = this.guestList[i].name;
  312. checkinInfo.userId = this.guestList[i].idNumber;
  313. checkinInfo.faceData = this.guestList[i].picBase64;
  314. let res = await uni.$http.post('/checkin', checkinInfo)
  315. console.log(res)
  316. if (res.data.code == 200 && res.data.success === true) {
  317. checkinResult[i] = true
  318. console.log('checkinResult[' + i + '] = true')
  319. }
  320. }
  321. if (checkinResult.indexOf(false) < 0) {
  322. uni.$showMsg('办理成功!')
  323. return true
  324. } else {
  325. uni.$showMsg('办理失败!')
  326. return false
  327. }
  328. } catch (e) {
  329. console.log(e)
  330. let failMsg = '办理失败!'
  331. uni.$showMsg(failMsg)
  332. return false
  333. } finally {
  334. this.checkinButtonLoading = false
  335. }
  336. }
  337. //E证通
  338. else {
  339. if (this.guestList.length < 1) {
  340. uni.$showMsg('请添加入住人!')
  341. return
  342. } else {
  343. let start = new Date(this.reservation.startTime)
  344. let checkinInfo = {
  345. hotelId: this.reservation.hotelId,
  346. building: this.reservation.building,
  347. floorId: this.reservation.floor,
  348. roomId: this.reservation.room,
  349. startTime: moment(this.reservation.startTime).format('YYMMDDHHmmss'),
  350. endTime: moment(this.reservation.endTime).format('YYMMDDHHmmss'),
  351. cardId: '0',
  352. userType: 1,
  353. }
  354. this.guestList.forEach(guest => {
  355. this.eidTokens.push(guest.eidToken)
  356. });
  357. checkinInfo.eidTokens = this.eidTokens;
  358. console.log("checkinInfo:" + checkinInfo)
  359. let res = await uni.$http.post('/checkin', checkinInfo)
  360. console.log(res)
  361. if (res.data.code === 200 && res.data.success === true) {
  362. uni.$showMsg('办理成功!')
  363. setTimeout(() => {
  364. uni.switchTab({
  365. url: '/pages/home/home'
  366. })
  367. }, 1500)
  368. } else {
  369. let failMsg = '办理失败!'
  370. uni.$showMsg(failMsg)
  371. }
  372. }
  373. }
  374. this.checkinButtonLoading = false
  375. },
  376. async authentication() {
  377. if (this.guestList.length > 3) {
  378. uni.$showMsg('入住人数已达上限!')
  379. return
  380. }
  381. let _this = this;
  382. //#ifdef MP-WEIXIN
  383. if (!(this.hotelParams.wx === null || this.hotelParams.wx === undefined || this.hotelParams.wx ===
  384. 0)) {
  385. let eidTokenRes = await uni.$http.get('/faceVerification/eidToken')
  386. let eidToken = eidTokenRes.data.data
  387. console.log("eidToken" + eidToken)
  388. startEid({
  389. data: {
  390. token: eidToken,
  391. needJumpPage: false
  392. },
  393. async verifyDoneCallback(res) {
  394. const {
  395. token,
  396. verifyDone
  397. } = res;
  398. console.log('收到核身完成的res:', res);
  399. console.log('核身的token是:', token);
  400. console.log('是否完成核身:', verifyDone);
  401. let eidResult = await uni.$http.get('/faceVerification/eidResult/' + eidToken)
  402. console.log('=========eidResult===========')
  403. console.log(eidResult)
  404. console.log('=========eidResult===========')
  405. if (eidResult.data.code === 200) {
  406. let guest = {
  407. verificated: true,
  408. name: eidResult.data.data.name,
  409. idNumber: eidResult.data.data.idNumber,
  410. eidToken: eidToken
  411. }
  412. _this.guestList.push(guest)
  413. } else {
  414. uni.$showMsg('身份验证失败,请重试!')
  415. }
  416. }
  417. });
  418. }
  419. //#endif
  420. },
  421. async getReservationInfo() {
  422. let res = await uni.$http.post('/userPicRoomInfo/queryByCondition', {
  423. userId: this.userInfo.userId,
  424. // userId: 29,
  425. status: true,
  426. pageNo: 1,
  427. pageSize: 1
  428. })
  429. console.log(res)
  430. if (res.data.data.records?.length > 0) {
  431. this.reservation = res.data.data.records[0]
  432. this.reservation.startTime = moment(this.reservation.startTime).format('YYYY/MM/DD HH:mm:ss')
  433. this.reservation.endTime = moment(this.reservation.endTime).format('YYYY/MM/DD HH:mm:ss')
  434. } else {
  435. this.reservation = {}
  436. }
  437. console.log(this.reservation)
  438. }
  439. },
  440. onLoad() {
  441. // this.getReservationInfo()
  442. //#ifdef MP-WEIXIN
  443. this.needInitHotelList = this.hotelParams.wx === 0 || this.hotelParams.wx === null || this.hotelParams.wx ===
  444. undefined
  445. //#endif
  446. //#ifdef MP-ALIPAY
  447. this.needInitHotelList = this.hotelParams.alipay === 0 || this.hotelParams.alipay === null || this.hotelParams
  448. .alipay === undefined
  449. //#endif
  450. console.log(this.needInitHotelList)
  451. if (this.needInitHotelList) {
  452. this.guestList.push({
  453. id: 0,
  454. name: '',
  455. idNumber: '',
  456. pic: [],
  457. picBase64: 'iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAACkVJREFUeF7tnW1y00oQRe0A63hhJYSKqcouCCt5sBLydpGqOEVYCeyDJMKTknkisWzpzvV45D6u4g+oB/XpOeqR9eH5jA8EINBLYA4bCECgnwCCMDsgsIUAgjA9IIAgzAEIaAToIBo3ooIQQJAghSZNjQCCaNyICkIAQYIUmjQ1AgiicSMqCAEECVJo0tQIIIjGjaggBBAkSKFJUyOAIBo3ooIQQJAghS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QUKUmSRVAgiikiMuBAEECVFmklQJIIhKjrgQBH4DtH6CMu0Z/30AAAAASUVORK5CYII=',
  458. picValid: false
  459. })
  460. this.guestList[0].idNumber = this.userInfo.idNumber
  461. this.guestList[0].name = this.userInfo.name
  462. }
  463. if (this.userInfo.openid === '' || this.userInfo.openid === null || this.userInfo.openid === undefined) {
  464. let _this = this
  465. wx.login({
  466. success(res) {
  467. if (res.code) {
  468. //发起网络请求
  469. uni.$http.post('/weChatLogin', {
  470. code: res.code
  471. }).then((res) => {
  472. _this.updateUserInfo(Object.assign(_this.userInfo, {
  473. openid: res.data.data
  474. }))
  475. })
  476. } else {
  477. console.log('登录失败!' + res.errMsg)
  478. }
  479. }
  480. })
  481. }
  482. },
  483. onShow() {
  484. console.log('onshow', this.pic)
  485. let pages = getCurrentPages();
  486. console.log("pages", pages);
  487. }
  488. }
  489. </script>
  490. <style lang="scss">
  491. .is-debug {
  492. height: 900rpx;
  493. overflow: scroll;
  494. }
  495. .guest-list {
  496. border: 1rpx solid grey;
  497. margin: 20rpx;
  498. }
  499. .guest-form-item {
  500. display: flex;
  501. width: 80%;
  502. }
  503. .guest-form-item-tip {
  504. width: 160rpx;
  505. display: flex;
  506. margin-left: 20rpx;
  507. }
  508. .add-guest-btn,
  509. .checkin-btn {
  510. width: 80%;
  511. height: 72rpx;
  512. margin: 40rpx auto;
  513. }
  514. .u-input {
  515. width: 80%;
  516. }
  517. .guest-form-bottom {
  518. display: flex;
  519. }
  520. .delete-guest-btn {
  521. margin: 0 auto;
  522. position: relative;
  523. top: 30%;
  524. /*偏移*/
  525. transform: translateY(30%);
  526. text-align: center;
  527. }
  528. .bottom {
  529. z-index: 999;
  530. position: fixed;
  531. bottom: 0;
  532. background-color: white;
  533. width: 100%;
  534. height: 300rpx;
  535. }
  536. .guest-form-bottom-left {
  537. height: 216rpx;
  538. width: 336rpx;
  539. }
  540. </style>