ソースを参照

Merge pull request #552 from John-Hong/release-3.9.0

fix(SCRM-6439): 处理多个pdf的url的场景
Tron 1 年間 前
コミット
ebf353174e

+ 10 - 1
src/pages/parkingFeeV2/mixins/parkingReceipt/parkingInvoice.js

@@ -94,6 +94,10 @@ export default {
         const res = await invoicesDeatil(id)
         console.log('支付订单详情', res)
         self.order = res;
+        // self.order.invoiceUrls = [
+        //   "https://kip-public-qa.oss-cn-shanghai.aliyuncs.com/d159353ac6974b3d9cc6e5b2f4f6d29e_982792411690_46740156.pdf",
+        //   "https://kip-public-qa.oss-cn-shanghai.aliyuncs.com/37ba3bf249da457d8e10a582d29eb7c0_960842461483_17739293.pdf"
+        // ]
       } catch {
         uni.showToast({
           title: '服务器开小差了呢,请您稍后再试',
@@ -140,8 +144,13 @@ export default {
       });
     },
     showInvoiceDetail() {
+        window.localStorage.setItem('parkingInvoice', JSON.stringify(this.order))
         this.$router.push({
-          path: 'parkingInvoiceImage?order=' + JSON.stringify(this.order),
+          path: 'parkingInvoiceImage',
+          query:{
+            ...this.$route.query,
+            orderId: this.order.id
+          }
         });
     },
   },

+ 12 - 2
src/pages/parkingFeeV2/mixins/parkingReceipt/parkingInvoiceImage.js

@@ -19,7 +19,13 @@ export default {
     };
   },
   created() {
-    this.order = JSON.parse(this.$route.query.order);
+    const parkingInvoice = window.localStorage.getItem('parkingInvoice')
+    const order = JSON.parse(parkingInvoice);
+    if(order.id == this.$route.query.orderId) {
+      this.order = order
+    } else {
+      this.order = {}
+    }
     console.log('order::::', this.order)
   },
   mounted() {
@@ -81,7 +87,11 @@ export default {
     downloadPdf() {
       if(this.order.invoiceUrls.length > 1) {
         this.$router.push({
-          path: 'parkingInvoiceImages?order=' + JSON.stringify(this.order),
+          path: 'parkingInvoiceImages',
+          query:{
+            ...this.$route.query,
+            orderId: this.order.id
+          }
         });
         return
       }

+ 11 - 4
src/pages/parkingFeeV2/parkingReceipt/parkingInvoiceImages.vue

@@ -1,7 +1,7 @@
 <!-- 更多发票预览 -->
 <template>
     <div :class="['invoice-url-list', theme]">
-        <div class="invoice-url" v-for="item in invoiceUrl">
+        <div class="invoice-url" v-for="item in invoiceUrls">
             <div class="url-box">
                 <div class="title">发票号码:</div>
                 <div class="url">{{ getTitle(item) }}</div>
@@ -19,12 +19,19 @@ export default {
     data() {
         return {
             order: {},
-            invoiceUrl: []
+            invoiceUrls: []
         }
     },
     created() {
-        this.order = JSON.parse(this.$route.query.order);
-        this.invoiceUrl = this.order.invoiceUrl
+        const parkingInvoice = window.localStorage.getItem('parkingInvoice');
+        const order = JSON.parse(parkingInvoice);
+        if(order.id == this.$route.query.orderId) {
+            this.order = order;
+            this.invoiceUrls = this.order.invoiceUrls;
+        } else {
+            this.order = {};
+            this.invoiceUrls = [];
+        }
     },
     methods:{
         getTitle(fileUrl = '') {