Преглед на файлове

站点详情背景轮播;充电页充值按钮

zuy преди 1 година
родител
ревизия
3335427db1
променени са 2 файла, в които са добавени 31 реда и са изтрити 11 реда
  1. 30 10
      src/pages-charge/appointment/appointment.vue
  2. 1 1
      src/pages-charge/machines/machines.vue

+ 30 - 10
src/pages-charge/appointment/appointment.vue

@@ -165,11 +165,11 @@
           </block>
           <block v-else-if="checkedUserRightsOrCoupon&&checkedUserRightsOrCoupon.couponId">
             <view class="fs-28 lh-28 ml-auto" style="color: #f43636" v-if="checkedUserRightsOrCoupon.userCoupon.couponType=='FullDiscount'">
-            {{ ((checkedUserRightsOrCoupon?.userCoupon?.discount || 0) / 100).toFixed(2) }}元
-            </view >
+              {{ ((checkedUserRightsOrCoupon?.userCoupon?.discount || 0) / 100).toFixed(2) }}元
+            </view>
             <view class="fs-28 lh-28 ml-auto" style="color: #f43636" v-else>
               {{ ((checkedUserRightsOrCoupon?.userCoupon?.discount || 0) / 10).toFixed(1) }}折
-            </view >
+            </view>
 
             <!--            <view class="fs-28 lh-28 color-666 ml-8">权益待领取</view>-->
             <uni-icons type="right" size="16" color="#CACACA"></uni-icons>
@@ -215,10 +215,17 @@
               >
             </view>
           </template>
-          <style-button v-else type="primary" size="small" @click="submit">{{
-              chargeType === 0 ? "提交预约" : "立即充电"
-            }}
-          </style-button>
+          <template v-else>
+            <style-button v-if="balance>0" type="primary" size="small" @click="submit">{{
+                chargeType === 0 ? "提交预约" : "立即充电"
+              }}
+            </style-button>
+
+            <style-button v-else type="primary" size="small" @click="to('/pages-user/wallet-recharge/wallet-recharge')">
+              余额不足,请充值
+            </style-button>
+          </template>
+
         </view>
       </style-bottom-view>
     </view>
@@ -307,7 +314,7 @@ import ChargeMachine from "../machines/charge-machine/charge-machine.vue";
 import PriceDesc from "../machines/price-desc/price-desc.vue";
 import StationChargeCoupon from "@/components/station-charge-coupon/station-charge-coupon.vue";
 import {format} from "@/utils/date";
-import {redirect} from "../../utils/navigate";
+import {redirect, to} from "../../utils/navigate";
 
 
 const DAY = 24 * 60 * 60 * 1000;
@@ -319,6 +326,8 @@ const timesInfo = ref<any>({
   day: [],
   time: [],
 });
+
+
 const checkedUserRightsOrCoupon = ref<any>({
   rightsId: null,
   userRechargeRightsId: null,
@@ -360,6 +369,14 @@ const discountList = ref<any[]>([]);
 const activity = ref();
 
 const stationId = ref();
+const balance = ref(0);
+
+
+const refreshUserBalance = () => {
+  let user = getApp<any>().globalData.user
+  console.log(user)
+  balance.value = user?.balance || 0;
+}
 
 const handleShowStationChargeCoupon = () => {
   let {rightsId, couponId} = checkedUserRightsOrCoupon.value;
@@ -871,12 +888,14 @@ onLoad((_options: any) => {
       activity.value = res.activityList[0];
       activity.value.minDiscount = Number(
           (
-              Number(res.activityList[0].rechargeRightsList[0].discount) / 10
+              Number(res.activityList[0].rechargeRightsList[0]?.discount) / 10
           ).toFixed(1)
       );
     }
-  });
 
+    refreshUserBalance();
+  });
+  refreshUserBalance();
 });
 
 onShow(() => {
@@ -884,6 +903,7 @@ onShow(() => {
     discountIndex.value = getApp<any>().globalData.lastData.discount.index;
     getApp<any>().globalData.lastData.discount = undefined;
   }
+  refreshUserBalance();
 });
 </script>
 

+ 1 - 1
src/pages-charge/machines/machines.vue

@@ -259,7 +259,7 @@ onLoad((options: any) => {
           }
         });
       }
-      res.bannerImages = res.pictures.split(",");
+      res.bannerImages = res.pictures.split(";");
       station.value = res;
       stationEquipmentInfos.value = res.equipmentInfos.map((item: any) => {
         return {