Prechádzať zdrojové kódy

调整下单时,传递参数和计算逻辑

john.hong 2 rokov pred
rodič
commit
cbedd3dd0a

+ 7 - 3
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -105,8 +105,9 @@ export default {
   methods: {
     // 前往支付
     async toPay() {
-      const { parkingRecord, discountInfo = {} } = this.orderDetail;
+      const { parkingRecord, discountInfo = {}, parkingRule } = this.orderDetail;
       const { coupons, points } = discountInfo
+      const { hourPrice } = parkingRule
       try {
         const params = {
           // vehicleNo: '', // 车牌号
@@ -129,9 +130,9 @@ export default {
           // 15 兑换 5元
           const { pointsPerUnit, unitAmount, discountFee, available } = points[0]
           params.discountInfo.points = {
-            "discountTime": discountFee / pointsPerUnit,
+            "discountTime": discountFee / hourPrice * 60,
             "discountFee": discountFee,
-            "discountPoints": discountFee * (unitAmount / pointsPerUnit)
+            "discountPoints": discountFee / hourPrice * pointsPerUnit
           }
         }
         // 优惠券
@@ -139,6 +140,9 @@ export default {
           const selectedCoupons = coupons.filter(elm => {
             const selected = elm.hasOwnProperty('selected') ? elm.selected : elm.defaultSelected;
             return selected
+          }).map(elm => {
+            elm.discountTime = elm.discountFee / hourPrice * 60
+            return elm
           })
           if (selectedCoupons.length) {
             params.discountInfo.coupons = selectedCoupons