替换人脸拍照
This commit is contained in:
@ -1,46 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<!-- <@devicePosition: 摄像头位置 前置或后置摄像头,值为front, back
|
||||||
<face-bio-assay :isDev="false" :action="['StraightenHead']" ref="faceDetect" @detectFailed="photoChange" @photoChange="photoChange">
|
@quality: 成像质量,值为high(高质量)、normal(普通质量)、low(低质量) -->
|
||||||
</face-bio-assay>
|
<view>
|
||||||
</view>
|
<hao-camera
|
||||||
|
:devicePosition="back"
|
||||||
|
:quality="low"
|
||||||
|
@confirmPhoto="confirmPhoto"
|
||||||
|
></hao-camera>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import faceBioAssay from '@/uni_modules/face-bio-assay/components/face-bio-assay/face-bio-assay.vue'
|
import haoCamera from '@/uni_modules/hao-camera/components/hao-camera/hao-camera.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
faceBioAssay,
|
haoCamera
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
data() {
|
|
||||||
return {
|
return {
|
||||||
order_id: 0,
|
order_id: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(args) {
|
onLoad(args) {
|
||||||
this.order_id = args.order_id || 0;
|
this.order_id = args.order_id || 0;
|
||||||
this.$refs.faceDetect.initData()
|
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
methods: {
|
confirmPhoto(filePath){
|
||||||
detectFailed() {
|
console.log("🚀 ~ filePath:", filePath)
|
||||||
uni.showToast({
|
|
||||||
title: "人脸核验失败~",
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
uni.navigateBack()
|
|
||||||
},
|
|
||||||
|
|
||||||
photoChange(path) {
|
|
||||||
let self = this
|
let self = this
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
this.getOpenerEventChannel().emit('data',{path: path, order_id: self.order_id});
|
this.getOpenerEventChannel().emit('data',{path: filePath, order_id: self.order_id});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
</script>
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
@ -501,6 +501,7 @@
|
|||||||
self.bill.dgf.nums = 0;
|
self.bill.dgf.nums = 0;
|
||||||
self.bill.dgf.price = 0;
|
self.bill.dgf.price = 0;
|
||||||
self.bill.dgf.total = 0;
|
self.bill.dgf.total = 0;
|
||||||
|
self.bill.unLightTotal = 0;
|
||||||
for (const key in self.order.trade) {
|
for (const key in self.order.trade) {
|
||||||
const value = self.order.trade[key];
|
const value = self.order.trade[key];
|
||||||
for (const item of value) {
|
for (const item of value) {
|
||||||
@ -510,6 +511,11 @@
|
|||||||
self.bill.dgf.nums = self.order.hours;
|
self.bill.dgf.nums = self.order.hours;
|
||||||
self.bill.dgf.price = 0; // 假设每个时间段的灯光价格相同
|
self.bill.dgf.price = 0; // 假设每个时间段的灯光价格相同
|
||||||
self.bill.dgf.total += Number(item.light_price);
|
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) : '');
|
if (idx === -1) return str + (decimal > 0 ? '.' + '0'.repeat(decimal) : '');
|
||||||
return str.substring(0, idx + decimal + 1).padEnd(idx + decimal + 1, '0');
|
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.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.dgf.total = Number(toFixedNoRound(self.bill.dgf.total, 2));
|
||||||
self.bill.total = Number(toFixedNoRound(self.bill.cdf.total + self.bill.dgf.total, 2));
|
self.bill.total = Number(toFixedNoRound(self.bill.cdf.total + self.bill.dgf.total, 2));
|
||||||
self.originalTotal = self.bill.total; // 记录原始总价
|
self.originalTotal = self.bill.total; // 记录原始总价
|
||||||
|
console.log("🚀 ~ self.bill:", self.bill)
|
||||||
|
console.log("🚀 ~ self.bill.unLightTotal:", self.bill.unLightTotal)
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// self.countPrice()
|
// self.countPrice()
|
||||||
}
|
}
|
||||||
@ -847,17 +860,17 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.userAccount = this.userBalance['balance' + this.currentType];
|
this.userAccount = this.userBalance['balance' + this.currentType];
|
||||||
this.userDiscount = this.balance['discount' + this.currentType];
|
this.userDiscount = this.balance['discount' + this.currentType];
|
||||||
|
|
||||||
const discount = Number(this.userDiscount) || 10; // 折扣,默认10(不打折)
|
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));
|
const finalPrice = Number((baseTotal * (discount / 10)).toFixed(2));
|
||||||
this.bill.dis = Number((baseTotal - finalPrice).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)
|
console.log("🚀 ~ finalPrice:", finalPrice)
|
||||||
|
|
||||||
// this.payType = this.currentType;
|
// this.payType = this.currentType;
|
||||||
|
|||||||
@ -484,6 +484,15 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
// 未选中则添加
|
// 未选中则添加
|
||||||
this.selectedTime[title].push(time);
|
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);
|
this.countSelectedTime = Object.values(this.selectedTime).reduce((acc, times) => acc + times.length, 0);
|
||||||
|
|
||||||
@ -493,6 +502,7 @@ export default {
|
|||||||
let totalPrice = 0;
|
let totalPrice = 0;
|
||||||
let totalLightPrice = 0;
|
let totalLightPrice = 0;
|
||||||
let amount_price = 0;
|
let amount_price = 0;
|
||||||
|
console.log("🚀 ~ selectedTime:", this.selectedTime)
|
||||||
|
|
||||||
Object.keys(this.selectedTime).forEach(roomTitle => {
|
Object.keys(this.selectedTime).forEach(roomTitle => {
|
||||||
const roomId = this.cdList.find(cd => cd.title === roomTitle)?.room_id;
|
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 + totalLightPrice).toFixed(2)); 2025-12-30要求显示灯光费用,但是不显示在总价中
|
||||||
const total = Number((totalPrice - 0).toFixed(2));
|
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;
|
this.selectedReserveTime = room_list;
|
||||||
|
|
||||||
// 计算场地费用
|
// 计算场地费用
|
||||||
@ -638,8 +653,9 @@ export default {
|
|||||||
|
|
||||||
// 立即预约-提交订单
|
// 立即预约-提交订单
|
||||||
toReserve() {
|
toReserve() {
|
||||||
|
|
||||||
let self = this
|
let self = this
|
||||||
|
|
||||||
// 一进来就锁定,彻底防止高频点击
|
// 一进来就锁定,彻底防止高频点击
|
||||||
if (self.typeId == 1) {
|
if (self.typeId == 1) {
|
||||||
if (self.selectedReserveTime.length === 0) {
|
if (self.selectedReserveTime.length === 0) {
|
||||||
@ -654,12 +670,21 @@ export default {
|
|||||||
mask: true,
|
mask: true,
|
||||||
});
|
});
|
||||||
try {
|
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 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 startTimestamp = Math.floor(Date.parse(start.replace(/-/g, '/')) / 1000);
|
||||||
const endTimestamp = Math.floor(Date.parse(end.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(
|
self._post(
|
||||||
'order.groundOrder/submitStoreOrder',
|
'order.groundOrder/submitStoreOrder',
|
||||||
|
|||||||
@ -106,18 +106,13 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <view class="d-f a-i-c open-light" @click="buyLight" v-if="detail.order_status == 1 || detail.order_status == 2">
|
|
||||||
<image style="width: 48rpx;height: 48rpx;" src="https://xh.stnav.com/uploads/sport/light.png" ></image>
|
|
||||||
<view>购买灯光</view>
|
|
||||||
</view> -->
|
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 购买灯光 -->
|
<!-- 购买灯光 -->
|
||||||
<view class="cg-order" style="margin-bottom: 20rpx;" v-if="detail.order_status == 1 || detail.order_status == 2 && ballType == 1">
|
<view class="cg-order" style="margin-bottom: 20rpx;" v-if="(detail.order_status == 1 || detail.order_status == 2 || detail.order_status == 3) && ballType == 1">
|
||||||
<view class="cg-order-title d-f a-i-c open-light">
|
<view class="cg-order-title d-f a-i-c open-light">
|
||||||
<!-- <image style="width: 48rpx;height: 48rpx;" src="https://xh.stnav.com/uploads/sport/light.png" ></image> -->
|
<!-- <image style="width: 48rpx;height: 48rpx;" src="https://xh.stnav.com/uploads/sport/light.png" ></image> -->
|
||||||
<view>购买灯光</view>
|
<view>购买灯光</view>
|
||||||
@ -129,9 +124,9 @@
|
|||||||
v-for="(item2, index2) in item"
|
v-for="(item2, index2) in item"
|
||||||
:key="index2"
|
:key="index2"
|
||||||
:class="isSelected(index, index2) ? 'date-time-btn' : 'date-time-btn-normal'"
|
:class="isSelected(index, index2) ? 'date-time-btn' : 'date-time-btn-normal'"
|
||||||
@click="toggleSelect(index, index2, item2.room_id)"
|
@click="toggleSelect(index, index2, item2.room_id, item2.light_status)"
|
||||||
>
|
>
|
||||||
{{ item2.start_time }}-{{ item2.end_time }}
|
{{ item2.light_status == 1 ? '已购买' : `${item2.start_time}-${item2.end_time}`}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -338,35 +333,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</Popup>
|
</Popup>
|
||||||
|
|
||||||
<!-- 开灯弹窗 -->
|
|
||||||
<Popup :show="openLightPopup" radius="16rpx">
|
|
||||||
<view class="light-popup">
|
|
||||||
<view class="title">提示</view>
|
|
||||||
<view class="desc">
|
|
||||||
<view class="rule">请选择要开灯的场地</view>
|
|
||||||
<scroll-view scroll-y="true" enhanced="true" :show-scrollbar="false" style="height: 500rpx;">
|
|
||||||
<view class="desc" v-for="(item, index) in detail.trade" :key="index">
|
|
||||||
<view class="fb" style="margin: 20rpx 0;">{{ index }}</view>
|
|
||||||
<view class="date-grid">
|
|
||||||
<view
|
|
||||||
:class="isSelected(index, index2) ? 'date-time-btn' : 'date-time-btn-normal'"
|
|
||||||
v-for="(item2, index2) in item"
|
|
||||||
:key="index2"
|
|
||||||
@click="toggleSelect(index, index2, item2.room_id)"
|
|
||||||
>
|
|
||||||
{{ item2.start_time }}-{{ item2.end_time }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
</view>
|
|
||||||
<view class="btn">
|
|
||||||
<view class="btn1" @click="openLightPopup = false">取消</view>
|
|
||||||
<view class="btn2" @click="getSelectedContent">确定</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</Popup>
|
|
||||||
|
|
||||||
<!-- 会员卡选择弹窗 -->
|
<!-- 会员卡选择弹窗 -->
|
||||||
<Popup :show="balancePopup" :width='750' :padding="0" type="bottom" backgroundColor="#fff" radius="32rpx 32rpx 0 0">
|
<Popup :show="balancePopup" :width='750' :padding="0" type="bottom" backgroundColor="#fff" radius="32rpx 32rpx 0 0">
|
||||||
<view class="ww100 box-s-b pop-improt typeof pr">
|
<view class="ww100 box-s-b pop-improt typeof pr">
|
||||||
@ -481,8 +447,9 @@
|
|||||||
userBalance: {},
|
userBalance: {},
|
||||||
currentType: '', // 选择的会员卡类型
|
currentType: '', // 选择的会员卡类型
|
||||||
userAccount: 0,
|
userAccount: 0,
|
||||||
userDiscount: 0
|
userDiscount: 0,
|
||||||
|
lightDateTime: '',
|
||||||
|
lightPrice: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
@ -829,12 +796,36 @@
|
|||||||
return this.selectedTimes.some(sel => sel.group === groupIdx && sel.idx === idx);
|
return this.selectedTimes.some(sel => sel.group === groupIdx && sel.idx === idx);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSelect(groupIdx, idx, roomId) {
|
toggleSelect(groupIdx, idx, roomId, status) {
|
||||||
|
if (status == 1) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '已支付过灯光费用',
|
||||||
|
mask: false,
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const found = this.selectedTimes.findIndex(sel => sel.group === groupIdx && sel.idx === idx);
|
const found = this.selectedTimes.findIndex(sel => sel.group === groupIdx && sel.idx === idx);
|
||||||
if (found > -1) {
|
if (found > -1) {
|
||||||
this.selectedTimes.splice(found, 1);
|
this.selectedTimes.splice(found, 1);
|
||||||
} else {
|
} else {
|
||||||
this.selectedTimes.push({ group: groupIdx, idx, roomId });
|
let self = this
|
||||||
|
self.loadding = true
|
||||||
|
self._post(
|
||||||
|
'ground.ground/groundRoomDetails',
|
||||||
|
{
|
||||||
|
app_id: self.getAppId(),
|
||||||
|
id: roomId, // 场馆包间ID
|
||||||
|
},
|
||||||
|
function(res) {
|
||||||
|
console.log("🚀 ~ res:", res)
|
||||||
|
self.detail.trade[groupIdx][idx].light_price = res.data.lists.set_light_price
|
||||||
|
self.selectedTimes.push({ group: groupIdx, idx, roomId });
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.loadding = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -848,19 +839,31 @@
|
|||||||
const result = [];
|
const result = [];
|
||||||
const trade = self.detail.trade || [];
|
const trade = self.detail.trade || [];
|
||||||
const roomMap = {};
|
const roomMap = {};
|
||||||
|
|
||||||
|
self.lightDateTime = ''
|
||||||
|
self.lightPrice = 0
|
||||||
self.selectedTimes.forEach(sel => {
|
self.selectedTimes.forEach(sel => {
|
||||||
if (!roomMap[sel.roomId]) roomMap[sel.roomId] = [];
|
if (!roomMap[sel.roomId]) roomMap[sel.roomId] = [];
|
||||||
// 获取时间段
|
// 获取时间段
|
||||||
const item = trade[sel.group] && trade[sel.group][sel.idx];
|
const item = trade[sel.group] && trade[sel.group][sel.idx];
|
||||||
|
console.log("🚀 ~ item:", item)
|
||||||
if (item) {
|
if (item) {
|
||||||
roomMap[sel.roomId].push(`${item.start_time}-${item.end_time}`);
|
roomMap[sel.roomId].push(`${item.start_time}-${item.end_time}`);
|
||||||
|
self.lightDateTime = item.day_time
|
||||||
|
self.lightPrice += parseFloat(item.light_price)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Object.keys(roomMap).forEach(roomId => {
|
Object.keys(roomMap).forEach(roomId => {
|
||||||
result.push({ room_id: roomId, arr: roomMap[roomId].join(',') });
|
result.push({ room_id: roomId, arr: roomMap[roomId].join(',') });
|
||||||
});
|
});
|
||||||
self.content = result;
|
self.content = result;
|
||||||
|
|
||||||
|
console.log("🚀 ~ item lightDateTime:", self.lightDateTime)
|
||||||
|
console.log("🚀 ~ item lightPrice:", self.lightPrice)
|
||||||
|
console.log("🚀 ~ self.content:", self.content)
|
||||||
|
|
||||||
if (self.detail.light_order == 1) {
|
if (self.detail.light_order == 1) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
@ -915,12 +918,15 @@
|
|||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '正在处理'
|
title: '正在处理'
|
||||||
});
|
});
|
||||||
|
console.log(123123)
|
||||||
self._post(
|
self._post(
|
||||||
'order.GroundOrder/addLightStoreOrder', {
|
'order.GroundOrder/addLightStoreOrder', {
|
||||||
order_id: self.order_id,
|
order_id: self.order_id,
|
||||||
room_id: '',
|
room_id: '',
|
||||||
ground_id: self.detail.ground_id,
|
ground_id: self.detail.ground_id,
|
||||||
content: JSON.stringify(self.content)
|
content: JSON.stringify(self.content),
|
||||||
|
day_time: self.lightDateTime,
|
||||||
|
light_price: self.lightPrice,
|
||||||
},
|
},
|
||||||
function(res) {
|
function(res) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|||||||
Reference in New Issue
Block a user