浏览代码

Merge pull request #144 from John-Hong/John/release-2.10.0/KIP-10484

John/release 2.10.0/kip 10484
John-Hong 2 年之前
父节点
当前提交
63f22477fb

+ 38 - 0
src/api/mockData/checkout.qh15.response.json

@@ -0,0 +1,38 @@
+{
+  "parkingRecord": {
+    "vehicleNo": "粤A22233",
+    "enterTime": "2023-05-06 14:39:55",
+    "serviceMin": 37511,
+    "totalFee": 8000,
+    "actualPayFee": 80,
+    "thirdPartyId": "c33e35e6fe0b48af9a8b3b798c8195ae",
+    "thirdParkOrderNo": "BctVnyZ21H1Ykdz88S5coh",
+    "createdByQrCode": false,
+    "totalFeeInYuan": 80
+  },
+  "discountInfo": {
+    "usingTotalDiscount": 0,
+    "memberLevelDiscount": false
+  },
+  "parkingRule": {
+    "maxOneDayDiscountFee": 60,
+    "enableNewMemberPoints": false,
+    "enablePoints": true,
+    "unLimitWeekendPoints": false,
+    "enableCoupon": true,
+    "enablePaperCoupons": false,
+    "maxPointsTime": 0,
+    "enableConsume": false,
+    "enableConsumeSplit": false,
+    "availableDiscountFee": 60,
+    "hourPrice": 5,
+    "oneTimeLimitation": false,
+    "oneDayLimitation": true
+  },
+  "parkInfo": {
+    "parkName": "深圳前海湾停车场",
+    "description": "基础计费规则:\n15分钟内免费,首小时15元,其后每小时5元,全天封顶60元。\n嘉湾汇会员停车礼遇:\n银卡:每月可免费领取2张首2小时停车券\n金卡:每月可免费领取5张首2小时停车券\n铂金卡:每月可免费领取10张首2小时停车券\n*数量有限,领完即止\n仅限开具一个月内的停车费电子发票 ",
+    "parkMallCode": 5,
+    "buildingId": "QHKC-P1"
+  }
+}

+ 3 - 1
src/main.js

@@ -30,7 +30,8 @@ import {
   Dialog,
   NumberKeyboard,
   Divider,
-  Stepper
+  Stepper,
+  Loading
 } from 'vant';
 
 import router from './routes/index.js'; // 注册页面路由
@@ -68,6 +69,7 @@ Vue.use(Icon)
   .use(Dialog)
   .use(NumberKeyboard)
   .use(Divider)
+  .use(Loading)
   .use(Stepper);
   
 

