Переглянути джерело

fix: 修复移动端查看发票ios跳转404问题

cuiyalong 6 місяців тому
батько
коміт
87907b1e0c
1 змінених файлів з 91 додано та 92 видалено
  1. 91 92
      apps/mobile/src/views/invoice/viewInvoice.vue

+ 91 - 92
apps/mobile/src/views/invoice/viewInvoice.vue

@@ -1,23 +1,21 @@
 <template>
   <div class="Invoicing">
     <div class="header">
-      <p class="rightBtn" @click="tipShow = true" v-if="!$envs.inApp">
+      <p v-if="!$envs.inApp" class="rightBtn" @click="tipShow = true">
         开票规则
       </p>
-      <invoiceList
-        :list="invoiceList"
-        @change="invoiceChange"
+      <InvoiceList
         v-if="invoiceList.length > 1"
         ref="invoice_list"
-      >
-      </invoiceList>
-      <invoiceProgress
+        :list="invoiceList"
+        @change="invoiceChange"
+      />
+      <InvoiceProgress
         v-if="status !== -1 && status !== -2"
         :active="status | statusFilter"
         :steps="steps"
-      >
-      </invoiceProgress>
-      <invoiceErr :desc="errdesc" v-if="status === -1"></invoiceErr>
+      />
+      <InvoiceErr v-if="status === -1" :desc="errdesc" />
     </div>
     <div class="j-body">
       <div class="j-content">
@@ -29,7 +27,7 @@
           type="textarea"
           rows="1"
           autosize
-        ></van-field>
+        />
         <van-field
           :value="infoMap.type | typeFilter"
           label="发票类型:"
@@ -37,13 +35,9 @@
           type="textarea"
           rows="1"
           autosize
-        ></van-field>
+        />
 
-        <van-field
-          v-model.trim="infoMap.content"
-          label="发票内容:"
-          readonly
-        ></van-field>
+        <van-field v-model.trim="infoMap.content" label="发票内容:" readonly />
 
         <van-field
           :value="infoMap.invoiceHeader | invoiceHeaderFilter"
@@ -52,150 +46,151 @@
           type="textarea"
           rows="1"
           autosize
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.company"
           v-model.trim="infoMap.company"
           label="公司名称:"
           maxlength="50"
           :required="requireds.company"
-          v-if="showModule.company"
           type="textarea"
           rows="1"
           autosize
           readonly
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.dutyparagraph"
           v-model.trim="infoMap.dutyparagraph"
           label="单位税号:"
           :required="requireds.dutyparagraph"
-          v-if="showModule.dutyparagraph"
           type="textarea"
           rows="1"
           autosize
           readonly
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.unitAddress"
           v-model.trim="infoMap.unitAddress"
           label="单位地址:"
           :required="requireds.unitAddress"
-          v-if="showModule.unitAddress"
           type="textarea"
           rows="1"
           autosize
           readonly
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.tel"
           v-model.trim="infoMap.tel"
           label="电话号码:"
           :required="requireds.tel"
-          v-if="showModule.tel"
           readonly
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.bank"
           v-model.trim="infoMap.bank"
           label="开户银行:"
           :required="requireds.bank"
-          v-if="showModule.bank"
           type="textarea"
           rows="1"
           autosize
           readonly
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.bankCode"
           v-model.trim="infoMap.bankCode"
           label="银行账号:"
           :required="requireds.bankCode"
-          v-if="showModule.bankCode"
           type="textarea"
           rows="1"
           autosize
           readonly
-        ></van-field>
+        />
       </div>
       <div class="j-content">
         <van-field
+          v-if="showModule.desc"
           v-model.trim="infoMap.desc"
           label="开票备注:"
           :required="requireds.desc"
-          v-if="showModule.desc"
           type="textarea"
           rows="1"
           autosize
           readonly
-        ></van-field>
+        />
       </div>
       <div class="j-content">
         <van-field
+          v-if="showModule.name"
           v-model.trim="infoMap.name"
           label="收件人:"
           :required="requireds.name"
-          v-if="showModule.name"
           readonly
-        ></van-field>
+        />
 
         <van-field
           v-model.trim="infoMap.phone"
           label="联系电话:"
           :required="requireds.phone"
           readonly
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.deliveryAddress"
           v-model.trim="infoMap.deliveryAddress"
           label="收件地址:"
           :required="requireds.deliveryAddress"
           type="textarea"
           rows="1"
           autosize
-          v-if="showModule.deliveryAddress"
           readonly
-        ></van-field>
+        />
 
         <van-field
+          v-if="showModule.email"
           v-model.trim="infoMap.email"
           label="电子邮箱:"
           :required="requireds.email"
           type="textarea"
           rows="1"
           autosize
-          v-if="showModule.email"
           readonly
-        ></van-field>
+        />
       </div>
     </div>
     <div class="j-bottom">
-      <p class="b-desc" v-if="desc">{{ desc }}</p>
+      <p v-if="desc" class="b-desc">
+        {{ desc }}
+      </p>
       <div class="j-button-group">
         <button
-          v-if="!(!this.url && btntext === '查看发票')"
-          :class="{ 'j-button-confirm': true }"
-          @click="confirm_ok"
+          v-if="!(!url && btntext === '查看发票')"
+          class="j-button-confirm"
           :disabled="btntext === '开票中'"
+          @click="confirm_ok"
         >
           {{ btntext }}
         </button>
         <button
-          :class="{ 'j-button-confirm': true, grey: true }"
-          @click="Replace"
           v-if="Secondbtn === '换开申请'"
+          class="j-button-confirm grey"
           style="margin-left: 13px"
