|
|
@ -13,7 +13,8 @@ |
|
|
|
<view class="l">发票类型:</view> |
|
|
|
<view class="l">发票类型:</view> |
|
|
|
<view class="r"> |
|
|
|
<view class="r"> |
|
|
|
<picker :value="index" :range="array" @change="bindPickerChange"> |
|
|
|
<picker :value="index" :range="array" @change="bindPickerChange"> |
|
|
|
<view class="lx">{{ index == -1 ? '请选择' : array[index] }}</view> |
|
|
|
<view class="lx" style="color: #888;" v-if="index == null">请选择发票类型</view> |
|
|
|
|
|
|
|
<view class="lx" v-else>{{ array[index] }}</view> |
|
|
|
</picker> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -24,17 +25,10 @@ |
|
|
|
<view class="li" :class="tabIndex == 2 ? 'li-on' : ''" @click="tabItem(2)">单位</view> |
|
|
|
<view class="li" :class="tabIndex == 2 ? 'li-on' : ''" @click="tabItem(2)">单位</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="item" v-if="tabIndex != 2"> |
|
|
|
<view class="item"> |
|
|
|
<view class="l">发票抬头:</view> |
|
|
|
|
|
|
|
<view class="r"> |
|
|
|
|
|
|
|
<input type="text" v-model="obj.header" placeholder="请输入个人姓名" /> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="item" v-if="tabIndex == 2"> |
|
|
|
|
|
|
|
<view class="l">发票抬头:</view> |
|
|
|
<view class="l">发票抬头:</view> |
|
|
|
<view class="r"> |
|
|
|
<view class="r"> |
|
|
|
<input type="text" v-model="array1[index1]" placeholder="请输入单位名称" /> |
|
|
|
<input type="text" v-model="obj.header" :placeholder="tabIndex == 2 ? '请输入单位名称' : '请输入个人姓名'" /> |
|
|
|
<!-- <view class="tt" @click="bindPickerChange1" style="color: rgb(58, 134, 255)">更改抬头</view> --> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="item" v-if="tabIndex == 2"> |
|
|
|
<view class="item" v-if="tabIndex == 2"> |
|
|
@ -77,7 +71,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="invoice-btn"> |
|
|
|
<view class="invoice-btn"> |
|
|
|
<view class="invoice-fd" @click="toDetail()"> |
|
|
|
<view class="invoice-fd" @click="onSubmit()"> |
|
|
|
提交 |
|
|
|
提交 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -92,52 +86,66 @@ import * as InvoiceApi from '@/api/invoice' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
|
|
|
|
id: '', |
|
|
|
content: "确认您的发票信息无误后再提交", |
|
|
|
content: "确认您的发票信息无误后再提交", |
|
|
|
show: true, |
|
|
|
show: true, |
|
|
|
toggleIndex: true, |
|
|
|
toggleIndex: true, |
|
|
|
index: -1, |
|
|
|
index: null, |
|
|
|
array: ['普通增值税发票'], |
|
|
|
array: ['普通增值税发票'], |
|
|
|
index1: -1, |
|
|
|
tabIndex: null, |
|
|
|
array1: [], |
|
|
|
|
|
|
|
tabIndex: 2, |
|
|
|
|
|
|
|
sourcePage: 0, |
|
|
|
sourcePage: 0, |
|
|
|
orderDetail: '', |
|
|
|
orderDetail: '', |
|
|
|
orderId: '', |
|
|
|
orderId: '', |
|
|
|
obj: { |
|
|
|
obj: { |
|
|
|
header: '', |
|
|
|
header: '', |
|
|
|
gongsi: '', |
|
|
|
|
|
|
|
duty_no: '', |
|
|
|
duty_no: '', |
|
|
|
bank_name: '', |
|
|
|
bank_name: '', |
|
|
|
bank_no: '', |
|
|
|
bank_no: '', |
|
|
|
address: '', |
|
|
|
address: '', |
|
|
|
phone: '', |
|
|
|
phone: '', |
|
|
|
type: '', |
|
|
|
type: 1, |
|
|
|
source: 2 |
|
|
|
source: '' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad(op) { |
|
|
|
onLoad(op) { |
|
|
|
let app = this; |
|
|
|
if (op.detailObj && op.detailObj != 'null') { |
|
|
|
app.orderId = op.orderId |
|
|
|
let end = JSON.parse(op.detailObj) |
|
|
|
app.sourcePage = op.source == 1 ? op.source : 0 |
|
|
|
this.index = 0 |
|
|
|
if (op.source == 0) { |
|
|
|
if (end.source == 1) { |
|
|
|
app.orderDetail = op.order ? JSON.parse(op.order) : ''; |
|
|
|
this.tabIndex = 1 |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (op.source == 2 || op.source == 1) { |
|
|
|
this.tabIndex = 2 |
|
|
|
let detail = op.detail ? JSON.parse(op.detail) : ''; |
|
|
|
} |
|
|
|
app.index = detail.type == 1 ? 0 : 1; |
|
|
|
this.obj = end |
|
|
|
app.tabIndex = detail.source |
|
|
|
|
|
|
|
app.obj = detail |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// let app = this; |
|
|
|
|
|
|
|
// app.orderId = op.orderId |
|
|
|
|
|
|
|
// app.sourcePage = op.source == 1 ? op.source : 0 |
|
|
|
|
|
|
|
// if (op.source == 0) { |
|
|
|
|
|
|
|
// app.orderDetail = op.order ? JSON.parse(op.order) : ''; |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// if (op.source == 2 || op.source == 1) { |
|
|
|
|
|
|
|
// let detail = op.detail ? JSON.parse(op.detail) : ''; |
|
|
|
|
|
|
|
// app.index = detail.type == 1 ? 0 : 1; |
|
|
|
|
|
|
|
// app.tabIndex = detail.source |
|
|
|
|
|
|
|
// app.obj = detail |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
//添加发票 |
|
|
|
//添加发票 |
|
|
|
// 获取当前订单信息 |
|
|
|
onSubmit() { |
|
|
|
async toDetail(canReset = false) { |
|
|
|
if (this.obj.id) { |
|
|
|
const app = this |
|
|
|
this.editeInvoice() |
|
|
|
if (app.index == -1) { |
|
|
|
} else { |
|
|
|
|
|
|
|
this.addInvoice() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
async addInvoice(canReset = false) { |
|
|
|
|
|
|
|
const app = this |
|
|
|
|
|
|
|
if (app.index == null || !app.obj.source) { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: '请选择发票类型', |
|
|
|
title: '请选择发票类型', |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
@ -155,79 +163,67 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
if (app.tabIndex == 2 && !app.obj.duty_no) { |
|
|
|
if (app.tabIndex == 2 && !app.obj.duty_no) { |
|
|
|
uni.showToast({ |
|
|
|
uni.showToast({ |
|
|
|
title: '请输入抬头', |
|
|
|
title: '请输入纳税人识别号', |
|
|
|
icon: 'none', |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
}) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(app.obj) |
|
|
|
|
|
|
|
debugger |
|
|
|
|
|
|
|
let { |
|
|
|
let { |
|
|
|
status, |
|
|
|
status, |
|
|
|
data |
|
|
|
data |
|
|
|
} = await InvoiceApi.addInvoicing(app.obj); |
|
|
|
} = await InvoiceApi.addInvoicing(app.obj); |
|
|
|
if (status == 200) { |
|
|
|
if (status == 200) { |
|
|
|
debugger |
|
|
|
uni.showToast({ |
|
|
|
} |
|
|
|
title: '新增成功!', |
|
|
|
return |
|
|
|
icon: 'none', |
|
|
|
app.isLoading = true; |
|
|
|
duration: 2000 |
|
|
|
if (app.tabIndex == 1) { |
|
|
|
}) |
|
|
|
app.obj.gongsi = ''; |
|
|
|
app.index = null |
|
|
|
app.obj.duty_no = ''; |
|
|
|
app.tabIndex =null |
|
|
|
app.obj.bank_name = ''; |
|
|
|
app.obj = app.$options.data().obj |
|
|
|
app.obj.bank_no = ''; |
|
|
|
|
|
|
|
app.obj.address = ''; |
|
|
|
|
|
|
|
app.obj.phone = ''; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
app.obj.type = app.index == 0 ? 1 : 2; |
|
|
|
|
|
|
|
app.obj.source = app.tabIndex; |
|
|
|
|
|
|
|
let url = '' |
|
|
|
|
|
|
|
if (app.sourcePage == 0) { //开票addInvoicing editInvoicing invoicingAdd |
|
|
|
|
|
|
|
url = InvoiceApi.invoicingAdd(app.orderId, app.obj) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (app.sourcePage == 1) { //我的开票使用某一个开票 |
|
|
|
}, |
|
|
|
app.obj.invoice_id = app.obj.id; //选择 |
|
|
|
async editeInvoice() { |
|
|
|
url = InvoiceApi.invoicingAdd(app.orderId, app.obj) |
|
|
|
const app = this |
|
|
|
|
|
|
|
if (app.index == null || !app.obj.source) { |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: '请选择发票类型', |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (app.sourcePage == 2) { //申请记录 修改抬头 |
|
|
|
if (!app.obj.header) { |
|
|
|
url = InvoiceApi.invoicingEdit(app.orderId, app.obj) |
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: '请输入抬头', |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (app.sourcePage == 3) { //新增发票抬头 |
|
|
|
if (app.tabIndex == 2 && !app.obj.duty_no) { |
|
|
|
url = InvoiceApi.addInvoicing(app.orderId, app.obj) |
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: '请输入抬头', |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (app.sourcePage == 4) { //我的发票记录过来编辑 |
|
|
|
let { |
|
|
|
url = InvoiceApi.editInvoicing(app.orderId, app.obj) |
|
|
|
status, |
|
|
|
|
|
|
|
data |
|
|
|
|
|
|
|
} = await InvoiceApi.editInvoicing(app.obj); |
|
|
|
|
|
|
|
if (status == 200) { |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: '编辑成功!', |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
app.index = null |
|
|
|
|
|
|
|
app.tabIndex =null |
|
|
|
|
|
|
|
app.obj = app.$options.data().obj |
|
|
|
} |
|
|
|
} |
|
|
|
url.then(result => { |
|
|
|
|
|
|
|
if (result.status == 200) { |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: result.message, |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if (result.data.list.length.length > 0) { |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
|
|
url: "/pages/invoice/detail?id=" + result.data.list[0].id |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: '请求成功无返回详情', |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title: result.message, |
|
|
|
|
|
|
|
icon: 'none', |
|
|
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
// 相应全局事件订阅: 刷新上级页面数据 |
|
|
|
|
|
|
|
canReset && uni.$emit('syncRefresh', true, true) |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 复制指定内容 |
|
|
|
// 复制指定内容 |
|
|
@ -247,11 +243,11 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
onClose() { }, |
|
|
|
onClose() { }, |
|
|
|
tabItem(i) { |
|
|
|
tabItem(i) { |
|
|
|
this.tabIndex = i; |
|
|
|
this.tabIndex = i; |
|
|
|
|
|
|
|
this.obj.source = i |
|
|
|
}, |
|
|
|
}, |
|
|
|
toggleItem(i) { |
|
|
|
toggleItem(i) { |
|
|
|
this.toggleIndex = !this.toggleIndex; |
|
|
|
this.toggleIndex = !this.toggleIndex; |
|
|
|
this.pamres.invoiceUnit = this.toggleIndex |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
bindPickerChange(e) { |
|
|
|
bindPickerChange(e) { |
|
|
|
this.index = e.detail.value; |
|
|
|
this.index = e.detail.value; |
|
|
@ -590,4 +586,5 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}</style> |
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|