修改用电查询电表选择问题
This commit is contained in:
parent
19ba67134f
commit
1e92bb8bcf
|
@ -4,6 +4,7 @@ import { getTenementMeterList } from "../../service/meter";
|
||||||
import dayjs from "../../utils/dayjs";
|
import dayjs from "../../utils/dayjs";
|
||||||
import request from '../../utils/request';
|
import request from '../../utils/request';
|
||||||
import * as echarts from '../../components/echarts/echarts';
|
import * as echarts from '../../components/echarts/echarts';
|
||||||
|
import { alertInfo } from "../../utils/index";
|
||||||
const { OK } = request;
|
const { OK } = request;
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
|
@ -37,7 +38,9 @@ Page({
|
||||||
list: [],
|
list: [],
|
||||||
visible: false,
|
visible: false,
|
||||||
meterReadingList: [],
|
meterReadingList: [],
|
||||||
accountingList: []
|
accountingList: [],
|
||||||
|
electricNumber: 0,
|
||||||
|
meterNumber: 0,
|
||||||
},
|
},
|
||||||
changeQueryType(e) {
|
changeQueryType(e) {
|
||||||
const { type } = e.currentTarget.dataset
|
const { type } = e.currentTarget.dataset
|
||||||
|
@ -90,26 +93,38 @@ Page({
|
||||||
time = yearMonthDay;
|
time = yearMonthDay;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const { code, message, data } = await getElectricityList({ type: timeType, meter: meterId, time: time })
|
const { code, message, data, electricNumber, meterNumber } = await getElectricityList({ type: timeType, meter: meterId, time: time })
|
||||||
this.setData({ list: data })
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({ list: data, electricNumber, meterNumber })
|
||||||
},
|
},
|
||||||
async getReadingList() {
|
async getReadingList() {
|
||||||
const { meterId } = this.data;
|
const { meterId } = this.data;
|
||||||
const { code, message, data } = await getMeterReadingList(meterId)
|
const { code, message, data } = await getMeterReadingList(meterId)
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setData({ meterReadingList: data })
|
this.setData({ meterReadingList: data })
|
||||||
},
|
},
|
||||||
async getAccountingBalanceList() {
|
async getAccountingBalanceList() {
|
||||||
const { meterId } = this.data;
|
const { meterId } = this.data;
|
||||||
const { code, message, data } = await getAccountingList(meterId)
|
const { code, message, data } = await getAccountingList(meterId)
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setData({ accountingList: data })
|
this.setData({ accountingList: data })
|
||||||
},
|
},
|
||||||
async getMeters() {
|
async getMeters() {
|
||||||
const { id } = wx.getStorageSync('tenement')
|
const { id } = wx.getStorageSync('tenement')
|
||||||
const { code, message, data } = await getTenementMeterList(id);
|
const { code, message, data } = await getTenementMeterList(id);
|
||||||
// if (code !== OK) {
|
if (code !== OK) {
|
||||||
// alertInfo(message)
|
alertInfo(message)
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
meterList: data || [],
|
meterList: data || [],
|
||||||
|
@ -133,12 +148,13 @@ Page({
|
||||||
},
|
},
|
||||||
onOk(e) {
|
onOk(e) {
|
||||||
const { type, value = {} } = e.detail;
|
const { type, value = {} } = e.detail;
|
||||||
const { id, code } = e;
|
const { id, code } = e.detail.value;
|
||||||
|
console.log('e', e)
|
||||||
const { year } = this.data;
|
const { year } = this.data;
|
||||||
// const currentYear = years[Number(e)]
|
// const currentYear = years[Number(e)]
|
||||||
this.setData({
|
this.setData({
|
||||||
// year: currentYear,
|
// year: currentYear,
|
||||||
codeId: id,
|
meterId: id,
|
||||||
meterCode: code,
|
meterCode: code,
|
||||||
type: "",
|
type: "",
|
||||||
show: false,
|
show: false,
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
<empty bind:refresh="init" wx:else />
|
<empty bind:refresh="init" wx:else />
|
||||||
</view>
|
</view>
|
||||||
<view class="sum">
|
<view class="sum">
|
||||||
合计:表计数量:10,耗电量100
|
合计:表计数量:{{meterNumber}},耗电量:{{electricNumber}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{queryType === 1}}">
|
<view wx:if="{{queryType === 1}}">
|
||||||
|
@ -86,9 +86,11 @@
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{queryType === 2}}">
|
<view wx:if="{{queryType === 2}}">
|
||||||
<view style="margin: 30rpx;">
|
<view style="margin: 30rpx;">
|
||||||
<accountingCard wx:for="{{accountingList}}" data="{{item}}" />
|
<view wx:if="{{accountingList.length}}">
|
||||||
|
<accountingCard wx:for="{{accountingList}}" data="{{item}}" />
|
||||||
|
</view>
|
||||||
<!-- <table header="{{meterReadingHeader}}" list="{{accountingList}}" wx:if="{{accountingList.length}}" /> -->
|
<!-- <table header="{{meterReadingHeader}}" list="{{accountingList}}" wx:if="{{accountingList.length}}" /> -->
|
||||||
<!-- <empty bind:refresh="init" wx:else /> -->
|
<empty bind:refresh="getAccountingBalanceList" wx:else />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -23,6 +23,7 @@ page {
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
|
padding-bottom: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.query {
|
.query {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
|
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
|
||||||
import { alertInfo } from "../../utils/index";
|
import { alertInfo, loadingFunc } from "../../utils/index";
|
||||||
import request from '../../utils/request'
|
import request from '../../utils/request'
|
||||||
const { OK } = request;
|
const { OK } = request;
|
||||||
// pages/invoiceInfo/index.js
|
// pages/invoiceInfo/index.js
|
||||||
|
@ -33,34 +33,34 @@ Page({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
download() {
|
download() {
|
||||||
// console.log('---------')
|
|
||||||
const that = this;
|
const that = this;
|
||||||
wx.showActionSheet({
|
wx.showActionSheet({
|
||||||
itemList: ['发票XML文件下载', '发票PDF文件下载'],
|
itemList: ['发票XML文件下载', '发票PDF文件下载'],
|
||||||
async success(res) {
|
async success(res) {
|
||||||
console.log('res', res.tapIndex)
|
loadingFunc(async () => {
|
||||||
const { code, message, data } = await downloadInvoice(that.data.id, res.tapIndex);
|
const { code, message, data } = await downloadInvoice(that.data.id, res.tapIndex);
|
||||||
if (code !== OK) {
|
if (code !== OK) {
|
||||||
alertInfo(message)
|
alertInfo(message)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
wx.downloadFile({
|
|
||||||
url: data,
|
|
||||||
success(res) {
|
|
||||||
if (res.statusCode === 200) {
|
|
||||||
wx.openDocument({
|
|
||||||
filePath: res.tempFilePath,
|
|
||||||
fileType: [res.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!!
|
|
||||||
success: function (res) {
|
|
||||||
console.log('打开文档成功')
|
|
||||||
},
|
|
||||||
fail: function (e) {
|
|
||||||
console.log(e.errMsg);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
wx.downloadFile({
|
||||||
|
url: data,
|
||||||
|
success(res) {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
wx.openDocument({
|
||||||
|
filePath: res.tempFilePath,
|
||||||
|
fileType: [res.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!!
|
||||||
|
success: function (res) {
|
||||||
|
|
||||||
|
},
|
||||||
|
fail: function (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ Page({
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log('options', options)
|
|
||||||
const { id } = options;
|
const { id } = options;
|
||||||
this.getDetail(id)
|
this.getDetail(id)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user