Compare commits
38 Commits
ce81f9fe0a
...
shop
| Author | SHA1 | Date | |
|---|---|---|---|
| c266572022 | |||
| 0b568a81e5 | |||
| 765b3ad111 | |||
| e4a22af891 | |||
| 8e1ed62bd7 | |||
| 14dad0a506 | |||
| e6edf6e3d1 | |||
| 9ca94479fa | |||
| 31870c0222 | |||
| 4963d4f8a6 | |||
| e3ad9ea30a | |||
| 75713f1e97 | |||
| 56e08863de | |||
| 8b970f2b8f | |||
| 8ecb1e5977 | |||
| 60fcd5f8e2 | |||
| 7ac104d1b8 | |||
| 8f83197c02 | |||
| ada2d71136 | |||
| 05853b819f | |||
| e730e66c7c | |||
| 6d35c78da9 | |||
| b673d0c994 | |||
| 2d59d0eb8c | |||
| aab3819a9d | |||
| 6ad47c47ac | |||
| 1e92bb8bcf | |||
| 19ba67134f | |||
| d7a31af5d5 | |||
| 355778d068 | |||
| 91eeeabf94 | |||
| 9fddb955ce | |||
| 63cb2f8250 | |||
| f8115cf724 | |||
| 45cb065d6f | |||
| 2a6447e292 | |||
| 3d13c3003a | |||
| 5885281810 |
7
app.json
7
app.json
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
"pages/home/index",
|
"pages/home/index",
|
||||||
"pages/billList/index",
|
|
||||||
"pages/electricQuery/index",
|
"pages/electricQuery/index",
|
||||||
|
"pages/billDetail/index",
|
||||||
|
"pages/billList/index",
|
||||||
"pages/rechargeRecord/index",
|
"pages/rechargeRecord/index",
|
||||||
"pages/invoiceList/index",
|
"pages/invoiceList/index",
|
||||||
"pages/invoiceDetail/index",
|
"pages/invoiceDetail/index",
|
||||||
@@ -17,12 +18,10 @@
|
|||||||
"pages/qrCode/index",
|
"pages/qrCode/index",
|
||||||
"pages/recharge/index",
|
"pages/recharge/index",
|
||||||
"pages/questions/index",
|
"pages/questions/index",
|
||||||
"pages/editInvoice/index",
|
|
||||||
"pages/rechargeDetail/index",
|
"pages/rechargeDetail/index",
|
||||||
"pages/agreements/index",
|
"pages/agreements/index",
|
||||||
"pages/updateInvoice/index",
|
"pages/updateInvoice/index",
|
||||||
"pages/billDetail/index"
|
"pages/rechargeWay/index"
|
||||||
|
|
||||||
],
|
],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"list": [
|
"list": [
|
||||||
|
|||||||
2
app.wxss
2
app.wxss
@@ -8,7 +8,7 @@ page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.border {
|
.border {
|
||||||
border: 0.5rpx solid #f0f0f0;
|
border: 0.5rpx solid #cfc9c9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radius12 {
|
.radius12 {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* components/avatar/index.wxss */
|
/* components/avatar/index.wxss */
|
||||||
.wrapper {
|
.wrapper {
|
||||||
width: 150rpx;
|
width: 120rpx;
|
||||||
height: 150rpx;
|
height: 120rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
|
background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -14,4 +14,5 @@
|
|||||||
max-width: 100rpx;
|
max-width: 100rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
/* components/dot/index.wxss */
|
/* components/dot/index.wxss */
|
||||||
.dot {
|
.dot {
|
||||||
background-color: #ee0a24;
|
background-color: #ee0a24;
|
||||||
width: 56rpx;
|
width: 52rpx;
|
||||||
height: 56rpx;
|
height: 52rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 28rpx;
|
font-size: 26rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
.ec-canvas {
|
.ec-canvas {
|
||||||
position: static !important;
|
position: relative !important;
|
||||||
float: none;
|
float: none;
|
||||||
width: 700rpx;
|
width: 700rpx;
|
||||||
height: 700rpx;
|
height: 700rpx;
|
||||||
|
z-index: 0 !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
position: relative;
|
|
||||||
background-color: var(--deep-green);
|
background-color: var(--deep-green);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
.d-table {
|
.d-table {
|
||||||
display: table !important;
|
display: table !important;
|
||||||
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
.d-table-row {
|
.d-table-row {
|
||||||
display: table-row !important;
|
display: table-row !important;
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
import { getReportDetail } from "../../service/report";
|
||||||
|
import { alertInfo, getPixelRatio } from "../../utils/index";
|
||||||
|
import request from '../../utils/request'
|
||||||
|
import * as echarts from '../../components/echarts/echarts';
|
||||||
|
const { OK } = request
|
||||||
|
|
||||||
// pages/billDetail/index.js
|
// pages/billDetail/index.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@@ -5,21 +11,146 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
id: "",
|
||||||
|
time: "",
|
||||||
|
detail: {},
|
||||||
|
meters: [],
|
||||||
|
header1: [
|
||||||
|
{ key: 'address', title: '电表地址' },
|
||||||
|
{ title: '起码',renderBody: (item) => { return item?.startNumber } },
|
||||||
|
{ title: '止码',renderBody: (item) => { return item?.endNumber } },
|
||||||
|
{ title: '倍率',renderBody: (item) => { return item?.displayRatio } },
|
||||||
|
],
|
||||||
|
header2: [
|
||||||
|
{ title: '用电量', renderBody: (item) => item?.overall?.amount },
|
||||||
|
{ title: '线损电量',renderBody: (item) => item?.loss?.amount },
|
||||||
|
{ title: '公摊电量',renderBody: (item) => item?.publicAmount },
|
||||||
|
{ title: '合计电量',renderBody: (item) => {
|
||||||
|
|
||||||
|
} },
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const { id: report } = options;
|
const { id = "R00053677580943361", time = "2023-10" } = options;
|
||||||
const { id: tenement } = wx.getStorageSync('tenement')
|
this.init(id, time);
|
||||||
|
},
|
||||||
|
async init(id, time) {
|
||||||
|
const { code, message, detail } = await getReportDetail(id)
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
url: `https://zgd.hbhcbn.com/h5/?report=${report}&tenement=${tenement}`
|
id, time, detail, meters: detail?.meters?.map(item => {
|
||||||
// url: `http://localhost:3000/?report=${report}&tenement=${tenement}`
|
const finalAmount = Number(item?.overall?.amount || 0) + Number(item?.loss?.amount || 0) + Number(item?.publicAmount || 0)
|
||||||
|
item.finalAmount = Number(finalAmount).toFixed(2)
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const option = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
top: 10,
|
||||||
|
left: 'center'
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
alignTo: 'edge',
|
||||||
|
formatter: '{name|{b}}\n{value|{c} }',
|
||||||
|
minMargin: 5,
|
||||||
|
edgeDistance: 10,
|
||||||
|
lineHeight: 15,
|
||||||
|
rich: {
|
||||||
|
time: {
|
||||||
|
fontSize: 10,
|
||||||
|
color: '#999'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
type: 'pie',
|
||||||
|
radius: '50%',
|
||||||
|
data: [
|
||||||
|
{ value: 18.3, name: '本期线损电量', itemStyle: { color: 'rgb(104,187,196)' } },
|
||||||
|
{ value: 187.56, name: '本期用电量', itemStyle: { color: 'rgb(80,135,236)' } },
|
||||||
|
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
this.init_pieCharts(option);
|
||||||
|
const that = this;
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: function (res) {
|
||||||
|
that.setData({
|
||||||
|
statusBarHeight : res.statusBarHeight,
|
||||||
|
navBarHeight : res.statusBarHeight , // 顶部导航栏高度为 44px
|
||||||
|
jiaonangheight: wx.getMenuButtonBoundingClientRect().height, // 胶囊高度
|
||||||
|
jiaonangwidth:wx.getMenuButtonBoundingClientRect().width,
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
init_pieCharts: function(options) {
|
||||||
|
this.selectComponent('#echarts').init((canvas, width, height) => {
|
||||||
|
// 初始化图表
|
||||||
|
const pieChart = echarts.init(canvas, null, {
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
devicePixelRatio: getPixelRatio(),
|
||||||
|
});
|
||||||
|
|
||||||
|
pieChart.setOption(options);
|
||||||
|
// 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
||||||
|
return pieChart;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
download() {
|
||||||
|
const { id: tenement } = wx.getStorageSync('tenement')
|
||||||
|
const { id } = this.data;
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '为了您更好的体验,请复制链接,通过浏览器打开下载',
|
||||||
|
showCancel: true,
|
||||||
|
cancelText: '关闭',
|
||||||
|
confirmText: '复制链接',
|
||||||
|
|
||||||
|
complete: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
const result = wx.getAccountInfoSync();
|
||||||
|
const { envVersion } = result.miniProgram;
|
||||||
|
let api = ""
|
||||||
|
switch (envVersion) {
|
||||||
|
// 开发版
|
||||||
|
case 'develop':
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: `https://zgd.hbhcbn.com/user-report/?report=${id}&tenement=${tenement}`,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
// 体验版
|
||||||
|
case 'trial':
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: `https://zgd.hbhcbn.com/user-report/?report=${id}&tenement=${tenement}`,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
// 正式版
|
||||||
|
case 'release':
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: `https://zgd.hbhcbn.com/user-report-h5/?report=${id}&tenement=${tenement}`,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {}
|
"usingComponents": {
|
||||||
|
"navigator": "/components/navigator/index",
|
||||||
|
"avatar": "/components/avatar/index",
|
||||||
|
"van-row": "@vant/weapp/row/index",
|
||||||
|
"van-col": "@vant/weapp/col/index",
|
||||||
|
"echarts": "/components/echarts/ec-canvas",
|
||||||
|
"table": "/components/table/table",
|
||||||
|
"van-button": "@vant/weapp/button/index"
|
||||||
|
},
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,109 @@
|
|||||||
<!--pages/billDetail/index.wxml-->
|
<!--pages/billDetail/index.wxml-->
|
||||||
<view>
|
<navigator title="{{ time }}电费账单" canBack="{{true}}" />
|
||||||
<web-view src="{{url}}"/>
|
<view class="title" style="top: {{statusBarHeight + 46}}px">
|
||||||
|
<avatar text="{{detail.tenement.shortName}}" />
|
||||||
|
<view class="titleContent">
|
||||||
|
<view class="park">
|
||||||
|
<view class="label">
|
||||||
|
所属园区:
|
||||||
|
</view>
|
||||||
|
<view class="value"> {{ detail.park.name }} </view>
|
||||||
|
</view>
|
||||||
|
<view class="address">
|
||||||
|
<view class="label">
|
||||||
|
用电地址:
|
||||||
|
</view>
|
||||||
|
<view class="value"> {{ detail.tenement.address }} </view>
|
||||||
|
</view>
|
||||||
|
<view class="time">
|
||||||
|
<view class="label">
|
||||||
|
账单周期:
|
||||||
|
</view>
|
||||||
|
<view class="value"> {{ detail.comprehensive.startDate }} 至 {{ detail.comprehensive.endDate }} </view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<van-button type="info" size="small" class="download" bind:click="download">下载</van-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="wrapper">
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="contentTitle"> 本期账单 </view>
|
||||||
|
<van-row gutter="10">
|
||||||
|
<van-col span="8">
|
||||||
|
<view class="colContent">
|
||||||
|
<view class="colContentTitle">本期用电量</view>
|
||||||
|
<view class="colContentValue"> {{ detail.comprehensive.consumption }} 千瓦时 </view>
|
||||||
|
</view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="8">
|
||||||
|
<view class="colContent">
|
||||||
|
<view class="colContentTitle">本期电单价</view>
|
||||||
|
<view class="colContentValue"> {{ detail.comprehensive.price }} 元 </view>
|
||||||
|
</view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="8">
|
||||||
|
<view class="colContent">
|
||||||
|
<view class="colContentTitle">本期电费</view>
|
||||||
|
<view class="colContentValue"> {{ detail.comprehensive.total }} 元 </view>
|
||||||
|
</view>
|
||||||
|
</van-col>
|
||||||
|
</van-row>
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="contentTitle"> 电费构成 </view>
|
||||||
|
<echarts
|
||||||
|
style="width:200rpx;height:180rpx;"
|
||||||
|
id="echarts"
|
||||||
|
class='mychart-bar'
|
||||||
|
canvas-id="mychart-bar"
|
||||||
|
ec="{{ ec }}"
|
||||||
|
forceUseOldCanvas="{{false}}"
|
||||||
|
>
|
||||||
|
</echarts>
|
||||||
|
<view class="tooltip">
|
||||||
|
(本月电量+本月线损电量)*电单价+摊薄公摊电费+摊薄调整电费
|
||||||
|
</view>
|
||||||
|
<view class="line"></view>
|
||||||
|
<view class="contentTitle"> 电量明细 </view>
|
||||||
|
<view class="tableWrapper" wx:for="{{meters}}">
|
||||||
|
<view style="margin: 20rpx 0; background-color: #fff;">
|
||||||
|
<van-row custom-style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 电表地址 </view>
|
||||||
|
<view class="tableContent"> {{item.address}} </view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 起码 </view>
|
||||||
|
<view class="tableContent"> {{item.startNumber}} </view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 止码 </view>
|
||||||
|
<view class="tableContent"> {{item.endNumber}} </view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 倍率 </view>
|
||||||
|
<view class="tableContent"> {{item.displayRatio}} </view>
|
||||||
|
</van-col>
|
||||||
|
</van-row>
|
||||||
|
<van-row>
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 用电量 </view>
|
||||||
|
<view class="tableContent"> {{item.overall.amount}} </view>
|
||||||
|
|
||||||
|
</van-col>
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 线损电量 </view>
|
||||||
|
<view class="tableContent"> {{item.loss.amount}} </view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 公摊电量 </view>
|
||||||
|
<view class="tableContent"> {{item.publicAmount}} </view>
|
||||||
|
</van-col>
|
||||||
|
<van-col span="6">
|
||||||
|
<view class="tableTitle"> 合计电量 </view>
|
||||||
|
<view class="tableContent"> {{item.finalAmount}} </view>
|
||||||
|
</van-col>
|
||||||
|
</van-row>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view style="height: 20rpx;"></view>
|
||||||
@@ -1 +1,96 @@
|
|||||||
/* pages/billDetail/index.wxss */
|
/* pages/billDetail/index.wxss */
|
||||||
|
.title {
|
||||||
|
padding: 30rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: linear-gradient(to bottom, rgb(76,151,131), rgb(167,203,193) );
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: sticky;
|
||||||
|
z-index: 99 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titleContent {
|
||||||
|
margin-left: 30rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titleContent .park, .titleContent .address, .titleContent .time {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titleContent .address, .titleContent .time {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titleContent .label {
|
||||||
|
width: 170rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titleContent .value {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
height: 0.5rpx;
|
||||||
|
background-color: rgba(5, 5, 5, 0.06);
|
||||||
|
margin-top: 30rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
page {
|
||||||
|
background-color: var(--transparent-green);
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentTitle {
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colContent {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colContentTitle {
|
||||||
|
padding: 30rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.colContentValue {
|
||||||
|
padding-bottom: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tooltip {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: rgb(136, 132, 132);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tableTitle {
|
||||||
|
background-color: rgb(242,242,242);
|
||||||
|
font-size: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding: 6rpx 0;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tableContent {
|
||||||
|
font-size: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
padding: 6rpx 10rpx;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download {
|
||||||
|
position: absolute;
|
||||||
|
top: 20rpx;
|
||||||
|
right: 20rpx;
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ Page({
|
|||||||
const { page, list } = this.data;
|
const { page, list } = this.data;
|
||||||
const { code, data, message } = await getBillList(page)
|
const { code, data, message } = await getBillList(page)
|
||||||
if (!data?.length) {
|
if (!data?.length) {
|
||||||
alertInfo("没用更多了")
|
alertInfo("没有更多了")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
@@ -36,10 +36,6 @@ Page({
|
|||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/billDetail/index?id=' + report,
|
url: '/pages/billDetail/index?id=' + report,
|
||||||
})
|
})
|
||||||
// const { id: tenement } = wx.getStorageSync('tenement')
|
|
||||||
// wx.navigateTo({
|
|
||||||
// url: `https://zgd.hbhcbn.com/h5/?report=${report}&tenement=${tenement}`,
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"navigator": "/components/navigator/index",
|
"navigator": "/components/navigator/index",
|
||||||
"van-icon": "@vant/weapp/icon/index"
|
"van-icon": "@vant/weapp/icon/index",
|
||||||
|
"empty": "/components/empty/index"
|
||||||
},
|
},
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
<!--pages/billList/index.wxml-->
|
<!--pages/billList/index.wxml-->
|
||||||
<navigator title="电费账单" canBack="{{true}}" />
|
<navigator title="电费账单" canBack="{{true}}" />
|
||||||
|
<view wx:if="{{!list.length}}">
|
||||||
<view class="itemWrapper" wx:for="{{list}}" wx:key="index">
|
<empty bind:refresh="init" />
|
||||||
<van-icon name="balance-list-o" />
|
</view>
|
||||||
<view class="time"> {{ item.time }} </view>
|
<view wx:else>
|
||||||
<view class="operate" bind:tap="jumpToDetail" data-id="{{item.id}}"> 查看详细 </view>
|
<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" data-id="{{item.id}}"> 查看详细 </view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
// pages/editInvoice/index.js
|
|
||||||
Page({
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面的初始数据
|
|
||||||
*/
|
|
||||||
data: {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面加载
|
|
||||||
*/
|
|
||||||
onLoad(options) {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
|
||||||
*/
|
|
||||||
onReady() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面显示
|
|
||||||
*/
|
|
||||||
onShow() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面隐藏
|
|
||||||
*/
|
|
||||||
onHide() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生命周期函数--监听页面卸载
|
|
||||||
*/
|
|
||||||
onUnload() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
|
||||||
*/
|
|
||||||
onPullDownRefresh() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面上拉触底事件的处理函数
|
|
||||||
*/
|
|
||||||
onReachBottom() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户点击右上角分享
|
|
||||||
*/
|
|
||||||
onShareAppMessage() {
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<!--pages/editInvoice/index.wxml-->
|
|
||||||
<text>pages/editInvoice/index.wxml</text>
|
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
// pages/electricQuery/index.js
|
// pages/electricQuery/index.js
|
||||||
import { getAccountingList, getElectricityList, getMeterReadingList } from "../../service/accounting";
|
import { exportElectricityList, getAccountingList, getElectricityList, getMeterReadingList } from "../../service/accounting";
|
||||||
import { getTenementMeterList } from "../../service/meter";
|
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, getPixelRatio, loadingFunc } 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
|
||||||
@@ -77,27 +80,128 @@ Page({
|
|||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
async init() {
|
async init() {
|
||||||
const { queryType, timeType, meterId } = this.data;
|
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data;
|
||||||
const { code, message, data } = await getElectricityList({ type: queryType, meter: meterId, time: timeType })
|
let time;
|
||||||
this.setData({ list: data })
|
switch(timeType) {
|
||||||
|
case 1:
|
||||||
|
time = yearMonth;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
time = year;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
time = yearMonthDay;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const { code, message, data, electricNumber, meterNumber } = await getElectricityList({ type: timeType, meter: meterId, time: time })
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({ list: data, electricNumber, meterNumber })
|
||||||
|
if (!data?.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.selectComponent('#echarts').init((canvas, width, height) => {
|
||||||
|
// 初始化图表
|
||||||
|
const pieChart = echarts.init(canvas, null, {
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
devicePixelRatio: getPixelRatio(),
|
||||||
|
});
|
||||||
|
const ids = [...new Set(data?.map(item => item?.meter?.id))]
|
||||||
|
const options = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: data?.map(item => item?.meter?.address),
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '3%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '3%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
boundaryGap: false,
|
||||||
|
data: [...new Set(data?.map(item => item.time))]
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value'
|
||||||
|
},
|
||||||
|
series: ids?.map(item => {
|
||||||
|
const element = data?.find(i => i?.meter?.id === item)
|
||||||
|
return {
|
||||||
|
name: element?.meter?.address,
|
||||||
|
type: 'line',
|
||||||
|
stack: 'Total',
|
||||||
|
data: data?.filter(ele => ele?.meter?.id === item).map(item => item.number)
|
||||||
|
}})
|
||||||
|
|
||||||
|
};
|
||||||
|
pieChart.setOption(options);
|
||||||
|
// 注意这里一定要返回 chart 实例,否则会影响事件处理等
|
||||||
|
return pieChart;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
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 export() {
|
||||||
|
loadingFunc(async () => {
|
||||||
|
const { queryType, timeType, meterId, year, yearMonth, yearMonthDay } = this.data;
|
||||||
|
let time;
|
||||||
|
switch(timeType) {
|
||||||
|
case 1:
|
||||||
|
time = yearMonth;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
time = year;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
time = yearMonthDay;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const data = await exportElectricityList({ type: timeType, meter: meterId, time: time })
|
||||||
|
// if (code !== OK) {
|
||||||
|
// alertInfo(message)
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
wx.openDocument({
|
||||||
|
filePath: data.tempFilePath,
|
||||||
|
fileType: ['xlsx'],
|
||||||
|
success() {
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
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 || [],
|
||||||
@@ -120,20 +224,27 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onOk(e) {
|
onOk(e) {
|
||||||
const { type, value = {} } = e.detail;
|
const { id, code } = e.detail.value;
|
||||||
const { id, code } = e;
|
|
||||||
console.log('e', e)
|
|
||||||
const { year } = this.data;
|
|
||||||
// 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,
|
||||||
title: ""
|
title: ""
|
||||||
}, () => {
|
}, () => {
|
||||||
this.init();
|
const { queryType, } = this.data;
|
||||||
|
switch(queryType) {
|
||||||
|
case 1:
|
||||||
|
this.getReadingList();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this.getAccountingBalanceList();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.init();
|
||||||
|
break;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onTimeClose() {
|
onTimeClose() {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
"table": "/components/table/table",
|
"table": "/components/table/table",
|
||||||
"empty": "/components/empty/index",
|
"empty": "/components/empty/index",
|
||||||
"timePicker": "/components/timePicker/index",
|
"timePicker": "/components/timePicker/index",
|
||||||
"accountingCard": "./components/accountingCard/index"
|
"accountingCard": "./components/accountingCard/index",
|
||||||
|
"echarts": "/components/echarts/ec-canvas"
|
||||||
},
|
},
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<view class="timeText" wx:else> {{year}} </view>
|
<view class="timeText" wx:else> {{year}} </view>
|
||||||
<van-icon name="arrow-down" />
|
<van-icon name="arrow-down" />
|
||||||
</view>
|
</view>
|
||||||
<van-button type="info" size="small"> 导出 </van-button>
|
<van-button type="info" size="small" bind:click="export"> 导出 </van-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:elif="{{queryType === 1}}">
|
<view wx:elif="{{queryType === 1}}">
|
||||||
@@ -74,32 +74,36 @@
|
|||||||
<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}}">
|
||||||
<view style="margin: 30rpx;">
|
<view style="margin: 30rpx;">
|
||||||
<table header="{{meterReadingHeader}}" list="{{meterReadingList}}" wx:if="{{meterReadingList.length}}" />
|
<table header="{{meterReadingHeader}}" list="{{meterReadingList}}" wx:if="{{meterReadingList.length}}" />
|
||||||
<empty bind:refresh="init" wx:else />
|
<empty bind:refresh="getReadingList" wx:else />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</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>
|
||||||
<!-- <echarts
|
<echarts
|
||||||
style="width:200rpx;height:200rpx;position:relative"
|
style="width:200rpx;height:180rpx;"
|
||||||
id="echarts"
|
id="echarts"
|
||||||
class='mychart-bar'
|
class='mychart-bar'
|
||||||
canvas-id="mychart-bar"
|
canvas-id="mychart-bar"
|
||||||
ec="{{ ec }}"
|
ec="{{ ec }}"
|
||||||
|
forceUseOldCanvas="{{false}}"
|
||||||
|
wx:if="{{list.length}}"
|
||||||
>
|
>
|
||||||
</echarts> -->
|
</echarts>
|
||||||
<custom-picker
|
<custom-picker
|
||||||
title="{{title}}"
|
title="{{title}}"
|
||||||
show="{{show}}"
|
show="{{show}}"
|
||||||
|
|||||||
@@ -6,23 +6,24 @@ page {
|
|||||||
.queryWrapper {
|
.queryWrapper {
|
||||||
margin: 20rpx 0rpx;
|
margin: 20rpx 0rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 30rpx;
|
padding:15rpx 20rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
width: 180rpx;
|
width: 180rpx;
|
||||||
font-size: 34rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sum {
|
.sum {
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
|
padding-bottom: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.query {
|
.query {
|
||||||
@@ -31,9 +32,9 @@ page {
|
|||||||
|
|
||||||
.typeQueryText {
|
.typeQueryText {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 30rpx;
|
padding: 20rpx;
|
||||||
background-color: var(--light-green);
|
background-color: var(--light-green);
|
||||||
font-size: 34rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select {
|
.select {
|
||||||
@@ -43,13 +44,14 @@ page {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeQueryText {
|
.timeQueryText {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 30rpx;
|
padding: 20rpx;
|
||||||
background-color: rgb(242,248,246);
|
background-color: rgb(242,248,246);
|
||||||
font-size: 34rpx;
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
@@ -60,12 +62,13 @@ page {
|
|||||||
|
|
||||||
.tooltip {
|
.tooltip {
|
||||||
margin: 20rpx 0;
|
margin: 20rpx 0;
|
||||||
font-size: 32rpx;
|
font-size: 28rpx;
|
||||||
color: rgb(119, 114, 114);
|
color: rgb(97, 93, 93);
|
||||||
}
|
}
|
||||||
.timeChooseWrapper {
|
.timeChooseWrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
|
|||||||
@@ -14,14 +14,18 @@ Page({
|
|||||||
parkName: "",
|
parkName: "",
|
||||||
park: "",
|
park: "",
|
||||||
tenementName: "",
|
tenementName: "",
|
||||||
tenement: ""
|
tenement: "",
|
||||||
|
canBack: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
const { canBack } = options
|
||||||
|
if (canBack === 'false') {
|
||||||
|
this.setData({ canBack: false })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onChangeName(e) {
|
onChangeName(e) {
|
||||||
this.setData({
|
this.setData({
|
||||||
@@ -64,7 +68,7 @@ Page({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!phone) {
|
if (!phone) {
|
||||||
alertInfo("请输入联系人手机号")
|
alertInfo("请输入预留手机号")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
"van-field": "@vant/weapp/field/index",
|
"van-field": "@vant/weapp/field/index",
|
||||||
"van-icon": "@vant/weapp/icon/index",
|
"van-icon": "@vant/weapp/icon/index",
|
||||||
"van-tab": "@vant/weapp/tab/index",
|
"van-tab": "@vant/weapp/tab/index",
|
||||||
"van-tabs": "@vant/weapp/tabs/index"
|
"van-tabs": "@vant/weapp/tabs/index",
|
||||||
|
"navigator": "/components/navigator/index"
|
||||||
},
|
},
|
||||||
"navigationBarTitleText": "绑定商户"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<!--pages/handleLogin/index.wxml-->
|
<!--pages/handleLogin/index.wxml-->
|
||||||
<!-- <topbar /> -->
|
<!-- <topbar /> -->
|
||||||
|
<navigator title="绑定商户" canBack="{{canBack}}" />
|
||||||
<van-tabs>
|
<van-tabs>
|
||||||
<van-tab title="扫码绑定">
|
<van-tab title="扫码绑定">
|
||||||
<view class="codeContent">
|
<view class="codeContent">
|
||||||
@@ -24,8 +25,8 @@
|
|||||||
<van-field
|
<van-field
|
||||||
required
|
required
|
||||||
value="{{ phone }}"
|
value="{{ phone }}"
|
||||||
label="联系人手机号"
|
label="预留手机号"
|
||||||
placeholder="请输入联系人手机号"
|
placeholder="请输入预留手机号"
|
||||||
border="{{ true }}"
|
border="{{ true }}"
|
||||||
bind:change="onChangePhone"
|
bind:change="onChangePhone"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { alertInfo, alertSuccess } from "../../utils/index";
|
|||||||
import request from '../../utils/request';
|
import request from '../../utils/request';
|
||||||
import { getDot } from "../../utils/system";
|
import { getDot } from "../../utils/system";
|
||||||
import { getUserInfo } from "../../service/user"
|
import { getUserInfo } from "../../service/user"
|
||||||
import { requestRecharge } from "../../service/recharge";
|
|
||||||
const { OK } = request;
|
const { OK } = request;
|
||||||
// pages/home/index.js
|
// pages/home/index.js
|
||||||
Page({
|
Page({
|
||||||
@@ -22,6 +21,8 @@ Page({
|
|||||||
pickerType: "",
|
pickerType: "",
|
||||||
meterList: [],
|
meterList: [],
|
||||||
meterIndex: 0,
|
meterIndex: 0,
|
||||||
|
rechargeVisible: false,
|
||||||
|
background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,18 +53,29 @@ Page({
|
|||||||
onReady() {
|
onReady() {
|
||||||
|
|
||||||
},
|
},
|
||||||
async changeMeter() {
|
jumpToRecharge() {
|
||||||
const { meterList = [] } = this.data;
|
const { user } = this.data;
|
||||||
const newColumns = meterList.map(item => { item.id = item.code; item.name = `${item.code} - ${item.address}`; return item; })
|
if (!user || !user?.id) {
|
||||||
this.setData({
|
alertInfo("请先登录")
|
||||||
columns: newColumns,
|
return;
|
||||||
show: true,
|
}
|
||||||
pickerType: "meter"
|
wx.navigateTo({
|
||||||
|
url: '/pages/recharge/index',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async refreshMeter() {
|
|
||||||
const { meter } = this.data;
|
async setUser() {
|
||||||
this.handleGetMeterDetail(meter.id);
|
const result = await getUserInfo();
|
||||||
|
if (result.code !== OK) {
|
||||||
|
// alertInfo(result.message)
|
||||||
|
const user = wx.getStorageSync('user')
|
||||||
|
this.setData({ user: user })
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({ user: result.data })
|
||||||
|
wx.setStorageSync('user', result.data)
|
||||||
|
// const user = wx.getStorageSync('user')
|
||||||
|
// this.setData({ user: user })
|
||||||
},
|
},
|
||||||
onOk(e) {
|
onOk(e) {
|
||||||
const { type, index, value } = e.detail;
|
const { type, index, value } = e.detail;
|
||||||
@@ -79,7 +91,7 @@ Page({
|
|||||||
park: value,
|
park: value,
|
||||||
tenement: value.tenements?.[0]
|
tenement: value.tenements?.[0]
|
||||||
})
|
})
|
||||||
wx.setStorageSync('park', park)
|
wx.setStorageSync('park', value)
|
||||||
wx.setStorageSync('tenement', value.tenements?.[0])
|
wx.setStorageSync('tenement', value.tenements?.[0])
|
||||||
break;
|
break;
|
||||||
case "tenement":
|
case "tenement":
|
||||||
@@ -95,10 +107,6 @@ Page({
|
|||||||
tenement: value
|
tenement: value
|
||||||
})
|
})
|
||||||
|
|
||||||
break;
|
|
||||||
case "meter":
|
|
||||||
const { code, id } = e.detail.value;
|
|
||||||
this.handleGetMeterDetail(id)
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -119,68 +127,9 @@ Page({
|
|||||||
show: false,
|
show: false,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
changeMoney(e) {
|
|
||||||
const { money } = e.currentTarget.dataset;
|
|
||||||
this.setData({
|
|
||||||
money: money
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onChangeMoney(e) {
|
|
||||||
this.setData({ money: e.detail })
|
|
||||||
},
|
|
||||||
async recharge() {
|
|
||||||
const { user, money, meter, tenement, park } = this.data;
|
|
||||||
const that = this;
|
|
||||||
if (!user || !user.id) {
|
|
||||||
alertInfo("请先登录")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!money) {
|
|
||||||
alertInfo("请先输入金额")
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!meter?.code) {
|
|
||||||
alertInfo("没有选择表计")
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (money < 0.01) {
|
|
||||||
alertInfo("最少为1分")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const { code, message, data } = await requestRecharge({ money: Number(money), id: meter.id, tenement: tenement.id, park: park.id })
|
|
||||||
if (code !== OK) {
|
|
||||||
alertInfo(message)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wx.requestPayment({
|
|
||||||
timeStamp: data?.time,
|
|
||||||
nonceStr: data?.nonceStr,
|
|
||||||
package: "prepay_id=" + data?.prepay_id,
|
|
||||||
paySign: data?.paySign,
|
|
||||||
signType: 'RSA',
|
|
||||||
success: (res) => {
|
|
||||||
console.log('success', res)
|
|
||||||
alertSuccess("充值成功")
|
|
||||||
that.setData({
|
|
||||||
money: null
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail: (res) => {
|
|
||||||
console.log('fail', res)
|
|
||||||
alertInfo("请稍后重试")
|
|
||||||
},
|
|
||||||
complete: (res) => {
|
|
||||||
console.log('complete')
|
|
||||||
that.handleGetMeterDetail(meter.id)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
jumpToInvoice() {
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '/pages/invoiceList/index',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
jumpToLogin() {
|
jumpToLogin() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/login/index',
|
url: '/pages/login/index',
|
||||||
@@ -190,7 +139,6 @@ Page({
|
|||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow() {
|
onShow() {
|
||||||
this.setUser();
|
|
||||||
this.getAllList();
|
this.getAllList();
|
||||||
this.watchTenement();
|
this.watchTenement();
|
||||||
this.watchPark();
|
this.watchPark();
|
||||||
@@ -210,10 +158,8 @@ Page({
|
|||||||
set: function (newVal) {
|
set: function (newVal) {
|
||||||
// const oldValue = value;
|
// const oldValue = value;
|
||||||
wx.setStorageSync('tenement', newVal)
|
wx.setStorageSync('tenement', newVal)
|
||||||
if (value !== newVal) {
|
that.setUser();
|
||||||
that.getMeters(newVal);
|
// that.getMeters(newVal);
|
||||||
that.setUser();
|
|
||||||
}
|
|
||||||
value = newVal;
|
value = newVal;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -258,36 +204,32 @@ Page({
|
|||||||
const { code, message, data } = await getTenementMeterList(id);
|
const { code, message, data } = await getTenementMeterList(id);
|
||||||
if (code !== OK) {
|
if (code !== OK) {
|
||||||
alertInfo(message)
|
alertInfo(message)
|
||||||
|
this.setData({ meterList: [], meter: {} })
|
||||||
|
wx.setStorageSync('meter', {})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const storageMeter = wx.getStorageSync('meter');
|
|
||||||
this.setData({
|
this.setData({
|
||||||
meterList: data || [],
|
meterList: data || [],
|
||||||
meter: storageMeter || (data?.[0] || {})
|
meter: (data?.[0] || {})
|
||||||
})
|
})
|
||||||
if (!storageMeter) {
|
// if (!storageMeter) {
|
||||||
wx.setStorageSync('meter', data?.[0])
|
wx.setStorageSync('meter', data?.[0] || {} )
|
||||||
}
|
// }
|
||||||
},
|
|
||||||
async setUser() {
|
|
||||||
const result = await getUserInfo();
|
|
||||||
if (result.code !== OK) {
|
|
||||||
// alertInfo(result.message)
|
|
||||||
const user = wx.getStorageSync('user')
|
|
||||||
this.setData({ user: user })
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.setData({ user: result.data })
|
|
||||||
wx.setStorageSync('user', result.data)
|
|
||||||
// const user = wx.getStorageSync('user')
|
|
||||||
// this.setData({ user: user })
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getAllList() {
|
async getAllList() {
|
||||||
const { code, message, data } = await getOwnTenementList()
|
const { code, message, data } = await getOwnTenementList()
|
||||||
if (code !== OK) {
|
if (code !== OK) {
|
||||||
alertInfo(message)
|
alertInfo(message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!data?.length) {
|
||||||
|
alertInfo("尚无信息")
|
||||||
|
wx.redirectTo({
|
||||||
|
url: '/pages/handleLogin/index?back=false',
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
const [firstPark = {}] = data;
|
const [firstPark = {}] = data;
|
||||||
const { park, tenement } = this.data;
|
const { park, tenement } = this.data;
|
||||||
const updateDatas = {}
|
const updateDatas = {}
|
||||||
@@ -308,16 +250,9 @@ Page({
|
|||||||
...updateDatas
|
...updateDatas
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
jumpToRecord() {
|
|
||||||
wx.navigateTo({
|
jumpToShop() {
|
||||||
url: '/pages/rechargeRecord/index',
|
alertInfo("开发中");
|
||||||
})
|
|
||||||
},
|
|
||||||
jumpToOrder() {
|
|
||||||
// alertInfo("尚未完成")
|
|
||||||
wx.navigateTo({
|
|
||||||
url: '/pages/billList/index',
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"van-field": "@vant/weapp/field/index",
|
"van-field": "@vant/weapp/field/index",
|
||||||
"picker": "/components/picker/index",
|
"picker": "/components/picker/index",
|
||||||
"van-grid": "@vant/weapp/grid/index",
|
"van-grid": "@vant/weapp/grid/index",
|
||||||
"van-grid-item": "@vant/weapp/grid-item/index"
|
"van-grid-item": "@vant/weapp/grid-item/index",
|
||||||
|
"van-action-sheet": "@vant/weapp/action-sheet/index"
|
||||||
},
|
},
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
<!--pages/home/index.wxml-->
|
<!--pages/home/index.wxml-->
|
||||||
<page-meta page-style="{{ show ? 'overflow: hidden;' : '' }}" />
|
<page-meta page-style="{{ show ? 'overflow: hidden;' : '' }}" />
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<view class="top">
|
<view class="top">
|
||||||
|
|
||||||
<custom-status-bar transparent="{{true}}" />
|
<custom-status-bar transparent="{{true}}" />
|
||||||
<view class="chooseParkWrapper">
|
<view class="chooseParkWrapper">
|
||||||
用电管理服务 ·
|
用电管理服务 ·
|
||||||
@@ -24,80 +26,27 @@
|
|||||||
<view class="logined" wx:else>
|
<view class="logined" wx:else>
|
||||||
<avatar text="{{ user.nickName }}" />
|
<avatar text="{{ user.nickName }}" />
|
||||||
<view>
|
<view>
|
||||||
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="chooseTenement">{{tenement.name}} <van-icon name="arrow-down" style="margin-left: 16rpx;" /></van-button>
|
<view class="company" bind:tap="chooseTenement">
|
||||||
|
<view class="companyName"> {{tenement.name}} </view>
|
||||||
|
<van-icon name="arrow-down" style="margin-left: 16rpx;" />
|
||||||
|
</view>
|
||||||
<view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view>
|
<view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="rechargeWrapper">
|
<swiper indicator-dots="{{true}}" autoplay="{{true}}" interval="{{8000}}" duration="{{300}}">
|
||||||
<view class="card">
|
<block wx:for="{{background}}" wx:key="*this">
|
||||||
<view class="cardTop">
|
<swiper-item>
|
||||||
<view class="cardTopLeft">
|
<view class="swiper-item {{item}}">
|
||||||
<view wx:if="{{user.id}}"> {{ tenement.shortName}} - {{ meter.address }} </view>
|
{{item}}
|
||||||
<view wx:else> -- </view>
|
|
||||||
</view>
|
</view>
|
||||||
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="changeMeter" wx:if="{{user.id}}">
|
</swiper-item>
|
||||||
<van-icon name="exchange" />
|
</block>
|
||||||
切换电表
|
</swiper>
|
||||||
</van-button>
|
<van-grid column-num="2" direction="horizontal">
|
||||||
</view>
|
<van-grid-item icon="balance-list-o" text="充值" bind:tap="jumpToRecharge" />
|
||||||
<view class="cardContent">
|
<van-grid-item icon="shop-o" text="商城" bind:tap="jumpToShop" />
|
||||||
<view class="cardItem">
|
</van-grid>
|
||||||
<view class="cardItemLabel"> 电表编号: </view>
|
|
||||||
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.code}} </view>
|
|
||||||
<view class="cardItemValue" wx:else> -- </view>
|
|
||||||
</view>
|
|
||||||
<view class="cardItem">
|
|
||||||
<view class="cardItemLabel"> 电表地址: </view>
|
|
||||||
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.address}} </view>
|
|
||||||
<view class="cardItemValue" wx:else> -- </view>
|
|
||||||
</view>
|
|
||||||
<view class="cardItem">
|
|
||||||
<view class="cardItemLabel"> 电表余额: </view>
|
|
||||||
<view class="cardItemValue">
|
|
||||||
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </view>
|
|
||||||
<view class="text" wx:else> --- </view>
|
|
||||||
<van-button type="info" size="small" plain="{{true}}" bind:click="refreshMeter" wx:if="{{user.id}}">
|
|
||||||
<van-icon name="replay" />
|
|
||||||
刷新
|
|
||||||
</van-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="recharge">
|
|
||||||
<view> 请输入金额: </view>
|
|
||||||
<view class="moneyBox">
|
|
||||||
<view class="money" bind:tap="changeMoney" data-money="30"> ¥30 </view>
|
|
||||||
<view class="money" bind:tap="changeMoney" data-money="50"> ¥50 </view>
|
|
||||||
<view class="money" bind:tap="changeMoney" data-money="100"> ¥100 </view>
|
|
||||||
<view class="money" style="margin-right: 0;" bind:tap="changeMoney" data-money="200"> ¥200 </view>
|
|
||||||
</view>
|
|
||||||
<view class="moneyInput">
|
|
||||||
<van-field
|
|
||||||
value="{{ money }}"
|
|
||||||
placeholder="请输入充值金额"
|
|
||||||
border="{{true}}"
|
|
||||||
bind:change="onChangeMoney"
|
|
||||||
size="large"
|
|
||||||
type="digit"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="operate">
|
|
||||||
<van-button color="rgb(88, 165, 141)" block bind:click="recharge">去缴费</van-button>
|
|
||||||
</view>
|
|
||||||
<view class="others">
|
|
||||||
<van-grid direction="horizontal" column-num="2">
|
|
||||||
<van-grid-item icon="balance-list-o" text="电费账单" bind:click="jumpToOrder">
|
|
||||||
<!-- <view slot="icon"> 111 </view> -->
|
|
||||||
<!-- <van-icon slot="icom" name="balance-list-o" /> -->
|
|
||||||
</van-grid-item>
|
|
||||||
<van-grid-item icon="after-sale" text="缴费记录" bind:click="jumpToRecord" />
|
|
||||||
<van-grid-item icon="bar-chart-o" text="用电查询" />
|
|
||||||
<van-grid-item icon="bill-o" text="去开票" bind:click="jumpToInvoice" />
|
|
||||||
</van-grid>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<picker show="{{show}}" valueKey="name" columns="{{columns}}" bind:ok="onOk" bind:cancel="onCancel" type="{{pickerType}}" />
|
<picker show="{{show}}" valueKey="name" columns="{{columns}}" bind:ok="onOk" bind:cancel="onCancel" type="{{pickerType}}" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,118 +21,47 @@
|
|||||||
|
|
||||||
.park {
|
.park {
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
|
max-width: 200rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.parkContent {
|
.parkContent {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notLoginWrapper, .logined {
|
.notLoginWrapper, .logined {
|
||||||
padding: 30rpx 32rpx;
|
padding: 24rpx 32rpx;
|
||||||
|
padding-left: 50rpx;
|
||||||
background-color: var(--middle-green);
|
background-color: var(--middle-green);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loginBtn {
|
.loginBtn, .company {
|
||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rechargeWrapper {
|
.company {
|
||||||
background: linear-gradient(to bottom, var(--middle-green), #fff );
|
font-size: 32rpx;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.companyName {
|
||||||
|
max-width:300rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
.card {
|
|
||||||
margin-top: 1vh;
|
|
||||||
margin-left: 46rpx;
|
|
||||||
margin-right: 46rpx;
|
|
||||||
border-radius: 30rpx;
|
|
||||||
padding: 28rpx 30rpx;
|
|
||||||
/* background-color: rgb(173, 217, 203); */
|
|
||||||
background: linear-gradient(to bottom right, rgb(212, 240, 231), rgb(145, 206, 185));
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardTop {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardTopLeft {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardContent {
|
|
||||||
margin: 30rpx 20rpx 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardItem {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
font-size: 34rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardItemValue {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardItemValue .text {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recharge {
|
|
||||||
background: #fff;
|
|
||||||
padding: 20rpx 30rpx;
|
|
||||||
margin-top: 30rpx;
|
|
||||||
margin-left: 46rpx;
|
|
||||||
margin-right: 46rpx;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
border-radius: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.operate {
|
|
||||||
margin-left: 46rpx;
|
|
||||||
margin-right: 46rpx;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome {
|
.welcome {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
font-size: 32rpx;
|
font-size: 30rpx;
|
||||||
color: #fff;
|
color: rgba(255,255,255, .85);
|
||||||
}
|
|
||||||
|
|
||||||
.moneyBox {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.money {
|
|
||||||
flex: 1;
|
|
||||||
padding: 16rpx;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
border: 1rpx solid #ccc;
|
|
||||||
margin-right: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.moneyInput {
|
|
||||||
margin-top: 30rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.others {
|
|
||||||
margin-left: 46rpx;
|
|
||||||
margin-right: 46rpx;
|
|
||||||
margin-top: 40rpx;
|
|
||||||
margin-bottom: 40rpx;
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { getInvoiceInfoDetail } from "../../service/invoice";
|
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
|
||||||
|
import { alertError, alertInfo, loadingFunc } from "../../utils/index";
|
||||||
|
import request from '../../utils/request'
|
||||||
|
const { OK } = request;
|
||||||
// pages/invoiceInfo/index.js
|
// pages/invoiceInfo/index.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@@ -7,7 +9,8 @@ Page({
|
|||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
detail: {}
|
detail: {},
|
||||||
|
id: "",
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,14 +22,74 @@ Page({
|
|||||||
},
|
},
|
||||||
async init(id) {
|
async init(id) {
|
||||||
const { code, message, data } = await getInvoiceInfoDetail(id)
|
const { code, message, data } = await getInvoiceInfoDetail(id)
|
||||||
this.setData({ detail: data });
|
this.setData({ detail: data, id });
|
||||||
},
|
},
|
||||||
handleBack() {
|
handleBack() {
|
||||||
wx.navigateBack()
|
wx.navigateBack()
|
||||||
},
|
},
|
||||||
jumpToDetail() {
|
jumpToDetail() {
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/invoiceDetailContent/index',
|
url: '/pages/invoiceDetailContent/index?id=' + this.data.id,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
download() {
|
||||||
|
const that = this;
|
||||||
|
wx.showActionSheet({
|
||||||
|
itemList: ['发票XML文件下载', '发票PDF文件下载'],
|
||||||
|
async success(res) {
|
||||||
|
loadingFunc(async () => {
|
||||||
|
const { code, message, data } = await downloadInvoice(that.data.id, res.tapIndex);
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!data) {
|
||||||
|
alertInfo("暂无文档信息")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.downloadFile({
|
||||||
|
url: data,
|
||||||
|
success(res) {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
if (!res.tempFilePath) {
|
||||||
|
alertError("没有开票信息")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wx.openDocument({
|
||||||
|
filePath: res.tempFilePath,
|
||||||
|
fileType: [res.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!!
|
||||||
|
success: function (res) {
|
||||||
|
|
||||||
|
},
|
||||||
|
fail: function (e) {
|
||||||
|
alertError("打开失败")
|
||||||
|
console.log('打开失败错误为', e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (e) => {
|
||||||
|
console.log('e', e)
|
||||||
|
alertInfo("下载文件失败")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// console.log('data', data)
|
||||||
|
// const filePath = `${wx.env.USER_DATA_PATH}/发票/${that.data.id}.${res.tapIndex === 0 ? 'xml' : "pdf"}`;
|
||||||
|
// FileSystemManager.writeFile({
|
||||||
|
// filePath: filePath,
|
||||||
|
// data: res.data,
|
||||||
|
// encoding: 'base64', // 2. base64解密写入, 后台返回的byte[]数组是经过base64编码的,其他方式写入文件打开格式不对
|
||||||
|
// success: function(res) {
|
||||||
|
|
||||||
|
// },
|
||||||
|
// fail: function (e) {
|
||||||
|
// console.log(e.errMsg);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -50,14 +50,25 @@
|
|||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
<navigator title="发票详细" canBack="{{true}}" bind:back="back" />
|
<navigator title="发票详细" canBack="{{true}}" bind:back="back" />
|
||||||
<view class="wrapper">
|
<view wx:if="{{detail.status === 2}}">
|
||||||
<view style="margin-top: 40rpx;"> 尊敬的客户,您好: </view>
|
<view class="wrapper">
|
||||||
<view style="margin-top: 20rpx;"> 已经为您开具订单2222222222的发票,发票数量共计1张,如下: </view>
|
<view style="margin-top: 40rpx;"> 尊敬的客户,您好: </view>
|
||||||
<view style="margin-top: 20rpx;"> 发票类型:数电发票(电子发票),发票号码:54645654656556,您可以点击“发票XML文件下载”获取该发票XML文件,或者点击“发票PDF文件下载”获取该发票PDF文件; </view>
|
<view style="margin-top: 20rpx;"> 已经为您开具订单{{detail.id}}的发票,发票数量共计1张,如下: </view>
|
||||||
<view style="margin-top: 20rpx;"> 同时您也可以到预留的邮箱中查看下载发票。 </view>
|
<view style="margin-top: 20rpx;"> 发票类型:数电发票(电子发票),发票号码:{{detail.number}},您可以点击“发票XML文件下载”获取该发票XML文件,或者点击“发票PDF文件下载”获取该发票PDF文件; </view>
|
||||||
</view>
|
<view style="margin-top: 20rpx;"> 同时您也可以到预留的邮箱中查看下载发票。 </view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="operate">
|
<view class="operate">
|
||||||
<van-button type="info" style="flex: 1;" block> 下载 </van-button>
|
<van-button type="info" style="flex: 1;" block bind:click="download"> 下载 </van-button>
|
||||||
<van-button type="info" style="flex: 1;margin-left: 40rpx;" block bind:click="jumpToDetail"> 发票明细 </van-button>
|
<van-button type="info" style="flex: 1;margin-left: 40rpx;" block bind:click="jumpToDetail"> 发票明细 </van-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{detail.status === 1}}">
|
||||||
|
<view class="wrapper">
|
||||||
|
<view style="margin-top: 40rpx;"> 尊敬的客户,您好: </view>
|
||||||
|
<view style="margin-top: 20rpx;"> 开票申请已提交,系统正在开票中,请您稍后再查看。 </view>
|
||||||
|
</view>
|
||||||
|
<view class="operate">
|
||||||
|
<van-button type="info" style="flex: 1;" block bind:click="jumpToDetail"> 发票明细 </van-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -8,6 +8,7 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
detail: {},
|
detail: {},
|
||||||
|
id: "",
|
||||||
header: [
|
header: [
|
||||||
{ key: 'time', title: '月份' },
|
{ key: 'time', title: '月份' },
|
||||||
{ title: '电表地址',renderBody: (item) => item.meter.address },
|
{ title: '电表地址',renderBody: (item) => item.meter.address },
|
||||||
@@ -25,12 +26,13 @@ Page({
|
|||||||
async getDetail(id) {
|
async getDetail(id) {
|
||||||
const { code, message, data } = await getInvoiceInfoDetail(id);
|
const { code, message, data } = await getInvoiceInfoDetail(id);
|
||||||
this.setData({
|
this.setData({
|
||||||
detail: data
|
detail: data,
|
||||||
|
id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
jumpToInvoiceDetail() {
|
jumpToInvoiceDetail() {
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/invoiceDetail/index',
|
url: '/pages/invoiceDetail/index?id=' + this.data.id,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
title-width="160rpx"
|
title-width="160rpx"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{detail.invoice.type === 0 ? '普通电子发票' : '增值税专用电子发票'}}"
|
value="{{detail.invoice.type === 0 ? '普通发票' : '增值税专用发票'}}"
|
||||||
label="发票类型 :"
|
label="发票类型 :"
|
||||||
readonly
|
readonly
|
||||||
autosize="{{true}}"
|
autosize="{{true}}"
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ Component({
|
|||||||
list: []
|
list: []
|
||||||
},
|
},
|
||||||
onRefresh() {
|
onRefresh() {
|
||||||
console.log('--------------')
|
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
lifetimes: {
|
lifetimes: {
|
||||||
@@ -36,7 +35,7 @@ Component({
|
|||||||
const { page, list = [] } = this.data;
|
const { page, list = [] } = this.data;
|
||||||
const { code, message, data } = await getAlreadyInvoiceList(page);
|
const { code, message, data } = await getAlreadyInvoiceList(page);
|
||||||
if (!data.length) {
|
if (!data.length) {
|
||||||
alertInfo("没用更多数据了")
|
alertInfo("没有更多数据了")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
@@ -50,9 +49,10 @@ Component({
|
|||||||
scrollToLower() {
|
scrollToLower() {
|
||||||
loadingFunc(() => this.getList())
|
loadingFunc(() => this.getList())
|
||||||
},
|
},
|
||||||
jumpToDetail() {
|
jumpToDetail(e) {
|
||||||
|
const { id } = e.currentTarget.dataset;
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/invoiceDetail/index',
|
url: '/pages/invoiceDetail/index?id=' + id,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
jumpToDetailContent(e) {
|
jumpToDetailContent(e) {
|
||||||
|
|||||||
@@ -8,24 +8,29 @@
|
|||||||
{{item.invoice.name}}
|
{{item.invoice.name}}
|
||||||
</view>
|
</view>
|
||||||
<view class="invoiceContent">
|
<view class="invoiceContent">
|
||||||
发票内容: {{item.invoice.content}}
|
发票内容: {{item.invoice.content}}({{item.money}}元)
|
||||||
</view>
|
</view>
|
||||||
<view class="invoiceType">
|
<view class="invoiceType">
|
||||||
发票类型:{{ item.invoice.type === 0 ? '普通电子发票' : '增值税专用电子发票' }}
|
发票类型:{{ item.invoice.type === 0 ? '普通发票' : '增值税专用发票' }}
|
||||||
</view>
|
</view>
|
||||||
<view class="time">
|
<view class="time">
|
||||||
{{item.finishTime}}
|
{{item.finishTime}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="money"> ¥{{item.money}} </view>
|
|
||||||
|
<view class="money"> </view>
|
||||||
<view class="operate">
|
<view class="operate">
|
||||||
<view style="margin-top: 20rpx; margin-bottom: 20rpx;">
|
<view style="margin-top: 20rpx; margin-bottom: 20rpx;">
|
||||||
<van-button type="info" class="invoiceBtn" bind:click="submit" size="small" bind:click="jumpToDetail">发票</van-button>
|
<van-button type="info" class="invoiceBtn" bind:click="submit" size="small" bind:click="jumpToDetail" data-id="{{item.id}}">发票</van-button>
|
||||||
</view>
|
</view>
|
||||||
<van-button type="info" class="detailBtn" bind:click="submit" size="small" bind:click="jumpToDetailContent" data-id="{{item.id}}">明细</van-button>
|
<van-button type="info" class="detailBtn" bind:click="submit" size="small" bind:click="jumpToDetailContent" data-id="{{item.id}}">明细</van-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="{{item.status === 1 ? 'approving' : 'already'}}">
|
||||||
|
<view wx:if="{{item.status === 1}}"> 审核中 </view>
|
||||||
|
<view wx:else> 已开票 </view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 50rpx;"></view>
|
<view style="height: 50rpx;"></view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|||||||
@@ -8,15 +8,17 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 26rpx;
|
border-radius: 26rpx;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
box-sizing: border-box
|
box-sizing: border-box;
|
||||||
;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
.right {
|
.right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
.detailBtn {
|
.detailBtn {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
@@ -31,3 +33,31 @@
|
|||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.operate {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.approving {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 30rpx;
|
||||||
|
background-color: rgb(239,227,227);
|
||||||
|
padding: 14rpx 24rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
color: rgb(224, 106, 106)
|
||||||
|
}
|
||||||
|
|
||||||
|
.already {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 30rpx;
|
||||||
|
background-color: #0958d9;
|
||||||
|
padding: 14rpx 24rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
color: #fff;
|
||||||
|
/* color: var(--deep-green) */
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getInvoiceInfo, updateInvoiceInfo } from "../../../../service/invoice"
|
import { getInvoiceInfo, updateInvoiceInfo } from "../../../../service/invoice"
|
||||||
import { getUserInfo } from "../../../../service/user";
|
import { getUserInfo } from "../../../../service/user";
|
||||||
import { alertInfo, alertSuccess } from "../../../../utils/index";
|
import { alertInfo, alertSuccess, isValidPhoneNumber } from "../../../../utils/index";
|
||||||
import request from '../../../../utils/request'
|
import request from '../../../../utils/request'
|
||||||
const { OK } = request
|
const { OK } = request
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ Component({
|
|||||||
this.setData({ user: data });
|
this.setData({ user: data });
|
||||||
},
|
},
|
||||||
changeEditType() {
|
changeEditType() {
|
||||||
this.setData({ editType: 'edit', formData: this.data.detail })
|
this.setData({ editType: 'edit', formData: {...this.data.detail, tenement: wx.getStorageSync('tenement')?.id} })
|
||||||
},
|
},
|
||||||
cancelEdit() {
|
cancelEdit() {
|
||||||
this.setData({ editType: 'detail', formData: {} })
|
this.setData({ editType: 'detail', formData: {} })
|
||||||
@@ -93,9 +93,9 @@ Component({
|
|||||||
// alertInfo("请输入地址")
|
// alertInfo("请输入地址")
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
if (!phone) {
|
if (phone && !isValidPhoneNumber(phone)) {
|
||||||
alertInfo("请输入电话")
|
alertInfo("手机号格式不正确")
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if (!bank) {
|
if (!bank) {
|
||||||
alertInfo("请输入开户行")
|
alertInfo("请输入开户行")
|
||||||
@@ -107,6 +107,10 @@ Component({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { code, message } = await updateInvoiceInfo(formData)
|
const { code, message } = await updateInvoiceInfo(formData)
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
alertSuccess("编辑成功")
|
alertSuccess("编辑成功")
|
||||||
this.getDetail()
|
this.getDetail()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,229 +12,339 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view slot="content">
|
<view slot="content">
|
||||||
<van-field
|
<view wx:if="{{editType === 'detail'}}">
|
||||||
label="发票类型"
|
<van-field
|
||||||
readonly="{{editType === 'detail'}}"
|
label="发票类型"
|
||||||
autosize="{{true}}"
|
readonly="{{true}}"
|
||||||
type="textarea"
|
autosize="{{true}}"
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
|
||||||
title-width="132rpx"
|
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
|
||||||
>
|
|
||||||
<view slot="input" style="margin-top: 16rpx;" wx:if="{{editType === 'edit'}}">
|
|
||||||
<van-radio-group direction="horizontal" value="{{formData.type}}" bind:change="onChangeType">
|
|
||||||
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">普通电子</van-radio>
|
|
||||||
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">增值税专用电子</van-radio>
|
|
||||||
</van-radio-group>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view wx:else slot="input" style="margin-top: -10rpx;">
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
<view wx:if="{{detail.type === 0}}"> 普通电子发票 </view>
|
title-width="132rpx"
|
||||||
<view wx:elif="{{detail.type === 1}}"> 增值税专用电子发票 </view>
|
border="{{ false }}"
|
||||||
<view wx:else>-</view>
|
value="普通发票"
|
||||||
</view>
|
wx:if="{{detail.type === 0}}"
|
||||||
</van-field>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
label="抬头类型"
|
label="发票类型"
|
||||||
readonly="{{editType === 'detail'}}"
|
readonly="{{true}}"
|
||||||
autosize="{{true}}"
|
autosize="{{true}}"
|
||||||
type="textarea"
|
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
title-width="132rpx"
|
title-width="132rpx"
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
border="{{ false }}"
|
||||||
>
|
value="增值税专用发票"
|
||||||
<view slot="input" style="margin-top: 16rpx;" wx:if="{{editType === 'edit'}}">
|
wx:elif="{{detail.type === 1}}"
|
||||||
<van-radio-group direction="horizontal" bind:change="onChangeHeaderType" value="{{formData.headerType}}">
|
/>
|
||||||
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">企业单位</van-radio>
|
<van-field
|
||||||
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">个人/非企业单位</van-radio>
|
label="发票类型"
|
||||||
</van-radio-group>
|
readonly="{{true}}"
|
||||||
</view>
|
autosize="{{true}}"
|
||||||
<view
|
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ false }}"
|
||||||
|
value="-"
|
||||||
|
wx:elif="{{detail.type === 1}}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
label="抬头类型"
|
||||||
|
readonly="{{true}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ false }}"
|
||||||
|
value="企业单位"
|
||||||
|
wx:if="{{detail.headerType === 0}}"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
slot="input"
|
||||||
|
style="margin-top: -10rpx;"
|
||||||
|
>
|
||||||
|
<view wx:if="{{detail.headerType === 0}}"> 企业单位 </view>
|
||||||
|
<view wx:elif="{{detail.headerType === 1}}"> 个人/非企业单位 </view>
|
||||||
|
<view wx:else>-</view>
|
||||||
|
</view>
|
||||||
|
</van-field>
|
||||||
|
<van-field
|
||||||
|
label="抬头类型"
|
||||||
|
readonly="{{true}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ false }}"
|
||||||
|
value="个人/非企业单位"
|
||||||
|
wx:elif="{{detail.headerType === 1}}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
label="抬头类型"
|
||||||
|
readonly="{{true}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ false }}"
|
||||||
|
value="个人/非企业单位"
|
||||||
wx:else
|
wx:else
|
||||||
slot="input"
|
/>
|
||||||
style="margin-top: -10rpx;"
|
|
||||||
|
<van-field
|
||||||
|
value="{{detail.name || '-'}}"
|
||||||
|
label="发票抬头"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{true}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ false }}"
|
||||||
>
|
>
|
||||||
<view wx:if="{{detail.headerType === 0}}"> 企业单位 </view>
|
</van-field>
|
||||||
<view wx:elif="{{detail.headerType === 1}}"> 个人/非企业单位 </view>
|
<van-field
|
||||||
<view wx:else>-</view>
|
label="发票税号"
|
||||||
</view>
|
value="{{detail.tin || '-'}}"
|
||||||
</van-field>
|
wx:if="{{detail.headerType === 0}}"
|
||||||
<van-field
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
value="{{formData.name}}"
|
readonly="{{editType === 'detail'}}"
|
||||||
label="发票抬头"
|
autosize="{{true}}"
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
|
||||||
readonly="{{editType === 'detail'}}"
|
title-width="132rpx"
|
||||||
disabled="{{editType === 'edit' && formData.headerType !== 1}}"
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
autosize="{{true}}"
|
|
||||||
type="textarea"
|
|
||||||
title-width="132rpx"
|
|
||||||
bind:change="onChangeText"
|
|
||||||
data-name="name"
|
|
||||||
bind:change="onChangeText"
|
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail'}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
>
|
||||||
<view wx:if="{{!!detail.name}}" style="margin-top: -10rpx;"> {{detail.name}} </view>
|
</van-field>
|
||||||
<view wx:else style="margin-top: -10rpx;">--</view>
|
<van-field
|
||||||
</view>
|
value="{{detail.bank || '-'}}"
|
||||||
</van-field>
|
label="开户行"
|
||||||
<van-field
|
wx:if="{{detail.headerType === 0}}"
|
||||||
value="{{formData.tin}}"
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
label="发票税号"
|
readonly="{{editType === 'detail'}}"
|
||||||
wx:if="{{(editType === 'edit' && formData.headerType === 0) || (editType === 'detail' && detail.headerType === 0)}}"
|
autosize="{{true}}"
|
||||||
placeholder="{{editType === 'edit' ? '请输入发票税号' : ''}}"
|
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
title-width="132rpx"
|
||||||
readonly="{{editType === 'detail'}}"
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
autosize="{{true}}"
|
|
||||||
type="textarea"
|
|
||||||
title-width="132rpx"
|
|
||||||
bind:change="onChangeText"
|
|
||||||
data-name="tin"
|
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail'}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
>
|
||||||
<view wx:if="{{!!detail.tin}}" style="margin-top: -10rpx;">{{detail.tin}}</view>
|
</van-field>
|
||||||
<view wx:else style="margin-top: -10rpx;">-</view>
|
<van-field
|
||||||
</view>
|
label="银行账号"
|
||||||
</van-field>
|
value="{{detail.account || '-'}}"
|
||||||
<van-field
|
wx:if="{{(detail.headerType === 0)}}"
|
||||||
value="{{formData.bank}}"
|
placeholder="{{editType === 'edit' ? '请输入银行账号' : ''}}"
|
||||||
label="开户行"
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
wx:if="{{(editType === 'edit' && formData.headerType === 0) || (editType === 'detail' && detail.headerType === 0)}}"
|
readonly="{{editType === 'detail'}}"
|
||||||
placeholder="{{editType === 'edit' ? '请输入开户行' : ''}}"
|
autosize="{{true}}"
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
|
||||||
readonly="{{editType === 'detail'}}"
|
title-width="132rpx"
|
||||||
autosize="{{bank}}"
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
type="textarea"
|
bind:change="onChangeText"
|
||||||
title-width="132rpx"
|
data-name="account"
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
|
||||||
bind:change="onChangeText"
|
|
||||||
data-name="bank"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail'}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
>
|
||||||
<view wx:if="{{!!detail.bank}}" style="margin-top: -10rpx;">{{detail.bank}}</view>
|
</van-field>
|
||||||
<view wx:else style="margin-top: -10rpx;">-</view>
|
<van-field
|
||||||
</view>
|
label="地址"
|
||||||
</van-field>
|
wx:if="{{(detail.headerType === 0)}}"
|
||||||
<van-field
|
placeholder="{{editType === 'edit' ? '请输入地址' : ''}}"
|
||||||
value="{{formData.account}}"
|
custom-style="padding-left: 0; padding-right: 0; height: auto;"
|
||||||
label="银行账号"
|
readonly="{{editType === 'detail'}}"
|
||||||
wx:if="{{(editType === 'edit' && formData.headerType === 0) || (editType === 'detail' && detail.headerType === 0)}}"
|
autosize="{{true}}"
|
||||||
placeholder="{{editType === 'edit' ? '请输入银行账号' : ''}}"
|
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
title-width="132rpx"
|
||||||
readonly="{{editType === 'detail'}}"
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
autosize="{{true}}"
|
bind:change="onChangeText"
|
||||||
type="textarea"
|
data-name="address"
|
||||||
title-width="132rpx"
|
value="{{detail.address || '-'}}"
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
|
||||||
bind:change="onChangeText"
|
|
||||||
data-name="account"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail' && !detail.account}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
>
|
||||||
<view wx:if="{{!!detail.account}}">{{detail.account}}</view>
|
</van-field>
|
||||||
<view>-</view>
|
|
||||||
</view>
|
<van-field
|
||||||
</van-field>
|
label="备注"
|
||||||
<van-field
|
wx:if="{{editType === 'detail' }}"
|
||||||
value="{{detail.address}}"
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
label="地址"
|
readonly="{{editType === 'detail'}}"
|
||||||
wx:if="{{(editType === 'edit' && formData.headerType === 0) || (editType === 'detail' && detail.headerType === 0)}}"
|
autosize="{{true}}"
|
||||||
placeholder="{{editType === 'edit' ? '请输入地址' : ''}}"
|
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
title-width="132rpx"
|
||||||
readonly="{{editType === 'detail'}}"
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
autosize="{{true}}"
|
bind:change="onChangeText"
|
||||||
type="textarea"
|
data-name="remark"
|
||||||
title-width="132rpx"
|
value="{{detail.remark || '-'}}"
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
|
||||||
bind:change="onChangeText"
|
|
||||||
data-name="address"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail'}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
>
|
||||||
<view wx:if="{{!!detail.address}}">{{detail.address}}</view>
|
<!-- <view slot="input" style="margin-top: -10rpx;">
|
||||||
<view>-</view>
|
<view> {{detail.remark || '-'}} </view>
|
||||||
</view>
|
</view> -->
|
||||||
</van-field>
|
</van-field>
|
||||||
<van-field
|
</view>
|
||||||
value="{{detail.phone}}"
|
<view wx:else>
|
||||||
label="电话"
|
<van-field
|
||||||
wx:if="{{(editType === 'edit' && formData.headerType === 0) || (editType === 'detail' && detail.headerType === 0)}}"
|
label="发票类型"
|
||||||
placeholder="{{editType === 'edit' ? '请输入电话' : ''}}"
|
autosize="{{true}}"
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
readonly="{{editType === 'detail'}}"
|
title-width="132rpx"
|
||||||
autosize="{{true}}"
|
border="{{ true }}"
|
||||||
type="textarea"
|
|
||||||
title-width="132rpx"
|
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
|
||||||
bind:change="onChangeText"
|
|
||||||
data-name="phone"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail' && !detail.phone}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
>
|
||||||
<view>-</view>
|
<view slot="input" style="margin-top: 16rpx;">
|
||||||
</view>
|
<van-radio-group direction="horizontal" value="{{formData.type}}" bind:change="onChangeType">
|
||||||
</van-field>
|
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">普通发票</van-radio>
|
||||||
<van-field
|
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">增值税专用发票</van-radio>
|
||||||
value="{{detail.remark}}"
|
</van-radio-group>
|
||||||
label="备注"
|
</view>
|
||||||
placeholder="{{editType === 'edit' ? '请输入备注' : ''}}"
|
</van-field>
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
<van-field
|
||||||
readonly="{{editType === 'detail'}}"
|
label="抬头类型"
|
||||||
autosize="{{true}}"
|
autosize="{{true}}"
|
||||||
type="textarea"
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
title-width="132rpx"
|
title-width="132rpx"
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
border="{{ true }}"
|
||||||
bind:change="onChangeText"
|
|
||||||
data-name="remark"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail' && !detail.remark}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
>
|
||||||
<view>-</view>
|
<view slot="input" style="margin-top: 16rpx;">
|
||||||
</view>
|
<van-radio-group direction="horizontal" bind:change="onChangeHeaderType" value="{{formData.headerType}}">
|
||||||
</van-field>
|
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">企业单位</van-radio>
|
||||||
|
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">个人/非企业单位</van-radio>
|
||||||
|
</van-radio-group>
|
||||||
|
</view>
|
||||||
|
</van-field>
|
||||||
|
<van-field
|
||||||
|
wx:if="{{formData.headerType === 0 }}"
|
||||||
|
value="{{formData.name || '--'}}"
|
||||||
|
label="发票抬头"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{true}}"
|
||||||
|
disabled="{{true}}"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ true }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
wx:else
|
||||||
|
value="{{formData.name}}"
|
||||||
|
label="发票抬头"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="name"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
border="{{ true }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.tin }}"
|
||||||
|
label="发票税号"
|
||||||
|
wx:if="{{formData.headerType === 0}}"
|
||||||
|
placeholder="{{'请输入发票税号'}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="tin"
|
||||||
|
border="{{true }}"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<van-field
|
||||||
|
value="{{formData.bank}}"
|
||||||
|
label="开户行"
|
||||||
|
wx:if="{{ formData.headerType === 0}}"
|
||||||
|
placeholder="{{'请输入开户行'}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="bank"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<van-field
|
||||||
|
value="{{formData.account}}"
|
||||||
|
label="银行账号"
|
||||||
|
wx:if="{{(formData.headerType === 0) }}"
|
||||||
|
placeholder="{{'请输入银行账号' }}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="account"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<van-field
|
||||||
|
value="{{formData.address}}"
|
||||||
|
label="地址"
|
||||||
|
wx:if="{{(formData.headerType === 0)}}"
|
||||||
|
placeholder="{{'请输入地址'}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="address"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<van-field
|
||||||
|
value="{{formData.remark}}"
|
||||||
|
label="备注"
|
||||||
|
placeholder="{{'请输入备注'}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="remark"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</card>
|
</card>
|
||||||
</view>
|
</view>
|
||||||
<view class="cardWrapper" style="margin-bottom: 40rpx;">
|
<view class="cardWrapper" style="margin-bottom: 40rpx;">
|
||||||
<card title="接收信息">
|
<card title="接收信息">
|
||||||
<view slot="content">
|
<view slot="content">
|
||||||
|
<view wx:if="{{editType === 'detail'}}">
|
||||||
|
<van-field
|
||||||
|
label="手机号"
|
||||||
|
wx:if="{{(detail.headerType === 0)}}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入手机号' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="phone"
|
||||||
|
value="{{detail.phone || '-'}}"
|
||||||
|
>
|
||||||
|
|
||||||
|
</van-field>
|
||||||
|
</view>
|
||||||
|
<view wx:else>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.phone }}"
|
||||||
|
label="手机号"
|
||||||
|
wx:if="{{(formData.headerType === 0) }}"
|
||||||
|
placeholder="{{ '请输入手机号' }}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="phone"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{detail.email}}"
|
value="{{detail.email || '--'}}"
|
||||||
|
wx:if="{{editType === 'detail'}}"
|
||||||
label="电子邮箱"
|
label="电子邮箱"
|
||||||
custom-style="padding-left: 0; padding-right: 0;"
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
readonly="{{editType === 'detail'}}"
|
readonly="{{editType === 'detail'}}"
|
||||||
autosize="{{true}}"
|
autosize="{{true}}"
|
||||||
type="textarea"
|
|
||||||
title-width="132rpx"
|
title-width="132rpx"
|
||||||
border="{{ editType === 'detail' ? false : true }}"
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
bind:change="onChangeText"
|
bind:change="onChangeText"
|
||||||
data-name="email"
|
data-name="email"
|
||||||
|
value="{{detail.email || '-'}}"
|
||||||
>
|
>
|
||||||
<view
|
|
||||||
wx:if="{{editType === 'detail' && !detail.email}}"
|
|
||||||
slot="input"
|
|
||||||
>
|
|
||||||
<view>-</view>
|
|
||||||
</view>
|
|
||||||
</van-field>
|
</van-field>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.email}}"
|
||||||
|
wx:else
|
||||||
|
label="电子邮箱"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="email"
|
||||||
|
placeholder="请输入电子邮箱"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</card>
|
</card>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -34,11 +34,12 @@ Component({
|
|||||||
methods: {
|
methods: {
|
||||||
async init() {
|
async init() {
|
||||||
const { code, message, data } = await getInvoiceList();
|
const { code, message, data } = await getInvoiceList();
|
||||||
// if (code !== OK) {
|
if (code !== OK) {
|
||||||
// alertInfo(message)
|
alertInfo(message)
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
this.setData({ list: data, selectList: new Array(data?.length).map(() => false) })
|
|
||||||
|
this.setData({ list: data, selectList: new Array(data?.length).map(() => false), allChecked: false, })
|
||||||
},
|
},
|
||||||
onRefresh() {
|
onRefresh() {
|
||||||
loadingFunc(() => this.init())
|
loadingFunc(() => this.init())
|
||||||
@@ -67,13 +68,15 @@ Component({
|
|||||||
this.setData({
|
this.setData({
|
||||||
// chooseList: newList,
|
// chooseList: newList,
|
||||||
selectList: newSelectList,
|
selectList: newSelectList,
|
||||||
|
allChecked: selectCount === list.length,
|
||||||
selectCount,
|
selectCount,
|
||||||
selectMoney
|
selectMoney: Number(selectMoney.toFixed(2))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
next() {
|
next() {
|
||||||
const { selectList, list, selectMoney, selectCount } = this.data;
|
const { selectList, list, selectMoney, selectCount } = this.data;
|
||||||
let tenementID = "";
|
let tenementID = "";
|
||||||
|
let tenementName = "";
|
||||||
let ids = [];
|
let ids = [];
|
||||||
for(let i = 0; i < selectList.length; i ++) {
|
for(let i = 0; i < selectList.length; i ++) {
|
||||||
if (selectList[i]) {
|
if (selectList[i]) {
|
||||||
@@ -81,6 +84,7 @@ Component({
|
|||||||
ids.push(list[i]?.id);
|
ids.push(list[i]?.id);
|
||||||
if (!tenementID) {
|
if (!tenementID) {
|
||||||
tenementID = currentTenementID;
|
tenementID = currentTenementID;
|
||||||
|
tenementName = list[i]?.tenement?.name;
|
||||||
} else if(tenementID !== currentTenementID) {
|
} else if(tenementID !== currentTenementID) {
|
||||||
alertInfo("只能对一个公司开票")
|
alertInfo("只能对一个公司开票")
|
||||||
return;
|
return;
|
||||||
@@ -88,8 +92,18 @@ Component({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: `/pages/invoicing/index?money=${selectMoney}&count=${selectCount}&tenement=${tenementID}&ids=${ids}`,
|
url: `/pages/invoicing/index?money=${selectMoney}&count=${selectCount}&tenement=${tenementID}&ids=${ids}&tenementName=${tenementName}`,
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
onAllChecked(e) {
|
||||||
|
const { list } = this.data;
|
||||||
|
if (e.detail) {
|
||||||
|
const newSelectList = Array.from({ length: list.length }, () => true)
|
||||||
|
|
||||||
|
this.setData({ selectList: newSelectList, selectCount: list.length, selectMoney: list.map(item => item.money).reduce((prev, next) => prev + next).toFixed(2), allChecked: true })
|
||||||
|
} else {
|
||||||
|
this.setData({ allChecked: false, selectMoney: 0, selectList: [], selectCount: 0 })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -25,10 +25,15 @@
|
|||||||
</van-checkbox-group>
|
</van-checkbox-group>
|
||||||
|
|
||||||
<view class="allSelect">
|
<view class="allSelect">
|
||||||
<view class="allNumber"> {{ selectCount }} </view>
|
<van-checkbox value="{{ allChecked }}" bind:change="onAllChecked">
|
||||||
笔订单,共
|
全选
|
||||||
<view class="allMoney"> ¥ {{selectMoney}} </view>
|
</van-checkbox>
|
||||||
<van-button size="small" type="info" bind:click="next" disabled="{{!selectCount}}"> 下一步 </van-button>
|
<view style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
|
||||||
|
<view class="allNumber"> {{ selectCount }} </view>
|
||||||
|
笔订单,共
|
||||||
|
<view class="allMoney"> ¥ {{selectMoney}} </view>
|
||||||
|
<van-button size="small" type="info" bind:click="next" disabled="{{!selectCount}}"> 下一步 </van-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.allNumber {
|
.allNumber {
|
||||||
@@ -56,8 +57,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.allMoney {
|
.allMoney {
|
||||||
flex: 1;
|
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
color: var(--money-color);
|
color: var(--money-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,13 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
const { tab } = options;
|
||||||
|
if (isNaN(Number(tab))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
active: Number(tab)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getInvoiceInfo, makeInvoice } from "../../service/invoice"
|
import { getInvoiceInfo, makeInvoice } from "../../service/invoice"
|
||||||
import { alertInfo, alertSuccess } from "../../utils/index";
|
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
|
||||||
import request from '../../utils/request'
|
import request from '../../utils/request'
|
||||||
const { OK } = request
|
const { OK } = request
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
money: 0,
|
money: 0,
|
||||||
tenement: "",
|
tenement: "",
|
||||||
|
tenementName: "",
|
||||||
ids: [],
|
ids: [],
|
||||||
count: 0,
|
count: 0,
|
||||||
show: false,
|
show: false,
|
||||||
@@ -22,8 +23,8 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const { money = 10, tenement, ids = 'q', count = 10 } = options;
|
const { money = 0, tenement, ids = '', count = 0, tenementName } = options;
|
||||||
this.setData({ money, tenement, ids: ids.split(","), count })
|
this.setData({ money, tenement, ids: ids.split(","), count, tenementName })
|
||||||
this.getDetail();
|
this.getDetail();
|
||||||
},
|
},
|
||||||
async getDetail() {
|
async getDetail() {
|
||||||
@@ -32,6 +33,46 @@ Page({
|
|||||||
alertInfo(message)
|
alertInfo(message)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!data?.tenement?.id || !data?.name) {
|
||||||
|
const user = wx.getStorageSync('user')
|
||||||
|
if (user.isAdmin) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '当前公司没有开票信息,请先前往开票信息页面编辑开票信息',
|
||||||
|
confirmText: '前往编辑',
|
||||||
|
cancelText: '取消',
|
||||||
|
complete: (res) => {
|
||||||
|
if (res.cancel) {
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.redirectTo({
|
||||||
|
url: '/pages/invoiceList/index?tab=2',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '当前公司没有开票信息,请联系管理员编辑完开票信息之后再开票',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '返回',
|
||||||
|
complete: (res) => {
|
||||||
|
if (res.cancel) {
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
this.setData({ detail: {...data, }, remark: data.remark })
|
this.setData({ detail: {...data, }, remark: data.remark })
|
||||||
},
|
},
|
||||||
changeRemark(e) {
|
changeRemark(e) {
|
||||||
@@ -42,9 +83,6 @@ Page({
|
|||||||
*/
|
*/
|
||||||
onReady() {
|
onReady() {
|
||||||
|
|
||||||
},
|
|
||||||
onSubmit() {
|
|
||||||
console.log('----------')
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
@@ -53,14 +91,22 @@ Page({
|
|||||||
|
|
||||||
},
|
},
|
||||||
async onSubmit() {
|
async onSubmit() {
|
||||||
const {ids = [], remark } = this.data;
|
loadingFunc(async() => {
|
||||||
const tenement = wx.getStorageSync('tenement')
|
const {ids = [], remark } = this.data;
|
||||||
const { code, message, data } = await makeInvoice({ ids, tenement: tenement.id, remark })
|
const tenement = wx.getStorageSync('tenement')
|
||||||
if (code !== OK) {
|
const { code, message, data } = await makeInvoice({ ids, tenement: tenement.id, remark })
|
||||||
alertInfo(message)
|
if (code !== OK) {
|
||||||
return;
|
alertInfo(message)
|
||||||
}
|
return;
|
||||||
alertSuccess("开票成功,未完")
|
}
|
||||||
|
alertSuccess("操作成功")
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.redirectTo({
|
||||||
|
url: '/pages/invoiceList/index?tab=1',
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
})
|
||||||
},
|
},
|
||||||
changeShow() {
|
changeShow() {
|
||||||
this.setData({ show: true })
|
this.setData({ show: true })
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
<view>
|
<view>
|
||||||
<card title="发票类型">
|
<card title="发票类型">
|
||||||
<van-radio-group disabled="{{true}}" direction="horizontal" slot="content" value="{{detail.type}}">
|
<van-radio-group disabled="{{true}}" direction="horizontal" slot="content" value="{{detail.type}}">
|
||||||
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 32rpx;margin-bottom: 20rpx;">普通电子发票</van-radio>
|
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 32rpx;margin-bottom: 20rpx;">普通发票</van-radio>
|
||||||
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 32rpx;">增值税专用电子发票</van-radio>
|
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 32rpx;">增值税专用发票</van-radio>
|
||||||
</van-radio-group>
|
</van-radio-group>
|
||||||
</card>
|
</card>
|
||||||
</view>
|
</view>
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
disabled="{{true}}"
|
disabled="{{true}}"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{ detail.address }}"
|
value="{{ detail.phone }}"
|
||||||
wx:if="{{detail.headerType === 0}}"
|
wx:if="{{detail.headerType === 0}}"
|
||||||
label="电话"
|
label="电话"
|
||||||
readonly
|
readonly
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
>
|
>
|
||||||
<view class="modalContentWrapper">
|
<view class="modalContentWrapper">
|
||||||
<van-field
|
<van-field
|
||||||
value="{{ '河北华昌宝能售电有限公司' }}"
|
value="{{ tenementName }}"
|
||||||
label="发票抬头"
|
label="发票抬头"
|
||||||
readonly
|
readonly
|
||||||
type="textarea"
|
type="textarea"
|
||||||
@@ -113,21 +113,21 @@
|
|||||||
border="{{false}}"
|
border="{{false}}"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{ 99.99 }}"
|
value="{{ money }}"
|
||||||
label="发票金额"
|
label="发票金额"
|
||||||
readonly
|
readonly
|
||||||
title-width="132rpx"
|
title-width="132rpx"
|
||||||
border="{{false}}"
|
border="{{false}}"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{ '普通发票' }}"
|
value="{{ detail.type === 0 ? '普通发票' : '增值税专用发票' }}"
|
||||||
label="发票类型"
|
label="发票类型"
|
||||||
readonly
|
readonly
|
||||||
title-width="132rpx"
|
title-width="132rpx"
|
||||||
border="{{false}}"
|
border="{{false}}"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
value="{{ '123456@qq.com' }}"
|
value="{{ detail.email }}"
|
||||||
label="邮箱地址"
|
label="邮箱地址"
|
||||||
readonly
|
readonly
|
||||||
title-width="132rpx"
|
title-width="132rpx"
|
||||||
|
|||||||
@@ -20,19 +20,19 @@ Page({
|
|||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad() {
|
onLoad() {
|
||||||
const user = wx.getStorageSync('user')
|
// const user = wx.getStorageSync('user')
|
||||||
if (!user || !user.id) {
|
// if (!user || !user.id) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// if (user.status === 0 || user.status === 2) {
|
// if (user.status === 0 || user.status === 2) {
|
||||||
// wx.redirectTo({
|
// wx.redirectTo({
|
||||||
// url: '/pages/waitApprove/index',
|
// url: '/pages/waitApprove/index',
|
||||||
// })
|
// })
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
wx.switchTab({
|
// wx.switchTab({
|
||||||
url: '/pages/home/index',
|
// url: '/pages/home/index',
|
||||||
})
|
// })
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { alertInfo } from "../../utils/index";
|
import { alertInfo, alertSuccess } from "../../utils/index";
|
||||||
import Dialog from '@vant/weapp/dialog/dialog';
|
import Dialog from '@vant/weapp/dialog/dialog';
|
||||||
import { getUserInfo } from "../../service/user";
|
import { getUserInfo, logout } from "../../service/user";
|
||||||
import { getDot } from "../../utils/system";
|
import { getDot } from "../../utils/system";
|
||||||
import request from "../../utils/request"
|
import request from "../../utils/request"
|
||||||
const { OK } = request;
|
const { OK } = request;
|
||||||
@@ -69,7 +69,7 @@ Page({
|
|||||||
},
|
},
|
||||||
jumpToUpdateInvoice() {
|
jumpToUpdateInvoice() {
|
||||||
wx.navigateTo({
|
wx.navigateTo({
|
||||||
url: '/pages/updateInvoice/index',
|
url: '/pages/invoiceList/index?tab=2',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async getUnReadNumber() {
|
async getUnReadNumber() {
|
||||||
@@ -78,10 +78,26 @@ Page({
|
|||||||
dot
|
dot
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
logout() {
|
async logout() {
|
||||||
wx.clearStorageSync()
|
Dialog.alert({
|
||||||
wx.switchTab({
|
title: '提示',
|
||||||
url: '/pages/home/index',
|
message: '确认退出登录?',
|
||||||
|
showCancelButton: true,
|
||||||
|
}).then(async () => {
|
||||||
|
const { code, message } = await logout()
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wx.clearStorageSync()
|
||||||
|
wx.switchTab({
|
||||||
|
url: '/pages/home/index',
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
jumpToQuestions() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/questions/index',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
bindTenement() {
|
bindTenement() {
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
"van-cell-group": "@vant/weapp/cell-group/index",
|
"van-cell-group": "@vant/weapp/cell-group/index",
|
||||||
"cell": "/components/cell/index",
|
"cell": "/components/cell/index",
|
||||||
"van-dialog": "@vant/weapp/dialog/index",
|
"van-dialog": "@vant/weapp/dialog/index",
|
||||||
"dot": "/components/dot/index"
|
"dot": "/components/dot/index",
|
||||||
|
"navigator": "/components/navigator/index"
|
||||||
},
|
},
|
||||||
"navigationBarTitleText": "我的"
|
"navigationBarTitleText": "我的",
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -4,20 +4,21 @@
|
|||||||
<cell title="常见问题" bind:click="jumpToQuestions" /> -->
|
<cell title="常见问题" bind:click="jumpToQuestions" /> -->
|
||||||
|
|
||||||
<!-- <van-cell-group title=" "> -->
|
<!-- <van-cell-group title=" "> -->
|
||||||
|
<navigator title="我的" />
|
||||||
<van-cell title="联系客服" value="" is-link bind:tap="connect" />
|
<van-cell title="联系客服" value="" is-link bind:tap="connect" />
|
||||||
<van-cell wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
|
<van-cell wx:if="{{!!user.isAdmin}}" title="二维码" value="" is-link bind:click="jumpToQrCode" />
|
||||||
<van-cell wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
|
<van-cell wx:if="{{!!user.isAdmin}}" is-link bind:click="jumpToMember">
|
||||||
<view slot="title">
|
<view slot="title">
|
||||||
<view class="cellWrapper">
|
<view class="cellWrapper">
|
||||||
<view class="text"> 成员管理 </view>
|
<view class="text"> 成员管理 </view>
|
||||||
<dot wx:if="{{dot > 0}}" number="{{dot}}" />
|
<dot wx:if="{{dot > 0}}" number="{{dot}}" />
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</van-cell>
|
</view>
|
||||||
<van-cell title="发票抬头" value="" is-link bind:tap="jumpToUpdateInvoice" />
|
</van-cell>
|
||||||
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
|
<van-cell title="发票抬头" value="" is-link bind:tap="jumpToUpdateInvoice" />
|
||||||
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
|
<van-cell title="绑定企业" value="" is-link bind:tap="bindTenement" />
|
||||||
|
<!-- <van-cell title="常见问题" value="" is-link bind:tap="jumpToQuestions" /> -->
|
||||||
|
<van-cell title="退出登录" value="" is-link bind:tap="logout" />
|
||||||
<!-- </van-cell-group> -->
|
<!-- </van-cell-group> -->
|
||||||
<!-- <van-cell-group title=" ">
|
<!-- <van-cell-group title=" ">
|
||||||
<van-cell title="单元格" value="内容" is-link />
|
<van-cell title="单元格" value="内容" is-link />
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ Page({
|
|||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// this.getList()
|
// this.getList()
|
||||||
this.getCode()
|
loadingFunc(async () => {
|
||||||
|
await this.getCode()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
async getList() {
|
async getList() {
|
||||||
const { code, message, data } = await getOwnTenementList()
|
const { code, message, data } = await getOwnTenementList()
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"van-image": "@vant/weapp/image/index"
|
"van-image": "@vant/weapp/image/index",
|
||||||
|
"navigator": "/components/navigator/index"
|
||||||
},
|
},
|
||||||
"navigationBarTitleText": "二维码"
|
"navigationBarTitleText": "二维码",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
<navigator title="二维码" canBack="{{true}}" />
|
||||||
<view class="wrapper">
|
<view class="wrapper">
|
||||||
<view class="image">
|
<view class="image">
|
||||||
<van-image width="400rpx" height="400rpx" src="{{url}}" />
|
<van-image width="400rpx" height="400rpx" src="{{url}}" />
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
/* pages/qrCode/index.wxss */
|
/* pages/qrCode/index.wxss */
|
||||||
.wrapper {
|
.wrapper {
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -22,7 +20,6 @@
|
|||||||
.tenement {
|
.tenement {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
@@ -30,7 +27,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
margin: 50rpx 0;
|
margin: 50rpx 40rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
margin-top: 10vh;
|
||||||
}
|
}
|
||||||
@@ -2,5 +2,6 @@
|
|||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"navigator": "/components/navigator/index",
|
"navigator": "/components/navigator/index",
|
||||||
"scrollPageWrapper": "/components/scrollPageWrapper/index"
|
"scrollPageWrapper": "/components/scrollPageWrapper/index"
|
||||||
}
|
},
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -9,17 +9,4 @@
|
|||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <movable-area>
|
|
||||||
<movable-view x="{{x}}" y="{{y}}" direction="all">
|
|
||||||
<rich-text nodes="<div style='color:red;font-size:46px'>1234</div>"></rich-text>
|
|
||||||
</movable-view>
|
|
||||||
</movable-area> -->
|
|
||||||
|
|
||||||
<!-- <movable-area style="width: 500rpx; height: 500rpx;background-color: red;">
|
|
||||||
<movable-view x="{{x}}" y="{{y}}" direction="all">
|
|
||||||
<view style="width: 100rpx; height: 100rpx;background-color: blue;"> 1111 </view>
|
|
||||||
</movable-view>
|
|
||||||
</movable-area> -->
|
|
||||||
|
|
||||||
|
|
||||||
</scrollPageWrapper>
|
</scrollPageWrapper>
|
||||||
@@ -1,32 +1,202 @@
|
|||||||
import { getMeterDetail } from "../../service/meter";
|
import { getMeterDetail, getTenementMeterList } from "../../service/meter";
|
||||||
import { getGlobalData, showModal } from "../../utils/index";
|
import request from '../../utils/request';
|
||||||
|
import { getUserInfo } from "../../service/user"
|
||||||
|
import { alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
|
||||||
|
import { requestRecharge } from "../../service/recharge";
|
||||||
|
const { OK } = request;
|
||||||
|
|
||||||
// pages/recharge/index.js
|
// pages/recharge/index.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
money: 0,
|
meterList: [],
|
||||||
moneyIndex: -1,
|
meter: {},
|
||||||
primaryColor: getGlobalData().primaryColor,
|
actions: [
|
||||||
defaultMoneyArray: [100, 200, 500, 1000, 2000],
|
{ name: '微信支付', },
|
||||||
customFlag: false,
|
{ name: '对公支付', disabled: true },
|
||||||
detail: {}
|
],
|
||||||
|
user: {},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad() {
|
||||||
const { tenement, code } = options
|
const tenement = wx.getStorageSync('tenement')
|
||||||
this.init({ tenement, code })
|
const park = wx.getStorageSync('park')
|
||||||
},
|
|
||||||
async init(options) {
|
|
||||||
const { code, message, data = {}} = await getMeterDetail(options)
|
|
||||||
this.setData({
|
this.setData({
|
||||||
detail: data
|
tenement, park
|
||||||
|
})
|
||||||
|
this.init(park, tenement)
|
||||||
|
},
|
||||||
|
async changeMeter() {
|
||||||
|
const { meterList = [] } = this.data;
|
||||||
|
const newColumns = meterList.map(item => { item.id = item.code; item.name = `${item.code} - ${item.address}`; return item; })
|
||||||
|
this.setData({
|
||||||
|
columns: newColumns,
|
||||||
|
show: true,
|
||||||
|
pickerType: "meter"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onOk(e) {
|
||||||
|
const { type } = e.detail;
|
||||||
|
switch(type) {
|
||||||
|
case "meter":
|
||||||
|
const { id } = e.detail.value;
|
||||||
|
this.handleGetMeterDetail(id)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async init(park, tenement) {
|
||||||
|
this.getMeters({ id: tenement?.id })
|
||||||
|
},
|
||||||
|
async refreshMeter() {
|
||||||
|
const { meter } = this.data;
|
||||||
|
this.handleGetMeterDetail(meter.id);
|
||||||
|
},
|
||||||
|
async handleGetMeterDetail(meterId) {
|
||||||
|
const { tenement } = this.data;
|
||||||
|
const { code, message, data } = await getMeterDetail({ tenement: tenement?.id, id: meterId });
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
meter: data,
|
||||||
|
show: false,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
this.setData({
|
||||||
|
show: false,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async setUser() {
|
||||||
|
const result = await getUserInfo();
|
||||||
|
if (result.code !== OK) {
|
||||||
|
const user = wx.getStorageSync('user')
|
||||||
|
this.setData({ user: user })
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({ user: result.data })
|
||||||
|
wx.setStorageSync('user', result.data)
|
||||||
|
},
|
||||||
|
async recharge() {
|
||||||
|
const { user, money, meter, tenement, park } = this.data;
|
||||||
|
if (!user || !user.id) {
|
||||||
|
alertInfo("请先登录")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!money) {
|
||||||
|
alertInfo("请先输入金额")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!meter?.code) {
|
||||||
|
alertInfo("没有选择表计")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (money < 0.01) {
|
||||||
|
alertInfo("最少为1分")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// wx.navigateTo({
|
||||||
|
// url: `/pages/rechargeWay/index?money=${money}&address=${meter.address}&id=${meter?.id}&tenement=${tenement?.id}&park=${park.id}`,
|
||||||
|
// })
|
||||||
|
this.setData({ rechargeVisible: true })
|
||||||
|
},
|
||||||
|
async getMeters({ id }) {
|
||||||
|
const { code, message, data } = await getTenementMeterList(id);
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
this.setData({ meterList: [], meter: {} })
|
||||||
|
wx.setStorageSync('meter', {})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
meterList: data || [],
|
||||||
|
meter: (data?.[0] || {})
|
||||||
|
})
|
||||||
|
// if (!storageMeter) {
|
||||||
|
wx.setStorageSync('meter', data?.[0] || {} )
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
changeMoney(e) {
|
||||||
|
const { money } = e.currentTarget.dataset;
|
||||||
|
this.setData({
|
||||||
|
money: money
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onChangeMoney(e) {
|
||||||
|
this.setData({ money: e.detail })
|
||||||
|
},
|
||||||
|
onCloseRechargeWay() {
|
||||||
|
this.setData({ rechargeVisible: false })
|
||||||
|
},
|
||||||
|
|
||||||
|
onSelectRechargeWay(e) {
|
||||||
|
const that = this;
|
||||||
|
switch(e.detail.name) {
|
||||||
|
case "对公支付":
|
||||||
|
alertInfo("开发中")
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
loadingFunc(async () => {
|
||||||
|
await that.wxRecharge();
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jumpToRecord() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/rechargeRecord/index',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpToOrder() {
|
||||||
|
// alertInfo("尚未完成")
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/billList/index',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpToElectric() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/electricQuery/index',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpToInvoice() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/invoiceList/index',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async wxRecharge() {
|
||||||
|
const { money, meter, tenement, park } = this.data;
|
||||||
|
const that = this;
|
||||||
|
const { code, message, data } = await requestRecharge({ money: Number(money), id: meter?.id, tenement: tenement?.id, park: park?.id })
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wx.requestPayment({
|
||||||
|
timeStamp: data?.time,
|
||||||
|
nonceStr: data?.nonceStr,
|
||||||
|
package: "prepay_id=" + data?.prepay_id,
|
||||||
|
paySign: data?.paySign,
|
||||||
|
signType: 'RSA',
|
||||||
|
success: (res) => {
|
||||||
|
alertSuccess("充值成功")
|
||||||
|
that.setData({
|
||||||
|
money: null
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log('fail', res)
|
||||||
|
alertInfo("请稍后重试")
|
||||||
|
},
|
||||||
|
complete: (res) => {
|
||||||
|
console.log('complete')
|
||||||
|
that.handleGetMeterDetail(meter.id)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +210,7 @@ Page({
|
|||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow() {
|
onShow() {
|
||||||
|
this.setUser();
|
||||||
},
|
},
|
||||||
chooseMoney(e) {
|
chooseMoney(e) {
|
||||||
const { money, index } = e.currentTarget.dataset;
|
const { money, index } = e.currentTarget.dataset;
|
||||||
@@ -69,13 +239,6 @@ Page({
|
|||||||
money: money,
|
money: money,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async recharge() {
|
|
||||||
const { detail = {}, money } = this.data;
|
|
||||||
const confirmResult = await showModal({ title: "充值确认", content: `确认充值表号为${detail?.meter?.code}的表计${money}元吗?` });
|
|
||||||
if (!confirmResult) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,7 +4,12 @@
|
|||||||
"van-grid": "@vant/weapp/grid/index",
|
"van-grid": "@vant/weapp/grid/index",
|
||||||
"van-grid-item": "@vant/weapp/grid-item/index",
|
"van-grid-item": "@vant/weapp/grid-item/index",
|
||||||
"van-row": "@vant/weapp/row/index",
|
"van-row": "@vant/weapp/row/index",
|
||||||
|
"van-button": "@vant/weapp/button/index",
|
||||||
|
"picker": "/components/picker/index",
|
||||||
|
"van-field": "@vant/weapp/field/index",
|
||||||
|
"van-action-sheet": "@vant/weapp/action-sheet/index",
|
||||||
"van-col": "@vant/weapp/col/index"
|
"van-col": "@vant/weapp/col/index"
|
||||||
},
|
},
|
||||||
"navigationBarTitleText": "充值"
|
"navigationBarTitleText": "充值",
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -1,76 +1,77 @@
|
|||||||
<!--pages/recharge/index.wxml-->
|
<navigator title="充值" canBack="true" />
|
||||||
|
<view class="rechargeWrapper">
|
||||||
<view class="wrapper">
|
<view class="card">
|
||||||
<!-- <van-grid column-num="2" center="{{false}}">
|
<view class="cardTop">
|
||||||
<van-grid-item icon="photo-o" text="文字" use-slot>
|
<view class="cardTopLeft">
|
||||||
<view>
|
<view wx:if="{{user.id}}"> {{ tenement.shortName}} - {{ meter.address }} </view>
|
||||||
<view class="gridTitle"> 充值表号: </view>
|
<view wx:else> -- </view>
|
||||||
<view class="gridContent"> {{ detail.meter.code }} </view>
|
|
||||||
</view>
|
</view>
|
||||||
</van-grid-item>
|
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="changeMeter" wx:if="{{user.id}}">
|
||||||
<van-grid-item icon="photo-o" text="文字" use-slot>
|
<van-icon name="exchange" />
|
||||||
<view>
|
切换电表
|
||||||
<view class="gridTitle"> 表计地址: </view>
|
</van-button>
|
||||||
<view class="gridContent"> {{ detail.meter.address }} </view>
|
</view>
|
||||||
|
<view class="cardContent">
|
||||||
|
<view class="cardItem">
|
||||||
|
<view class="cardItemLabel"> 电表编号: </view>
|
||||||
|
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.code}} </view>
|
||||||
|
<view class="cardItemValue" wx:else> -- </view>
|
||||||
</view>
|
</view>
|
||||||
</van-grid-item>
|
<view class="cardItem">
|
||||||
<van-grid-item icon="photo-o" text="文字" use-slot>
|
<view class="cardItemLabel"> 电表地址: </view>
|
||||||
<view>
|
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.address}} </view>
|
||||||
<view class="gridTitle"> 剩余金额: </view>
|
<view class="cardItemValue" wx:else> -- </view>
|
||||||
<view class="gridContent"> {{ detail.money }} </view>
|
|
||||||
</view>
|
</view>
|
||||||
</van-grid-item>
|
<view class="cardItem">
|
||||||
<van-grid-item icon="photo-o" text="文字" use-slot>
|
<view class="cardItemLabel"> 电表余额: </view>
|
||||||
<view>
|
<view class="cardItemValue" style="position: relative;">
|
||||||
<view class="gridTitle"> 公司名称: </view>
|
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </view>
|
||||||
<view class="gridContent"> {{ detail.tenement.name }} </view>
|
<view class="text" wx:else> --- </view>
|
||||||
|
<van-button type="info" size="small" plain="{{true}}" custom-style="position: absolute; right: 0; bottom: 0;z-index: 99;" bind:click="refreshMeter" wx:if="{{user.id}}">
|
||||||
|
<van-icon name="replay" />
|
||||||
|
刷新
|
||||||
|
</van-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</van-grid-item>
|
</view>
|
||||||
</van-grid> -->
|
|
||||||
<van-row gutter="10">
|
|
||||||
<van-col span="12">
|
|
||||||
<view class="title">充值表号:</view>
|
|
||||||
<view class="content">{{ detail.meter.code }}</view>
|
|
||||||
</van-col>
|
|
||||||
<van-col span="12">
|
|
||||||
<view class="title">表计地址:</view>
|
|
||||||
<view class="content">{{ detail.meter.address }}</view>
|
|
||||||
</van-col>
|
|
||||||
|
|
||||||
<van-col span="12" custom-class="colBottom">
|
|
||||||
<view class="title">剩余金额:</view>
|
|
||||||
<view class="content">{{ detail.money }}</view>
|
|
||||||
</van-col>
|
|
||||||
<van-col span="12" custom-class="colBottom">
|
|
||||||
<view class="title">公司名称:</view>
|
|
||||||
<view class="content">{{ detail.tenement.name }}</view>
|
|
||||||
</van-col>
|
|
||||||
|
|
||||||
</van-row>
|
|
||||||
<view class="moneyBoxs">
|
|
||||||
<view
|
|
||||||
wx:for="{{defaultMoneyArray}}"
|
|
||||||
class="moneyBox border radius12"
|
|
||||||
style="background-color: {{moneyIndex === index ? primaryColor : ''}};"
|
|
||||||
wx:key="index"
|
|
||||||
bind:tap="chooseMoney"
|
|
||||||
data-money="{{item}}"
|
|
||||||
data-index="{{index}}"
|
|
||||||
> {{item}} </view>
|
|
||||||
<view class="moneyBox border radius12" bind:tap="custom"> 自定义 </view>
|
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="recharge">
|
||||||
class="customInput border radius12"
|
<view> 请输入金额: </view>
|
||||||
wx:if="{{customFlag}}"
|
<view class="moneyBox">
|
||||||
>
|
<view class="money" bind:tap="changeMoney" data-money="30"> ¥30 </view>
|
||||||
<input
|
<view class="money" bind:tap="changeMoney" data-money="50"> ¥50 </view>
|
||||||
type="number"
|
<view class="money" bind:tap="changeMoney" data-money="100"> ¥100 </view>
|
||||||
focus
|
<view class="money" style="margin-right: 0;" bind:tap="changeMoney" data-money="200"> ¥200 </view>
|
||||||
placeholder="请输入要充值的金额"
|
</view>
|
||||||
bindinput="onChangeCustomMoney"
|
<view class="moneyInput">
|
||||||
/>
|
<van-field
|
||||||
|
value="{{ money }}"
|
||||||
|
placeholder="请输入充值金额"
|
||||||
|
border="{{true}}"
|
||||||
|
bind:change="onChangeMoney"
|
||||||
|
size="large"
|
||||||
|
type="digit"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="operate">
|
<view class="operate">
|
||||||
<button type="primary" bind:tap="recharge" disabled="{{!money}}"> 充值 </button>
|
<van-button color="rgb(88, 165, 141)" block bind:click="recharge">去缴费</van-button>
|
||||||
|
</view>
|
||||||
|
<view class="others">
|
||||||
|
<van-grid direction="horizontal" column-num="2">
|
||||||
|
<van-grid-item icon="balance-list-o" text="电费账单" bind:click="jumpToOrder">
|
||||||
|
</van-grid-item>
|
||||||
|
<van-grid-item icon="after-sale" text="缴费记录" bind:click="jumpToRecord" />
|
||||||
|
<van-grid-item icon="bar-chart-o" text="用电查询" bind:click="jumpToElectric" />
|
||||||
|
<van-grid-item icon="bill-o" text="去开票" bind:click="jumpToInvoice" />
|
||||||
|
</van-grid>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<van-action-sheet
|
||||||
|
show="{{ rechargeVisible }}"
|
||||||
|
actions="{{ actions }}"
|
||||||
|
bind:close="onCloseRechargeWay"
|
||||||
|
bind:select="onSelectRechargeWay"
|
||||||
|
/>
|
||||||
|
<picker show="{{show}}" valueKey="name" columns="{{columns}}" bind:ok="onOk" bind:cancel="onCancel" type="{{pickerType}}" />
|
||||||
@@ -1,62 +1,99 @@
|
|||||||
/* pages/recharge/index.wxss */
|
/* pages/recharge/index.wxss */
|
||||||
.moneyBoxs {
|
.rechargeWrapper {
|
||||||
margin-top: 32rpx;
|
background: linear-gradient(to bottom, var(--middle-green), #fff );
|
||||||
display: flex;
|
overflow: hidden;
|
||||||
justify-content: space-between;
|
padding-top: 30rpx;
|
||||||
align-items: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.moneyBox {
|
.card {
|
||||||
width: 30%;
|
margin-top: 0rpx;
|
||||||
height: 140rpx;
|
margin-left: 46rpx;
|
||||||
display: flex;
|
margin-right: 46rpx;
|
||||||
justify-content: center;
|
border-radius: 30rpx;
|
||||||
align-items: center;
|
padding: 22rpx 30rpx;
|
||||||
margin-bottom: 24rpx;
|
/* background-color: rgb(173, 217, 203); */
|
||||||
|
background: linear-gradient(to bottom right, rgb(212, 240, 231), rgb(145, 206, 185));
|
||||||
}
|
}
|
||||||
|
|
||||||
.chooseMeter {
|
.cardTop {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 10rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.selectMeter {
|
.cardTopLeft {
|
||||||
margin-left: 24rpx;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex: 1;
|
||||||
|
font-size: 33rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardContent {
|
||||||
|
margin: 30rpx 20rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardItem {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardItem:last-child {
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardItemValue {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardItemValue .text {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recharge {
|
||||||
|
background: #fff;
|
||||||
|
padding: 20rpx 30rpx;
|
||||||
|
margin-top: 24rpx;
|
||||||
|
margin-left: 46rpx;
|
||||||
|
margin-right: 46rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.operate {
|
.operate {
|
||||||
margin-top: 24rpx;
|
margin-left: 46rpx;
|
||||||
}
|
margin-right: 46rpx;
|
||||||
|
|
||||||
.input {
|
|
||||||
height: 40rpx;
|
|
||||||
width: 400rpx;
|
|
||||||
line-height: 40rpx;
|
|
||||||
border-radius: 20rpx;
|
|
||||||
padding: 12rpx 14rpx 16rpx;
|
|
||||||
/* border: 1rpx solid #ccc; */
|
|
||||||
}
|
|
||||||
|
|
||||||
.customInput {
|
|
||||||
padding: 16rpx 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gridTitle {
|
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.colBottom {
|
|
||||||
margin-top: 40rpx;
|
|
||||||
|
.moneyBox {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.money {
|
||||||
font-weight: 600;
|
flex: 1;
|
||||||
font-size: 40rpx;
|
padding: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border: 1rpx solid #ccc;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.moneyInput {
|
||||||
|
margin-top: 20rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.others {
|
||||||
font-size: 32rpx;
|
margin-left: 46rpx;
|
||||||
|
margin-right: 46rpx;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { getRechargeDetail } from "../../service/recharge";
|
import { getRechargeDetail } from "../../service/recharge";
|
||||||
|
import { alertError, alertInfo, loadingFunc } from "../../utils/index";
|
||||||
import { getRechargeOperateType, getRechargeOperateWay } from "../../utils/data";
|
import { getRechargeOperateType, getRechargeOperateWay } from "../../utils/data";
|
||||||
import request from "../../utils/request"
|
import request from "../../utils/request"
|
||||||
const { OK } = request
|
const { OK } = request
|
||||||
@@ -17,14 +18,59 @@ Page({
|
|||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const { id } = options;
|
const { id } = options;
|
||||||
this.init(id)
|
loadingFunc(async () => {
|
||||||
|
await this.init(id)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
async init(id) {
|
async init(id) {
|
||||||
const { code, message, data } = await getRechargeDetail(id)
|
const { code, message, data } = await getRechargeDetail(id)
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
detail: { ...data, way: getRechargeOperateWay(data.way), type: getRechargeOperateType(data.type) }
|
detail: { ...data, way: getRechargeOperateWay(data.way), type: getRechargeOperateType(data.type) }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
record() {
|
||||||
|
const { detail } = this.data;
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '为了您更好的体验,请复制链接,通过电脑浏览器打开下载',
|
||||||
|
showCancel: true,
|
||||||
|
cancelText: '关闭',
|
||||||
|
confirmText: '复制链接',
|
||||||
|
|
||||||
|
complete: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
const result = wx.getAccountInfoSync();
|
||||||
|
const { envVersion } = result.miniProgram;
|
||||||
|
let api = ""
|
||||||
|
switch (envVersion) {
|
||||||
|
// 开发版
|
||||||
|
case 'develop':
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: `https://1.92.72.5:8080/print/?id=${detail.serialNumber}`,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
// 体验版
|
||||||
|
case 'trial':
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: `http://1.92.72.5:8080/print/?id=${detail.serialNumber}`,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
// 正式版
|
||||||
|
case 'release':
|
||||||
|
wx.setClipboardData({
|
||||||
|
data: `https://zgd.hbhcbn.com/print/?id=${detail.serialNumber}`,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
back() {
|
back() {
|
||||||
// wx.navigateBack({ delta: 1 });
|
// wx.navigateBack({ delta: 1 });
|
||||||
wx.navigateBack();
|
wx.navigateBack();
|
||||||
|
|||||||
@@ -86,5 +86,6 @@
|
|||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<view class="operate">
|
<view class="operate">
|
||||||
<van-button type="default" block bind:tap="back">返回</van-button>
|
<van-button type="info" block bind:tap="record" style="flex: 1; margin-right: 20rpx;">收据</van-button>
|
||||||
|
<van-button type="default" block bind:tap="back" style="flex: 1;">返回</van-button>
|
||||||
</view>
|
</view>
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
/* pages/rechargeDetail/index.wxss */
|
/* pages/rechargeDetail/index.wxss */
|
||||||
.operate {
|
.operate {
|
||||||
margin-top: 60rpx;
|
margin-top: 20rpx;
|
||||||
margin-left: 36rpx;
|
margin-left: 36rpx;
|
||||||
margin-right: 36rpx;
|
margin-right: 36rpx;
|
||||||
padding-bottom: 50rpx;
|
padding-bottom: 50rpx;
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getRechargeList } from "../../service/recharge";
|
import { getRechargeList } from "../../service/recharge";
|
||||||
import { getTenementMeterList } from "../../service/meter";
|
import { getTenementMeterList } from "../../service/meter";
|
||||||
import { getYears, alertInfo } from "../../utils/index";
|
import { getYears, alertInfo, loadingFunc } from "../../utils/index";
|
||||||
import request from "../../utils/request";
|
import request from "../../utils/request";
|
||||||
const { OK } = request;
|
const { OK } = request;
|
||||||
// pages/rechargeRecord/index.js
|
// pages/rechargeRecord/index.js
|
||||||
@@ -35,7 +35,7 @@ Page({
|
|||||||
clickMeter() {
|
clickMeter() {
|
||||||
this.setData({
|
this.setData({
|
||||||
type: "meter",
|
type: "meter",
|
||||||
columns: this.data.meterList.map(item => ({ id: item.id, name: `${item.code}-${item.address}`, code: item.code })),
|
columns: [{id: "", name: "全部", address: "", code: ""}, ...this.data.meterList.map(item => ({ id: item.id, name: `${item.code}-${item.address}`, code: item.code }))],
|
||||||
show: true,
|
show: true,
|
||||||
title: "表计"
|
title: "表计"
|
||||||
})
|
})
|
||||||
@@ -65,15 +65,15 @@ Page({
|
|||||||
|
|
||||||
},
|
},
|
||||||
onChangeYear(e) {
|
onChangeYear(e) {
|
||||||
const { years, tenement } = this.data;
|
const { codeId } = this.data;
|
||||||
const currentYear = years[Number(e)]
|
const currentYear = e
|
||||||
this.setData({
|
this.setData({
|
||||||
year: currentYear,
|
year: currentYear,
|
||||||
type: "",
|
type: "",
|
||||||
show: false,
|
show: false,
|
||||||
title: ""
|
title: ""
|
||||||
})
|
})
|
||||||
this.init(currentYear, tenement)
|
this.init(currentYear, codeId)
|
||||||
},
|
},
|
||||||
onChangeMeter(e) {
|
onChangeMeter(e) {
|
||||||
const { id, code } = e;
|
const { id, code } = e;
|
||||||
@@ -95,10 +95,14 @@ Page({
|
|||||||
onShow() {
|
onShow() {
|
||||||
const { year } = this.data;
|
const { year } = this.data;
|
||||||
const tenement = wx.getStorageSync('tenement')
|
const tenement = wx.getStorageSync('tenement')
|
||||||
this.init(year, '');
|
loadingFunc(async () => {
|
||||||
this.getMeters(tenement?.id);
|
await this.init(year, '');
|
||||||
|
await this.getMeters(tenement?.id);
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
refreshEmpty() {
|
refreshEmpty() {
|
||||||
|
const { year } = this.data;
|
||||||
const tenement = wx.getStorageSync('tenement')
|
const tenement = wx.getStorageSync('tenement')
|
||||||
this.init(year, '');
|
this.init(year, '');
|
||||||
this.init(year, tenement);
|
this.init(year, tenement);
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
<!--pages/rechargeRecord/index.wxml-->
|
<!--pages/rechargeRecord/index.wxml-->
|
||||||
<navigator title="缴费记录" canBack="{{true}}" bind:back="back" />
|
<navigator title="缴费记录" canBack="{{true}}" bind:back="back" />
|
||||||
<view class="chooseWrapper">
|
<view class="chooseWrapper">
|
||||||
<!-- <picker bindchange="onChangeYear" value="{{index}}" range="{{years}}"> -->
|
<view class="yearPicker" bind:tap="clickYear">
|
||||||
<view class="yearPicker" bind:tap="clickYear">
|
{{ year }}年
|
||||||
{{ year }}年
|
<van-icon name="arrow-down" custom-class="down" />
|
||||||
<image src="/assets/images/down.png" mode="" class="down" />
|
</view>
|
||||||
</view>
|
<view class="tenementPicker" bind:tap="clickMeter">
|
||||||
<!-- </picker> -->
|
<view wx:if="{{meterCode}}" class="tenementName"> {{ meterCode }} </view>
|
||||||
<!-- <picker bindchange="onChangeYear" value="{{index}}" range="{{years}}"> -->
|
<view wx:else> 全部 </view>
|
||||||
<view class="tenementPicker" bind:tap="clickMeter">
|
<van-icon name="arrow-down" custom-class="down" />
|
||||||
<view wx:if="{{meterCode}}" class="tenementName"> {{ meterCode }} </view>
|
</view>
|
||||||
<view wx:else> 全部 </view>
|
|
||||||
<image src="/assets/images/down.png" mode="" class="down" />
|
|
||||||
</view>
|
|
||||||
<!-- </picker> -->
|
|
||||||
<view class="allMoney">
|
<view class="allMoney">
|
||||||
合计: {{amount}}元
|
合计: {{amount}}元
|
||||||
</view>
|
</view>
|
||||||
@@ -21,7 +17,9 @@
|
|||||||
<view class="wrapper" wx:if="{{list.length}}">
|
<view class="wrapper" wx:if="{{list.length}}">
|
||||||
<view class="recordsWrapper">
|
<view class="recordsWrapper">
|
||||||
<view class="recordsItem border" wx:for="{{list}}" wx:key="index" bind:tap="jumpToDetail" data-id="{{item.id}}">
|
<view class="recordsItem border" wx:for="{{list}}" wx:key="index" bind:tap="jumpToDetail" data-id="{{item.id}}">
|
||||||
<view class="type"> 充值 </view>
|
<view class="type" wx:if="{{item.type === 1}}"> 冲正 </view>
|
||||||
|
<view class="type" wx:elif="{{item.type === 2}}"> 退费 </view>
|
||||||
|
<view class="type" wx:else> 充值 </view>
|
||||||
<view class="codeTime">
|
<view class="codeTime">
|
||||||
<view class="code"> {{ item.meter.address }} </view>
|
<view class="code"> {{ item.meter.address }} </view>
|
||||||
<view class="time"> {{ item.time }} </view>
|
<view class="time"> {{ item.time }} </view>
|
||||||
@@ -34,4 +32,12 @@
|
|||||||
<view wx:else>
|
<view wx:else>
|
||||||
<empty bind:refresh="refreshEmpty" />
|
<empty bind:refresh="refreshEmpty" />
|
||||||
</view>
|
</view>
|
||||||
<custom-picker title="{{title}}" show="{{show}}" valueKey="name" columns="{{columns}}" bind:ok="onOk" bind:cancel="onCancel" type="{{type}}" />
|
<custom-picker
|
||||||
|
title="{{title}}"
|
||||||
|
show="{{show}}"
|
||||||
|
valueKey="name"
|
||||||
|
columns="{{columns}}"
|
||||||
|
bind:ok="onOk"
|
||||||
|
bind:cancel="onCancel"
|
||||||
|
type="{{type}}"
|
||||||
|
/>
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
.yearPicker {
|
.yearPicker {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.down {
|
.down {
|
||||||
@@ -32,15 +34,16 @@
|
|||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
.code {
|
.code {
|
||||||
font-size: 36rpx;
|
font-size: 34rpx;
|
||||||
}
|
}
|
||||||
.time {
|
.time {
|
||||||
margin-top: 16rpx;
|
margin-top: 12rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
color:rgb(158, 154, 154);
|
||||||
}
|
}
|
||||||
.money {
|
.money {
|
||||||
font-size: 42rpx;
|
font-size: 36rpx;
|
||||||
font-weight: 600;
|
font-weight: 500;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +64,8 @@
|
|||||||
margin-left: 30rpx;
|
margin-left: 30rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.allMoney {
|
.allMoney {
|
||||||
@@ -73,8 +78,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.type {
|
.type {
|
||||||
margin-right: 46rpx;
|
margin-right: 40rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
font-size: 36rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.codeTime {
|
.codeTime {
|
||||||
|
|||||||
140
pages/rechargeWay/index.js
Normal file
140
pages/rechargeWay/index.js
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
// pages/rechargeWay/index.js
|
||||||
|
import { requestRecharge } from "../../service/recharge";
|
||||||
|
import { alertInfo } from "../../utils/index";
|
||||||
|
import request from '../../utils/request';
|
||||||
|
const { OK } = request;
|
||||||
|
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
money: 0,
|
||||||
|
address: "",
|
||||||
|
rechargeWay: 0,
|
||||||
|
id: "",
|
||||||
|
tenement: "",
|
||||||
|
park: "",
|
||||||
|
rechargeLoading: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
const { money, address, id, tenement, park } = options
|
||||||
|
this.setData({ money: Number(money), address, id, tenement, park })
|
||||||
|
},
|
||||||
|
onChangeRechargeWay(e) {
|
||||||
|
this.setData({ rechargeWay: e.detail })
|
||||||
|
},
|
||||||
|
onClickCell(e) {
|
||||||
|
const { name } = e.currentTarget.dataset;
|
||||||
|
this.setData({ rechargeWay: name })
|
||||||
|
},
|
||||||
|
async recharge() {
|
||||||
|
const { rechargeWay } = this.data;
|
||||||
|
await this.setLoading(true)
|
||||||
|
try {
|
||||||
|
switch(rechargeWay) {
|
||||||
|
case 1:
|
||||||
|
alertInfo("开发中")
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
await this.wxRecharge();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch(err) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
await this.setLoading(false)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async wxRecharge() {
|
||||||
|
const { money, id, tenement, park } = this.data;
|
||||||
|
const { code, message, data } = await requestRecharge({ money: Number(money), id, tenement, park })
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wx.requestPayment({
|
||||||
|
timeStamp: data?.time,
|
||||||
|
nonceStr: data?.nonceStr,
|
||||||
|
package: "prepay_id=" + data?.prepay_id,
|
||||||
|
paySign: data?.paySign,
|
||||||
|
signType: 'RSA',
|
||||||
|
success: (res) => {
|
||||||
|
alertSuccess("充值成功")
|
||||||
|
that.setData({
|
||||||
|
money: null
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log('fail', res)
|
||||||
|
alertInfo("请稍后重试")
|
||||||
|
},
|
||||||
|
complete: (res) => {
|
||||||
|
console.log('complete')
|
||||||
|
that.handleGetMeterDetail(meter.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async setLoading(flag) {
|
||||||
|
return new Promise((res) => {
|
||||||
|
this.setData({
|
||||||
|
rechargeLoading: flag,
|
||||||
|
}, () => {
|
||||||
|
res()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
11
pages/rechargeWay/index.json
Normal file
11
pages/rechargeWay/index.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {
|
||||||
|
"navigator": "/components/navigator/index",
|
||||||
|
"van-radio": "@vant/weapp/radio/index",
|
||||||
|
"van-radio-group": "@vant/weapp/radio-group/index",
|
||||||
|
"van-cell": "@vant/weapp/cell/index",
|
||||||
|
"van-cell-group": "@vant/weapp/cell-group/index",
|
||||||
|
"van-button": "@vant/weapp/button/index"
|
||||||
|
},
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
25
pages/rechargeWay/index.wxml
Normal file
25
pages/rechargeWay/index.wxml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<!--pages/rechargeWay/index.wxml-->
|
||||||
|
<navigator title="支付订单" canBack="{{true}}" bind:back="back" />
|
||||||
|
|
||||||
|
<view class="rechargeInfoWrapper">
|
||||||
|
<view>
|
||||||
|
<text> ¥ </text>
|
||||||
|
<text class="money"> {{ money }} </text>
|
||||||
|
</view>
|
||||||
|
<view class="address"> 地址:{{address}} </view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<van-radio-group value="{{ rechargeWay }}" bind:change="onChangeRechargeWay">
|
||||||
|
<van-cell-group>
|
||||||
|
<van-cell title="微信支付" clickable data-name="{{0}}" bind:click="onClickCell">
|
||||||
|
<van-radio slot="right-icon" name="{{0}}" />
|
||||||
|
</van-cell>
|
||||||
|
<van-cell title="对公转账" clickable data-name="{{1}}" bind:click="onClickCell">
|
||||||
|
<van-radio slot="right-icon" name="{{1}}" />
|
||||||
|
</van-cell>
|
||||||
|
</van-cell-group>
|
||||||
|
</van-radio-group>
|
||||||
|
|
||||||
|
<view class="rechargeBtn">
|
||||||
|
<van-button type="info" block bind:click="recharge" loading="{{rechargeLoading}}">支付</van-button>
|
||||||
|
</view>
|
||||||
23
pages/rechargeWay/index.wxss
Normal file
23
pages/rechargeWay/index.wxss
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* pages/rechargeWay/index.wxss */
|
||||||
|
.rechargeInfoWrapper {
|
||||||
|
margin-top: 10vw;
|
||||||
|
margin-bottom: 10vw;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.money {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 60rpx;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.address {
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rechargeBtn {
|
||||||
|
margin-top: 10vh;
|
||||||
|
margin-left: 32rpx;
|
||||||
|
margin-right: 32rpx;
|
||||||
|
}
|
||||||
@@ -1,66 +1,118 @@
|
|||||||
// pages/updateInvoice/index.js
|
import { getInvoiceInfo, updateInvoiceInfo } from "../../service/invoice"
|
||||||
Page({
|
import { getUserInfo } from "../../service/user";
|
||||||
|
import { alertInfo, alertSuccess } from "../../utils/index";
|
||||||
|
import request from '../../utils/request'
|
||||||
|
const { OK } = request
|
||||||
|
|
||||||
|
// pages/invoiceList/components/info/index.js
|
||||||
|
Component({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 页面的初始数据
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
|
||||||
|
},
|
||||||
|
lifetimes: {
|
||||||
|
attached() {
|
||||||
|
this.getDetail();
|
||||||
|
this.getUser();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
detail: { },
|
||||||
|
formData: {headerType: 0, name: wx.getStorageSync('tenement')?.name},
|
||||||
|
editType: "detail"
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 组件的方法列表
|
||||||
*/
|
*/
|
||||||
onLoad(options) {
|
methods: {
|
||||||
|
async getDetail() {
|
||||||
},
|
const { code, message, data } = await getInvoiceInfo()
|
||||||
|
if (code !== OK) {
|
||||||
/**
|
alertInfo(message)
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
return;
|
||||||
*/
|
}
|
||||||
onReady() {
|
this.setData({ detail: {...data,name: wx.getStorageSync('tenement')?.name, },editType: 'detail', })
|
||||||
|
},
|
||||||
},
|
async getUser() {
|
||||||
|
const { code, message, data } = await getUserInfo()
|
||||||
/**
|
this.setData({ user: data });
|
||||||
* 生命周期函数--监听页面显示
|
},
|
||||||
*/
|
changeEditType() {
|
||||||
onShow() {
|
this.setData({ editType: 'edit', formData: {...this.data.detail, tenement: wx.getStorageSync('tenement')?.id} })
|
||||||
|
},
|
||||||
},
|
cancelEdit() {
|
||||||
|
this.setData({ editType: 'detail', formData: {} })
|
||||||
/**
|
},
|
||||||
* 生命周期函数--监听页面隐藏
|
onChangeType(e) {
|
||||||
*/
|
const { formData } = this.data;
|
||||||
onHide() {
|
this.setData({ formData: {...formData, type: e.detail} })
|
||||||
|
},
|
||||||
},
|
onChangeHeaderType(e) {
|
||||||
|
const { formData } = this.data;
|
||||||
/**
|
this.setData({ formData: {...formData, headerType: e.detail} })
|
||||||
* 生命周期函数--监听页面卸载
|
},
|
||||||
*/
|
onChangeText(e) {
|
||||||
onUnload() {
|
const { name } = e.currentTarget.dataset;
|
||||||
|
const { formData } = this.data;
|
||||||
},
|
this.setData({ formData: {...formData, [name]: e.detail} })
|
||||||
|
},
|
||||||
/**
|
async submit() {
|
||||||
* 页面相关事件处理函数--监听用户下拉动作
|
const { formData } = this.data;
|
||||||
*/
|
const { tin, address, phone, bank, account, email, type, headerType, name } = formData;
|
||||||
onPullDownRefresh() {
|
if (type !== 0 && type !== 1) {
|
||||||
|
alertInfo("请选择发票类型");
|
||||||
},
|
return;
|
||||||
|
}
|
||||||
/**
|
if (headerType !== 0 && headerType !== 1) {
|
||||||
* 页面上拉触底事件的处理函数
|
alertInfo("请选择抬头类型");
|
||||||
*/
|
return;
|
||||||
onReachBottom() {
|
}
|
||||||
|
if (headerType === 1) {
|
||||||
},
|
if (!name) {
|
||||||
|
alertInfo("请输入发票抬头")
|
||||||
/**
|
return
|
||||||
* 用户点击右上角分享
|
}
|
||||||
*/
|
}
|
||||||
onShareAppMessage() {
|
if (!email || !/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(email)) {
|
||||||
|
alertInfo("邮箱格式不正确")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (headerType === 0) {
|
||||||
|
if (!tin) {
|
||||||
|
alertInfo("请输入发票税号")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// if (!address) {
|
||||||
|
// alertInfo("请输入地址")
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if (!phone) {
|
||||||
|
alertInfo("请输入电话")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!bank) {
|
||||||
|
alertInfo("请输入开户行")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!account) {
|
||||||
|
alertInfo("请输入银行账号")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { code, message } = await updateInvoiceInfo(formData)
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alertSuccess("编辑成功")
|
||||||
|
this.getDetail()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"navigator": "/components/navigator/index",
|
"navigator": "/components/navigator/index",
|
||||||
"info": "/pages/invoiceList/components/info/index"
|
"info": "/pages/invoiceList/components/info/index",
|
||||||
|
"card": "/components/card/index",
|
||||||
|
"van-icon": "@vant/weapp/icon/index",
|
||||||
|
"van-field": "@vant/weapp/field/index",
|
||||||
|
"van-radio": "@vant/weapp/radio/index",
|
||||||
|
"van-radio-group": "@vant/weapp/radio-group/index",
|
||||||
|
"van-button": "@vant/weapp/button/index"
|
||||||
},
|
},
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,298 @@
|
|||||||
<!--pages/updateInvoice/index.wxml-->
|
<!--pages/updateInvoice/index.wxml-->
|
||||||
<navigator title="发票抬头" canBack="{{true}}" />
|
<navigator title="发票抬头" canBack="{{true}}" />
|
||||||
<info />
|
<view class="cardWrapper">
|
||||||
|
<card title="发票详情">
|
||||||
|
<view
|
||||||
|
slot="operate"
|
||||||
|
class="cardOperate"
|
||||||
|
wx:if="{{editType === 'detail' && user.isAdmin}}"
|
||||||
|
bind:tap="changeEditType"
|
||||||
|
>
|
||||||
|
<van-icon name="edit" />
|
||||||
|
<view class="editContent">修改</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view slot="content">
|
||||||
|
<van-field
|
||||||
|
label="发票类型"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
>
|
||||||
|
<view slot="input" style="margin-top: 16rpx;" wx:if="{{editType === 'edit'}}">
|
||||||
|
<van-radio-group direction="horizontal" value="{{formData.type}}" bind:change="onChangeType">
|
||||||
|
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">普通发票</van-radio>
|
||||||
|
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">增值税专用发票</van-radio>
|
||||||
|
</van-radio-group>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view wx:else slot="input" style="margin-top: -10rpx;">
|
||||||
|
<view wx:if="{{detail.type === 0}}"> 普通发票 </view>
|
||||||
|
<view wx:elif="{{detail.type === 1}}"> 增值税专用发票 </view>
|
||||||
|
<view wx:else>-</view>
|
||||||
|
</view>
|
||||||
|
</van-field>
|
||||||
|
<van-field
|
||||||
|
label="抬头类型"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
>
|
||||||
|
<view slot="input" style="margin-top: 16rpx;" wx:if="{{editType === 'edit'}}">
|
||||||
|
<van-radio-group direction="horizontal" bind:change="onChangeHeaderType" value="{{formData.headerType}}">
|
||||||
|
<van-radio name="{{0}}" icon-size="30rpx" style="font-size: 30rpx;margin-bottom: 20rpx;">企业单位</van-radio>
|
||||||
|
<van-radio name="{{1}}" icon-size="30rpx" style="font-size: 30rpx;">个人/非企业单位</van-radio>
|
||||||
|
</van-radio-group>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
wx:else
|
||||||
|
slot="input"
|
||||||
|
style="margin-top: -10rpx;"
|
||||||
|
>
|
||||||
|
<view wx:if="{{detail.headerType === 0}}"> 企业单位 </view>
|
||||||
|
<view wx:elif="{{detail.headerType === 1}}"> 个人/非企业单位 </view>
|
||||||
|
<view wx:else>-</view>
|
||||||
|
</view>
|
||||||
|
</van-field>
|
||||||
|
<van-field
|
||||||
|
wx:if="{{editType === 'detail'}}"
|
||||||
|
value="{{detail.name || '--'}}"
|
||||||
|
label="发票抬头"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{true}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ false }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
wx:elif="{{editType === 'edit' }}"
|
||||||
|
value="{{detail.name || '--'}}"
|
||||||
|
label="发票抬头"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{true}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ false }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
wx:else
|
||||||
|
value="{{formData.name}}"
|
||||||
|
label="发票抬头"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
disabled="{{formData.headerType !== 1}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="name"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
border="{{ true }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{detail.tin|| '--'}}"
|
||||||
|
label="发票税号"
|
||||||
|
wx:if="{{editType === 'detail' && detail.headerType === 0}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.tin }}"
|
||||||
|
label="发票税号"
|
||||||
|
wx:if="{{editType === 'edit' && formData.headerType === 0}}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入发票税号' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="tin"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{detail.bank || '--'}}"
|
||||||
|
label="开户行"
|
||||||
|
wx:if="{{editType === 'detail' && detail.headerType === 0}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.bank}}"
|
||||||
|
label="开户行"
|
||||||
|
wx:if="{{editType === 'edit' && formData.headerType === 0}}"
|
||||||
|
placeholder="{{'请输入开户行'}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="bank"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{detail.account || '--'}}"
|
||||||
|
label="银行账号"
|
||||||
|
wx:if="{{(editType === 'detail' && detail.headerType === 0)}}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入银行账号' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="account"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.account}}"
|
||||||
|
label="银行账号"
|
||||||
|
wx:if="{{(editType === 'edit' && formData.headerType === 0) }}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入银行账号' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="account"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{detail.address || '--'}}"
|
||||||
|
label="地址"
|
||||||
|
wx:if="{{(editType === 'detail' && detail.headerType === 0)}}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入地址' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="address"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.address}}"
|
||||||
|
label="地址"
|
||||||
|
wx:if="{{(editType === 'edit' && formData.headerType === 0)}}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入地址' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="address"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{detail.phone || '--'}}"
|
||||||
|
label="电话"
|
||||||
|
wx:if="{{(editType === 'detail' && detail.headerType === 0)}}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入电话' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="phone"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.phone }}"
|
||||||
|
label="电话"
|
||||||
|
wx:if="{{(editType === 'edit' && formData.headerType === 0) }}"
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入电话' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="phone"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{detail.remark || '--'}}"
|
||||||
|
label="备注"
|
||||||
|
wx:if="{{editType === 'detail' }}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="remark"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.remark}}"
|
||||||
|
label="备注"
|
||||||
|
wx:else
|
||||||
|
placeholder="{{editType === 'edit' ? '请输入备注' : ''}}"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="remark"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</card>
|
||||||
|
</view>
|
||||||
|
<view class="cardWrapper" style="margin-bottom: 40rpx;">
|
||||||
|
<card title="接收信息">
|
||||||
|
<view slot="content">
|
||||||
|
<van-field
|
||||||
|
value="{{detail.email || '--'}}"
|
||||||
|
wx:if="{{editType === 'detail'}}"
|
||||||
|
label="电子邮箱"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="email"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
value="{{formData.email}}"
|
||||||
|
wx:else
|
||||||
|
label="电子邮箱"
|
||||||
|
custom-style="padding-left: 0; padding-right: 0;"
|
||||||
|
readonly="{{editType === 'detail'}}"
|
||||||
|
autosize="{{true}}"
|
||||||
|
type="textarea"
|
||||||
|
title-width="132rpx"
|
||||||
|
border="{{ editType === 'detail' ? false : true }}"
|
||||||
|
bind:change="onChangeText"
|
||||||
|
data-name="email"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</card>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="submit" wx:if="{{editType === 'edit'}}">
|
||||||
|
<van-button block class="cancelEdit" bind:click="cancelEdit">取消编辑</van-button>
|
||||||
|
<van-button type="info" block class="save" bind:click="submit">保存</van-button>
|
||||||
|
</view>
|
||||||
@@ -1 +1,34 @@
|
|||||||
/* pages/updateInvoice/index.wxss */
|
/* pages/updateInvoice/index.wxss *//* pages/invoiceList/components/info/index.wxss */
|
||||||
|
.cardOperate {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardWrapper {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editContent {
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.van-cell {
|
||||||
|
padding-left: 0rpx !important;
|
||||||
|
padding-right: 0rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit {
|
||||||
|
margin: 32rpx;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancelEdit, .save {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancelEdit {
|
||||||
|
margin-right: 40rpx;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import apis from '../utils/request';
|
import apis from '../utils/request';
|
||||||
|
import { getConfigByEnv } from "../utils/index"
|
||||||
const { GET, POST, PUT, DELETE } = apis
|
const { GET, POST, PUT, DELETE } = apis
|
||||||
|
|
||||||
// 获取电费账单列表
|
// 获取电费账单列表
|
||||||
@@ -23,3 +24,21 @@ export const getAccountingList = async function(meter) {
|
|||||||
const tenement = wx.getStorageSync('tenement')?.id || ""
|
const tenement = wx.getStorageSync('tenement')?.id || ""
|
||||||
return await GET(`/wx/getAccountingList?tenement=${tenement}&meter=${meter}`);
|
return await GET(`/wx/getAccountingList?tenement=${tenement}&meter=${meter}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出电量查询
|
||||||
|
export const exportElectricityList = async function({ meter, type, time }) {
|
||||||
|
const tenement = wx.getStorageSync('tenement')?.id || ""
|
||||||
|
const { api } = getConfigByEnv();
|
||||||
|
return new Promise(resolve => {
|
||||||
|
wx.downloadFile({
|
||||||
|
url: `${api}/wx/getElectricityList/export?tenement=${tenement}&meter=${meter}&type=${type}&time=${time}`,
|
||||||
|
success(res) {
|
||||||
|
console.log('请求成功结果', res)
|
||||||
|
resolve(res)
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.log('err', err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -41,3 +41,8 @@ export const getAlreadyInvoiceList = async function(page) {
|
|||||||
export const makeInvoice = async function(data) {
|
export const makeInvoice = async function(data) {
|
||||||
return await POST(`/wx/invoice`, data);
|
return await POST(`/wx/invoice`, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下载发票文件
|
||||||
|
export const downloadInvoice = async function(id, type) {
|
||||||
|
return await GET(`/wx/downloadInvoice/${id}?type=${type}`,);
|
||||||
|
}
|
||||||
8
service/report.js
Normal file
8
service/report.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import apis from '../utils/request';
|
||||||
|
const { GET, POST, PUT, DELETE } = apis
|
||||||
|
|
||||||
|
// 获取电费账单
|
||||||
|
export const getReportDetail = async function(id) {
|
||||||
|
const tenement = wx.getStorageSync('tenement')
|
||||||
|
return await GET(`/report/${id}/tenement/${tenement?.id}`);
|
||||||
|
}
|
||||||
@@ -55,3 +55,7 @@ export const getUserParksAndTenementsList = async function() {
|
|||||||
export const getUnReadApproveNumber = async function() {
|
export const getUnReadApproveNumber = async function() {
|
||||||
return await GET('/wx/getApproveNumber');
|
return await GET('/wx/getApproveNumber');
|
||||||
}
|
}
|
||||||
|
// 退出登录
|
||||||
|
export const logout = async function() {
|
||||||
|
return await POST('/wx/logout');
|
||||||
|
}
|
||||||
@@ -46,6 +46,7 @@ export function getConfigByEnv() {
|
|||||||
// 开发版
|
// 开发版
|
||||||
case 'develop':
|
case 'develop':
|
||||||
api = "http://localhost:8000"
|
api = "http://localhost:8000"
|
||||||
|
// api = "https://zgd.hbhcbn.com/wxApi"
|
||||||
// api = "http://127.0.0.1:4523/m1/4143821-0-default"
|
// api = "http://127.0.0.1:4523/m1/4143821-0-default"
|
||||||
break;
|
break;
|
||||||
// 体验版
|
// 体验版
|
||||||
@@ -220,3 +221,21 @@ export const wxModal = (data) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const getPixelRatio = () => {
|
||||||
|
let pixelRatio = 0
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: function (res) {
|
||||||
|
pixelRatio = res.pixelRatio
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
pixelRatio = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return pixelRatio
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function isValidPhoneNumber(phoneNumber) {
|
||||||
|
return /^1\d{10}$/.test(phoneNumber);
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ const requestWithoutCookie = promisify(wx.request);
|
|||||||
|
|
||||||
// 考虑了Cookie的请求
|
// 考虑了Cookie的请求
|
||||||
const request = async function (options, config = {}) {
|
const request = async function (options, config = {}) {
|
||||||
console.log('请求参数', 'options', options, 'config', config)
|
console.log('请求地址', options.url, "请求参数", options.data, 'config', config)
|
||||||
let token = wx.getStorageSync('token');
|
let token = wx.getStorageSync('token');
|
||||||
const result = wx.getAccountInfoSync();
|
const result = wx.getAccountInfoSync();
|
||||||
const { envVersion } = result.miniProgram;
|
const { envVersion } = result.miniProgram;
|
||||||
@@ -73,18 +73,17 @@ const request = async function (options, config = {}) {
|
|||||||
} catch(err) {
|
} catch(err) {
|
||||||
alertInfo(err.errMsg)
|
alertInfo(err.errMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理返回结果,默认直接返回数据
|
// 处理返回结果,默认直接返回数据
|
||||||
const parseResponse = function (response, url) {
|
const parseResponse = function (response, url) {
|
||||||
console.log('url', url, 'response', response)
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
alertError("服务异常")
|
alertError("服务异常")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const { statusCode } = response;
|
const { statusCode } = response;
|
||||||
|
console.log('url', url, 'response.status', statusCode, 'response.data', response.data)
|
||||||
if (statusCode === 401) {
|
if (statusCode === 401) {
|
||||||
wx.redirectTo({
|
wx.redirectTo({
|
||||||
url: '/pages/login/index',
|
url: '/pages/login/index',
|
||||||
|
|||||||
Reference in New Issue
Block a user