Kaynağa Gözat

请求充电参数更正

skyline 1 yıl önce
ebeveyn
işleme
b3399fae5d

+ 3 - 3
src/components/order-coupon-detail/order-coupon-detail.vue

@@ -35,9 +35,9 @@
                         @click.stop="to(`/pages-common/activity/activity?id=${item.activityId}`)">
                     <view class="fs-26 color-999">到期时间:{{ item.endTime }}</view>
                     <view class="flex-align-center" v-if="mode === 0">
-                      <view class="fs-24 color-999">充值{{ ((item.amountMin || 0) / 100).toFixed(2) }}元,享受{{ (item.discount / 10).toFixed(1) }}折服务费权益,有效期{{ item.validity }}天
-                        <!--                        <text class="color-primary">详细规则</text>
-                                                <text class="fs-24 ml-4 color-primary">>></text>-->
+                      <view class="fs-24 color-999">享受{{ (item.discount / 10).toFixed(1) }}折服务费权益,本次充电优惠:{{ ((item.discountAmount || 0) / 100).toFixed(2) }}元
+                                                <text class="color-primary">详细规则</text>
+                                                <text class="fs-24 ml-4 color-primary">>></text>
                       </view>
                     </view>
                   </view>

+ 28 - 10
src/components/station-charge-coupon/station-charge-coupon.vue

@@ -50,7 +50,7 @@
               </view>
               <view class="item-content_right">
                 <style-checkbox
-                    @on-checkChange="handleCheckRights($event,item.rightsId)"
+                    @on-checkChange="handleCheckRights($event,item.rightsId,item.id)"
                     :size="48"
                     :checked="item.rightsId === rightsId"
                     :iconsize="17"
@@ -120,7 +120,7 @@
                                       <radio  :checked="item.couponId === couponId"/>
                                     </radio-group>-->
                   <style-checkbox
-                      @on-checkChange="handleCheckCoupon($event,item.couponId)"
+                      @on-checkChange="handleCheckCoupon($event,item.couponId,item.id)"
                       :size="48"
                       :checked="item.couponId === couponId"
                       :iconsize="17"
@@ -176,12 +176,14 @@ const handleClose = () => {
 const handleConfirm = () => {
   let emitData = {
     rightsId: rightsId.value,
+    userRechargeRightsId: userRechargeRightsId.value,
     couponId: couponId.value,
+    userCouponId: userCouponId.value,
     stationId: stationId.value,
     userRights: rightsList.value?.find((k: any) => k.rightsId == rightsId.value ),
-    userCoupon: couponList.value?.find((k: any) => k.couponId == couponId.value)
+    userCoupon: couponList.value?.find((k: any) => k.couponId == couponId.value),
   }
-  // console.log(emitData)
+   console.log(emitData)
   emits('on-change', emitData)
   handleClose();
 }
@@ -194,22 +196,38 @@ const changeTab = (tab: number) => {
   mode.value = tab;
 }
 
-const handleCheckRights = (val: boolean, userRightsId: any) => {
+/**
+ *
+ * @param val
+ * @param rId rechargeRightsId
+ * @param urId userRechargeRightsId
+ */
+const handleCheckRights = (val: boolean, rId: any,urId: any) => {
   // console.log("handleCheckRights", userRightsId, val)
-  if (rightsId.value == userRightsId) {
+  if (rightsId.value == rId) {
     rightsId.value = null;
+    userRechargeRightsId.value = null;
   } else {
-    rightsId.value = userRightsId;
+    rightsId.value = rId;
+    userRechargeRightsId.value = urId;
     couponId.value = null;
   }
 }
 
-const handleCheckCoupon = (e: any, userCouponId: any) => {
+/**
+ *
+ * @param e
+ * @param cid couponId
+ * @param ucid userCouponId
+ */
+const handleCheckCoupon = (e: any, cid: any,ucid: any) => {
   // console.log("handleCheckCoupon", userCouponId, e)
-  if (couponId.value == userCouponId) {
+  if (couponId.value == cid) {
     couponId.value = null;
+    userCouponId.value = null;
   } else {
-    couponId.value = userCouponId;
+    couponId.value = cid;
+    userCouponId.value = ucid;
     rightsId.value = null;
   }
 }

+ 8 - 7
src/pages-charge/appointment/appointment.vue

@@ -155,7 +155,7 @@
           <!--          to(-->
           <!--          `/pages-charge/discount/discountV2?rightsId=${userRechargeRightsId}&couponId=${userCouponId}&stationId=${stationId}`-->
           <!--          )-->
-          <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.rightsId">
             <view class="fs-28 lh-28 ml-auto" style="color: #f43636"
             >{{ ((checkedUserRightsOrCoupon?.userRights?.discount || 0) / 10).toFixed(1) }}折
@@ -216,7 +216,7 @@
             </view>
           </template>
           <style-button v-else type="primary" size="small" @click="submit">{{
-              chargeType === 0 ? "提交预约" : "马上充电"
+              chargeType === 0 ? "提交预约" : "立即充电"
             }}
           </style-button>
         </view>
@@ -718,12 +718,13 @@ const submit = () => {
   if (chargeType.value === 1) {
     query += "isBooking=false";
   }
-  let {rightsId, couponId} = checkedUserRightsOrCoupon.value;
-  if (rightsId && rightsId >= 0) {
-    query += `&userRechargeRightsId=${rightsId}`;
+  let {userRechargeRightsId, userCouponId} = checkedUserRightsOrCoupon.value;
+  console.log("userRechargeRightsId")
+  if (userRechargeRightsId && userRechargeRightsId >= 0) {
+    query += `&userRechargeRightsId=${userRechargeRightsId}`;
   }
-  if (couponId && couponId >= 0) {
-    query += `&userCouponId=${couponId}`;
+  if (userCouponId && userCouponId >= 0) {
+    query += `&userCouponId=${userCouponId}`;
   }
   console.log(query)
   uni.showLoading({