diff --git a/pages/invoiceDetail/index.js b/pages/invoiceDetail/index.js
index 41ea00e..dab2843 100644
--- a/pages/invoiceDetail/index.js
+++ b/pages/invoiceDetail/index.js
@@ -7,7 +7,8 @@ Page({
* 页面的初始数据
*/
data: {
- detail: {}
+ detail: {},
+ id: "",
},
/**
@@ -19,14 +20,27 @@ Page({
},
async init(id) {
const { code, message, data } = await getInvoiceInfoDetail(id)
- this.setData({ detail: data });
+ this.setData({ detail: data, id });
},
handleBack() {
wx.navigateBack()
},
jumpToDetail() {
wx.redirectTo({
- url: '/pages/invoiceDetailContent/index',
+ url: '/pages/invoiceDetailContent/index?id=' + this.data.id,
+ })
+ },
+ download() {
+ // console.log('---------')
+ wx.showActionSheet({
+ itemList: ['发票XML文件下载', '发票PDF文件下载'],
+ async success(res) {
+ console.log('res', res.tapIndex)
+ const { code, message, data } = await downloadInvoice(this.data.id, res.tapIndex);
+ if (code !== OK) {
+
+ }
+ }
})
},
/**
diff --git a/pages/invoiceDetail/index.wxml b/pages/invoiceDetail/index.wxml
index 92776ef..5fe4fec 100644
--- a/pages/invoiceDetail/index.wxml
+++ b/pages/invoiceDetail/index.wxml
@@ -52,12 +52,12 @@
尊敬的客户,您好:
- 已经为您开具订单2222222222的发票,发票数量共计1张,如下:
- 发票类型:数电发票(电子发票),发票号码:54645654656556,您可以点击“发票XML文件下载”获取该发票XML文件,或者点击“发票PDF文件下载”获取该发票PDF文件;
+ 已经为您开具订单{{detail.id}}的发票,发票数量共计1张,如下:
+ 发票类型:数电发票(电子发票),发票号码:{{detail.number}},您可以点击“发票XML文件下载”获取该发票XML文件,或者点击“发票PDF文件下载”获取该发票PDF文件;
同时您也可以到预留的邮箱中查看下载发票。
- 下载
+ 下载
发票明细
\ No newline at end of file
diff --git a/pages/invoiceDetailContent/index.js b/pages/invoiceDetailContent/index.js
index 198434a..cee3e9f 100644
--- a/pages/invoiceDetailContent/index.js
+++ b/pages/invoiceDetailContent/index.js
@@ -19,6 +19,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
+ console.log('options', options)
const { id } = options;
this.getDetail(id)
},
diff --git a/pages/invoiceList/components/already/index.js b/pages/invoiceList/components/already/index.js
index f0c6561..afb62bd 100644
--- a/pages/invoiceList/components/already/index.js
+++ b/pages/invoiceList/components/already/index.js
@@ -49,9 +49,10 @@ Component({
scrollToLower() {
loadingFunc(() => this.getList())
},
- jumpToDetail() {
+ jumpToDetail(e) {
+ const { id } = e.currentTarget.dataset;
wx.navigateTo({
- url: '/pages/invoiceDetail/index',
+ url: '/pages/invoiceDetail/index?id=' + id,
})
},
jumpToDetailContent(e) {
diff --git a/pages/invoiceList/components/already/index.wxml b/pages/invoiceList/components/already/index.wxml
index cc6e417..1a9a45d 100644
--- a/pages/invoiceList/components/already/index.wxml
+++ b/pages/invoiceList/components/already/index.wxml
@@ -21,7 +21,7 @@
¥{{item.money}}
- 发票
+ 发票
明细
diff --git a/pages/invoiceList/components/info/index.js b/pages/invoiceList/components/info/index.js
index 6215f60..6883c12 100644
--- a/pages/invoiceList/components/info/index.js
+++ b/pages/invoiceList/components/info/index.js
@@ -45,7 +45,7 @@ Component({
this.setData({ user: data });
},
changeEditType() {
- this.setData({ editType: 'edit', formData: this.data.detail })
+ this.setData({ editType: 'edit', formData: {...this.data.detail, tenement: wx.getStorageSync('tenement')?.id} })
},
cancelEdit() {
this.setData({ editType: 'detail', formData: {} })
diff --git a/pages/invoicing/index.js b/pages/invoicing/index.js
index 99b1012..0763892 100644
--- a/pages/invoicing/index.js
+++ b/pages/invoicing/index.js
@@ -33,6 +33,42 @@ Page({
alertInfo(message)
return;
}
+ if (!data?.tenement?.id || !data?.name) {
+ const user = wx.getStorageSync('user')
+ if (user.isAdmin) {
+ wx.showModal({
+ title: '提示',
+ content: '当前公司没用开票信息,请先前往开票信息页面编辑开票信息',
+ complete: (res) => {
+ if (res.cancel) {
+ wx.navigateBack()
+ }
+
+ if (res.confirm) {
+ wx.redirectTo({
+ url: '/pages/invoiceList/index?tab=2',
+ })
+ }
+ }
+ })
+ return
+ } else {
+ wx.showModal({
+ title: '提示',
+ content: '当前公司没用开票信息,请联系管理员编辑完开票信息之后再开票',
+ complete: (res) => {
+ if (res.cancel) {
+ wx.navigateBack()
+ }
+
+ if (res.confirm) {
+ wx.navigateBack()
+ }
+ }
+ })
+ return
+ }
+ }
this.setData({ detail: {...data, }, remark: data.remark })
},
changeRemark(e) {
diff --git a/service/invoice.js b/service/invoice.js
index 497ef93..2ef5159 100644
--- a/service/invoice.js
+++ b/service/invoice.js
@@ -40,4 +40,9 @@ export const getAlreadyInvoiceList = async function(page) {
// 开票
export const makeInvoice = async function(data) {
return await POST(`/wx/invoice`, data);
+}
+
+// 下载发票文件
+export const downloadInvoice = async function(id, type) {
+ return await POST(`/wx/downloadInvoice/${id}?type=${type}`,);
}
\ No newline at end of file