替换人脸拍照

This commit is contained in:
wangxiaowei
2026-02-02 02:37:58 +08:00
parent 1d773081ea
commit 18e0423699
4 changed files with 117 additions and 83 deletions

View File

@ -1,46 +1,36 @@
<template>
<view>
<face-bio-assay :isDev="false" :action="['StraightenHead']" ref="faceDetect" @detectFailed="photoChange" @photoChange="photoChange">
</face-bio-assay>
</view>
<!-- <@devicePosition: 摄像头位置 前置或后置摄像头值为front, back
@quality: 成像质量值为high高质量normal普通质量low低质量 -->
<view>
<hao-camera
:devicePosition="back"
:quality="low"
@confirmPhoto="confirmPhoto"
></hao-camera>
</view>
</template>
<script>
import faceBioAssay from '@/uni_modules/face-bio-assay/components/face-bio-assay/face-bio-assay.vue'
export default {
components: {
faceBioAssay,
},
data() {
import haoCamera from '@/uni_modules/hao-camera/components/hao-camera/hao-camera.vue';
export default {
components: {
haoCamera
},
data() {
return {
order_id: 0,
}
},
onLoad(args) {
this.order_id = args.order_id || 0;
this.$refs.faceDetect.initData()
},
methods: {
detectFailed() {
uni.showToast({
title: "人脸核验失败~",
icon: 'none'
})
uni.navigateBack()
},
photoChange(path) {
methods: {
confirmPhoto(filePath){
console.log("🚀 ~ filePath:", filePath)
let self = this
uni.navigateBack()
this.getOpenerEventChannel().emit('data',{path: path, order_id: self.order_id});
}
}
}
</script>
<style>
</style>
this.getOpenerEventChannel().emit('data',{path: filePath, order_id: self.order_id});
}
}
}
</script>

View File

@ -501,6 +501,7 @@
self.bill.dgf.nums = 0;
self.bill.dgf.price = 0;
self.bill.dgf.total = 0;
self.bill.unLightTotal = 0;
for (const key in self.order.trade) {
const value = self.order.trade[key];
for (const item of value) {
@ -510,6 +511,11 @@
self.bill.dgf.nums = self.order.hours;
self.bill.dgf.price = 0; // 假设每个时间段的灯光价格相同
self.bill.dgf.total += Number(item.light_price);
// 将非灯光费用累加到 unLightTotal
// if (Number(item.light_price) > 0) {
// self.bill.unLightTotal += Number(item.room_price) - Number(item.light_price);
// console.log("🚀 ~ Number(item.room_price):", Number(item.room_price), Number(item.light_price))
// }
}
}
// 保留两位小数但不四舍五入
@ -519,10 +525,17 @@
if (idx === -1) return str + (decimal > 0 ? '.' + '0'.repeat(decimal) : '');
return str.substring(0, idx + decimal + 1).padEnd(idx + decimal + 1, '0');
}
// self.bill.unLightTotal = Number(toFixedNoRound(self.bill.cdf.total - self.bill.dgf.total, 2));
console.log("🚀 ~ self.bill.unLightTotal:", self.bill.unLightTotal)
self.bill.cdf.total = Number(toFixedNoRound(self.bill.cdf.total - self.bill.dgf.total, 2));
self.bill.dgf.total = Number(toFixedNoRound(self.bill.dgf.total, 2));
self.bill.total = Number(toFixedNoRound(self.bill.cdf.total + self.bill.dgf.total, 2));
self.originalTotal = self.bill.total; // 记录原始总价
console.log("🚀 ~ self.bill:", self.bill)
console.log("🚀 ~ self.bill.unLightTotal:", self.bill.unLightTotal)
// }
// self.countPrice()
}
@ -847,17 +860,17 @@
return;
}
this.userAccount = this.userBalance['balance' + this.currentType];
this.userDiscount = this.balance['discount' + this.currentType];
const discount = Number(this.userDiscount) || 10; // 折扣默认10不打折
// 始终基于原始金额打折
const baseTotal = Number(this.originalTotal) || 0;
// const baseTotal = Number(this.originalTotal) || 0;
const baseTotal = Number(this.bill.cdf.total) || 0;
const finalPrice = Number((baseTotal * (discount / 10)).toFixed(2));
this.bill.dis = Number((baseTotal - finalPrice).toFixed(2));
this.bill.total = finalPrice;
this.bill.total = finalPrice + Number(this.bill.dgf.total);
console.log("🚀 ~ finalPrice:", finalPrice)
// this.payType = this.currentType;

View File

@ -484,6 +484,15 @@ export default {
} else {
// 未选中则添加
this.selectedTime[title].push(time);
// 添加后进行升序排序
this.selectedTime[title].sort((a, b) => {
// 假设时间格式为 "HH:mm" 或 "HH:mm-HH:mm"
// 只取开始时间进行比较
const getStart = t => t.includes('-') ? t.split('-')[0] : t;
const [ah, am] = getStart(a).split(":").map(Number);
const [bh, bm] = getStart(b).split(":").map(Number);
return ah !== bh ? ah - bh : am - bm;
});
}
this.countSelectedTime = Object.values(this.selectedTime).reduce((acc, times) => acc + times.length, 0);
@ -493,6 +502,7 @@ export default {
let totalPrice = 0;
let totalLightPrice = 0;
let amount_price = 0;
console.log("🚀 ~ selectedTime:", this.selectedTime)
Object.keys(this.selectedTime).forEach(roomTitle => {
const roomId = this.cdList.find(cd => cd.title === roomTitle)?.room_id;
@ -536,6 +546,11 @@ export default {
// const total = Number((totalPrice + totalLightPrice).toFixed(2)); 2025-12-30要求显示灯光费用但是不显示在总价中
const total = Number((totalPrice - 0).toFixed(2));
// 按 room_id 升序排序
room_list.sort((a, b) => {
// room_id 可能为字符串或数字,统一转为数字比较
return Number(a.room_id) - Number(b.room_id);
});
this.selectedReserveTime = room_list;
// 计算场地费用
@ -638,8 +653,9 @@ export default {
// 立即预约-提交订单
toReserve() {
let self = this
// 一进来就锁定,彻底防止高频点击
if (self.typeId == 1) {
if (self.selectedReserveTime.length === 0) {
@ -654,12 +670,21 @@ export default {
mask: true,
});
try {
const start = self.selectedReserveTime[0].day_time + ' ' + self.selectedReserveTime[0].end_time;
const start = self.selectedReserveTime[0].day_time + ' ' + self.selectedReserveTime[0].start_time;
const end = self.selectedReserveTime[self.selectedReserveTime.length -1].day_time + ' ' + self.selectedReserveTime[self.selectedReserveTime.length -1].end_time;
// 转换为时间戳
const startTimestamp = Math.floor(Date.parse(start.replace(/-/g, '/')) / 1000);;
const endTimestamp = Math.floor(Date.parse(end.replace(/-/g, '/')) / 1000);;
const startTimestamp = Math.floor(Date.parse(start.replace(/-/g, '/')) / 1000);
const endTimestamp = Math.floor(Date.parse(end.replace(/-/g, '/')) / 1000);
// let p = {
// app_id: self.getAppId(),
// ground_id: self.id,
// room_list: JSON.stringify(self.selectedReserveTime),
// type: self.typeId,
// start_end: startTimestamp + '-' + endTimestamp,
// amount_price: self.bill.total
// }
// console.log("🚀 ~ p:", p)
// 订单提交
self._post(
'order.groundOrder/submitStoreOrder',