From b7e831662edbab24e871a271ecf3ffc2df4642a4 Mon Sep 17 00:00:00 2001 From: qiaomu <3520484422@qq.com> Date: Thu, 25 Apr 2024 16:53:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=8F=91=E7=A5=A8=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 2 + components/empty/index.js | 24 ++++ components/empty/index.json | 7 ++ components/empty/index.wxml | 4 + components/empty/index.wxss | 1 + components/table/table.js | 104 ++++++++++++++++++ components/table/table.json | 4 + components/table/table.less | 69 ++++++++++++ components/table/table.wxml | 22 ++++ components/table/table.wxss | 55 +++++++++ pages/invoiceDetail/index.js | 5 + pages/invoiceDetail/index.wxml | 12 +- pages/invoiceDetail/index.wxss | 12 ++ pages/invoiceDetailContent/index.js | 84 ++++++++++++++ pages/invoiceDetailContent/index.json | 9 ++ pages/invoiceDetailContent/index.wxml | 80 ++++++++++++++ pages/invoiceDetailContent/index.wxss | 10 ++ pages/invoiceList/components/already/index.js | 42 ++++++- .../invoiceList/components/already/index.wxml | 49 +++++---- pages/invoiceList/components/info/index.js | 6 + pages/invoiceList/components/info/index.wxml | 2 +- pages/qrCode/index.js | 2 +- service/invoice.js | 7 +- 23 files changed, 581 insertions(+), 31 deletions(-) create mode 100644 components/empty/index.js create mode 100644 components/empty/index.json create mode 100644 components/empty/index.wxml create mode 100644 components/empty/index.wxss create mode 100644 components/table/table.js create mode 100644 components/table/table.json create mode 100644 components/table/table.less create mode 100644 components/table/table.wxml create mode 100644 components/table/table.wxss create mode 100644 pages/invoiceDetailContent/index.js create mode 100644 pages/invoiceDetailContent/index.json create mode 100644 pages/invoiceDetailContent/index.wxml create mode 100644 pages/invoiceDetailContent/index.wxss diff --git a/app.json b/app.json index 0e1ea89..e4e0ea5 100644 --- a/app.json +++ b/app.json @@ -3,6 +3,7 @@ "pages/home/index", "pages/invoiceList/index", "pages/invoiceDetail/index", + "pages/invoiceDetailContent/index", "pages/invoicing/index", "pages/rechargeRecord/index", "pages/member/index", @@ -18,6 +19,7 @@ "pages/editInvoice/index", "pages/rechargeDetail/index", "pages/agreements/index" + ], "tabBar": { "list": [ diff --git a/components/empty/index.js b/components/empty/index.js new file mode 100644 index 0000000..7f80210 --- /dev/null +++ b/components/empty/index.js @@ -0,0 +1,24 @@ +// components/empty/index.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) \ No newline at end of file diff --git a/components/empty/index.json b/components/empty/index.json new file mode 100644 index 0000000..0e6a126 --- /dev/null +++ b/components/empty/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-empty": "@vant/weapp/empty/index", + "van-button": "@vant/weapp/button/index" + } +} \ No newline at end of file diff --git a/components/empty/index.wxml b/components/empty/index.wxml new file mode 100644 index 0000000..147019f --- /dev/null +++ b/components/empty/index.wxml @@ -0,0 +1,4 @@ + + + 按钮 + \ No newline at end of file diff --git a/components/empty/index.wxss b/components/empty/index.wxss new file mode 100644 index 0000000..615e47f --- /dev/null +++ b/components/empty/index.wxss @@ -0,0 +1 @@ +/* components/empty/index.wxss */ \ No newline at end of file diff --git a/components/table/table.js b/components/table/table.js new file mode 100644 index 0000000..e4dd2c2 --- /dev/null +++ b/components/table/table.js @@ -0,0 +1,104 @@ +// components/table/table/table.js + +Component({ + /** + * 组件的属性列表 + */ + externalClasses: ['table-class', 'tr-class', 'td-class', 'th-class', 'tr-class_even', 'tr-class_odd'], + properties: { + colWidth: Number, + isScroll: { + type: Boolean, + value: false + }, + header: { + type: Array, + value: [] + }, + list: { + type: Array, + value: [] + }, + showActive: { + type: Boolean, + value: true + }, + activeColor: { + type: String, + value: '#d6e8ff' + }, + maxLine: { + type: Number, + value: 2 + } + }, + + observers: { + 'header,list': function (header, list) { + this.init(); + } + }, + /** + * 组件的初始数据 + */ + data: { + }, + + /** + * 组件的方法列表 + */ + methods: { + setWidth (head) { + const colWidth = this.data.colWidth || head.length < 3 ? (730 / head.length) : 300; + const tableWidth = head.length >= 1 && this.data.isScroll ? head.length * colWidth : null; + this.setData({ tableWidth }); + }, + init () { + !this.data.tableWidth && this.setWidth(this.data.header); + const { list, header } = this.data; + let showHeader = JSON.parse(JSON.stringify(header)); + let showList = JSON.parse(JSON.stringify(list)); + showHeader.forEach((head, headIndex) => { + showList.forEach((item, index) => { + const body = header[headIndex].renderBody && header[headIndex].renderBody(item, index); + const color = header[headIndex].renderColor && header[headIndex].renderColor(item, index); + const bg = header[headIndex].renderBg && header[headIndex].renderBg(item, index); + if (body !== undefined) { + head.key = `col${headIndex}`; + item[`col${headIndex}`] = {}; + item[`col${headIndex}`].text = body; + } else if (head.key) { + const text = item[head.key]; + item[head.key] = { text }; + } + if (color && head.key) { + item[head.key].color = color; + } + if (bg && head.key) { + item[head.key].bg = bg; + } + }); + }); + this.setData({ showHeader, showList }); + }, + checkRow (index) { + if (!this.data.showActive) { + return; + } + index = /\d+/.test(index) ? index : 0; + this.setData({ currentIndex: index }); + }, + onLongPress (e) { + const { index } = e.currentTarget.dataset; + this.checkRow(index); + const data = this.data.list[index]; + this.triggerEvent('onLongPress', { index, data }); + }, + onTap (e) { + const { index } = e.currentTarget.dataset; + this.checkRow(index); + const data = this.data.list[index]; + this.triggerEvent('onClick', { index, data }); + } + } +}); diff --git a/components/table/table.json b/components/table/table.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/table/table.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/table/table.less b/components/table/table.less new file mode 100644 index 0000000..a4ac6e6 --- /dev/null +++ b/components/table/table.less @@ -0,0 +1,69 @@ +@display: table, + table-row, + table-cell; + +each(@display, { + .d-@{value} { + display: @value !important; + } + } + +) .d-table-cell { + padding: 10px 5px; + font-size: 14px; + word-break: break-all; + min-height: 42px; + max-width: 150px; + position: relative; +} + +.d-table { + background-color: #fff; + + .d-table-row.active { + background-color: #d6e8ff; + } + + .d-table-row:not(:first-child) { + .d-table-cell { + &::before { + content: ''; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 1px; + background-color: #ddd; + transform: scaleY(0.3); + } + } + } +} + +.table { + position: relative; + background-color: #fff; + overflow: hidden; + font-size: 13px; + width: 100%; + + +} + +.table1-view { + width: 100%; +} + +.table1 { + width: var(--width, 100%); + min-width: auto; +} + +.text { + font-size: 14px; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: var(--max_line, 2) +} \ No newline at end of file diff --git a/components/table/table.wxml b/components/table/table.wxml new file mode 100644 index 0000000..54a5a3b --- /dev/null +++ b/components/table/table.wxml @@ -0,0 +1,22 @@ + + module.exports = function (tableWidth) { + if (!tableWidth) { + return; + } + return tableWidth + 'rpx' + } + + \ No newline at end of file diff --git a/components/table/table.wxss b/components/table/table.wxss new file mode 100644 index 0000000..5862796 --- /dev/null +++ b/components/table/table.wxss @@ -0,0 +1,55 @@ +.d-table { + display: table !important; +} +.d-table-row { + display: table-row !important; +} +.d-table-cell { + display: table-cell !important; +} +.d-table-cell { + padding: 10px 5px; + font-size: 14px; + word-break: break-all; + min-height: 42px; + max-width: 150px; + position: relative; +} +.d-table { + background-color: #fff; +} +.d-table .d-table-row.active { + background-color: #d6e8ff; +} +.d-table .d-table-row:not(:first-child) .d-table-cell::before { + content: ''; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 1px; + background-color: #ddd; + transform: scaleY(0.3); +} +.table { + position: relative; + background-color: #fff; + overflow: hidden; + font-size: 13px; + width: 100%; +} +.table1-view { + width: 100%; +} +.table1 { + width: var(--width, 100%); + min-width: auto; +} +.text { + font-size: 14px; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: var(--max_line, 2); +} diff --git a/pages/invoiceDetail/index.js b/pages/invoiceDetail/index.js index 509c4be..41ea00e 100644 --- a/pages/invoiceDetail/index.js +++ b/pages/invoiceDetail/index.js @@ -24,6 +24,11 @@ Page({ handleBack() { wx.navigateBack() }, + jumpToDetail() { + wx.redirectTo({ + url: '/pages/invoiceDetailContent/index', + }) + }, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/invoiceDetail/index.wxml b/pages/invoiceDetail/index.wxml index 48e4c03..92776ef 100644 --- a/pages/invoiceDetail/index.wxml +++ b/pages/invoiceDetail/index.wxml @@ -51,7 +51,13 @@ - 尊敬的客户,您好 - 已经为您开具订单2222222222的发票,发票数量共计1张,如下: - 发票裂隙:数电发票(电子发票),发票号码:54645654656556,您可以点击“发票下载”获取该发票文件 + 尊敬的客户,您好: + 已经为您开具订单2222222222的发票,发票数量共计1张,如下: + 发票类型:数电发票(电子发票),发票号码:54645654656556,您可以点击“发票XML文件下载”获取该发票XML文件,或者点击“发票PDF文件下载”获取该发票PDF文件; + 同时您也可以到预留的邮箱中查看下载发票。 + + + + 下载 + 发票明细 \ No newline at end of file diff --git a/pages/invoiceDetail/index.wxss b/pages/invoiceDetail/index.wxss index 19410eb..d56f10d 100644 --- a/pages/invoiceDetail/index.wxss +++ b/pages/invoiceDetail/index.wxss @@ -4,4 +4,16 @@ display: flex; align-items: center; margin-top: 50rpx; +} + +page { + background-color: var(--transparent-green); +} + +.operate { + margin-top: 80rpx; + display: flex; + align-items: center; + margin-left: 30rpx; + margin-right: 30rpx; } \ No newline at end of file diff --git a/pages/invoiceDetailContent/index.js b/pages/invoiceDetailContent/index.js new file mode 100644 index 0000000..198434a --- /dev/null +++ b/pages/invoiceDetailContent/index.js @@ -0,0 +1,84 @@ +import { getInvoiceInfoDetail } from "../../service/invoice"; + +// pages/invoiceDetailContent/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + detail: {}, + header: [ + { key: 'time', title: '月份' }, + { title: '电表地址',renderBody: (item) => item.meter.address }, + { key: 'money', title: '金额' }, + ] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + const { id } = options; + this.getDetail(id) + }, + async getDetail(id) { + const { code, message, data } = await getInvoiceInfoDetail(id); + this.setData({ + detail: data + }) + }, + jumpToInvoiceDetail() { + wx.redirectTo({ + url: '/pages/invoiceDetail/index', + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/invoiceDetailContent/index.json b/pages/invoiceDetailContent/index.json new file mode 100644 index 0000000..ed9a0e6 --- /dev/null +++ b/pages/invoiceDetailContent/index.json @@ -0,0 +1,9 @@ +{ + "usingComponents": { + "van-field": "@vant/weapp/field/index", + "table": "/components/table/table", + "van-button": "@vant/weapp/button/index", + "navigator": "/components/navigator/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/invoiceDetailContent/index.wxml b/pages/invoiceDetailContent/index.wxml new file mode 100644 index 0000000..32e5f1a --- /dev/null +++ b/pages/invoiceDetailContent/index.wxml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + 发票 + + + \ No newline at end of file diff --git a/pages/invoiceDetailContent/index.wxss b/pages/invoiceDetailContent/index.wxss new file mode 100644 index 0000000..51e14cc --- /dev/null +++ b/pages/invoiceDetailContent/index.wxss @@ -0,0 +1,10 @@ +/* pages/invoiceDetailContent/index.wxss */ +page { + background-color: var(--transparent-green); +} + +.wrapper { + background-color: #fff; + margin: 30rpx; + border-radius: 24rpx; +} \ No newline at end of file diff --git a/pages/invoiceList/components/already/index.js b/pages/invoiceList/components/already/index.js index 1a97511..26e00ee 100644 --- a/pages/invoiceList/components/already/index.js +++ b/pages/invoiceList/components/already/index.js @@ -1,3 +1,7 @@ +import { getAlreadyInvoiceList } from "../../../../service/invoice" +import { alertInfo } from "../../../../utils/index"; +import request from '../../../../utils/request' +const { OK } = request; // pages/invoiceList/components/already/index.js Component({ @@ -12,13 +16,45 @@ Component({ * 组件的初始数据 */ data: { - + page: 1, + list: [] + }, + onRefresh() { + console.log('--------------') + }, + lifetimes: { + attached() { + this.getList(); + } }, - /** * 组件的方法列表 */ methods: { - + async getList() { + const { page, list = [] } = this.data; + const { code, message, data } = await getAlreadyInvoiceList(page); + if (!data.length) { + alertInfo("没用更多数据了") + return + } + this.setData({ + list: [...list, ...data, ], + page: page + 1, + }) + }, + scrollToLower() { + this.getList(); + }, + jumpToDetail() { + wx.navigateTo({ + url: '/pages/invoiceDetail/index', + }) + }, + jumpToDetailContent() { + wx.navigateTo({ + url: '/pages/invoiceDetailContent/index', + }) + } } }) \ No newline at end of file diff --git a/pages/invoiceList/components/already/index.wxml b/pages/invoiceList/components/already/index.wxml index 4a980f3..69dabbf 100644 --- a/pages/invoiceList/components/already/index.wxml +++ b/pages/invoiceList/components/already/index.wxml @@ -1,26 +1,31 @@ - - - - 河北华昌宝能售电有限公司 - - - 发票内容:电费 - - - 发票类型:增值税专用发票 - - - 2024年3月3日 18:00:00 - - - - ¥3026 - - - 发票 + + + + + + + {{item.invoice.name}} + + + 发票内容: {{item.invoice.content}} + + + 发票类型:{{ item.invoice.type === 0 ? '普通电子发票' : '增值税专用电子发票' }} + + + {{item.finishTime}} + + + + ¥{{item.money}} + + + 发票 + + 明细 - 明细 - \ No newline at end of file + + \ No newline at end of file diff --git a/pages/invoiceList/components/info/index.js b/pages/invoiceList/components/info/index.js index ce01bc8..70a9b2d 100644 --- a/pages/invoiceList/components/info/index.js +++ b/pages/invoiceList/components/info/index.js @@ -1,4 +1,5 @@ import { getInvoiceInfo, updateInvoiceInfo } from "../../../../service/invoice" +import { getUserInfo } from "../../../../service/user"; import { alertInfo, alertSuccess } from "../../../../utils/index"; // pages/invoiceList/components/info/index.js @@ -13,6 +14,7 @@ Component({ lifetimes: { attached() { this.getDetail(); + this.getUser(); } }, /** @@ -33,6 +35,10 @@ Component({ this.setData({ detail: {...data, },editType: 'detail', formData: {} }) }, + async getUser() { + const { code, message, data } = await getUserInfo() + this.setData({ user: data }); + }, changeEditType() { this.setData({ editType: 'edit', formData: this.data.detail }) }, diff --git a/pages/invoiceList/components/info/index.wxml b/pages/invoiceList/components/info/index.wxml index 8ac51e9..60b64c8 100644 --- a/pages/invoiceList/components/info/index.wxml +++ b/pages/invoiceList/components/info/index.wxml @@ -4,7 +4,7 @@ diff --git a/pages/qrCode/index.js b/pages/qrCode/index.js index 925a558..f4639f8 100644 --- a/pages/qrCode/index.js +++ b/pages/qrCode/index.js @@ -40,7 +40,7 @@ Page({ list: [...tenements] }) }, - async getCode(e, that) { + async getCode() { // const { index, id } = e.currentTarget.dataset; const tenement = wx.getStorageSync('tenement'); const { code, message, data } = await getWxCode(tenement.id) diff --git a/service/invoice.js b/service/invoice.js index a4e8239..dab9dad 100644 --- a/service/invoice.js +++ b/service/invoice.js @@ -28,5 +28,10 @@ export const getInvoiceList = async function() { // 获取创建的发开票信息详情 export const getInvoiceInfoDetail = async function(id) { - return await GET(`/wx/getInvoiceInfoDetail/${id}`); + return await GET(`/wx/getInvoiceInfoDetail/${id}/${wx.getStorageSync('tenement')?.id}`); +} + +// 获取已开发票的列表 +export const getAlreadyInvoiceList = async function(page) { + return await GET(`/wx/getAlreadyInvoiceList?tenement=${wx.getStorageSync('tenement')?.id}&page=${page}`); } \ No newline at end of file