diff --git a/bundle/face/face-photo.vue b/bundle/face/face-photo.vue index a2ca619..2c11e07 100644 --- a/bundle/face/face-photo.vue +++ b/bundle/face/face-photo.vue @@ -1,46 +1,36 @@ - - + this.getOpenerEventChannel().emit('data',{path: filePath, order_id: self.order_id}); + } + } + } + \ No newline at end of file diff --git a/bundle/reserve/confirm.vue b/bundle/reserve/confirm.vue index cfeca31..a5b48b6 100644 --- a/bundle/reserve/confirm.vue +++ b/bundle/reserve/confirm.vue @@ -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; diff --git a/bundle/reserve/details.vue b/bundle/reserve/details.vue index 6b83f09..85df306 100644 --- a/bundle/reserve/details.vue +++ b/bundle/reserve/details.vue @@ -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', diff --git a/pages/order/cg-order-detail.vue b/pages/order/cg-order-detail.vue index 5d4c95c..f9a4f4c 100644 --- a/pages/order/cg-order-detail.vue +++ b/pages/order/cg-order-detail.vue @@ -106,18 +106,13 @@ - - - + 购买灯光 @@ -129,9 +124,9 @@ v-for="(item2, index2) in item" :key="index2" :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}`}} @@ -338,35 +333,6 @@ - - - - 提示 - - 请选择要开灯的场地 - - - {{ index }} - - - {{ item2.start_time }}-{{ item2.end_time }} - - - - - - - 取消 - 确定 - - - - @@ -481,8 +447,9 @@ userBalance: {}, currentType: '', // 选择的会员卡类型 userAccount: 0, - userDiscount: 0 - + userDiscount: 0, + lightDateTime: '', + lightPrice: 0, }; }, onLoad(e) { @@ -829,12 +796,36 @@ 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); if (found > -1) { this.selectedTimes.splice(found, 1); } 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 trade = self.detail.trade || []; const roomMap = {}; + + self.lightDateTime = '' + self.lightPrice = 0 self.selectedTimes.forEach(sel => { if (!roomMap[sel.roomId]) roomMap[sel.roomId] = []; // 获取时间段 const item = trade[sel.group] && trade[sel.group][sel.idx]; + console.log("🚀 ~ item:", item) if (item) { 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 => { result.push({ room_id: roomId, arr: roomMap[roomId].join(',') }); }); 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) { uni.showModal({ title: '提示', @@ -915,12 +918,15 @@ uni.showLoading({ title: '正在处理' }); + console.log(123123) self._post( 'order.GroundOrder/addLightStoreOrder', { order_id: self.order_id, room_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) { uni.hideLoading();