+          @click="Replace"
         >
           {{ Secondbtn }}
         </button>
       </div>
     </div>
-    <popupTip
+    <PopupTip
       v-model="tipShow"
       text="开票规则:<br>1.平台提供电子普通发票、电子专用发票,发票内容为可选“信息技术服务-技术服务费”、“信息技术服务-会员费”、“信息技术服务-招投标数据服务”;<br>2.您申请的电子发票将在3个工作日内由平台开具并发送至您的邮箱,请注意查收;<br>3.电子发票共有3种格式:PDF、OFD、XML,手机端查看发票默认为PDF格式,如需OFD、XML格式,您可前往邮箱或剑鱼标讯电脑端查看发票并下载;<br>4.如有问题可联系客服,客服电话:400-108-6670。"
-    >
-    </popupTip>
-    <popupTip v-model="logisticsShow">
+    />
+    <PopupTip v-model="logisticsShow">
       <div class="logistics">
         <div class="logistics_title">查看物流</div>
         <div class="logistics_content">
@@ -212,30 +207,59 @@
           </div>
         </div>
       </div>
-    </popupTip>
+    </PopupTip>
   </div>
 </template>
+
 <script>
+import { Button, Field, Icon } from 'vant'
 import EventBus from '@/utils/eventBus'
 import { ajaxInvoiceQuery, ajaxInvoiceShowList } from '@/api/modules'
 import { copyText, openAppOrWxPage, toWxGzhProfile } from '@/utils/'
 import { androidOrIOS } from '@/utils/prototype/modules/platform'
 import { LINKS } from '@/data'
-import { Field, Icon, Button } from 'vant'
 import popupTip from '@/components/invoice/popupTip'
 import invoiceList from '@/components/invoice/invoiceList'
 import invoiceErr from '@/components/invoice/invoiceErr'
 import invoiceProgress from '@/views/order/components/dataexport/DataExportProgress'
+
 export default {
-  name: 'viewInvoice',
+  name: 'ViewInvoice',
   components: {
     [Field.name]: Field,
     [Icon.name]: Icon,
     [Button.name]: Button,
-    popupTip,
-    invoiceProgress,
-    invoiceList,
-    invoiceErr
+    PopupTip: popupTip,
+    InvoiceProgress: invoiceProgress,
+    InvoiceList: invoiceList,
+    InvoiceErr: invoiceErr
+  },
+  filters: {
+    invoiceHeaderFilter(val) {
+      if (val === '1') {
+        return '个人'
+      } else if (val === '2') {
+        return '单位'
+      }
+    },
+    typeFilter(val) {
+      if (val === '1') {
+        return '电子普通发票'
+      } else if (val === '2') {
+        return '电子专用发票'
+      } else if (val === '3') {
+        return '纸质普通发票'
+      } else if (val === '4') {
+        return '纸质专用发票'
+      }
+    },
+    statusFilter(val) {
+      if (val === 0) {
+        return 2
+      } else if (val === 1) {
+        return 3
+      }
+    }
   },
   data() {
     return {
@@ -401,33 +425,6 @@ export default {
       }
     }
   },
-  filters: {
-    invoiceHeaderFilter(val) {
-      if (val === '1') {
-        return '个人'
-      } else if (val === '2') {
-        return '单位'
-      }
-    },
-    typeFilter(val) {
-      if (val === '1') {
-        return '电子普通发票'
-      } else if (val === '2') {
-        return '电子专用发票'
-      } else if (val === '3') {
-        return '纸质普通发票'
-      } else if (val === '4') {
-        return '纸质专用发票'
-      }
-    },
-    statusFilter(val) {
-      if (val === 0) {
-        return 2
-      } else if (val === 1) {
-        return 3
-      }
-    }
-  },
   created() {
     this.initData()
   },
@@ -446,12 +443,12 @@ export default {
   },
   methods: {
     initData() {
-      let { onlyIdentifying, invoiceMoney, operator, order_code } =
+      const { onlyIdentifying, invoiceMoney, operator, order_code } =
         this.$route.query
-      this.onlyIdentifying = onlyIdentifying ? onlyIdentifying : ''
-      this.invoiceMoney = invoiceMoney ? invoiceMoney : ''
-      this.operator = operator ? operator : ''
-      this.order_code = order_code ? order_code : ''
+      this.onlyIdentifying = onlyIdentifying || ''
+      this.invoiceMoney = invoiceMoney || ''
+      this.operator = operator || ''
+      this.order_code = order_code || ''
       if (this.enterSource === 'qrcode') {
         this.urlparms = {
           onlyIdentifying: this.onlyIdentifying,
@@ -580,6 +577,8 @@ export default {
         } else {
           const href = new URL(this.url)
           const path = href.pathname
+          const myHost = href.hostname?.includes('jianyu360')
+          const seeLink = myHost ? path : this.url
           // 非app内打开
           if (
             this.infoMap.type === '2' ||
@@ -587,12 +586,12 @@ export default {
               this.infoMap.price >= 10000 &&
               this.enterSource === 'qrcode')
           ) {
-            //扫码入口且金额大于10000
-            window.open(path)
+            // 扫码入口且金额大于10000
+            window.open(seeLink)
           } else {
             // 我的订单入口
             if (androidOrIOS() === 'ios') {
-              window.open(path)
+              window.open(seeLink)
             } else {
               const eleLink = document.createElement('a') // 新建A标签
               eleLink.href = this.url // 下载的路径
@@ -629,7 +628,7 @@ export default {
       }
     },
     Replace() {
-      //换开
+      // 换开
       if (!this.redInvoiceSwitch && this.enterSource === 'myorder') {
         this.$dialog
           .confirm({