Explorar o código

停车场退款

zaijin hai 1 ano
pai
achega
32013f06b6

+ 4 - 2
common/apiurl.js

@@ -7,7 +7,7 @@ export const apiurl = {
   payurl: '/client/app/pay',
   // 创建订单
   createOrderurl: '/client/order/createOrder',
-  // 退款
+  // 退款(路段退款)
   refundurl: '/client/app/order/refund',
   // 绑定手机号
   bindphoneurl: '/client/app/order/refund2',
@@ -76,8 +76,10 @@ export const apiurl = {
   getOrderInfoApi: '/client/pay/query/',
   // 查询设备状态
   getEqupmentStatusApi: '/client/hardware/deviceInfo/',
-  // 订单退款
+  // 订单退款(路段)
   updateOrderRefundApi: '/client/orderinfo/refundApply',
+  // 订单退款(停车场)
+  updateParkOrderRefundApi: '/client/orderinfo/refundApply',
   // 获取退款详情
   getOrderRefundDetailsApi: '/client/orderinfo/refund/detail/',
   // 普通微信支付

+ 6 - 3
common/http.api.js

@@ -82,8 +82,10 @@ const install = (Vue, vm) => {
   let getOrderInfo = (params = {}) => vm.$u.get(apiurl.getOrderInfoApi + params.orderId);
   // 设备状态查询
   let getEquomentInfo = (params = {}) => vm.$u.get(apiurl.getEqupmentStatusApi + params.orderNo);
-  // 订单退款操作
+  // 订单退款(路段)
   let updateOrderRefund = (params = {}) => vm.$u.post(apiurl.updateOrderRefundApi, params);
+  // 订单退款(停车场)
+  let updateParkingOrderRefund = (params = {}) => vm.$u.post(apiurl.updateParkOrderRefundApi, params);
   // 获取订单退款详情
   let getOrderRefundDetails = (params = {}) => vm.$u.get(apiurl.getOrderRefundDetailsApi + params.orderId);
   // 普通微信支付
@@ -91,7 +93,7 @@ const install = (Vue, vm) => {
   // 包月微信支付
   let monthlyWxPay = (params = {}) => vm.$u.post(apiurl.monthlyWxPayApi, params);
   // 获取自定义富文本内容: 0-包月须知 1-用户服务条款 2-隐私权政策信息 3-收费标准 4-退款温馨提示
-  let getSysterms = (params = {}) => vm.$u.get(apiurl.getSystermsApi + params.termsType);
+  let getSystems = (params = {}) => vm.$u.get(apiurl.getSystermsApi + params.termsType);
   // 通过微信登录获取openid
   let codeV2Api = {
     // 发送验证码V2
@@ -172,10 +174,11 @@ const install = (Vue, vm) => {
     getOrderInfo,
     getEquomentInfo,
     updateOrderRefund,
+    updateParkingOrderRefund,
     getOrderRefundDetails,
     ordinaryWxPay,
     monthlyWxPay,
-    getSysterms,
+    getSystems,
     bindVehicleNo,
     codeV2Api,
     userLoginApi,

+ 31 - 22
common/http.interceptor.js

@@ -7,7 +7,7 @@ const install = (Vue, vm) => {
     originalData: true,
     dataType: 'text'
   });
-  let isRefreshing = false
+  let isRefreshing = false;
   // 请求拦截,配置Token等参数
   Vue.prototype.$u.http.interceptor.request = (config) => {
     if (vm.vuex_token) {
@@ -27,29 +27,38 @@ const install = (Vue, vm) => {
     return config;
   };
   // 响应拦截,判断状态码是否通过
-  Vue.prototype.$u.http.interceptor.response = res => {
-    // 解决出现数据精度缺失问题
-    const jsonBigint = require('json-bigint')({ storeAsString: true });
-    res = jsonBigint.parse(res.data);
-    if (res.code == 200) {
-      return res;
-    } else if (res.code == 401 || (res.code == 400 && res.msg == '令牌不能为空')) {
-      if (!isRefreshing) {
-        login(vm);
-        isRefreshing = true;
+  Vue.prototype.$u.http.interceptor.response = (res) => {
+    if (res.data) {
+      // 解决出现数据精度缺失问题
+      const jsonBigint = require('json-bigint')({ storeAsString: true });
+      res = jsonBigint.parse(res.data);
+      if (res.code == 200) {
+        return res;
+      } else if (res.code == 401 || (res.code == 400 && res.msg == '令牌不能为空')) {
+        if (!isRefreshing) {
+          login(vm);
+          isRefreshing = true;
+        }
+        return false;
+      } else {
+        // 用来判断时候需要使用当前提示框
+        const noTipMsg = ['无任何订单'];
+        const index = noTipMsg.findIndex((item) => res?.msg.indexOf(item) > -1);
+        if (index < 0) {
+          uni.showToast({
+            title: res.msg || '程序错误!',
+            duration: 2000,
+            icon: 'none'
+          });
+        }
+        return false;
       }
-      return false
     } else {
-      // 用来判断时候需要使用当前提示框
-      const noTipMsg = ['无任何订单'];
-      const index = noTipMsg.findIndex((item) => res?.msg.indexOf(item) > -1);
-      if (index < 0) {
-        uni.showToast({
-          title: res.msg || '程序错误!',
-          duration: 2000,
-          icon: 'none'
-        });
-      }
+      uni.showToast({
+        title: '程序错误!',
+        duration: 2000,
+        icon: 'error'
+      });
       return false;
     }
   };

+ 81 - 57
pages/applyRefund/applyRefund.vue

@@ -29,7 +29,7 @@
       </view>
     </view>
     <view class="apply-refund-form-submit">
-      <u-button type="primary" @click="submit">提交</u-button>
+      <u-button type="primary" :loading="loading" @click="submitForm">提交</u-button>
     </view>
     <view class="refund-tips" v-if="refundTipsContent">
       <u-parse :html="refundTipsContent"></u-parse>
@@ -49,7 +49,7 @@
 </template>
 
 <script>
-import { mapState, mapMutations } from 'vuex';
+import { mapState } from 'vuex';
 import { config } from '@/common/config.js';
 export default {
   data() {
@@ -63,19 +63,28 @@ export default {
       action: config.baseUrl + '/file/tencent/upload',
       successPop: false,
       // 退款温馨提示
-      refundTipsContent: ''
+      refundTipsContent: '',
+      orderType: 'road',
+      loading: false
     };
   },
-  computed: {
-    ...mapState(['vuex_token'])
-  },
-  onLoad(page) {
-    this.refundForm.orderId = page.orderId;
-    this.refundForm.refundAmount = Number(page.payAmount);
-    this.getSysterms(4);
+  // computed: {
+  //   ...mapState(['vuex_token'])
+  // },
+  onLoad(options) {
+    const { orderId, payAmount, tabCur } = options;
+    this.refundForm.orderId = orderId;
+    this.refundForm.refundAmount = Number(payAmount);
+    this.orderType = tabCur;
+    this.getSystems(4);
+    console.log(this.vuex_token);
   },
   methods: {
-    submit() {
+    /**
+     * @description: 提交
+     * @return {*}
+     */
+    submitForm() {
       let files = [];
       // 是否有未完成上传的图片标识
       let isHas = false;
@@ -91,30 +100,15 @@ export default {
       });
       this.refundForm.images = files;
       if (this.refundForm.refundReason && !isHas) {
-        this.$u.api
-          .updateOrderRefund(this.refundForm)
-          .then((res) => {
-            this.successPop = true;
-            if (res.code === 200) {
-              setTimeout(() => {
-                this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
-                  orderId: this.refundForm.orderId
-                });
-              }, 2000);
-            } else {
-              this.successPop = false;
-              this.$refs.uToast.show({
-                title: res.msg,
-                type: 'error'
-              });
-            }
-          })
-          .catch((err) => {
-            this.$refs.uToast.show({
-              title: '操作失败!',
-              type: 'error'
-            });
-          });
+        const submitObj = {
+          road: () => {
+            this.roadRefundSubmit();
+          },
+          park: () => {
+            this.parkRefundSubmit();
+          }
+        };
+        submitObj[this.orderType]();
       } else if (this.refundForm.refundReason == '') {
         this.$refs.uToast.show({
           title: '请填写申请退款原因',
@@ -128,29 +122,59 @@ export default {
       }
     },
     /**
-     * 获取收费标准
-     * */
-    getSysterms(termsType) {
-      this.$u.api
-        .getSysterms({
-          termsType: Number(termsType)
-        })
-        .then((res) => {
-          if (res.code === 200) {
-            this.refundTipsContent = res.data?.content;
-          } else {
-            this.$refs.uToast.show({
-              title: res.msg,
-              type: 'error'
+     * @description: 路段退款提交
+     * @return {*}
+     */
+    async roadRefundSubmit() {
+      try {
+        this.loading = true;
+        const { code } = await this.$u.api.updateOrderRefund({ ...this.refundForm });
+        if (code === 200) {
+          this.successPop = true;
+          setTimeout(() => {
+            this.successPop = false;
+            this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
+              orderId: this.refundForm.orderId
             });
-          }
-        })
-        .catch((err) => {
-          this.$refs.uToast.show({
-            title: '系统错误!',
-            type: 'error'
-          });
-        });
+          }, 2000);
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    /**
+     * @description: 停车退款提交
+     * @return {*}
+     */
+    async parkRefundSubmit() {
+      try {
+        this.loading = true;
+        const { code } = await this.$u.api.updateParkingOrderRefund({ ...this.refundForm });
+        if (code === 200) {
+          this.successPop = true;
+          setTimeout(() => {
+            this.successPop = false;
+            this.$u.route('pages/applyRefundDetails/applyRefundDetails', {
+              orderId: this.refundForm.orderId
+            });
+          }, 2000);
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    /**
+     * @description: 获取收费标准
+     * @param {*} termsType
+     * @return {*}
+     */
+    async getSystems(termsType) {
+      const { code, data } = await this.$u.api.getSystems({ termsType: Number(termsType) });
+      if (code === 200) {
+        this.refundTipsContent = data.content;
+      }
     }
   }
 };

+ 1 - 1
pages/center/coupon/couponRules/couponRules.vue

@@ -17,7 +17,7 @@ export default {
   methods: {
     getExplain() {
       this.$u.api
-        .getSysterms({
+        .getSystems({
           termsType: 5
         })
         .then((res) => {

+ 2 - 1
pages/center/order/order.vue

@@ -343,7 +343,8 @@ export default {
     applyRefund(item) {
       this.$u.route('pages/applyRefund/applyRefund', {
         orderId: item.orderId,
-        payAmount: item.actualAmount
+        payAmount: item.actualAmount,
+				tabCur: this.typeCurrent.value
       });
     },
     /**

+ 4 - 4
pages/chargeStandard/chargeStandard.vue

@@ -61,11 +61,11 @@ export default {
     const { roadNo, parkNo } = page;
     if (roadNo) {
       this.roadNo = roadNo;
-      this.getSysterms(3);
+      this.getSystems(3);
       this.getChargeRulesInfo(roadNo);
     } else if (parkNo) {
 			this.parkNo = parkNo;
-			this.getSysterms(3);
+			this.getSystems(3);
 			this.getParkingChargeRulesInfo(parkNo);
 		} else {
       uni.showToast({
@@ -213,9 +213,9 @@ export default {
     /**
      * 获取收费标准
      * */
-    getSysterms(termsType) {
+    getSystems(termsType) {
       this.$u.api
-        .getSysterms({
+        .getSystems({
           termsType: Number(termsType)
         })
         .then((res) => {

+ 4 - 4
pages/geomagnetismLock/geomagnetismLock.vue

@@ -51,9 +51,9 @@
             <view>{{ orderInfo.orderId }}</view>
           </view>
         </view>
-        <view class="parking-lock-pay-btn" v-if="is_pay">
-          <button type="default" @click="payMoney">立即支付</button>
-        </view>
+				<view class="parking-lock-pay-btn" v-if="is_pay">
+				  <button type="default" @click="payMoney">立即支付</button>
+				</view>
       </view>
     </template>
     <template v-else-if="parkingLockStatus === 2">
@@ -249,7 +249,7 @@ export default {
                 }
               });
             }
-            if (res.data.payAmount == 0) {
+            if (res.data.payAmount == 0 && this.projectFlag !== 'zhenning') {
               this.is_pay = false;
             }
           } else {

+ 3 - 3
pages/handleMonthly/handleMonthly.vue

@@ -113,7 +113,7 @@ export default {
     }
   },
   onLoad(page) {
-    this.getSysterms(0);
+    this.getSystems(0);
     if (page.vehicleNo && page.roadNo) {
       this.roadNo = page.roadNo;
       this.vehicleNo = page.vehicleNo;
@@ -344,9 +344,9 @@ export default {
      * @param {any} termsType
      * @returns {any}
      */
-    getSysterms(termsType) {
+    getSystems(termsType) {
       this.$u.api
-        .getSysterms({
+        .getSystems({
           termsType: termsType
         })
         .then((res) => {

+ 3 - 3
pages/handleMonthly/handleMonthly20230220.vue

@@ -139,7 +139,7 @@
 		},
 		onLoad(page) {
 			this.wxEnv = getEnvIsWx();
-			this.getSysterms(0);
+			this.getSystems(0);
 			if (page.vehicleNo && page.roadNo) {
 				this.roadNo = page.roadNo;
 				this.vehicleNo = page.vehicleNo;
@@ -459,9 +459,9 @@
 			 * @param {any} termsType
 			 * @returns {any}
 			 */
-			getSysterms(termsType) {
+			getSystems(termsType) {
 				this.$u.api
-					.getSysterms({
+					.getSystems({
 						termsType: termsType
 					})
 					.then((res) => {

+ 3 - 3
pages/handleMonthly/handleMonthly20230314.vue

@@ -178,7 +178,7 @@ export default {
   },
   onLoad(page) {
     this.wxEnv = getEnvIsWx();
-    this.getSysterms(0);
+    this.getSystems(0);
     if (page.vehicleNo && page.roadNo) {
       this.roadNo = page.roadNo;
       this.vehicleNo = page.vehicleNo;
@@ -501,9 +501,9 @@ export default {
      * @param {any} termsType
      * @returns {any}
      */
-    getSysterms(termsType) {
+    getSystems(termsType) {
       this.$u.api
-        .getSysterms({
+        .getSystems({
           termsType: termsType
         })
         .then((res) => {

+ 3 - 3
pages/privacyPolicy/privacyPolicy.vue

@@ -23,7 +23,7 @@ export default {
       uni.setNavigationBarTitle({
         title: termsTypeObj[Number(termsType)]
       });
-      this.getSysterms(Number(termsType));
+      this.getSystems(Number(termsType));
     }
   },
   methods: {
@@ -32,9 +32,9 @@ export default {
      * @param {*} termsType
      * @return {*}
      */
-    async getSysterms(termsType) {
+    async getSystems(termsType) {
       try {
-        const { code, data } = await this.$u.api.getSysterms({ termsType });
+        const { code, data } = await this.$u.api.getSystems({ termsType });
         if (code === 200) {
           this.content = data?.content;
         }