|
@@ -3,7 +3,7 @@
|
|
|
<view class="all-container">
|
|
|
<view class="title">发票明细</view>
|
|
|
<view class="list" v-if="orderType == 'ORDER'">
|
|
|
- <view class="item" v-for="(item, index) in orderDetail.orderDetails" :key='index'>
|
|
|
+ <view class="item" v-for="(item, index) in orderDetail.orderDetails" :key="index">
|
|
|
<view class="name">{{ item.goodsName }}</view>
|
|
|
<view class="right">
|
|
|
<view class="price">¥{{ item.price | priceFilter }}</view>
|
|
@@ -64,7 +64,7 @@
|
|
|
<script>
|
|
|
import wx from 'weixin-js-sdk'
|
|
|
import { isEmail } from '@/common/utils/verify.js'
|
|
|
-import { wxConfig, mini_env } from "@/common/utils/util"
|
|
|
+import { wxConfig, mini_env } from '@/common/utils/util'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -77,41 +77,41 @@ export default {
|
|
|
name: '',
|
|
|
payerNum: '',
|
|
|
email: '',
|
|
|
- pamcs:''
|
|
|
+ pamcs: ''
|
|
|
}
|
|
|
},
|
|
|
|
|
|
onLoad(data) {
|
|
|
- mini_env((bool) => {
|
|
|
+ mini_env(bool => {
|
|
|
if (bool) {
|
|
|
var { orderType, orderId } = data
|
|
|
- this.orderType = orderType;
|
|
|
- this.orderId = orderId;
|
|
|
- this.getOrderDetail();
|
|
|
- if(data.invoice_type){
|
|
|
- this.headerType = data.invoice_type == 1 ? 1 : 2;
|
|
|
- if(data.invoice_type==0 && data.invoice_taxNumber){
|
|
|
- this.payerNum = data.invoice_taxNumber || '';
|
|
|
+ this.orderType = orderType
|
|
|
+ this.orderId = orderId
|
|
|
+ this.getOrderDetail()
|
|
|
+ if (data.invoice_type) {
|
|
|
+ this.headerType = data.invoice_type == 1 ? 1 : 2
|
|
|
+ if (data.invoice_type == 0 && data.invoice_taxNumber) {
|
|
|
+ this.payerNum = data.invoice_taxNumber || ''
|
|
|
}
|
|
|
}
|
|
|
- if(data.invoice_title){
|
|
|
- this.name = data.invoice_title;
|
|
|
+ if (data.invoice_title) {
|
|
|
+ this.name = data.invoice_title
|
|
|
}
|
|
|
- if(data.invoice_taxType){
|
|
|
+ if (data.invoice_taxType) {
|
|
|
this.taxType = Number(data.invoice_taxType) || 1
|
|
|
}
|
|
|
- if(data.invoice_taxContent){
|
|
|
+ if (data.invoice_taxContent) {
|
|
|
this.taxContent = Number(data.invoice_taxContent) || 1
|
|
|
}
|
|
|
- if(data.invoice_email){
|
|
|
+ if (data.invoice_email) {
|
|
|
this.email = data.invoice_email
|
|
|
}
|
|
|
} else {
|
|
|
var { orderType, orderId } = data
|
|
|
- this.orderType = orderType;
|
|
|
- this.orderId = orderId;
|
|
|
- this.getOrderDetail();
|
|
|
- wxConfig();
|
|
|
+ this.orderType = orderType
|
|
|
+ this.orderId = orderId
|
|
|
+ this.getOrderDetail()
|
|
|
+ wxConfig()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -119,65 +119,79 @@ export default {
|
|
|
methods: {
|
|
|
getOrderDetail() {
|
|
|
if (this.orderType == 'ORDER') {
|
|
|
- this.$api.get('/order/detail', {
|
|
|
- orderId: this.orderId
|
|
|
- }).then(res => {
|
|
|
- this.orderDetail = res.data || {};
|
|
|
- })
|
|
|
+ this.$api
|
|
|
+ .get('/order/detail', {
|
|
|
+ orderId: this.orderId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.orderDetail = res.data || {}
|
|
|
+ })
|
|
|
} else {
|
|
|
- this.$api.post('/increConfig/detailIncre', {
|
|
|
- id: this.orderId
|
|
|
- }).then(res => {
|
|
|
- this.orderDetail = res.data || {};
|
|
|
- })
|
|
|
+ this.$api
|
|
|
+ .post('/increConfig/detailIncre', {
|
|
|
+ id: this.orderId
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.orderDetail = res.data || {}
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
|
|
|
submitData() {
|
|
|
- if (!this.name) return this.$toast('请输入抬头名称');
|
|
|
- if (this.headerType == 2 && !this.payerNum) return this.$toast('请输入单位税号');
|
|
|
- if (!this.email) return this.$toast('请输入收票邮箱');
|
|
|
- if (this.email && !isEmail(this.email)) return this.$toast('收票邮箱格式不正确');
|
|
|
+ if (!this.name) return this.$toast('请输入抬头名称')
|
|
|
+ if (this.headerType == 2 && !this.payerNum) return this.$toast('请输入单位税号')
|
|
|
+ if (!this.email) return this.$toast('请输入收票邮箱')
|
|
|
+ if (this.email && !isEmail(this.email)) return this.$toast('收票邮箱格式不正确')
|
|
|
|
|
|
- this.$api.postJson('/user/order/tax/save', {
|
|
|
- userId: this.$store.state.user.userId,
|
|
|
- orderType: this.orderType,
|
|
|
- orderId: this.orderId,
|
|
|
- taxType: this.taxType == 1 ? false : true,
|
|
|
- content: this.taxContent == 1 ? '商品明细' : '商品类别',
|
|
|
- type: this.headerType == 1 ? false : true,
|
|
|
- name: this.name,
|
|
|
- taxNo: this.payerNum,
|
|
|
- receiverEmail: this.email,
|
|
|
- }).then(res => {
|
|
|
- this.$navToPage({
|
|
|
- url: '/packageMine/pages/invoice/result?orderTaxId=' + res.data.orderTaxId
|
|
|
- }, 'redirectTo');
|
|
|
- })
|
|
|
+ this.$api
|
|
|
+ .postJson('/user/order/tax/save', {
|
|
|
+ userId: this.$store.state.user.userId,
|
|
|
+ orderType: this.orderType,
|
|
|
+ orderId: this.orderId,
|
|
|
+ taxType: this.taxType == 1 ? false : true,
|
|
|
+ content: this.taxContent == 1 ? '商品明细' : '商品类别',
|
|
|
+ type: this.headerType == 1 ? false : true,
|
|
|
+ name: this.name,
|
|
|
+ taxNo: this.payerNum,
|
|
|
+ receiverEmail: this.email
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.$navToPage(
|
|
|
+ {
|
|
|
+ url: '/packageMine/pages/invoice/result?orderTaxId=' + res.data.orderTaxId
|
|
|
+ },
|
|
|
+ 'redirectTo'
|
|
|
+ )
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
getInvoice() {
|
|
|
- mini_env((bool) => {
|
|
|
+ mini_env(bool => {
|
|
|
if (bool) {
|
|
|
uniWebview.navigateTo({
|
|
|
- url: `/pages/getInvoiceTitle/getInvoiceTitle?url=${
|
|
|
- encodeURIComponent(window.location.href + `&invoice_taxType=${this.taxType}&invoice_taxContent=${this.taxContent}&invoice_email=${this.email}`)
|
|
|
- }`
|
|
|
+ url: `/pages/getInvoiceTitle/getInvoiceTitle?url=${encodeURIComponent(
|
|
|
+ window.location.href +
|
|
|
+ `&invoice_taxType=${this.taxType}&invoice_taxContent=${this.taxContent}&invoice_email=${this.email}`
|
|
|
+ )}`
|
|
|
})
|
|
|
- uni.navigateBack();
|
|
|
+ uni.navigateBack()
|
|
|
} else {
|
|
|
- wx.invoke('chooseInvoiceTitle', {
|
|
|
- scene: 1
|
|
|
- }, (res) => {
|
|
|
- if (res.choose_invoice_title_info || res.chooseInvoiceTitleInfo) {
|
|
|
- const data = JSON.parse(res.choose_invoice_title_info || res.chooseInvoiceTitleInfo);
|
|
|
- this.headerType = data.type == 1 ? 1 : 2;
|
|
|
- this.name = data.title;
|
|
|
- if (data.type == 0) {
|
|
|
- this.payerNum = data.taxNumber || '';
|
|
|
+ wx.invoke(
|
|
|
+ 'chooseInvoiceTitle',
|
|
|
+ {
|
|
|
+ scene: 1
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if (res.choose_invoice_title_info || res.chooseInvoiceTitleInfo) {
|
|
|
+ const data = JSON.parse(res.choose_invoice_title_info || res.chooseInvoiceTitleInfo)
|
|
|
+ this.headerType = data.type == 1 ? 1 : 2
|
|
|
+ this.name = data.title
|
|
|
+ if (data.type == 0) {
|
|
|
+ this.payerNum = data.taxNumber || ''
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ )
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -274,4 +288,5 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}</style>
|
|
|
+}
|
|
|
+</style>
|