开始做用电查询

This commit is contained in:
2024-04-28 17:33:16 +08:00
parent 72c8af7abd
commit 8d0f1931a9
31 changed files with 1003 additions and 169 deletions

View File

@@ -1,35 +1,20 @@
import { getMeterList } from "../../service/meter";
// pages/meterList/index.js
// pages/billDetail/index.js
Page({
/**
* 页面的初始数据
*/
data: {
list: [
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList();
},
async getList() {
const { code, message, data = [] } = await getMeterList()
this.setData({
list: data
})
},
jumpToRecharge(e) {
const { code, tenement } = e.currentTarget.dataset;
wx.navigateTo({
url: `/pages/recharge/index?code=${code}&tenement=${tenement}`,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,2 @@
<!--pages/billDetail/index.wxml-->
<web-view src="http://localhost:3000/userReport/1/1"/>

View File

@@ -0,0 +1 @@
/* pages/billDetail/index.wxss */

87
pages/billList/index.js Normal file
View File

@@ -0,0 +1,87 @@
import { getBillList } from "../../service/accounting"
import { alertInfo } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
// pages/billList/index.js
Page({
/**
* 页面的初始数据
*/
data: {
page: 1,
list: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init();
},
async init() {
const { page, list } = this.data;
const { code, data, message } = await getBillList(page)
if (!data?.length) {
alertInfo("没用更多了")
return;
}
this.setData({
list: [...list, ...data],
page: page + 1,
})
},
jumpToDetail() {
wx.navigateTo({
url: '/pages/billDetail/index',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,7 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-icon": "@vant/weapp/icon/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,8 @@
<!--pages/billList/index.wxml-->
<navigator title="电费账单" canBack="{{true}}" />
<view class="itemWrapper" wx:for="{{list}}" wx:key="index">
<van-icon name="balance-list-o" />
<view class="time"> {{ item.time }} </view>
<view class="operate" bind:tap="jumpToDetail"> 查看详细 </view>
</view>

23
pages/billList/index.wxss Normal file
View File

@@ -0,0 +1,23 @@
/* pages/billList/index.wxss */
page {
background-color: var(--transparent-green);
}
.itemWrapper {
margin: 20rpx 30rpx 20rpx 30rpx;
background-color: #fff;
border-radius: 20rpx;
box-sizing: border-box;
padding: 30rpx;
display: flex;
align-items: center;
}
.time {
flex: 1;
text-indent: 40rpx;
}
.operate {
}

View File

@@ -1,28 +1,20 @@
import { getInvoiceInfoDetail } from "../../service/invoice";
// pages/invoiceInfo/index.js
// pages/editInvoice/index.js
Page({
/**
* 页面的初始数据
*/
data: {
detail: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { id } = options;
if (id !== "-1") {
this.init(id);
}
},
async init(id) {
const { code, message, data } = await getInvoiceInfoDetail(id)
this.setData({ detail: data });
},
/**
* 生命周期函数--监听页面初次渲染完成
*/

View File

@@ -1,6 +0,0 @@
{
"usingComponents": {
"van-field": "@vant/weapp/field/index",
"van-button": "@vant/weapp/button/index"
}
}

View File

@@ -1,50 +1,2 @@
<van-cell-group>
<van-field
value="{{ detail.name }}"
label="公司名称"
border="{{ false }}"
placeholder="请选择公司名称"
required
/>
<van-field
value="{{ detail.tin }}"
label="税号"
border="{{ false }}"
placeholder="请输入税号"
required
/>
<van-field
value="{{ detail.address }}"
label="单位地址"
border="{{ false }}"
placeholder="请输入单位地址"
/>
<van-field
value="{{ detail.phone }}"
label="电话"
border="{{ false }}"
placeholder="请输入电话"
/>
<van-field
value="{{ detail.bank }}"
label="开户银行"
border="{{ false }}"
placeholder="请输入开户银行"
/>
<van-field
value="{{ detail.account }}"
label="开户账号"
border="{{ false }}"
placeholder="请输入开户账号"
/>
<van-field
value="{{ detail.email }}"
label="邮箱"
border="{{ false }}"
placeholder="请输入邮箱"
/>
</van-cell-group>
<view class="wrapper operate">
<van-button type="info" block style="margin-left: 30rpx;flex: 1;">保存</van-button>
</view>
<!--pages/editInvoice/index.wxml-->
<text>pages/editInvoice/index.wxml</text>

View File

@@ -1,6 +0,0 @@
/* pages/editInvoice/index.wxss */
.operate {
display: flex;
align-items: center;
margin-top: 50rpx;
}

View File

@@ -0,0 +1,150 @@
// pages/electricQuery/index.js
import { getElectricityList } from "../../service/accounting";
import { getTenementMeterList } from "../../service/meter";
import dayjs from "../../utils/dayjs";
import request from '../../utils/request';
import * as echarts from '../..//components/echarts/echarts';
const { OK } = request;
const piedata = [1,2,3,4,5]
Page({
/**
* 页面的初始数据
*/
data: {
queryType: 0,
timeType: 0,
show: false,
columns: [],
meterList: [],
meterCode: "",
meterId: "",
year: dayjs().format('YYYY'),
yearMonth: dayjs().format("YYYY-MM"),
yearMonthDay: dayjs().format("YYYY-MM-DD"),
header: [
{ key: 'address', title: '电表地址', renderBody: (item) => item.meter?.address },
{ title: '时间',renderBody: (item) => { return item.time } },
{ key: 'number', title: '耗量' },
],
list: []
},
changeQueryType(e) {
const { type } = e.currentTarget.dataset
this.setData({ queryType: type },() => {
this.init()
})
},
changeTimeType(e) {
const { type } = e.currentTarget.dataset
this.setData({ timeType: type }, () => {
this.init()
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init()
},
async init() {
const { queryType, timeType, meterId } = this.data;
const { code, message, data } = await getElectricityList({ type: queryType, meter: meterId, time: timeType })
console.log('data', data)
this.setData({ list: data })
},
async getMeters() {
const { id } = wx.getStorageSync('tenement')
const { code, message, data } = await getTenementMeterList(id);
// if (code !== OK) {
// alertInfo(message)
// return;
// }
this.setData({
meterList: data || [],
})
},
clickMeter() {
this.setData({
type: "meter",
columns: [{ id: "", name: "全部", code: "" }, ...this.data.meterList.map(item => ({ id: item.id, name: `${item.code}-${item.address}`, code: item.code }))],
show: true,
title: "表计"
})
},
onCancel() {
this.setData({
type: "meter",
columns: [],
show: false,
title: "",
})
},
onOk(e) {
const { type, value = {} } = e.detail;
const { id, code } = e;
console.log('e', e)
const { year } = this.data;
// const currentYear = years[Number(e)]
this.setData({
// year: currentYear,
codeId: id,
meterCode: code,
type: "",
show: false,
title: ""
}, () => {
this.init();
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getMeters()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@@ -0,0 +1,13 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-icon": "@vant/weapp/icon/index",
"custom-picker": "/components/picker/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-button": "@vant/weapp/button/index",
"table": "/components/table/table",
"empty": "/components/empty/index"
},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,81 @@
<!--pages/electricQuery/index.wxml-->
<navigator title="用电查询" canBack="{{true}}" />
<view class="wrapper">
<view class="queryWrapper">
<view class="label">
选择电表
</view>
<view class="select" bind:tap="clickMeter">
<view class="selectContent">
{{ meterCode === "" ? '全部' : meterCode }}
</view>
<van-icon name="arrow-down" />
</view>
</view>
<view class="query">
<view class="typeQuery">
<van-row>
<van-col span="8">
<view class="typeQueryText" style="color: {{queryType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{0}}"> 电量查询 </view>
</van-col>
<van-col span="8">
<view class="typeQueryText" style="color: {{queryType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{1}}"> 抄表记录 </view>
</van-col>
<van-col span="8">
<view class="typeQueryText" style="color: {{queryType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{2}}"> 账务余额 </view>
</van-col>
</van-row>
</view>
<view class="timeQuery" wx:if="{{queryType === 0}}">
<van-row>
<van-col span="8">
<view class="timeQueryText" style="color: {{timeType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{0}}"> 日耗量 </view>
</van-col>
<van-col span="8">
<view class="timeQueryText" style="color: {{timeType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{1}}"> 月耗量 </view>
</van-col>
<van-col span="8">
<view class="timeQueryText" style="color: {{timeType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{2}}"> 年耗量 </view>
</van-col>
</van-row>
</view>
</view>
<view class="tooltip">
不包括线损电量,显示为电表实际消耗电量。仅供参考,实际能耗电量以电费账单为主。如有疑问,请联系客服。
</view>
<view class="timeChooseWrapper">
<view> 选择时间 </view>
<view class="time">
<view class="timeText"> {{yearMonthDay}} </view>
<van-icon name="arrow-down" />
</view>
<van-button type="info" size="small"> 导出 </van-button>
</view>
</view>
<view style="margin: 30rpx;">
<table header="{{header}}" list="{{list}}" wx:if="{{list.length}}" />
<empty bind:refresh="init" wx:else />
</view>
<view class="sum">
合计表计数量10耗电量100
</view>
<!-- <echarts
style="width:200rpx;height:200rpx;position:relative"
id="echarts"
class='mychart-bar'
canvas-id="mychart-bar"
ec="{{ ec }}"
>
</echarts> -->
<custom-picker
title="{{title}}"
show="{{show}}"
valueKey="name"
columns="{{columns}}"
bind:ok="onOk"
bind:cancel="onCancel"
type="{{type}}"
/>

View File

@@ -0,0 +1,89 @@
/* pages/electricQuery/index.wxss */
page {
background-color: var(--transparent-green);
}
.queryWrapper {
margin: 20rpx 0rpx;
background-color: #fff;
padding: 30rpx;
box-sizing: border-box;
border-radius: 20rpx;
display: flex;
align-items: center;
}
.label {
width: 180rpx;
font-size: 34rpx;
}
.sum {
margin-bottom: 30rpx;
margin-left: 30rpx;
margin-right: 30rpx;
}
.query {
margin: 20rpx 0rpx;
}
.typeQueryText {
text-align: center;
padding: 30rpx;
background-color: var(--light-green);
font-size: 34rpx;
}
.select {
border: 1rpx solid #ccc;
padding: 12rpx;
border-radius: 12rpx;
flex: 1;
display: flex;
justify-content: space-between;
}
.timeQueryText {
text-align: center;
padding: 30rpx;
background-color: rgb(242,248,246);
font-size: 34rpx;
}
.wrapper {
margin-left: 30rpx;
margin-right: 30rpx;
padding: 0;
}
.tooltip {
margin: 20rpx 0;
font-size: 32rpx;
}
.timeChooseWrapper {
display: flex;
align-items: center;
}
.time {
flex: 1;
margin-left: 30rpx;
margin-right: 30rpx;
display: flex;
padding: 10rpx 20rpx;
border-radius: 12rpx;
border: 1rpx solid #ccc;
background-color: #fff;
}
.timeText {
flex: 1;
}
.mychart-bar::after{
content:"";
display:block;
clear:both
}

View File

@@ -314,7 +314,10 @@ Page({
})
},
jumpToOrder() {
alertInfo("尚未完成")
// alertInfo("尚未完成")
wx.navigateTo({
url: '/pages/billList/index',
})
},
/**
* 生命周期函数--监听页面隐藏

View File

@@ -1,7 +0,0 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"scrollPageWrapper": "/components/scrollPageWrapper/index"
},
"navigationBarTitleText": "表计列表"
}

View File

@@ -1,24 +0,0 @@
<!--pages/meterList/index.wxml-->
<view class="wrapper">
<view wx:for="{{list}}" wx:key="index" class="listItem">
<view class="tenementName"> {{ item.tenement.name }} :</view>
<view class="meter" wx:for="{{item.meter}}" wx:for-item="ele" wx:key="code">
<view class="content">
<view class="code"> 表{{ ele.code }}:余额为 </view>
<view class="money"> {{ ele.money }} </view>
<view
class="primaryTextBtn"
bind:tap="jumpToRecharge"
data-tenement="{{item.tenement.id}}"
data-code="{{ele.code}}"
> 充值 </view>
</view>
<view class="address">
表计地址: {{ ele.address }}
</view>
</view>
</view>
</view>

View File

@@ -1,40 +0,0 @@
/* pages/meterList/index.wxss */
/* .content {
flex: 1;
padding: 16rpx 24rpx 20rpx;
box-sizing: border-box;
display: flex;
overflow: hidden;
} */
.listItem {
/* display: flex;
align-items: center;
justify-content: space-between; */
margin: 12rpx 0;
}
.money {
font-size: 36rpx;
font-weight: 600;
margin-left: 20rpx;
flex: 1;
}
.content {
display: flex;
align-items: center;
margin-left: 30rpx;
margin-right: 20rpx;
}
.address {
margin-left: 30rpx;
margin-right: 20rpx;
}
.tenementName {
font-size: 42rpx;
font-weight: 600;
margin-bottom: 20rpx;
}