+ 19 - 1
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -121,6 +121,22 @@ export default {
   methods: {
     // 前往支付
     async toPay() {
+      this.btnLoading = true
+      setTimeout(() => {
+        if ( this.btnLoading ) {
+          const toast1 = Toast({
+            message: '操作异常,返回上一页后请重试!',
+            duration: 3000,
+            onClose: () => {
+              this.$router.replace({
+                // path: 'parkingFeeSuccess?carno=' + this.parkInfo.carno,
+                path: 'home',
+              });
+            }
+          });
+        }
+        this.btnLoading = false
+      }, 7000)
       const { parkingRecord, discountInfo = {}, parkingRule = {}} = this.orderDetail;
       const { coupons, points, memberGrade = [], paperCoupons = [], consume = [] } = discountInfo
       const { hourPrice } = parkingRule
@@ -164,7 +180,7 @@ export default {
           let discountFee = 0
           if(selected) {
             discountFee = consume[0].hasOwnProperty('discountFee') ? consume[0].discountFee : memberGrade[0].defaultDiscountTime * hourPrice;
-            discountTime = discountFee / hourPrice;
+            discountTime = discountFee / hourPrice * 60;
           }
           params.discountInfo.consume = {
             ...consume[0],
@@ -224,6 +240,7 @@ export default {
         }
         this.kerryPayment(res.sessionId);
       } catch (err) {
+        this.btnLoading = false
         console.log(err);
       }
     },
@@ -268,6 +285,7 @@ export default {
               console.log(1784, weixinH5PayRes);
               //  errMsg: 'requestPayment:ok'
               if (weixinH5PayRes?.errMsg === 'requestPayment:ok') {
+                this.btnLoading = false
                 this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
                   name: 'parkingFeeDetail'
                 });

+ 8 - 4
src/pages/parkingFee/parkingFeeDetail.vue

@@ -35,21 +35,21 @@
             <van-icon name="arrow"/>
           </div>
         </div>
-        <div class="info-item-box" v-if="orderDetail && orderDetail.discountInfo && orderDetail.parkingRule.enablePoints">
+        <div class="info-item-box" v-if="enablePoints">
           <div class="label">积分减免</div>
           <div :class="['value']" @click="showPointsMathPopup('bottom')">
             <span :class="[integralDesc === '今日已达上限' ? 'text-disable' : 'text-red']">{{ integralDesc }}</span>
             <van-icon name="arrow"/>
           </div>
         </div>
-        <div class="info-item-box" v-if="orderDetail && orderDetail.discountInfo && orderDetail.parkingRule.enableCoupon">
+        <div class="info-item-box" v-if="enableCoupon">
           <div class="label">优惠劵</div>
           <div :class="['value',]" @click="coupon">
             <span :class="[ coupons.length > 0 ? 'text-red':  'text-disable']">{{ couponDesc }}</span>
             <van-icon name="arrow"/>
           </div>
         </div>
-        <div class="info-item-box" v-if="enablePaperCoupons || orderDetail.parkInfo.parkMallCode === 1">
+        <div class="info-item-box" v-if="enablePaperCoupons">
           <div class="label">纸质优惠劵</div>
           <div :class="['value', 'text-red']" @click="paperCoupon">扫描纸质优惠劵二维码
             <van-icon name="arrow"/>
@@ -110,7 +110,11 @@
           </div>
         </div>
         <div class="btn-box">
-          <k-button style="width: 100%;max-width: 240px" title="支付" disabledColor="#D1D2D9" @click="toPay"/>
+          <k-button :disabled="btnLoading" style="width: 100%;max-width: 240px" title="支付" disabledColor="#D1D2D9" @click="toPay">
+            <template v-slot:left>
+              <van-loading v-if="btnLoading" size="20" color="#fff" style="margin-right: 10px"/>
+            </template>
+          </k-button>
         </div>
 
       </div>

+ 19 - 17
src/store/order/coupon.js

@@ -5,8 +5,8 @@ export default {
   // 电子优惠券
   couponRule( {commit,dispatch,state},checkOutResponse ) {
     commit('setEnableCoupon',checkOutResponse.parkingRule.enableCoupon);
-    if ( checkOutResponse.parkingRule.enableCoupon ) {
-      commit('setMaxOneDayCoupons',checkOutResponse.parkingRule.maxOneDayCoupons); // 仅在杭州使用
+    if ( checkOutResponse.parkingRule.enableCoupon) {
+      commit('setMaxOneDayCoupons',checkOutResponse?.parkingRule?.maxOneDayCoupons || 0); // 仅在杭州使用
       // 根据时间排序电子兑换券
       const couponSort = ( a,b ) => {
         let aTime = new Date(`${ a.expirationDate }`.replace(/-/g,'/'));
@@ -15,25 +15,27 @@ export default {
         let bN = bTime.getTime(bTime) // 方法2
         return aN - bN;
       }
-      const coupons = checkOutResponse.discountInfo.coupons.sort(couponSort)
-      commit('setCoupons',coupons);
-      // 统计已选择优惠券
-      let couponCount = 0;
-      checkOutResponse.discountInfo.coupons.forEach(( elm ) => {
-        const selected = elm.hasOwnProperty('selected') ? elm.selected : elm.defaultSelected;
-        if ( selected ) {
-          couponCount++;
+      if ( checkOutResponse?.discountInfo?.coupons?.length ) {
+        const coupons = checkOutResponse.discountInfo.coupons.sort(couponSort)
+        commit('setCoupons',coupons);
+        // 统计已选择优惠券
+        let couponCount = 0;
+        checkOutResponse.discountInfo.coupons.forEach(( elm ) => {
+          const selected = elm.hasOwnProperty('selected') ? elm.selected : elm.defaultSelected;
+          if ( selected ) {
+            couponCount++;
+          }
+        });
+        commit('setCouponCount',couponCount);
+
+        if ( couponCount > 0 ) {
+          return commit('setCouponDesc',`已选择${ couponCount }张优惠劵`);
         }
-      });
-      commit('setCouponCount',couponCount);
-      if ( couponCount > 0 ) {
-        return commit('setCouponDesc',`已选择${ couponCount }张优惠劵`);
-      } else {
         if ( checkOutResponse.discountInfo.coupons.length ) {
           return commit('setCouponDesc',`您有${ checkOutResponse.discountInfo.coupons.length }张可用优惠劵`);
-        }
-        return commit('setCouponDesc',`暂无可用优惠券`);
+        }  
       }
+      commit('setCouponDesc',`暂无可用优惠券`);
     } else {
       commit('setCouponDesc',`暂无可用优惠券`);
     }

+ 1 - 1
src/store/order/index.js

@@ -1,4 +1,4 @@
-import checkOutQHResponse from "@/api/mockData/checkout.pd12.response.json";
+import checkOutQHResponse from "@/api/mockData/checkout.qh15.response.json";
 import { checkOut,calculateDiscount,ordersAndPrepay,currentUnlicensedPlate,unlicensedCarCheckIn,unlicensedCarCheckout } from '@/api/parking';
 import state from "@/store/order/state";
 import mutations from "@/store/order/mutations";

+ 2 - 1
src/store/order/points.js

@@ -21,6 +21,7 @@ export default {
       maxOneDayDiscountFee, // 每日最大优惠金额(深圳车场)
       remainConsumeTime, // 当前订单剩余可使用的优惠
     } = parkingRule;
+    commit('setEnablePoints',enablePoints);
     if ( !points ) return commit('setIntegralDesc','暂无可用积分'); // 积分优惠处的描述
     const [
       {
@@ -37,7 +38,7 @@ export default {
     ] = points;
     commit('setAvailableDiscountFee',availableDiscountFee);
     dispatch('maxPointsTimeMath',checkOutResponse) // 剩余积分可兑换上限
-    commit('setEnablePoints',enablePoints);
+    
     commit('setAvailable',available);
     commit('setMaxPointsTime',maxPointsTime);
     commit('setMaxDiscountFee',maxDiscountFee);