MrShi
2026-05-19 ce06ca62a0dd65d4a8fb57126948449c804ad77e
small-program/shop/pages/confirm-invoice-issuance/confirm-invoice-issuance.vue
@@ -51,7 +51,8 @@
               title: '李春梅',
               content: '明细',
               amount: '¥100.00'
            }
            },
            data: {}
         };
      },
      computed: {
@@ -78,18 +79,68 @@
            return fields;
         }
      },
      onLoad() {
         const invoiceData = uni.getStorageSync('invoiceFormData')
         if (invoiceData) {
            this.data = invoiceData
            this.titleType = invoiceData.titleType || 'company'
            if (this.titleType === 'company') {
               this.invoiceInfo = {
                  invoiceType: invoiceData.invoiceType || '',
                  titleTypeText: invoiceData.titleTypeText || '',
                  title: invoiceData.title || '',
                  content: invoiceData.content || '',
                  amount: invoiceData.amount || '',
                  taxNo: invoiceData.taxNo || '',
                  bankName: invoiceData.bankName || '',
                  bankAccount: invoiceData.bankAccount || '',
                  companyAddress: invoiceData.companyAddress || '',
                  companyPhone: invoiceData.companyPhone || ''
               }
            } else {
               this.personalInfo = {
                  invoiceType: invoiceData.invoiceType || '',
                  titleTypeText: invoiceData.titleTypeText || '',
                  title: invoiceData.title || '',
                  content: invoiceData.content || '',
                  amount: invoiceData.amount || ''
               }
            }
            uni.removeStorageSync('invoiceFormData')
         }
      },
      methods: {
         goBackEdit() {
            uni.navigateBack();
            uni.navigateBack({ delta: 1 });
         },
         closeSubmitPopup() {
            this.showSubmitPopup = false;
         },
         confirmSubmit() {
         async confirmSubmit() {
            this.showSubmitPopup = false;
            uni.navigateTo({
               url: '/shop/pages/Invoice-issued-successfully/Invoice-issued-successfully'
            });
            const params = {
               orderId: this.data.orderId,
               orderNo: this.data.orderNo,
               name: this.data.title,
               invoiceType: this.data.invoiceType === '电子普通发票' ? 0 : 1,
               orgType: this.data.titleType === 'company' ? 1 : 0
            }
            if (this.data.titleType === 'company') {
               params.taxId = this.data.taxNo
            }
            if (this.data.invoiceType === '电子专用发票') {
               params.bankName = this.data.bankName
               params.bankAccount = this.data.bankAccount
               params.companyAddr = this.data.companyAddress
               params.companyPhone = this.data.companyPhone
            }
            const res = await this.$u.api.invoiceApply(params)
            if (res.code === 200) {
               uni.setStorageSync('invoiceSuccessData', this.data)
               uni.reLaunch({
                  url: '/shop/pages/Invoice-issued-successfully/Invoice-issued-successfully'
               });
            }
         }
      }
   };