|
@@ -158,14 +158,14 @@
|
|
|
<view class="fs-28 lh-28 color-000 fw-500">优惠</view>
|
|
<view class="fs-28 lh-28 color-000 fw-500">优惠</view>
|
|
|
<block v-if="checkedUserRightsOrCoupon&&checkedUserRightsOrCoupon.userRights">
|
|
<block v-if="checkedUserRightsOrCoupon&&checkedUserRightsOrCoupon.userRights">
|
|
|
<view class="fs-28 lh-28 ml-auto" style="color: #f43636"
|
|
<view class="fs-28 lh-28 ml-auto" style="color: #f43636"
|
|
|
- >{{ ((checkedUserRightsOrCoupon?.userRights?.discount||0)/10).toFixed(1) }}折
|
|
|
|
|
|
|
+ >{{ ((checkedUserRightsOrCoupon?.userRights?.discount || 0) / 10).toFixed(1) }}折
|
|
|
</view
|
|
</view
|
|
|
>
|
|
>
|
|
|
<uni-icons type="right" size="16" color="#CACACA"></uni-icons>
|
|
<uni-icons type="right" size="16" color="#CACACA"></uni-icons>
|
|
|
</block>
|
|
</block>
|
|
|
<block v-else-if="checkedUserRightsOrCoupon&&checkedUserRightsOrCoupon.userCoupon">
|
|
<block v-else-if="checkedUserRightsOrCoupon&&checkedUserRightsOrCoupon.userCoupon">
|
|
|
<view class="fs-28 lh-28 ml-auto" style="color: #f43636"
|
|
<view class="fs-28 lh-28 ml-auto" style="color: #f43636"
|
|
|
- >{{ ((checkedUserRightsOrCoupon?.userCoupon?.discount||0)/100).toFixed(2) }}元
|
|
|
|
|
|
|
+ >{{ ((checkedUserRightsOrCoupon?.userCoupon?.discount || 0) / 100).toFixed(2) }}元
|
|
|
</view
|
|
</view
|
|
|
>
|
|
>
|
|
|
<!-- <view class="fs-28 lh-28 color-666 ml-8">权益待领取</view>-->
|
|
<!-- <view class="fs-28 lh-28 color-666 ml-8">权益待领取</view>-->
|
|
@@ -297,7 +297,7 @@
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import {cancelAppointmentCharge, changeAppointmentTime, fetchChargeStatus, fetchStationByConnectorIdOrShortId, fetchStationPriceDesc, startAppointmentCharge, startCharge,} from "@/api/charge";
|
|
import {cancelAppointmentCharge, changeAppointmentTime, fetchChargeStatus, fetchStationByConnectorIdOrShortId, fetchStationPriceDesc, startAppointmentCharge, startCharge,} from "@/api/charge";
|
|
|
-import {fetchProfile} 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";
|
|
|
import ChargeMachine from "../machines/charge-machine/charge-machine.vue";
|
|
import ChargeMachine from "../machines/charge-machine/charge-machine.vue";
|
|
@@ -357,8 +357,8 @@ const activity = ref();
|
|
|
const stationId = ref();
|
|
const stationId = ref();
|
|
|
|
|
|
|
|
const handleShowStationChargeCoupon = () => {
|
|
const handleShowStationChargeCoupon = () => {
|
|
|
- let {rightsId,couponId} = checkedUserRightsOrCoupon.value;
|
|
|
|
|
- station_charge_coupon_ref.value?.open(stationId.value,rightsId,couponId);
|
|
|
|
|
|
|
+ let {rightsId, couponId} = checkedUserRightsOrCoupon.value;
|
|
|
|
|
+ station_charge_coupon_ref.value?.open(stationId.value, rightsId, couponId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleCheckedUserRightsAndCoupon = (data: any) => {
|
|
const handleCheckedUserRightsAndCoupon = (data: any) => {
|
|
@@ -713,11 +713,11 @@ const submit = () => {
|
|
|
if (chargeType.value === 1) {
|
|
if (chargeType.value === 1) {
|
|
|
query += "isBooking=false";
|
|
query += "isBooking=false";
|
|
|
}
|
|
}
|
|
|
- let {rightsId,couponId} = checkedUserRightsOrCoupon.value;
|
|
|
|
|
- if (rightsId &&rightsId >= 0) {
|
|
|
|
|
|
|
+ let {rightsId, couponId} = checkedUserRightsOrCoupon.value;
|
|
|
|
|
+ if (rightsId && rightsId >= 0) {
|
|
|
query += `&userRechargeRightsId=${rightsId}`;
|
|
query += `&userRechargeRightsId=${rightsId}`;
|
|
|
}
|
|
}
|
|
|
- if (couponId &&couponId >= 0) {
|
|
|
|
|
|
|
+ if (couponId && couponId >= 0) {
|
|
|
query += `&userCouponId=${couponId}`;
|
|
query += `&userCouponId=${couponId}`;
|
|
|
}
|
|
}
|
|
|
console.log(query)
|
|
console.log(query)
|
|
@@ -786,6 +786,26 @@ const _checkStartCharge = () => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 设置当前用户在该站点的默认充电权益或优惠券
|
|
|
|
|
+ */
|
|
|
|
|
+const fetchUserStationDefaultRightsAndCoupon = () => {
|
|
|
|
|
+ listStationAvailableRightsAndCoupons(stationId.value).then((res) => {
|
|
|
|
|
+ let {userRechargeRightsList, userCouponList} = res;
|
|
|
|
|
+ let couponList = (userCouponList || []).sort((a: any, b: any) => new Date(a.endTime).getTime() - new Date(b.endTime).getTime());
|
|
|
|
|
+ let rightsList = (userRechargeRightsList || []).sort((a: any, b: any) => new Date(a.endTime).getTime() - new Date(b.endTime).getTime());
|
|
|
|
|
+ checkedUserRightsOrCoupon.value.stationId = stationId.value;
|
|
|
|
|
+ if (rightsList && rightsList.length > 0) {
|
|
|
|
|
+ checkedUserRightsOrCoupon.value.userRights = rightsList[0];
|
|
|
|
|
+ checkedUserRightsOrCoupon.value.rightsId = rightsList[0].rightsId;
|
|
|
|
|
+ } else if (couponList && couponList.length > 0) {
|
|
|
|
|
+ checkedUserRightsOrCoupon.value.userCoupon = couponList[0];
|
|
|
|
|
+ checkedUserRightsOrCoupon.value.couponId = couponList[0].couponId;
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
onLoad((_options: any) => {
|
|
onLoad((_options: any) => {
|
|
|
// sn=SN100523042860091 测试环境
|
|
// sn=SN100523042860091 测试环境
|
|
|
console.log("options", _options);
|
|
console.log("options", _options);
|
|
@@ -799,6 +819,7 @@ onLoad((_options: any) => {
|
|
|
let {station, equipment} = res;
|
|
let {station, equipment} = res;
|
|
|
if (station) {
|
|
if (station) {
|
|
|
stationId.value = station.StationID;
|
|
stationId.value = station.StationID;
|
|
|
|
|
+ fetchUserStationDefaultRightsAndCoupon();
|
|
|
}
|
|
}
|
|
|
if (equipment && equipment.connectorInfos && equipment.connectorInfos.length) {
|
|
if (equipment && equipment.connectorInfos && equipment.connectorInfos.length) {
|
|
|
sn = equipment.connectorInfos[0].connectorId;
|
|
sn = equipment.connectorInfos[0].connectorId;
|