|
@@ -1,13 +1,13 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view :class="['page']">
|
|
<view :class="['page']">
|
|
|
- <view v-if="data && priceInfo">
|
|
|
|
|
|
|
+ <view v-if="station && priceInfo">
|
|
|
<view class="block">
|
|
<view class="block">
|
|
|
<view class="station">
|
|
<view class="station">
|
|
|
<ChargeMachine
|
|
<ChargeMachine
|
|
|
- :title="'NO.' + data.equipment.shortId"
|
|
|
|
|
- :list="data.equipment.connectorInfos"
|
|
|
|
|
|
|
+ :title="'NO.' + equipment.shortId"
|
|
|
|
|
+ :list="station.connectInfoList"
|
|
|
:time="priceInfo.useTime"
|
|
:time="priceInfo.useTime"
|
|
|
- :parkingNo="data.equipment.parkingNo"
|
|
|
|
|
|
|
+ :parkingNo="equipment.parkingNo"
|
|
|
></ChargeMachine>
|
|
></ChargeMachine>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="pt-20 pb-20 pl-30 pr-30 flex-align-center">
|
|
<view class="pt-20 pb-20 pl-30 pr-30 flex-align-center">
|
|
@@ -16,7 +16,7 @@
|
|
|
mode="widthFix"
|
|
mode="widthFix"
|
|
|
class="flex-shrink mr-12 width-40"
|
|
class="flex-shrink mr-12 width-40"
|
|
|
/>
|
|
/>
|
|
|
- <view class="fs-26 color-666">{{ data.station.address }}</view>
|
|
|
|
|
|
|
+ <view class="fs-26 color-666">{{ station.address }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- <view class="mt-40 ml-30 color-999 fs-32 fw-500">费用说明</view>-->
|
|
<!-- <view class="mt-40 ml-30 color-999 fs-32 fw-500">费用说明</view>-->
|
|
@@ -306,7 +306,17 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import {cancelAppointmentCharge, changeAppointmentTime, fetchChargeStatus, fetchStationByConnectorIdOrShortId, fetchStationPriceDesc, startAppointmentCharge, startCharge,} from "@/api/charge";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ cancelAppointmentCharge,
|
|
|
|
|
+ changeAppointmentTime,
|
|
|
|
|
+ fetchChargeStatus,
|
|
|
|
|
+ fetchStationByConnectorIdOrShortId,
|
|
|
|
|
+ fetchStationDetail, fetchStationDetailByShortId, fetchStationDetailByShortIdOrConnectorIdOrEquipmentId,
|
|
|
|
|
+ fetchStationPriceDesc,
|
|
|
|
|
+ startAppointmentCharge,
|
|
|
|
|
+ startCharge,
|
|
|
|
|
+} from "@/api/charge";
|
|
|
|
|
+
|
|
|
import {fetchProfile, listStationAvailableRightsAndCoupons} from "@/api/user";
|
|
import {fetchProfile, listStationAvailableRightsAndCoupons} from "@/api/user";
|
|
|
import {onLoad, onShow} from "@dcloudio/uni-app";
|
|
import {onLoad, onShow} from "@dcloudio/uni-app";
|
|
|
import {ref} from "vue";
|
|
import {ref} from "vue";
|
|
@@ -320,6 +330,9 @@ import {redirect, to} from "../../utils/navigate";
|
|
|
const DAY = 24 * 60 * 60 * 1000;
|
|
const DAY = 24 * 60 * 60 * 1000;
|
|
|
const options = ref<any>();
|
|
const options = ref<any>();
|
|
|
const data = ref<any>();
|
|
const data = ref<any>();
|
|
|
|
|
+const equipment = ref<any>(null);
|
|
|
|
|
+const station = ref<any>();
|
|
|
|
|
+const stationId = ref<any>();
|
|
|
const priceInfo = ref();
|
|
const priceInfo = ref();
|
|
|
const priceDescVisible = ref(false);
|
|
const priceDescVisible = ref(false);
|
|
|
const timesInfo = ref<any>({
|
|
const timesInfo = ref<any>({
|
|
@@ -368,7 +381,6 @@ const discountIndex = ref(-1);
|
|
|
const discountList = ref<any[]>([]);
|
|
const discountList = ref<any[]>([]);
|
|
|
const activity = ref();
|
|
const activity = ref();
|
|
|
|
|
|
|
|
-const stationId = ref();
|
|
|
|
|
const balance = ref(0);
|
|
const balance = ref(0);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -748,7 +760,7 @@ const submit = () => {
|
|
|
title: "提交中",
|
|
title: "提交中",
|
|
|
mask: true,
|
|
mask: true,
|
|
|
});
|
|
});
|
|
|
- startCharge(options.value.sn, query)
|
|
|
|
|
|
|
+ startCharge(equipment.value.connectorId, query)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
if (chargeType.value === 0) {
|
|
if (chargeType.value === 0) {
|
|
|
fetchChargeStatus()
|
|
fetchChargeStatus()
|
|
@@ -768,7 +780,7 @@ const submit = () => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
if (chargeType.value === 1) {
|
|
if (chargeType.value === 1) {
|
|
|
- redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
|
|
|
|
|
|
|
+ redirect(`/pages-charge/ordering/ordering?connectorId=${options.value.connectorId}&start=1`)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
@@ -785,7 +797,7 @@ const submitNow = () => {
|
|
|
title: "提交中",
|
|
title: "提交中",
|
|
|
mask: true,
|
|
mask: true,
|
|
|
});
|
|
});
|
|
|
- startAppointmentCharge(options.value.sn)
|
|
|
|
|
|
|
+ startAppointmentCharge(options.value.connectorId)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
_checkStartCharge();
|
|
_checkStartCharge();
|
|
|
})
|
|
})
|
|
@@ -802,7 +814,7 @@ const _checkStartCharge = () => {
|
|
|
fetchChargeStatus().then((res) => {
|
|
fetchChargeStatus().then((res) => {
|
|
|
if (res && [2].includes(res.chargeStatus)) {
|
|
if (res && [2].includes(res.chargeStatus)) {
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
- redirect(`/pages-charge/ordering/ordering?sn=${options.value.sn}&start=1`)
|
|
|
|
|
|
|
+ redirect(`/pages-charge/ordering/ordering?connectorId=${options.value.connectorId}&start=1`)
|
|
|
} else {
|
|
} else {
|
|
|
_checkStartCharge();
|
|
_checkStartCharge();
|
|
|
}
|
|
}
|
|
@@ -834,37 +846,68 @@ const fetchUserStationDefaultRightsAndCoupon = () => {
|
|
|
onLoad((_options: any) => {
|
|
onLoad((_options: any) => {
|
|
|
// sn=SN100523042860091 测试环境
|
|
// sn=SN100523042860091 测试环境
|
|
|
console.log("options", _options);
|
|
console.log("options", _options);
|
|
|
- let sn = _options.sn;
|
|
|
|
|
- let stationId = _options.stationId;
|
|
|
|
|
- if(stationId){
|
|
|
|
|
- stationId.value =stationId;
|
|
|
|
|
|
|
+ let {sn, connectorId, equipmentId} = _options
|
|
|
|
|
+ let _sn = _options.sn;
|
|
|
|
|
+ let _stationId = _options.stationId;
|
|
|
|
|
+ if (_stationId) {
|
|
|
|
|
+ stationId.value = _stationId;
|
|
|
}
|
|
}
|
|
|
|
|
+ options.value = {..._options}
|
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
|
title: "加载中",
|
|
title: "加载中",
|
|
|
});
|
|
});
|
|
|
- fetchStationByConnectorIdOrShortId(sn)
|
|
|
|
|
|
|
+ fetchStationDetailByShortIdOrConnectorIdOrEquipmentId(sn, connectorId, equipmentId)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
- console.log(res);
|
|
|
|
|
- let {station, equipment} = res;
|
|
|
|
|
- if (station) {
|
|
|
|
|
- stationId.value = station.StationID;
|
|
|
|
|
- fetchUserStationDefaultRightsAndCoupon();
|
|
|
|
|
|
|
+ console.log("1111111111", res);
|
|
|
|
|
+ stationId.value = res.stationId;
|
|
|
|
|
+ fetchUserStationDefaultRightsAndCoupon();
|
|
|
|
|
+ if (sn) {
|
|
|
|
|
+ let cns = res.connectInfoList?.filter(k => k.shortId === sn)
|
|
|
|
|
+ if (cns && cns.length > 0) {
|
|
|
|
|
+ equipment.value = cns[0]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (connectorId) {
|
|
|
|
|
+ let cns = res.connectInfoList?.filter(k => k.connectorId === connectorId)
|
|
|
|
|
+ if (cns && cns.length > 0) {
|
|
|
|
|
+ equipment.value = cns[0]
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- if (equipment && equipment.connectorInfos && equipment.connectorInfos.length) {
|
|
|
|
|
- sn = equipment.connectorInfos[0].connectorId;
|
|
|
|
|
- _options.sn = equipment.connectorInfos[0].connectorId;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (equipmentId) {
|
|
|
|
|
+ let cns = res.connectInfoList?.filter(k => k.equipmentId === equipmentId)
|
|
|
|
|
+ if (cns && cns.length > 0) {
|
|
|
|
|
+ equipment.value = cns[0]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ // if (equipment && equipment.connectorInfos && equipment.connectorInfos.length) {
|
|
|
|
|
+ // sn = equipment.connectorInfos[0].connectorId;
|
|
|
|
|
+ // _options.sn = equipment.connectorInfos[0].connectorId;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // options.value = _options;
|
|
|
|
|
+ // data.value = res;
|
|
|
|
|
+ station.value = res;
|
|
|
|
|
+ if(!equipment.value){
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ titile:'none',
|
|
|
|
|
+ content:"服务异常,请稍后再试。"
|
|
|
|
|
+ })
|
|
|
|
|
+ // return Promise.resolve({});
|
|
|
|
|
+ throw Error;
|
|
|
}
|
|
}
|
|
|
- options.value = _options;
|
|
|
|
|
- data.value = res;
|
|
|
|
|
- return fetchStationPriceDesc(sn);
|
|
|
|
|
|
|
+ return fetchStationPriceDesc(equipment.value.connectorId, res.stationId)
|
|
|
})
|
|
})
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
- // console.log(res);
|
|
|
|
|
|
|
+ console.log("xxxx price", res);
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
priceInfo.value = res;
|
|
priceInfo.value = res;
|
|
|
return fetchChargeStatus(false, true);
|
|
return fetchChargeStatus(false, true);
|
|
|
})
|
|
})
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
|
|
+ console.log("charge status", res)
|
|
|
if (res && res.isAppointment) {
|
|
if (res && res.isAppointment) {
|
|
|
appointmentData.value = res;
|
|
appointmentData.value = res;
|
|
|
startAppointmentCountDown();
|
|
startAppointmentCountDown();
|