|
|
@@ -263,6 +263,7 @@ import {
|
|
|
fetchStationByConnectorIdOrShortId,
|
|
|
fetchStationPriceDesc,
|
|
|
startCharge,
|
|
|
+ startAppointmentCharge,
|
|
|
cancelAppointmentCharge,
|
|
|
changeAppointmentTime,
|
|
|
} from "@/api/charge";
|
|
|
@@ -272,7 +273,7 @@ import { ref } from "vue";
|
|
|
import ChargeMachine from "../machines/charge-machine/charge-machine.vue";
|
|
|
import PriceDesc from "../machines/price-desc/price-desc.vue";
|
|
|
import { format } from "@/utils/date";
|
|
|
-import { to } from "../../utils/navigate";
|
|
|
+import { to, reLaunch } from "../../utils/navigate";
|
|
|
|
|
|
const DAY = 24 * 60 * 60 * 1000;
|
|
|
const options = ref<any>();
|
|
|
@@ -469,7 +470,7 @@ const changeHour = (index: number) => {
|
|
|
})
|
|
|
.then((res) => {
|
|
|
uni.hideLoading();
|
|
|
- if (res && res.isBooking === 1) {
|
|
|
+ if (res && [0].includes(res.chargeStatus)) {
|
|
|
uni.showToast({
|
|
|
icon: "success",
|
|
|
title: "修改成功",
|
|
|
@@ -586,6 +587,16 @@ const formatAppointmentCountDown = (time: string) => {
|
|
|
const now = new Date();
|
|
|
const date = new Date(time.replace(/-/g, "/"));
|
|
|
let secondTime = parseInt(`${(date.getTime() - now.getTime()) / 1000}`);
|
|
|
+ if (secondTime <= 0) {
|
|
|
+ uni.showModal({
|
|
|
+ content: "当前预约时间已到,将开始进行充电",
|
|
|
+ showCancel: false,
|
|
|
+ success() {
|
|
|
+ reLaunch();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
let hourTime = 0;
|
|
|
let minuteTime = 0; // 分
|
|
|
if (secondTime >= 60) {
|
|
|
@@ -650,7 +661,7 @@ const submit = () => {
|
|
|
if (chargeType.value === 0) {
|
|
|
fetchChargeStatus()
|
|
|
.then((res) => {
|
|
|
- if (res && res.isBooking === 1) {
|
|
|
+ if (res && [0].includes(res.chargeStatus)) {
|
|
|
uni.hideLoading();
|
|
|
uni.showToast({
|
|
|
icon: "success",
|
|
|
@@ -684,10 +695,7 @@ const submitNow = () => {
|
|
|
title: "提交中",
|
|
|
mask: true,
|
|
|
});
|
|
|
- cancelAppointmentCharge()
|
|
|
- .then(() => {
|
|
|
- return startCharge(options.value.sn, "isBooking=false");
|
|
|
- })
|
|
|
+ startAppointmentCharge(options.value.sn)
|
|
|
.then(() => {
|
|
|
uni.navigateTo({
|
|
|
url: `/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`,
|
|
|
@@ -731,7 +739,7 @@ onLoad((_options: any) => {
|
|
|
return fetchChargeStatus(false, true);
|
|
|
})
|
|
|
.then((res) => {
|
|
|
- if (res && res.isBooking === 1) {
|
|
|
+ if (res && [0].includes(res.chargeStatus)) {
|
|
|
appointmentData.value = res;
|
|
|
startAppointmentCountDown();
|
|
|
}
|