From cae7b2767f10c92f785de8a1be8d82089ffbe65a Mon Sep 17 00:00:00 2001 From: qiaomu <3520484422@qq.com> Date: Wed, 10 Apr 2024 15:36:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AC=E5=9C=B0=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 3 +- app.wxss | 2 + pages/home/index.wxml | 2 +- pages/invoiceList/components/notyet/index.js | 71 +++++++++++++++++-- .../invoiceList/components/notyet/index.json | 3 +- .../invoiceList/components/notyet/index.wxml | 20 ++++-- .../invoiceList/components/notyet/index.wxss | 45 ++++++++++++ pages/invoicing/index.js | 71 +++++++++++++++++++ pages/invoicing/index.json | 7 ++ pages/invoicing/index.wxml | 14 ++++ pages/invoicing/index.wxss | 31 ++++++++ pages/rechargeDetail/index.js | 3 +- pages/rechargeDetail/index.wxml | 24 ++++++- pages/rechargeRecord/index.wxss | 4 ++ utils/data.js | 2 + 15 files changed, 283 insertions(+), 19 deletions(-) create mode 100644 pages/invoicing/index.js create mode 100644 pages/invoicing/index.json create mode 100644 pages/invoicing/index.wxml create mode 100644 pages/invoicing/index.wxss diff --git a/app.json b/app.json index 3a815d0..c1e68bb 100644 --- a/app.json +++ b/app.json @@ -1,8 +1,9 @@ { "pages": [ "pages/home/index", - "pages/rechargeRecord/index", + "pages/invoicing/index", "pages/invoiceList/index", + "pages/rechargeRecord/index", "pages/member/index", "pages/login/index", "pages/handleLogin/index", diff --git a/app.wxss b/app.wxss index 6cf0a1b..0820b67 100644 --- a/app.wxss +++ b/app.wxss @@ -20,6 +20,8 @@ page { --deep-green: #15755e; --middle-green: rgb(75, 151, 131); --light-green: rgb(174,218,203); + --transparent-green: rgb(208, 230, 222); + --money-color: #ee0a24; /* background-color: #f0f0f0; */ } diff --git a/pages/home/index.wxml b/pages/home/index.wxml index 8d5cbf4..a5c9226 100644 --- a/pages/home/index.wxml +++ b/pages/home/index.wxml @@ -17,7 +17,7 @@ - + 请登录 diff --git a/pages/invoiceList/components/notyet/index.js b/pages/invoiceList/components/notyet/index.js index f84d1c2..1bc8075 100644 --- a/pages/invoiceList/components/notyet/index.js +++ b/pages/invoiceList/components/notyet/index.js @@ -1,4 +1,9 @@ // pages/invoiceList/components/notyet/index.js +import { getInvoiceList } from '../../../../service/invoice'; +import { alertInfo } from '../../../../utils/index'; +import request from '../../../../utils/request'; +const { OK } = request; + Component({ /** @@ -7,28 +12,80 @@ Component({ properties: { }, - + lifetimes: { + attached() { + this.init(); + } + }, /** * 组件的初始数据 */ data: { - chooseList: [] + chooseList: [], + selectList: [], + list: [], + selectCount: 0, + selectMoney: 0, }, /** * 组件的方法列表 */ methods: { + async init() { + const { code, message, data } = await getInvoiceList(); + // if (code !== OK) { + // alertInfo(message) + // return; + // } + this.setData({ list: data, selectList: new Array(data?.length).map(() => false) }) + }, onChange(e) { - const { id } = e.currentTarget.dataset; - let newList = this.data.chooseList; + const { id, index } = e.currentTarget.dataset; + // let newList = this.data.chooseList; + const { list } = this.data; + const newSelectList = this.data.selectList; if (e.detail) { - newList = [...new Set([...newList, id])] + newSelectList[index] = true; + // newList = [...new Set([...newList, id])] } else { - newList = newList.filter(item => item !== id); + newSelectList[index] = false; + // newList = newList.filter(item => item !== id); + } + let selectCount = 0; + let selectMoney = 0; + for(let i = 0; i < newSelectList.length; i ++) { + const item = newSelectList[i]; + if (item) { + selectCount++; + selectMoney += list[i]?.money; + } } this.setData({ - chooseList: newList, + // chooseList: newList, + selectList: newSelectList, + selectCount, + selectMoney + }) + }, + next() { + const { selectList, list, selectMoney, selectCount } = this.data; + let tenementID = ""; + let ids = []; + for(let i = 0; i < selectList.length; i ++) { + if (selectList[i]) { + const currentTenementID = list[i]?.tenement?.id; + ids.push(list[i]?.id); + if (!tenementID) { + tenementID = currentTenementID; + } else if(tenementID !== currentTenementID) { + alertInfo("只能对一个公司开票") + return; + } + } + } + wx.navigateTo({ + url: `/pages/invoicing/index?money=${selectMoney}&count=${selectCount}&tenement=${tenementID}&ids=${ids}`, }) } } diff --git a/pages/invoiceList/components/notyet/index.json b/pages/invoiceList/components/notyet/index.json index cee4dba..7360772 100644 --- a/pages/invoiceList/components/notyet/index.json +++ b/pages/invoiceList/components/notyet/index.json @@ -1,6 +1,7 @@ { "component": true, "usingComponents": { - "van-checkbox": "@vant/weapp/checkbox/index" + "van-checkbox": "@vant/weapp/checkbox/index", + "van-button": "@vant/weapp/button/index" } } \ No newline at end of file diff --git a/pages/invoiceList/components/notyet/index.wxml b/pages/invoiceList/components/notyet/index.wxml index c77f163..46d0617 100644 --- a/pages/invoiceList/components/notyet/index.wxml +++ b/pages/invoiceList/components/notyet/index.wxml @@ -1,20 +1,21 @@ - + - - 1月份 - 软C306 + + {{item.time}} + {{ item.meter.address }} - 河北创新风华科技有限公司 + {{ item.tenement.name }} - 2024年1月1日-2024年1月31日 + {{ item.range[0] }} - {{ item.range[1] }} + ¥ {{ item.money }} 待开票 @@ -22,4 +23,11 @@ + + {{ selectCount }} + 笔订单,共 + ¥ {{selectMoney}} + 下一步 + + diff --git a/pages/invoiceList/components/notyet/index.wxss b/pages/invoiceList/components/notyet/index.wxss index 2d45ea7..7f11fa4 100644 --- a/pages/invoiceList/components/notyet/index.wxss +++ b/pages/invoiceList/components/notyet/index.wxss @@ -34,4 +34,49 @@ padding: 14rpx 24rpx; border-radius: 18rpx; color: rgb(224, 106, 106) +} + +.allSelect { + position: fixed; + left: 0; + bottom: 0; + width: 100vw; + height: 100rpx; + background-color: #fff; + padding: 20rpx; + box-sizing: border-box; + display: flex; + align-items: center; +} + +.allNumber { + margin-left: 20rpx; + margin-right: 20rpx; + color: #ee0a24; +} + +.allMoney { + flex: 1; + margin-left: 20rpx; + color: var(--money-color); +} + +.content { + display: flex; + align-items: center; +} + +.rightMoney { + position: absolute; + right: 20rpx; + top: calc(50% - 20rpx); + font-size: 40rpx; + font-weight: 600; +} + +.month { + width: 138rpx; + white-space: nowrap; + overflow: hidden; + } \ No newline at end of file diff --git a/pages/invoicing/index.js b/pages/invoicing/index.js new file mode 100644 index 0000000..00bc2e0 --- /dev/null +++ b/pages/invoicing/index.js @@ -0,0 +1,71 @@ +// pages/invoicing/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + money: 0, + tenement: "", + ids: [], + count: 0, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + const { money = 10, tenement, ids = 'q', count = 10 } = options; + console.log('option', options) + this.setData({ money, tenement, ids: ids.split(","), count }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/invoicing/index.json b/pages/invoicing/index.json new file mode 100644 index 0000000..7feef6d --- /dev/null +++ b/pages/invoicing/index.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "navigator": "/components/navigator/index", + "van-button": "@vant/weapp/button/index" + }, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/invoicing/index.wxml b/pages/invoicing/index.wxml new file mode 100644 index 0000000..d9a5949 --- /dev/null +++ b/pages/invoicing/index.wxml @@ -0,0 +1,14 @@ + + + + 发票金额: {{money}} + 发票内容:电费 + + + + + + + + 提交 + \ No newline at end of file diff --git a/pages/invoicing/index.wxss b/pages/invoicing/index.wxss new file mode 100644 index 0000000..d493360 --- /dev/null +++ b/pages/invoicing/index.wxss @@ -0,0 +1,31 @@ +/* pages/invoicing/index.wxss */ +.submit { + margin-top: 40rpx; + margin-left: 32rpx; + margin-right: 32rpx; + margin-bottom: 40rpx; +} + +.info { + margin: 30rpx; + border-radius: 20rpx; + padding: 26rpx; + background-color: #fff; +} + +.info .moneyNumber { + color: var(--money-color) +} + +.info .content { + margin-top: 20rpx; +} + +.info .content .contentText { + margin-left: 10rpx; + font-weight: 600; +} + +page { + background-color: var(--transparent-green); +} diff --git a/pages/rechargeDetail/index.js b/pages/rechargeDetail/index.js index acab702..f6f53aa 100644 --- a/pages/rechargeDetail/index.js +++ b/pages/rechargeDetail/index.js @@ -1,4 +1,5 @@ import { getRechargeDetail } from "../../service/recharge"; +import { getRechargeOperateType, getRechargeOperateWay } from "../../utils/data"; import request from "../../utils/request" const { OK } = request // pages/rechargeDetail/index.js @@ -21,7 +22,7 @@ Page({ async init(id) { const { code, message, data } = await getRechargeDetail(id) this.setData({ - detail: data + detail: { ...data, way: getRechargeOperateWay(data.way), type: getRechargeOperateType(data.type) } }) }, back() { diff --git a/pages/rechargeDetail/index.wxml b/pages/rechargeDetail/index.wxml index 28bf0ce..a87a999 100644 --- a/pages/rechargeDetail/index.wxml +++ b/pages/rechargeDetail/index.wxml @@ -6,59 +6,79 @@ value="{{detail.tenement.name}}" label="商户名称" readonly + autosize="{{true}}" + type="textarea" border="{{ false }}" /> diff --git a/pages/rechargeRecord/index.wxss b/pages/rechargeRecord/index.wxss index 820aacc..8ac98d3 100644 --- a/pages/rechargeRecord/index.wxss +++ b/pages/rechargeRecord/index.wxss @@ -86,4 +86,8 @@ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; +} + +page { + /* background-color: var(--light-green); */ } \ No newline at end of file diff --git a/utils/data.js b/utils/data.js index 3baa953..7efd91b 100644 --- a/utils/data.js +++ b/utils/data.js @@ -1,9 +1,11 @@ export const getRechargeOperateType = (num) => { + console.log('typenum', num) const types = ["充值", "冲正", "退费"] return types[num]; } export const getRechargeOperateWay = (num) => { + console.log('num', num) const types = ["现金", "银行卡", "支付宝", "微信", "云闪付"] return types[num]; } \ No newline at end of file