|
@@ -18,7 +18,8 @@
|
|
|
<u-input v-model="name" border="none" clearable fontSize="36rpx"></u-input>
|
|
|
</u-form-item>
|
|
|
<u-form-item label="手机号" prop="phone">
|
|
|
- <u-input v-model="phone" border="none" clearable fontSize="36rpx" type="number" maxlength="11"></u-input>
|
|
|
+ <u-input v-model="phone" border="none" clearable fontSize="36rpx" type="number"
|
|
|
+ maxlength="11"></u-input>
|
|
|
</u-form-item>
|
|
|
<u-form-item label="身份证" prop="idNumber">
|
|
|
<u-input v-model="idNumber" border="none" clearable fontSize="36rpx"></u-input>
|
|
@@ -52,7 +53,8 @@
|
|
|
<view class="shoot-id-card" v-if="shootCard">
|
|
|
<camera id="card-camera" flash="off" device-position="back" @ready="cameraContext"
|
|
|
:style="[cardCameraStyle]" />
|
|
|
- <cover-image :src="frontSelect ? '/static/mp-alipay/identity_info.png' : '/static/mp-alipay/national_emblem.png'"
|
|
|
+ <cover-image
|
|
|
+ :src="frontSelect ? '/static/mp-alipay/identity_info.png' : '/static/mp-alipay/national_emblem.png'"
|
|
|
:style="[cardCameraStyle]"></cover-image>
|
|
|
<view class="camera-btn">
|
|
|
<image v-if="shot" src="/static/mp-alipay/camera.svg" style="width: 140rpx; height: 140rpx;"></image>
|
|
@@ -173,7 +175,7 @@
|
|
|
import NavigateBar from '../../components/navigateBar/navigate-bar.vue';
|
|
|
// #ifdef MP-ALIPAY
|
|
|
// 最大图片大小为2.0M
|
|
|
- const maxPhotoSize = 2097152
|
|
|
+ const maxPhotoSize = 2 * 1024 * 1024
|
|
|
// OCR类型,人像面为"0",国徽面为"1"
|
|
|
const ocrType = {
|
|
|
face: "0",
|
|
@@ -318,14 +320,12 @@
|
|
|
...mapState('m_user', ['userInfo']),
|
|
|
...mapState('m_business', ['checkinInfo', 'currentHotel', 'idCardInfo', 'order']),
|
|
|
getAllInfo() {
|
|
|
- let getAll = true
|
|
|
for (const info of this.infoList) {
|
|
|
if (!this.idCardInfoInPage[info]) {
|
|
|
- getAll = false
|
|
|
- break
|
|
|
+ return false
|
|
|
}
|
|
|
}
|
|
|
- return getAll
|
|
|
+ return true
|
|
|
},
|
|
|
// #ifdef MP-ALIPAY
|
|
|
cardCameraStyle() {
|
|
@@ -388,14 +388,11 @@
|
|
|
}
|
|
|
}
|
|
|
//检查该顾客是否在当前酒店入住
|
|
|
- let res = await uni.$http.post('/checkinInfo/queryByCondition', {
|
|
|
- userIdNumber: this.idNumber,
|
|
|
- status: 1,
|
|
|
- hotelId: this.currentHotel.hotelId,
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 1
|
|
|
+ let res = await uni.$http.post('/user/isCheckin', {
|
|
|
+ idNumber: this.idNumber,
|
|
|
+ hotelId: this.currentHotel.hotelId
|
|
|
})
|
|
|
- if (res.data.code == 200 && res.data.data.records.length > 0) {
|
|
|
+ if (res.data.code === 200 && res.data.data === true) {
|
|
|
uni.$showMsg('该顾客已入住!')
|
|
|
return
|
|
|
}
|
|
@@ -410,16 +407,14 @@
|
|
|
}
|
|
|
|
|
|
//本地缓存没有顾客身份信息,到后台查询
|
|
|
- let idCardInfoQueryRes = await uni.$http.post('/idCardInfo/queryByCondition', {
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 1,
|
|
|
+ let idCardInfoQueryRes = await uni.$http.post('/user/idCardInfo', {
|
|
|
idNumber: this.idNumber,
|
|
|
name: this.name
|
|
|
})
|
|
|
|
|
|
//查询到,写入local storage,跳转checkIdentity
|
|
|
- if (idCardInfoQueryRes.data.data.records.length === 1) {
|
|
|
- let info = idCardInfoQueryRes.data.data.records[0]
|
|
|
+ if (idCardInfoQueryRes.data.code === 200 && idCardInfoQueryRes.data.data) {
|
|
|
+ let info = idCardInfoQueryRes.data.data
|
|
|
info.birth = info.birthday
|
|
|
let keys = Object.keys(this.idCardInfoInPage)
|
|
|
for (const key of keys) {
|
|
@@ -437,7 +432,7 @@
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- //没查询到,跳转step 1,上传身份证
|
|
|
+ //没查询到,跳转uploadCard,上传身份证
|
|
|
this.step = "uploadCard"
|
|
|
},
|
|
|
// #ifdef MP-WEIXIN
|
|
@@ -605,7 +600,7 @@
|
|
|
}
|
|
|
},
|
|
|
async afterIdCardRead(event) {
|
|
|
- console.log(event)
|
|
|
+ console.log('afterIdCardRead', event)
|
|
|
//正面还是反面
|
|
|
this.idCardDirection = event.name
|
|
|
await this.setImageUploadInfo(event.file.url)
|
|
@@ -634,41 +629,34 @@
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- let baseUrl = BASE_URL.slice(0, -11)
|
|
|
uni.showLoading({
|
|
|
title: '上传中',
|
|
|
mask: true
|
|
|
})
|
|
|
- let filePath = this['idCard' + this.idCardDirection + 'PicPath']
|
|
|
- // uni.getFileSystemManager().readFile({
|
|
|
- // filePath: filePath, //选择图片返回的相对路径
|
|
|
- // encoding: 'base64',
|
|
|
- // success: res => {
|
|
|
- let data = {
|
|
|
- image: filePath.split(',')[1],
|
|
|
- imageType: 'BASE64',
|
|
|
- }
|
|
|
- data.ocrType = detectInfo.label
|
|
|
- uni.request({
|
|
|
- url: baseUrl + '/verification/idCardOcr',
|
|
|
- method: 'POST',
|
|
|
- data: data,
|
|
|
- success: res => {
|
|
|
- console.log(res)
|
|
|
- if (res.data.data.imageStatus !== 'normal') {
|
|
|
- uni.showModal({
|
|
|
- content: '获取信息失败,请检查图片并重新上传',
|
|
|
- showCancel: false,
|
|
|
- })
|
|
|
- }
|
|
|
- if (!this.name) {
|
|
|
- this.name = res.data.data.name
|
|
|
- }
|
|
|
- if (!this.idNumber) {
|
|
|
- this.idNumber = res.data.data.cardNum
|
|
|
- }
|
|
|
- if (event.name === 'Front' && (res.data.data.cardNum != this.idNumber || res.data
|
|
|
- .data.name != this.name)) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ let filePath = this['idCard' + this.idCardDirection + 'PicPath']
|
|
|
+
|
|
|
+ let res = await uni.$http.post('/user/idCardOcr', {
|
|
|
+ image: filePath.split(',')[1],
|
|
|
+ ocrType: detectInfo.label,
|
|
|
+ imageType: 'BASE64'
|
|
|
+ })
|
|
|
+ if (res.data.data.imageStatus !== 'normal') {
|
|
|
+ uni.showModal({
|
|
|
+ content: '获取信息失败,请检查图片并重新上传',
|
|
|
+ showCancel: false,
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.name) {
|
|
|
+ this.name = res.data.data.name
|
|
|
+ }
|
|
|
+ if (!this.idNumber) {
|
|
|
+ this.idNumber = res.data.data.cardNum
|
|
|
+ }
|
|
|
+ if (event.name === 'Front') {
|
|
|
+ if (res.data.data.cardNum != this.idNumber || res.data.data.name != this.name) {
|
|
|
uni.showModal({
|
|
|
content: '填写信息与身份证不一致',
|
|
|
showCancel: false,
|
|
@@ -676,38 +664,30 @@
|
|
|
this.step = "fillForm"
|
|
|
this.idCardFrontPicPath =
|
|
|
'../../static/upload_front.png'
|
|
|
- return
|
|
|
- }
|
|
|
+ },
|
|
|
})
|
|
|
+ return
|
|
|
}
|
|
|
- this['idCard' + this.idCardDirection + 'Base64'] = data.image
|
|
|
- if (event.name === 'Front') {
|
|
|
- this.idCardInfoInPage.name = res.data.data.name
|
|
|
- this.idCardInfoInPage.sex = res.data.data.sex
|
|
|
- this.idCardInfoInPage.nation = res.data.data.nation
|
|
|
- this.idCardInfoInPage.birth = res.data.data.birth
|
|
|
- this.idCardInfoInPage.address = res.data.data.address
|
|
|
- this.idCardInfoInPage.idNumber = res.data.data.cardNum
|
|
|
- } else {
|
|
|
- this.idCardInfoInPage.issuingAuthority = res.data.data.issuingAuthority
|
|
|
- this.idCardInfoInPage.issuingDate = res.data.data.issuingDate
|
|
|
- this.idCardInfoInPage.expiryDate = res.data.data.expiryDate
|
|
|
- }
|
|
|
- },
|
|
|
- fail: err => {
|
|
|
- uni.$showMsg('上传失败')
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- console.log('complete')
|
|
|
- uni.hideLoading()
|
|
|
+ this.idCardFrontBase64 = filePath.split(',')[1]
|
|
|
+ this.idCardInfoInPage.name = res.data.data.name
|
|
|
+ this.idCardInfoInPage.sex = res.data.data.sex
|
|
|
+ this.idCardInfoInPage.nation = res.data.data.nation
|
|
|
+ this.idCardInfoInPage.birth = res.data.data.birth
|
|
|
+ this.idCardInfoInPage.address = res.data.data.address
|
|
|
+ this.idCardInfoInPage.idNumber = res.data.data.cardNum
|
|
|
+ } else {
|
|
|
+ this.idCardBackBase64 = filePath.split(',')[1]
|
|
|
+ this.idCardInfoInPage.issuingAuthority = res.data.data.issuingAuthority
|
|
|
+ this.idCardInfoInPage.issuingDate = res.data.data.issuingDate
|
|
|
+ this.idCardInfoInPage.expiryDate = res.data.data.expiryDate
|
|
|
}
|
|
|
- })
|
|
|
- // },
|
|
|
- // complete: () => {
|
|
|
- // uni.hideLoading()
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
+ } catch (err) {
|
|
|
+ uni.showModal({
|
|
|
+ title: err.message
|
|
|
+ })
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading()
|
|
|
+ }
|
|
|
},
|
|
|
oversize() {
|
|
|
uni.$showMsg('图片超出允许大小(1.5M)')
|
|
@@ -759,14 +739,11 @@
|
|
|
}
|
|
|
}
|
|
|
//检查该顾客是否在当前酒店入住
|
|
|
- let res = await uni.$http.post('/checkinInfo/queryByCondition', {
|
|
|
- userIdNumber: this.idNumber,
|
|
|
- status: 1,
|
|
|
- hotelId: this.currentHotel.hotelId,
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 1
|
|
|
+ let res = await uni.$http.post('/user/isCheckin', {
|
|
|
+ idNumber: this.idNumber,
|
|
|
+ hotelId: this.currentHotel.hotelId
|
|
|
})
|
|
|
- if (res.data.code == 200 && res.data.data.records.length > 0) {
|
|
|
+ if (res.data.code === 200 && res.data.data === true) {
|
|
|
uni.$showMsg('该顾客已入住!')
|
|
|
return
|
|
|
}
|
|
@@ -1375,159 +1352,77 @@
|
|
|
//上传
|
|
|
async afterRead(mybase64) {
|
|
|
let that = this;
|
|
|
- uni.$http.post('/faceVerification/checkPic', {
|
|
|
- hotelId: that.currentHotel.hotelId,
|
|
|
- faceData: mybase64,
|
|
|
+ let res = await uni.$http.post('/user/faceCheckAll', {
|
|
|
+ hotelId: this.currentHotel.hotelId,
|
|
|
+ imageBase64: mybase64,
|
|
|
+ name: this.name,
|
|
|
+ idNumber: this.idNumber
|
|
|
+ })
|
|
|
+ if (res.data.code === 200 && res.data.success === true) {
|
|
|
+ let infoFromIdCard = {}
|
|
|
+ this.infoList.forEach(info => {
|
|
|
+ infoFromIdCard[info] = this.idCardInfoInPage[info]
|
|
|
})
|
|
|
- .then(async (res) => {
|
|
|
- uni.hideLoading();
|
|
|
- console.log('mybase64', mybase64);
|
|
|
- if (res.data.code === 200 && res.data.success === true) {
|
|
|
- if (that.userInfo.skipIdMatching === true) {
|
|
|
- uni.showModal({
|
|
|
- content: '图片检查通过!',
|
|
|
- showCancel: false,
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定');
|
|
|
- let infoFromIdCard = {}
|
|
|
- that.infoList.forEach(info => {
|
|
|
- infoFromIdCard[info] = that[info]
|
|
|
- })
|
|
|
- let currentCheckinInfo = {
|
|
|
- name: that.name,
|
|
|
- idNumber: that.idNumber,
|
|
|
- phone: that.phone,
|
|
|
- faceData: mybase64
|
|
|
- }
|
|
|
- currentCheckinInfo = {
|
|
|
- ...currentCheckinInfo,
|
|
|
- ...infoFromIdCard
|
|
|
- }
|
|
|
- that.checkinInfo.push(currentCheckinInfo)
|
|
|
- that.updateCheckinInfo(that.checkinInfo)
|
|
|
-
|
|
|
- let currentGuestInfo = {
|
|
|
- name: that.name,
|
|
|
- idNumber: that.idNumber,
|
|
|
- }
|
|
|
-
|
|
|
- let i
|
|
|
- for (i = 0; i < that.guestInfo.length; i++) {
|
|
|
- if (that.guestInfo[i].idNumber == that.idNumber) {
|
|
|
- that.guestInfo[i] = {
|
|
|
- ...currentGuestInfo,
|
|
|
- ...infoFromIdCard
|
|
|
- }
|
|
|
- that.updateGuestInfo(that.guestInfo)
|
|
|
- }
|
|
|
- }
|
|
|
- if (i === that.guestInfo.length) {
|
|
|
- that.guestInfo.push({
|
|
|
- ...currentGuestInfo,
|
|
|
- ...infoFromIdCard
|
|
|
- })
|
|
|
- that.updateGuestInfo(that.guestInfo)
|
|
|
- }
|
|
|
-
|
|
|
- setTimeout(() => uni.reLaunch({
|
|
|
- url: '/subpkg_checkin/confirmOrder/confirmOrder'
|
|
|
- }), 1000);
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showLoading({
|
|
|
- title: '正在身份核验,请稍后',
|
|
|
- });
|
|
|
- let yunjiFaceCheckInfo = {
|
|
|
- idNo: that.idNumber,
|
|
|
- name: that.name,
|
|
|
- image: mybase64,
|
|
|
- };
|
|
|
- let checkRes = await uni.$http.post(
|
|
|
- '/faceVerification/yunjiVerification',
|
|
|
- yunjiFaceCheckInfo
|
|
|
- );
|
|
|
-
|
|
|
- if (checkRes.data.success === true) {
|
|
|
- let infoFromIdCard = {}
|
|
|
- that.infoList.forEach(info => {
|
|
|
- infoFromIdCard[info] = that.idCardInfoInPage[info]
|
|
|
- })
|
|
|
- let currentCheckinInfo = {
|
|
|
- name: that.name,
|
|
|
- idNumber: that.idNumber,
|
|
|
- faceData: mybase64,
|
|
|
- phone: that.phone,
|
|
|
- ...infoFromIdCard
|
|
|
- }
|
|
|
- //更新local storage 中的入住信息
|
|
|
- let checkinInfoToUpdate = that.checkinInfo
|
|
|
- checkinInfoToUpdate.push(currentCheckinInfo)
|
|
|
- that.updateCheckinInfo(checkinInfoToUpdate)
|
|
|
- //更新local storage 中的身份证信息
|
|
|
- let idCardInfoToUpdate = that.idCardInfo
|
|
|
- idCardInfoToUpdate.push(that.idCardInfoInPage)
|
|
|
- that.updateIdCardInfo(idCardInfoToUpdate)
|
|
|
- //如果上传过照片则更新服务器中的身份证信息
|
|
|
- if (that.idCardFrontDetectInfo.detected && that.idCardBackDetectInfo
|
|
|
- .detected) {
|
|
|
- uni.$http.post('/idCardInfo', {
|
|
|
- ...that.idCardInfoInPage,
|
|
|
- birthday: that.idCardInfoInPage.birth,
|
|
|
- idCardFrontBase64: that.idCardFrontPicPath.split(',')[1],
|
|
|
- idCardBackBase64: that.idCardBackPicPath.split(',')[1]
|
|
|
- })
|
|
|
- }
|
|
|
- if (this.isMainCustomer) {
|
|
|
- //如果是主入住人,且当前账号姓名和身份证号为空,则更新账号信息为主入住人信息
|
|
|
- if (!this.userInfo.name || !this.userInfo.idNumber) {
|
|
|
- this.userInfo.name = this.name
|
|
|
- this.userInfo.idNumber = this.idNumber
|
|
|
- this.updateUserInfo(this.userInfo)
|
|
|
- uni.$http.put(`/userInfo/${this.userInfo.id}`, this.userInfo)
|
|
|
- }
|
|
|
- //更新订单预定人信息为主入住人信息
|
|
|
- let orderToUpdate = this.order
|
|
|
- orderToUpdate.name = this.name
|
|
|
- orderToUpdate.phone = this.phone
|
|
|
- this.updateOrder(orderToUpdate)
|
|
|
- }
|
|
|
- uni.hideLoading();
|
|
|
- uni.$showMsg('身份核验通过!')
|
|
|
- setTimeout(() => uni.reLaunch({
|
|
|
- url: '/subpkg_checkin/confirmOrder/confirmOrder'
|
|
|
- }), 1000)
|
|
|
- } else {
|
|
|
- uni.hideLoading()
|
|
|
- uni.showModal({
|
|
|
- content: '身份核验失败,请重试',
|
|
|
- showCancel: false,
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定');
|
|
|
- that.initData();
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.hideLoading()
|
|
|
- uni.showModal({
|
|
|
- content: '身份核验失败,请重试',
|
|
|
- showCancel: false,
|
|
|
- success: function(res) {
|
|
|
- if (res.confirm) {
|
|
|
- console.log('用户点击确定');
|
|
|
- that.initData();
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
+ let currentCheckinInfo = {
|
|
|
+ name: this.name,
|
|
|
+ idNumber: this.idNumber,
|
|
|
+ faceData: mybase64,
|
|
|
+ phone: this.phone,
|
|
|
+ ...infoFromIdCard
|
|
|
+ }
|
|
|
+ //更新local storage 中的入住信息
|
|
|
+ let checkinInfoToUpdate = this.checkinInfo
|
|
|
+ checkinInfoToUpdate.push(currentCheckinInfo)
|
|
|
+ this.updateCheckinInfo(checkinInfoToUpdate)
|
|
|
+ //更新local storage 中的身份证信息
|
|
|
+ let idCardInfoToUpdate = this.idCardInfo
|
|
|
+ idCardInfoToUpdate.push(this.idCardInfoInPage)
|
|
|
+ this.updateIdCardInfo(idCardInfoToUpdate)
|
|
|
+ //如果上传过照片则更新服务器中的身份证信息
|
|
|
+ if (this.idCardFrontDetectInfo.detected && this.idCardBackDetectInfo
|
|
|
+ .detected) {
|
|
|
+ uni.$http.post('/user/idCardInfo/add', {
|
|
|
+ ...this.idCardInfoInPage,
|
|
|
+ birthday: this.idCardInfoInPage.birth,
|
|
|
+ idCardFrontBase64: this.idCardFrontPicPath.split(',')[1],
|
|
|
+ idCardBackBase64: this.idCardBackPicPath.split(',')[1]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (this.isMainCustomer) {
|
|
|
+ //如果是主入住人,且当前账号姓名和身份证号为空,则更新账号信息为主入住人信息
|
|
|
+ if (!this.userInfo.name || !this.userInfo.idNumber) {
|
|
|
+ this.userInfo.name = this.name
|
|
|
+ this.userInfo.idNumber = this.idNumber
|
|
|
+ this.updateUserInfo(this.userInfo)
|
|
|
+ uni.$http.put(`/user`, {
|
|
|
+ name: this.name,
|
|
|
+ idNumber: this.idNumber
|
|
|
+ })
|
|
|
}
|
|
|
- console.log('checkPicRes', res);
|
|
|
+ //更新订单预定人信息为主入住人信息
|
|
|
+ let orderToUpdate = this.order
|
|
|
+ orderToUpdate.name = this.name
|
|
|
+ orderToUpdate.phone = this.phone
|
|
|
+ this.updateOrder(orderToUpdate)
|
|
|
+ }
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.$showMsg('身份核验通过!')
|
|
|
+ setTimeout(() => uni.reLaunch({
|
|
|
+ url: '/subpkg_checkin/confirmOrder/confirmOrder'
|
|
|
+ }), 1000)
|
|
|
+ } else {
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showModal({
|
|
|
+ content: `身份核验失败,${res.data.msg},请重试`,
|
|
|
+ showCancel: false,
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定');
|
|
|
+ that.initData();
|
|
|
+ }
|
|
|
+ },
|
|
|
});
|
|
|
+ }
|
|
|
},
|
|
|
// #endif
|
|
|
},
|
|
@@ -1812,6 +1707,7 @@
|
|
|
.btn {
|
|
|
margin: 20rpx;
|
|
|
}
|
|
|
+
|
|
|
/* #endif */
|
|
|
}
|
|
|
|
|
@@ -1839,6 +1735,7 @@
|
|
|
bottom: 50rpx;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/* #endif */
|
|
|
}
|
|
|
}
|